/**
  * Auto generated method comment
  *
  * @param p
  * @param attributeTypeId
  * @return
  */
 public static String personAttribute(Person p, Integer attributeTypeId) {
   try {
     PersonAttribute pa = null;
     if (p != null) pa = p.getAttribute(attributeTypeId);
     if (pa != null) {
       return Context.getConceptService()
           .getConcept(Integer.parseInt(pa.getValue()))
           .getName()
           .getName();
     } else return "-";
   } catch (Exception e) {
     log.error(">>>>>>>>>>>>>>>>>>>VCT>>Module>>Tag>>>> An error occured : " + e.getMessage());
     e.printStackTrace();
     return "-";
   }
 }
Example #2
0
 /** Gets the value of an attribute on a person. */
 public static String getPersonAttributeValue(Person person, PersonAttributeType attrType) {
   PersonAttribute attribute = person.getAttribute(attrType);
   return attribute != null ? attribute.getValue() : null;
 }
 /**
  * Gets the value of the first attribute of the given type
  *
  * @param attrTypeUuid the attribute type UUID
  * @return the value or null
  */
 protected String getAsAttribute(String attrTypeUuid) {
   PersonAttribute attr = findFirstAttribute(attrTypeUuid);
   return attr != null ? attr.getValue() : null;
 }
  @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";
  }