コード例 #1
0
  public boolean add3rdBillExt(Map<String, String> mVal, int id) {
    boolean retval = true;
    String[] temp = {
      "billTo",
      "remitTo",
      "total",
      "payment",
      "refund",
      "provider_no",
      "gst",
      "payDate",
      "payMethod"
    };
    String demoNo = mVal.get("demographic_no");
    String dateTime = UtilDateUtilities.getToday("yyyy-MM-dd HH:mm:ss");
    mVal.put("payDate", dateTime);

    BillingONPaymentDao billingONPaymentDao = SpringUtils.getBean(BillingONPaymentDao.class);
    BillingONPayment newPayment = new BillingONPayment();
    BillingONCHeader1 ch1 = cheaderDao.find(id);
    newPayment.setBillingOnCheader1(ch1);
    newPayment.setPaymentDate(UtilDateUtilities.StringToDate(dateTime));

    for (int i = 0; i < temp.length; i++) {
      BillingONExt b = new BillingONExt();
      b.setBillingNo(id);
      b.setDemographicNo(Integer.valueOf(demoNo));
      b.setKeyVal(temp[i]);
      b.setValue(mVal.get(temp[i]));
      b.setDateTime(new Date());
      b.setStatus('1');
      b.setPaymentId(0);
      newPayment.getBillingONExtItems().add(b);
    }

    billingONPaymentDao.persist(newPayment);

    return retval;
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  public boolean add3rdBillExt(Map<String, String> mVal, int id, Vector vecObj) {
    BillingClaimHeader1Data claim1Obj = (BillingClaimHeader1Data) vecObj.get(0);
    boolean retval = true;
    String[] temp = {
      "billTo",
      "remitTo",
      "total",
      "payment",
      "discount",
      "provider_no",
      "gst",
      "payDate",
      "payMethod"
    };
    String demoNo = mVal.get("demographic_no");
    String dateTime = UtilDateUtilities.getToday("yyyy-MM-dd HH:mm:ss");
    mVal.put("payDate", dateTime);
    String paymentSumParam = null;
    String paymentDateParam = null;
    String paymentTypeParam = null;
    String provider_no = mVal.get("provider_no");
    for (int i = 0; i < temp.length; i++) {
      String val = mVal.get(temp[i]);
      if ("discount".equals(temp[i])) {
        val =
            mVal.get(
                "total_discount"); // 'refund' stands for write off, here totoal_discount is write
                                   // off
      }
      if ("payment".equals(temp[i])) {
        val = mVal.get("total_payment");
      }
      BillingONExt billingONExt = new BillingONExt();
      billingONExt.setBillingNo(id);
      billingONExt.setDemographicNo(Integer.parseInt(demoNo));
      billingONExt.setKeyVal(StringEscapeUtils.escapeSql(temp[i]));
      billingONExt.setValue(StringEscapeUtils.escapeSql(val));
      billingONExt.setDateTime(new Date());
      billingONExt.setStatus('1');
      extDao.persist(billingONExt);

      if (i == 3) paymentSumParam = mVal.get("total_payment"); // total_payment
      else if (i == 7) paymentDateParam = mVal.get(temp[i]); // paymentDate
      else if (i == 8) paymentTypeParam = mVal.get(temp[i]); // paymentMethod
    }

    if (paymentSumParam != null) {
      BillingONPaymentDao billingONPaymentDao =
          (BillingONPaymentDao) SpringUtils.getBean("billingONPaymentDao");
      BillingPaymentTypeDao billingPaymentTypeDao =
          (BillingPaymentTypeDao) SpringUtils.getBean("billingPaymentTypeDao");
      BillingONCHeader1 ch1 = cheaderDao.find(id);
      Date paymentDate = null;
      try {
        paymentDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(paymentDateParam);
      } catch (ParseException ex) {
        _logger.error("add3rdBillExt wrong date format " + paymentDateParam);
        return retval;
      }

      // allow user to override with the text box added
      String paymentDateOverride = mVal.get("payment_date");
      if (paymentDateOverride != null && paymentDateOverride.length() > 0) {
        try {
          paymentDate =
              new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(paymentDateOverride + " 00:00:00");
        } catch (ParseException ex) {
          _logger.error("add3rdBillExt wrong date format " + paymentDateOverride);
          return retval;
        }
      }

      if (paymentTypeParam == null || paymentTypeParam.equals("")) {
        paymentTypeParam = "1";
      }
      BillingPaymentType type = billingPaymentTypeDao.find(Integer.parseInt(paymentTypeParam));
      BillingONPayment payment = null;

      if (paymentSumParam != null) {
        payment = new BillingONPayment();
        payment.setTotal_payment(BigDecimal.valueOf(Double.parseDouble(paymentSumParam)));
        payment.setTotal_discount(
            BigDecimal.valueOf(Double.parseDouble(mVal.get("total_discount"))));
        payment.setTotal_refund(new BigDecimal(0));
        payment.setPaymentDate(paymentDate);
        payment.setBillingOnCheader1(ch1);
        payment.setBillingNo(id);
        payment.setCreator(claim1Obj.getCreator());
        payment.setPaymentTypeId(Integer.parseInt(paymentTypeParam));

        // payment.setBillingPaymentType(type);
        billingONPaymentDao.persist(payment);
        addItemPaymentRecord(
            (List) vecObj.get(1),
            id,
            payment.getId(),
            Integer.parseInt(paymentTypeParam),
            paymentDate);
        addCreate3rdInvoiceTrans(
            (BillingClaimHeader1Data) vecObj.get(0),
            (List<BillingItemData>) vecObj.get(1),
            payment);
      }
    }
    return retval;
  }
コード例 #3
0
  public int addOneClaimHeaderRecord(BillingClaimHeader1Data val) {
    BillingONCHeader1 b = new BillingONCHeader1();
    b.setHeaderId(0);
    b.setTranscId(val.transc_id);
    b.setRecId(val.rec_id);
    b.setHin(val.hin);
    b.setVer(val.ver);
    b.setDob(val.dob);
    b.setPayProgram(val.pay_program);
    b.setPayee(val.payee);
    b.setRefNum(val.ref_num);
    b.setFaciltyNum(val.facilty_num);
    if (val.admission_date.length() > 0)
      try {
        b.setAdmissionDate(dateformatter.parse(val.admission_date));
      } catch (ParseException e) {
        /*empty*/
      }

    b.setRefLabNum(val.ref_lab_num);
    b.setManReview(val.man_review);
    b.setLocation(val.location);
    b.setDemographicNo(Integer.parseInt(val.demographic_no));
    b.setProviderNo(val.provider_no);
    String apptNo = StringUtils.trimToNull(val.appointment_no);

    if (apptNo != null) {
      b.setAppointmentNo(Integer.parseInt(val.appointment_no));
    } else {
      b.setAppointmentNo(null);
    }

    b.setDemographicName(val.demographic_name);
    b.setSex(val.sex);
    b.setProvince(val.province);
    if (val.billing_date.length() > 0)
      try {
        b.setBillingDate(dateformatter.parse(val.billing_date));
      } catch (ParseException e) {
        /*empty*/
      }
    if (val.billing_time.length() > 0)
      try {
        b.setBillingTime(timeFormatter.parse(val.billing_time));
      } catch (ParseException e) {
        MiscUtils.getLogger().error("Invalid time", e);
      }

    b.setTotal(new BigDecimal(val.total == null ? "0.00" : val.total));

    if (val.paid == null || val.paid.isEmpty()) {
      b.setPaid(new BigDecimal("0.00"));
    } else {
      b.setPaid(new BigDecimal(val.paid));
    }

    b.setStatus(val.status);
    b.setComment(val.comment);
    b.setVisitType(val.visittype);
    b.setProviderOhipNo(val.provider_ohip_no);
    b.setProviderRmaNo(val.provider_rma_no);
    b.setApptProviderNo(val.apptProvider_no);
    b.setAsstProviderNo(val.asstProvider_no);
    b.setCreator(val.creator);
    b.setClinic(val.clinic);

    cheaderDao.persist(b);

    return b.getId();
  }