diff --git a/.github/counter.txt b/.github/counter.txt index d00491fd7e..56a6051ca2 100644 --- a/.github/counter.txt +++ b/.github/counter.txt @@ -1 +1 @@ -1 +1 \ No newline at end of file diff --git a/.github/last_date.txt b/.github/last_date.txt index 3eff065eb0..1135f30580 100644 --- a/.github/last_date.txt +++ b/.github/last_date.txt @@ -1 +1 @@ -20240727 +20240727 \ No newline at end of file diff --git a/README.md b/README.md index bf2f6ce74a..fecaa2549d 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,8 @@ Developed using Java Enterprise Edition, the system offers both a web applicatio ## Current Version - - - Current Version: 3.0.0.20240727.1 (This line will be automatically updated to reflect the latest version) - ## History In 2004, Dr. M H B Ariyaratne, a medical doctor, pioneered the development of an Electronic Medical Record (EMR) System tailored for his general practice. Utilising Microsoft Visual Basic 6 and MS-Access, this system caught the attention of fellow doctors, leading to widespread adoption. As its user base grew, so did its features, evolving through collaborative discussions and feedback. diff --git a/src/main/java/com/divudi/bean/common/EnumController.java b/src/main/java/com/divudi/bean/common/EnumController.java index 26880b422f..7aaa3694f2 100644 --- a/src/main/java/com/divudi/bean/common/EnumController.java +++ b/src/main/java/com/divudi/bean/common/EnumController.java @@ -72,7 +72,9 @@ public class EnumController implements Serializable { List paymentMethodsForOpdBilling; List paymentMethodsForChanneling; List paymentMethodsForPharmacyBilling; + List paymentMethodsForPatientDeposit; + SessionNumberType[] sessionNumberTypes; @PostConstruct @@ -808,4 +810,19 @@ public void setPaymentScheme(PaymentScheme paymentScheme) { this.paymentScheme = paymentScheme; } + public List getPaymentMethodsForPatientDeposit() { + paymentMethodsForPatientDeposit = new ArrayList<>(); + for (PaymentMethod pm : PaymentMethod.values()) { + boolean include = configOptionApplicationController.getBooleanValueByKey(pm.getLabel() + " is available for Patient Deposit", true); + if (include) { + paymentMethodsForPatientDeposit.add(pm); + } + } + return paymentMethodsForPatientDeposit; + } + + public void setPaymentMethodsForPatientDeposit(List paymentMethodsForPatientDeposit) { + this.paymentMethodsForPatientDeposit = paymentMethodsForPatientDeposit; + } + } diff --git a/src/main/java/com/divudi/bean/common/PatientController.java b/src/main/java/com/divudi/bean/common/PatientController.java index 0bbc96334e..1589ea7408 100644 --- a/src/main/java/com/divudi/bean/common/PatientController.java +++ b/src/main/java/com/divudi/bean/common/PatientController.java @@ -453,7 +453,7 @@ public void downloadAllPatients() { response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment; filename=Patients.xlsx"); - try ( ServletOutputStream outputStream = response.getOutputStream()) { + try (ServletOutputStream outputStream = response.getOutputStream()) { workbook.write(outputStream); } catch (IOException e) { e.printStackTrace(); @@ -571,7 +571,7 @@ public void downloadPatientsPhoneNumbers() { response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment; filename=PatientPhoneNumbers.xlsx"); - try ( ServletOutputStream outputStream = response.getOutputStream()) { + try (ServletOutputStream outputStream = response.getOutputStream()) { workbook.write(outputStream); } catch (IOException e) { e.printStackTrace(); @@ -1047,7 +1047,6 @@ public void createPatientInvestigationsTableAllByLoggedInstitution() { temMap.put("ins", getSessionController().getInstitution()); sql += " order by pi.approveAt desc "; - //System.err.println("Sql " + sql); // patientInvestigations = getPatientInvestigationFacade().findByJpql(sql, temMap, TemporalType.TIMESTAMP); // patientInvestigations= } @@ -1563,6 +1562,7 @@ public void quickSearchPatientLongPhoneNumber(ControllerWithPatient controller) Long searchedPhoneNumber = CommonFunctions.removeSpecialCharsInPhonenumber(quickSearchPhoneNumber); m.put("pp", searchedPhoneNumber); quickSearchPatientList = getFacade().findByJpql(j, m); + opdBillController.setPaymentMethod(null); if (quickSearchPatientList == null) { JsfUtil.addErrorMessage("No Patient found !"); controller.setPatient(null); @@ -1581,6 +1581,14 @@ public void quickSearchPatientLongPhoneNumber(ControllerWithPatient controller) patientSearched = quickSearchPatientList.get(0); controller.setPatient(patientSearched); controller.setPatientDetailsEditable(false); + opdBillController.setPaymentMethod(null); + if (controller.getPatient().getHasAnAccount() != null) { + if (patientSearched.getHasAnAccount() && configOptionApplicationController.getBooleanValueByKey("Automatically set the PatientDeposit payment Method if a Deposit is Available", false)) { + opdBillController.setPaymentMethod(PaymentMethod.PatientDeposit); + opdBillController.listnerForPaymentMethodChange(); + } + } + quickSearchPatientList = null; } else { controller.setPatient(null); @@ -1608,6 +1616,14 @@ public void selectQuickOneFromQuickSearchPatient(ControllerWithPatient controlle controller.setPatient(current); admissionController.fillCurrentPatientAllergies(current); controller.setPatientDetailsEditable(false); + opdBillController.setPaymentMethod(null); + if (controller.getPatient().getHasAnAccount() != null) { + if (controller.getPatient().getHasAnAccount() && configOptionApplicationController.getBooleanValueByKey("Automatically set the PatientDeposit payment Method if a Deposit is Available", false)) { + opdBillController.setPaymentMethod(PaymentMethod.PatientDeposit); + opdBillController.listnerForPaymentMethodChange(); + } + } + quickSearchPatientList = null; } @@ -2042,22 +2058,18 @@ public void createPatientBarcode() { // return str; } catch (Exception ex) { - // ////System.out.println("ex = " + ex.getMessage()); } } else { - // ////System.out.println("else = "); try { Barcode bc = BarcodeFactory.createCode128A("0000"); bc.setBarHeight(5); bc.setBarWidth(3); bc.setDrawingText(true); BarcodeImageHandler.saveJPEG(bc, barcodeFile); - // ////System.out.println("12"); InputStream targetStream = new FileInputStream(barcodeFile); StreamedContent str = DefaultStreamedContent.builder().contentType("image/jpeg").name(barcodeFile.getName()).stream(() -> targetStream).build(); barcode = str; } catch (Exception ex) { - // ////System.out.println("ex = " + ex.getMessage()); } } } @@ -2155,7 +2167,6 @@ public void dobChangeListen() { } public StreamedContent getPhoto(Patient p) { - //////System.out.println("p is " + p); FacesContext context = FacesContext.getCurrentInstance(); if (context.getRenderResponse()) { return new DefaultStreamedContent(); @@ -2163,7 +2174,6 @@ public StreamedContent getPhoto(Patient p) { return new DefaultStreamedContent(); } else { if (p.getId() != null && p.getBaImage() != null) { - //////System.out.println("giving image"); InputStream targetStream = new ByteArrayInputStream(p.getBaImage()); StreamedContent str = DefaultStreamedContent.builder().contentType(p.getFileType()).name(p.getFileName()).stream(() -> targetStream).build(); return str; @@ -2306,7 +2316,6 @@ public List completePatient(String query) { + " or (p.person.mobile) like :q " + " order by p.person.name"; hm.put("q", "%" + query.toUpperCase() + "%"); - //////System.out.println(sql); suggestions = getFacade().findByJpql(sql, hm, 20); } return suggestions; @@ -2782,11 +2791,6 @@ public String getCountPatientCode(String s) { String st = ""; if (p != null) { String str = p.getCode(); -// //System.out.println("str.substring(0,1) = " + str.substring(0, 1)); -// //System.out.println("str.substring(0,2) = " + str.substring(0, 2)); -// //System.out.println("str.substring(2) = " + str.substring(2)); -// //System.out.println("str.substring(3) = " + str.substring(3)); -// //System.out.println("str.substring(3,7) = " + str.substring(3, 7)); long l = Long.parseLong(str.substring(2)); l++; st += s; @@ -3691,13 +3695,11 @@ public Object getAsObject(FacesContext facesContext, UIComponent component, Stri } PatientController controller = (PatientController) facesContext.getApplication().getELResolver(). getValue(facesContext.getELContext(), null, "patientController"); - //////System.out.println("value at converter getAsObject is " + value); return controller.getEjbFacade().find(getKey(value)); } java.lang.Long getKey(String value) { java.lang.Long key; - //////System.out.println(value); if (value == null || value.equals("null") || value.trim().equals("")) { key = 0l; } else { diff --git a/src/main/java/com/divudi/bean/lab/PatientInvestigationController.java b/src/main/java/com/divudi/bean/lab/PatientInvestigationController.java index 094ffc9b1d..c955b2ee14 100644 --- a/src/main/java/com/divudi/bean/lab/PatientInvestigationController.java +++ b/src/main/java/com/divudi/bean/lab/PatientInvestigationController.java @@ -52,7 +52,9 @@ import com.divudi.bean.common.util.JsfUtil; import com.divudi.data.lab.BillBarcode; import com.divudi.data.lab.PatientInvestigationWrapper; +import com.divudi.data.lab.PatientSampleWrapper; import com.divudi.data.lab.SampleTubeLabel; +import com.divudi.entity.WebUser; import com.divudi.java.CommonFunctions; import com.divudi.ws.lims.Lims; import java.io.Serializable; @@ -191,7 +193,8 @@ public class PatientInvestigationController implements Serializable { private List sampleTubeLabels; - List< BillBarcode> billBarcodes; + private List billBarcodes; + private List selectedBillBarcodes; public String navigateToPrintBarcodeFromMenu() { return "/lab/sample_barcode_printing?faces-redirect=true"; @@ -1172,6 +1175,31 @@ public void prepareToSample() { checkRefundBillItems(lstToSamle); } + public void generateBarcodesForSelectedBills() { + if (selectedBillBarcodes == null) { + JsfUtil.addErrorMessage("No Bills Seelcted"); + return; + } + if (selectedBillBarcodes.isEmpty()) { + JsfUtil.addErrorMessage("No Bills Seelcted"); + return; + } + for (BillBarcode bb : selectedBillBarcodes) { + List bs = new ArrayList<>(); + bs.add(bb.getBill()); + List psws = new ArrayList<>(); + List pss = prepareSampleCollectionByBillsForRequestss(bs, sessionController.getLoggedUser()); + if(pss!=null){ + for(PatientSample ps:pss){ + PatientSampleWrapper ptsw = new PatientSampleWrapper(ps); + psws.add(ptsw); + } + } + bb.setPatientSampleWrappers(psws); + } + + } + public void listPatientInvestigationAwaitingSamplling() { String temSql; Map temMap = new HashMap(); @@ -1187,7 +1215,7 @@ public void listBillsToGenerateBarcodes() { temSql = "SELECT i " + " FROM PatientInvestigation i " + " where i.retired=:ret " - + " and i.barcodeGenerated=:gb " + + " and i.barcodeGenerated=:bg " + " and i.billItem.bill.billDate between :fromDate and :toDate " + " order by i.id desc"; temMap.put("fromDate", getFromDate()); @@ -2051,6 +2079,22 @@ public void setLstForSampleManagement(List lstForSampleMan this.lstForSampleManagement = lstForSampleManagement; } + public List< BillBarcode> getBillBarcodes() { + return billBarcodes; + } + + public void setBillBarcodes(List< BillBarcode> billBarcodes) { + this.billBarcodes = billBarcodes; + } + + public List getSelectedBillBarcodes() { + return selectedBillBarcodes; + } + + public void setSelectedBillBarcodes(List selectedBillBarcodes) { + this.selectedBillBarcodes = selectedBillBarcodes; + } + /** * */ @@ -2102,12 +2146,178 @@ public void setCommonController(CommonController commonController) { this.commonController = commonController; } - public BillItemFacade getBillItemFacade() { - return billItemFacade; + public List prepareSampleCollectionByBillsForRequestss(List bills, WebUser wu) { + String j = ""; + Map m; + Map rPatientSamplesMap = new HashMap<>(); + + if (bills == null) { + return null; + } + + for (Bill b : bills) { + m = new HashMap(); + m.put("can", false); + m.put("bill", b); + j = "Select pi from PatientInvestigation pi " + + " where pi.cancelled=:can " + + " and pi.billItem.bill=:bill"; + List pis = ejbFacade.findByJpql(j, m); + + if (pis == null) { + return null; + } + + for (PatientInvestigation ptix : pis) { + + Investigation ix = ptix.getInvestigation(); + + if (ix == null) { + continue; + } + + ptix.setCollected(true); + ptix.setSampleCollecter(wu); + ptix.setSampleDepartment(wu.getDepartment()); + ptix.setSampleInstitution(wu.getInstitution()); + ptix.setSampledAt(new Date()); + ejbFacade.edit(ptix); + + List ixis = getItems(ix); + + if (ixis == null) { + continue; + } + + for (InvestigationItem ixi : ixis) { + + if (ixi.getIxItemType() == InvestigationItemType.Value) { + + if (ixi.getTube() == null) { + continue; + } + if (ixi.getSample() == null) { + continue; + } + + j = "select ps from PatientSample ps " + + " where ps.tube=:tube " + + " and ps.sample=:sample " + + " and ps.machine=:machine " + + " and ps.patient=:pt " + + " and ps.bill=:bill "; +// + " and ps.collected=:ca + m = new HashMap(); + m.put("tube", ixi.getTube()); + + m.put("sample", ixi.getSample()); + + m.put("machine", ixi.getMachine()); + + m.put("pt", b.getPatient()); + + m.put("bill", b); +// m.put("ca", false); + if (ix.isHasMoreThanOneComponant()) { + j += " and ps.investigationComponant=:sc "; + m.put("sc", ixi.getSampleComponent()); + } + + PatientSample pts = patientSampleFacade.findFirstByJpql(j, m); + if (pts == null) { + pts = new PatientSample(); + + pts.setTube(ixi.getTube()); + pts.setSample(ixi.getSample()); + if (ix.isHasMoreThanOneComponant()) { + pts.setInvestigationComponant(ixi.getSampleComponent()); + } + pts.setMachine(ixi.getMachine()); + pts.setPatient(b.getPatient()); + pts.setBill(b); + + pts.setSampleDepartment(wu.getDepartment()); + pts.setSampleInstitution(wu.getInstitution()); + pts.setSampleCollecter(wu); + pts.setSampledAt(new Date()); + pts.setCreatedAt(new Date()); + pts.setCreater(wu); + pts.setCollected(false); + pts.setReadyTosentToAnalyzer(false); + pts.setSentToAnalyzer(false); + patientSampleFacade.create(pts); + } + rPatientSamplesMap.put(pts.getId(), pts); + + PatientSampleComponant ptsc; + j = "select ps from PatientSampleComponant ps " + + " where ps.patientSample=:pts " + + " and ps.bill=:bill " + + " and ps.patient=:pt " + + " and ps.patientInvestigation=:ptix " + + " and ps.investigationComponant=:ixc"; + m = new HashMap(); + m.put("pts", pts); + m.put("bill", b); + m.put("pt", b.getPatient()); + m.put("ptix", ptix); + m.put("ixc", ixi.getSampleComponent()); + m.put("pts", pts); + + m.put("bill", b); + + m.put("pt", b.getPatient()); + + m.put("ptix", ptix); + + m.put("ixc", ixi.getSampleComponent()); + + ptsc = patientSampleComponantFacade.findFirstByJpql(j, m); + + if (ptsc == null) { + ptsc = new PatientSampleComponant(); + ptsc.setPatientSample(pts); + ptsc.setBill(b); + ptsc.setPatient(b.getPatient()); + ptsc.setPatientInvestigation(ptix); + ptsc.setInvestigationComponant(ixi.getSampleComponent()); + ptsc.setCreatedAt(new Date()); + ptsc.setCreater(wu); + patientSampleComponantFacade.create(ptsc); + } + } + } + } + + } + + List rPatientSamples = new ArrayList<>(rPatientSamplesMap.values()); + return rPatientSamples; } - public void setBillItemFacade(BillItemFacade billItemFacade) { - this.billItemFacade = billItemFacade; + public List getItems(Investigation ix) { + List iis; + if (ix == null) { + return new ArrayList<>(); + } + Investigation temIx = ix; + if (ix.getReportedAs() != null) { + if (ix.getReportedAs() instanceof Investigation) { + temIx = (Investigation) ix.getReportedAs(); + } + } + + if (ix.getId() != null) { + String temSql; + temSql = "SELECT i FROM InvestigationItem i where i.retired<>true and i.item=:item order by i.riTop, i.riLeft"; + Map m = new HashMap(); + m.put("item", temIx); + + iis = investigationItemFacade.findByJpql(temSql, m); + } else { + iis = new ArrayList<>(); + } + return iis; } } diff --git a/src/main/java/com/divudi/data/lab/PatientSampleWrapper.java b/src/main/java/com/divudi/data/lab/PatientSampleWrapper.java index aa6ab84e76..e55af8e0b0 100644 --- a/src/main/java/com/divudi/data/lab/PatientSampleWrapper.java +++ b/src/main/java/com/divudi/data/lab/PatientSampleWrapper.java @@ -10,6 +10,15 @@ public class PatientSampleWrapper { private PatientSample patientSample; private boolean selected; + public PatientSampleWrapper() { + } + + public PatientSampleWrapper(PatientSample patientSample) { + this.patientSample = patientSample; + } + + + public PatientSample getPatientSample() { return patientSample; } diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index a62ef4e1f1..d7e07da22b 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -2,7 +2,8 @@ - jdbc/demos + jdbc/arogya + false @@ -11,8 +12,11 @@ - jdbc/demoaudit + + jdbc/arogyaAudit + false + diff --git a/src/main/resources/VERSION.txt b/src/main/resources/VERSION.txt index fd452aa834..46ddd0a2e0 100644 --- a/src/main/resources/VERSION.txt +++ b/src/main/resources/VERSION.txt @@ -1 +1 @@ -3.0.0.20240727.1 +3.0.0.20240727.1 \ No newline at end of file diff --git a/src/main/webapp/lab/generate_barcode_p.xhtml b/src/main/webapp/lab/generate_barcode_p.xhtml index 8e4be9fcd9..9d5124089b 100644 --- a/src/main/webapp/lab/generate_barcode_p.xhtml +++ b/src/main/webapp/lab/generate_barcode_p.xhtml @@ -22,148 +22,102 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + class="m-2" + value="#{smpIx.bill.deptId}" + action="#{billSearch.navigateToViewOpdBill()}"> + - - - - - + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - + + + + diff --git a/src/main/webapp/opd/opd_bill.xhtml b/src/main/webapp/opd/opd_bill.xhtml index ee04ecb2d6..9eb1e7ce09 100644 --- a/src/main/webapp/opd/opd_bill.xhtml +++ b/src/main/webapp/opd/opd_bill.xhtml @@ -6,6 +6,7 @@ xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns="http://www.w3.org/1999/xhtml" xmlns:pa="http://xmlns.jcp.org/jsf/composite/paymentMethod" + xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:common="http://xmlns.jcp.org/jsf/composite/ezcomp/common"> @@ -56,12 +57,394 @@ -->
- - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #{ps.person.name} + + + #{ps.person.phone} + + + #{ps.person.mobile} + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+ + + + + + +
+
+ +
+
+ + + + +
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ +
+
+ +
+
+ +
+ + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
@@ -72,7 +455,7 @@ id="lcNumber"/>
- + @@ -580,7 +963,7 @@
- + @@ -645,7 +1028,7 @@
- + diff --git a/src/main/webapp/resources/ezcomp/common/patient_details.xhtml b/src/main/webapp/resources/ezcomp/common/patient_details.xhtml index 5ab1f8485d..a7846d12fd 100644 --- a/src/main/webapp/resources/ezcomp/common/patient_details.xhtml +++ b/src/main/webapp/resources/ezcomp/common/patient_details.xhtml @@ -383,6 +383,12 @@ severity="#{cc.attrs.controller.patient.person.foreigner?'warning':'success'}" styleClass="mr-2"> + + + + + +