diff --git a/src/main/java/com/divudi/bean/common/SearchController.java b/src/main/java/com/divudi/bean/common/SearchController.java index 96aa4f769c..84b296ae51 100644 --- a/src/main/java/com/divudi/bean/common/SearchController.java +++ b/src/main/java/com/divudi/bean/common/SearchController.java @@ -900,6 +900,58 @@ public void fillToDepartmentPatientInvestigations() { } + + public void fillToSelectedDepartmentPatientInvestigations() { + Date startTime = new Date(); + + String jpql = "select pi " + + " from PatientInvestigation pi " + + " join pi.investigation i " + + " join pi.billItem.bill b " + + " join b.patient.person p " + + " where " + + " b.createdAt between :fromDate and :toDate " + + " and pi.investigation.department=:dep "; + + Map temMap = new HashMap(); + temMap.put("toDate", getToDate()); + temMap.put("fromDate", getFromDate()); + temMap.put("dep", getReportKeyWord().getDepartment()); + + if (getSearchKeyword().getPatientName() != null && !getSearchKeyword().getPatientName().trim().equals("")) { + jpql += " and ((p.name) like :patientName )"; + temMap.put("patientName", "%" + getSearchKeyword().getPatientName().trim().toUpperCase() + "%"); + } + + if (getSearchKeyword().getBillNo() != null && !getSearchKeyword().getBillNo().trim().equals("")) { + jpql += " and ((b.insId) like :billNo )"; + temMap.put("billNo", "%" + getSearchKeyword().getBillNo().trim().toUpperCase() + "%"); + } + + if (getSearchKeyword().getPatientPhone() != null && !getSearchKeyword().getPatientPhone().trim().equals("")) { + jpql += " and ((p.phone) like :patientPhone )"; + temMap.put("patientPhone", "%" + getSearchKeyword().getPatientPhone().trim().toUpperCase() + "%"); + } + + if (getSearchKeyword().getItemName() != null && !getSearchKeyword().getItemName().trim().equals("")) { + jpql += " and ((i.name) like :itm )"; + temMap.put("itm", "%" + getSearchKeyword().getItemName().trim().toUpperCase() + "%"); + } + + if (patientEncounter != null) { + jpql += "and pi.encounter=:en"; + temMap.put("en", patientEncounter); + } + + jpql += " order by pi.id desc "; +// + + patientInvestigations = getPatientInvestigationFacade().findByJpql(jpql, temMap, TemporalType.TIMESTAMP, 50); + checkRefundBillItems(patientInvestigations); + + } + + public void createPreRefundTable() { bills = null; diff --git a/src/main/webapp/lab/search_for_reporting_ondemand.xhtml b/src/main/webapp/lab/search_for_reporting_ondemand.xhtml index 06916f5cc2..9135eee288 100644 --- a/src/main/webapp/lab/search_for_reporting_ondemand.xhtml +++ b/src/main/webapp/lab/search_for_reporting_ondemand.xhtml @@ -47,6 +47,15 @@ forceSelection="true" value="#{searchController.reportKeyWord.department}" /> + + + + + +