@RequestMapping(method = RequestMethod.GET) public String main( // @RequestParam(value = "date", required = false) String dateStr, @RequestParam(value = "searchKey", required = false) String searchKey, @RequestParam(value = "currentPage", required = false) Integer currentPage, // 21/11/2014 to work with size selector @RequestParam(value = "pgSize", required = false) Integer pgSize, Model model) { IpdService ipdService = (IpdService) Context.getService(IpdService.class); /* SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = null; try { date = sdf.parse(dateStr); } catch (ParseException e) { e.printStackTrace(); } */ // List<IpdPatientAdmission> listIndoorPatient1 = ipdService.getAllIndoorPatient(); // 24/11/2014 to Work with size selctor for IPDQueue List<IpdPatientAdmissionLog> listIndoorPatient2 = ipdService.getAllIndoorPatientFromAdmissionLog(searchKey, currentPage, pgSize); if (currentPage == null) currentPage = 1; int total = ipdService.countGetAllIndoorPatientFromAdmissionLog(searchKey, currentPage); PagingUtil pagingUtil = new PagingUtil(pgSize, currentPage, total); // model.addAttribute("listIndoorPatient1", listIndoorPatient1); model.addAttribute("listIndoorPatient2", listIndoorPatient2); model.addAttribute("pagingUtil", pagingUtil); // model.addAttribute("date", dateStr); return "/module/billing/indoorQueue/indoorBillingQueue"; }
@RequestMapping(method = RequestMethod.GET) public String viewForm( Model model, @RequestParam("patientId") Integer patientId, @RequestParam(value = "billId", required = false) Integer billId, @RequestParam(value = "pageSize", required = false) Integer pageSize, @RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "encounterId", required = false) Integer encounterId, @RequestParam(value = "admissionLogId", required = false) Integer admissionLogId, HttpServletRequest request) { BillingService billingService = Context.getService(BillingService.class); Patient patient = Context.getPatientService().getPatient(patientId); BillCalculatorForBDService calculator = new BillCalculatorForBDService(); IpdService ipdService = Context.getService(IpdService.class); IpdPatientAdmissionLog ipdPatientAdmissionLog = ipdService.getIpdPatientAdmissionLog(admissionLogId); IpdPatientAdmitted ipdPatientAdmitted = ipdService.getAdmittedByAdmissionLogId(ipdPatientAdmissionLog); PersonAttribute fileNumber = patient.getAttribute(43); if (fileNumber != null) { model.addAttribute("fileNumber", fileNumber.getValue()); } if (patient != null) { int total = billingService.countListPatientServiceBillByPatient(patient); PagingUtil pagingUtil = new PagingUtil( RequestUtil.getCurrentLink(request), pageSize, currentPage, total, patientId); model.addAttribute("pagingUtil", pagingUtil); model.addAttribute("patient", patient); model.addAttribute("age", patient.getAge()); if (patient.getGender().equals("M")) { model.addAttribute("gender", "Male"); } if (patient.getGender().equals("F")) { model.addAttribute("gender", "Female"); } model.addAttribute("category", patient.getAttribute(14).getValue()); model.addAttribute( "listBill", billingService.listPatientServiceBillByPatient( pagingUtil.getStartPos(), pagingUtil.getPageSize(), patient)); } User user = Context.getAuthenticatedUser(); model.addAttribute("canEdit", user.hasPrivilege(BillingConstants.PRIV_EDIT_BILL_ONCE_PRINTED)); if (billId != null) { PatientServiceBill bill = billingService.getPatientServiceBillById(billId); PatientServiceBillItem patientServiceBillItem = billingService.getPatientServiceBillItem(billId, "ADMISSION FILE CHARGES"); if (bill.getFreeBill().equals(1)) { String billType = "free"; bill.setFreeBill(calculator.isFreeBill(billType)); } else if (bill.getFreeBill().equals(2)) { String billType = "mixed"; bill.setFreeBill(2); } else { String billType = "paid"; bill.setFreeBill(calculator.isFreeBill(billType)); } model.addAttribute("paymentMode", bill.getPaymentMode()); model.addAttribute("cashier", bill.getCreator().getGivenName()); model.addAttribute("bill", bill); model.addAttribute("billItem", patientServiceBillItem); } return "/module/billing/indoorQueue/indoorPatientServiceBill"; }