Search in sources :

Example 1 with ConceptCode

use of com.salaboy.jbpm5.dev.guide.model.ConceptCode in project jBPM5-Developer-Guide by Salaboy.

the class CalculateHospitalRatesCommand method execute.

public ExecutionResults execute(CommandContext ctx) {
    String patientId = (String) ctx.getData("rates_patientName");
    BigDecimal finalAmount = BigDecimal.ZERO;
    //Mock Data
    List<ConceptCode> concepts = new ArrayList<ConceptCode>(2);
    concepts.add(new ConceptCode("CO-123", new BigDecimal(125), "Dialy Hospital Bed Rate", 4));
    concepts.add(new ConceptCode("CO-123", new BigDecimal(100), "Nurse Service", 1));
    try {
        InsuranceService client = getClient();
        //Fixed rate for insured patients
        finalAmount = client.calculateHospitalRates(patientId, concepts);
    } catch (MalformedURLException ex) {
        Logger.getLogger(PatientDataServiceWorkItemHandler.class.getName()).log(Level.SEVERE, null, ex);
    }
    ExecutionResults results = new ExecutionResults();
    results.setData("rates_finalAmount", finalAmount);
    results.setData("rates_concepts", concepts);
    return results;
}
Also used : ConceptCode(com.salaboy.jbpm5.dev.guide.model.ConceptCode) PatientDataServiceWorkItemHandler(com.salaboy.jbpm5.dev.guide.workitems.PatientDataServiceWorkItemHandler) MalformedURLException(java.net.MalformedURLException) InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) ExecutionResults(org.jbpm.executor.api.ExecutionResults) ArrayList(java.util.ArrayList) BigDecimal(java.math.BigDecimal)

Example 2 with ConceptCode

use of com.salaboy.jbpm5.dev.guide.model.ConceptCode in project jBPM5-Developer-Guide by Salaboy.

the class NotifyInsuranceCompanyCommand method execute.

public ExecutionResults execute(CommandContext ctx) {
    String patientId = (String) ctx.getData("company_patientName");
    BigDecimal finalAmount = BigDecimal.ZERO;
    try {
        InsuranceService client = getClient();
        //Fixed rate for insured patients
        finalAmount = client.notifyInsuranceCompany("Company 1", patientId, new BigDecimal(100));
    } catch (MalformedURLException ex) {
        ex.printStackTrace();
    }
    ExecutionResults results = new ExecutionResults();
    results.setData("company_finalAmount", finalAmount);
    List<ConceptCode> concepts = new ArrayList<ConceptCode>(1);
    concepts.add(new ConceptCode("CO-9999", finalAmount, " Insured Flat Rate", 1));
    results.setData("company_concepts", concepts);
    return results;
}
Also used : ConceptCode(com.salaboy.jbpm5.dev.guide.model.ConceptCode) MalformedURLException(java.net.MalformedURLException) InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) ExecutionResults(org.jbpm.executor.api.ExecutionResults) ArrayList(java.util.ArrayList) BigDecimal(java.math.BigDecimal)

Example 3 with ConceptCode

use of com.salaboy.jbpm5.dev.guide.model.ConceptCode in project jBPM5-Developer-Guide by Salaboy.

the class CompanyGatewayWorkItemHandler method executeWorkItem.

public void executeWorkItem(WorkItem wi, WorkItemManager wim) {
    String patientId = (String) wi.getParameter("company_patientName");
    BigDecimal finalAmount = BigDecimal.ZERO;
    InsuranceService client = getClient();
    //Fixed rate for insured patients
    finalAmount = client.notifyInsuranceCompany("Company 1", patientId, new BigDecimal(100));
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("company_finalAmount", finalAmount);
    List<ConceptCode> concepts = new ArrayList<ConceptCode>(1);
    concepts.add(new ConceptCode("CO-9999", finalAmount, " Insured Flat Rate", 1));
    result.put("company_concepts", concepts);
    wim.completeWorkItem(wi.getId(), result);
}
Also used : ConceptCode(com.salaboy.jbpm5.dev.guide.model.ConceptCode) InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BigDecimal(java.math.BigDecimal)

Example 4 with ConceptCode

use of com.salaboy.jbpm5.dev.guide.model.ConceptCode in project jBPM5-Developer-Guide by Salaboy.

the class InvoiceServiceWorkItemHandler method executeWorkItem.

public void executeWorkItem(WorkItem wi, WorkItemManager wim) {
    Patient patient = (Patient) wi.getParameter("invoice_patient");
    BigDecimal finalAmount = (BigDecimal) wi.getParameter("invoice_finalAmount");
    List<ConceptCode> concepts = (List<ConceptCode>) wi.getParameter("invoice_concepts");
    boolean patientNotified = false;
    InsuranceService client = getClient();
    patientNotified = client.notifyAndChargePatient(patient, finalAmount, concepts);
    System.out.println(" >>> Patient Notified = " + patientNotified);
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("invoice_patientNotified", patientNotified);
    wim.completeWorkItem(wi.getId(), result);
}
Also used : ConceptCode(com.salaboy.jbpm5.dev.guide.model.ConceptCode) InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) HashMap(java.util.HashMap) Patient(com.salaboy.jbpm5.dev.guide.model.Patient) List(java.util.List) BigDecimal(java.math.BigDecimal)

Example 5 with ConceptCode

use of com.salaboy.jbpm5.dev.guide.model.ConceptCode in project jBPM5-Developer-Guide by Salaboy.

the class HospitalInsuranceServiceTest method patientInsuredTest.

@Test
public void patientInsuredTest() {
    Patient patient = this.service.getPatientData(testPatients.get("salaboy").getId());
    assertNotNull(patient);
    boolean isPatientInsured = this.service.isPatientInsured(patient.getId());
    assertTrue(isPatientInsured);
    BigDecimal insuredAmount = this.service.notifyInsuranceCompany("Insurance Company 1", patient.getId(), new BigDecimal(100));
    assertEquals(50, insuredAmount.intValue());
    List<ConceptCode> concepts = new ArrayList<ConceptCode>(1);
    concepts.add(new ConceptCode("CO-9999", insuredAmount, "Insured Patient Flat Rate", 1));
    boolean notifyAndChargePatient = this.service.notifyAndChargePatient(patient, insuredAmount, concepts);
    assertTrue(notifyAndChargePatient);
}
Also used : ConceptCode(com.salaboy.jbpm5.dev.guide.model.ConceptCode) ArrayList(java.util.ArrayList) Patient(com.salaboy.jbpm5.dev.guide.model.Patient) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

ConceptCode (com.salaboy.jbpm5.dev.guide.model.ConceptCode)10 BigDecimal (java.math.BigDecimal)9 InsuranceService (com.salaboy.jbpm5.dev.guide.webservice.InsuranceService)6 ArrayList (java.util.ArrayList)6 Patient (com.salaboy.jbpm5.dev.guide.model.Patient)4 MalformedURLException (java.net.MalformedURLException)3 HashMap (java.util.HashMap)3 ExecutionResults (org.jbpm.executor.api.ExecutionResults)3 List (java.util.List)2 Test (org.junit.Test)2 PatientDataServiceWorkItemHandler (com.salaboy.jbpm5.dev.guide.workitems.PatientDataServiceWorkItemHandler)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1