コード例 #1
0
  @RequestMapping(method = RequestMethod.GET)
  public String displayForm(
      @ModelAttribute("command") Object command,
      @RequestParam("billId") Integer billId,
      HttpServletRequest request,
      Model model) {

    BillingService billingService = (BillingService) Context.getService(BillingService.class);

    List<MiscellaneousService> listMiscellaneousService =
        billingService.getAllMiscellaneousService();

    if (listMiscellaneousService == null || listMiscellaneousService.size() == 0) {
      request
          .getSession()
          .setAttribute(WebConstants.OPENMRS_MSG_ATTR, "No MiscellaneousService found.");
    } else {
      model.addAttribute("listMiscellaneousService", listMiscellaneousService);
    }

    MiscellaneousServiceBill bill = billingService.getMiscellaneousServiceBillById(billId);
    model.addAttribute("bill", bill);

    return "module/billing/main/miscellaneousServiceBillEdit";
  }
コード例 #2
0
  @RequestMapping(method = RequestMethod.POST)
  public String onSubmit(
      @RequestParam("patientId") Integer patientId,
      @RequestParam(value = "billId", required = false) Integer billId,
      @RequestParam(value = "encounterId", required = false) Integer encounterId) {
    if (encounterId != null) {
      BillingService billingService = (BillingService) Context.getService(BillingService.class);
      PatientServiceBill patientServiceBill = billingService.getPatientServiceBillById(billId);
      if (patientServiceBill != null && !patientServiceBill.getPrinted()) {
        patientServiceBill.setPrinted(true);
        BillCalculatorForBDService calculator = new BillCalculatorForBDService();
        if (patientServiceBill.getFreeBill().equals(1)) {
          String billType = "free";
          patientServiceBill.setFreeBill(calculator.isFreeBill(billType));
        } else if (patientServiceBill.getFreeBill().equals(2)) {
          String billType = "mixed";
          patientServiceBill.setFreeBill(2);
        } else {
          String billType = "paid";
          patientServiceBill.setFreeBill(calculator.isFreeBill(billType));
        }

        billingService.savePatientServiceBill(patientServiceBill);
      }
    }

    return "redirect:/module/billing/ipdbillingqueue.form";
  }
コード例 #3
0
  @RequestMapping(method = RequestMethod.POST)
  public String onSubmit(
      Model model,
      @RequestParam(value = "serviceId") Integer miscellaneousServiceId,
      @RequestParam("billId") Integer billId,
      @RequestParam("name") String name,
      @RequestParam("action") String action,
      Object command,
      BindingResult binding,
      HttpServletRequest request) {

    BillingService billingService = (BillingService) Context.getService(BillingService.class);
    MiscellaneousServiceBill miscellaneousServiceBill =
        billingService.getMiscellaneousServiceBillById(billId);

    // if action is void
    if ("void".equalsIgnoreCase(action)) {
      miscellaneousServiceBill.setVoided(true);
      billingService.saveMiscellaneousServiceBill(miscellaneousServiceBill);
      return "redirect:/module/billing/miscellaneousServiceBill.list";
    }

    // 07/07/2012:kesavulu: New Requirement #306 Add field quantity in Miscellaneous Services Bill

    MiscellaneousService miscellaneousService = null;
    int quantity = 0;
    Money itemAmount;
    Money totalAmount = new Money(BigDecimal.ZERO);

    miscellaneousService = billingService.getMiscellaneousServiceById(miscellaneousServiceId);
    quantity = Integer.parseInt(request.getParameter(miscellaneousServiceId + "_qty"));
    itemAmount =
        new Money(new BigDecimal(request.getParameter(miscellaneousServiceId + "_amount")));

    itemAmount = itemAmount.times(quantity);
    totalAmount = totalAmount.plus(itemAmount);
    miscellaneousServiceBill.setLiableName(name);

    miscellaneousService = billingService.getMiscellaneousServiceById(miscellaneousServiceId);
    miscellaneousServiceBill.setAmount(totalAmount.getAmount());
    miscellaneousServiceBill.setService(miscellaneousService);
    miscellaneousServiceBill.setQuantity(quantity);
    miscellaneousServiceBill =
        billingService.saveMiscellaneousServiceBill(miscellaneousServiceBill);

    return "redirect:/module/billing/miscellaneousServiceBill.list?serviceId="
        + miscellaneousServiceId
        + "&billId="
        + miscellaneousServiceBill.getId();
  }
コード例 #4
0
  @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";
  }