Search in sources :

Example 6 with Patient

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

the class HospitalInsuranceProcessTest method setUp.

@Before
public void setUp() {
    initializeWebService();
    initializeSession();
    Patient salaboy = new Patient(UUID.randomUUID().toString(), "Salaboy", "SalaboyLastName", "salaboy@gmail.com", "555-15151-515151", 28);
    testPatients.put("salaboy", salaboy);
    Patient nonInsuredBrotha = new Patient(UUID.randomUUID().toString(), "John", "Doe", "gangsta1980@gmail.com", "333-333131-13131", 40);
    testPatients.put("brotha", nonInsuredBrotha);
    this.service.getPatients().put(testPatients.get("salaboy").getId(), testPatients.get("salaboy"));
    this.service.getPatients().put(testPatients.get("brotha").getId(), testPatients.get("brotha"));
    this.service.getInsuredPatients().put(testPatients.get("salaboy").getId(), Boolean.TRUE);
    this.service.getInsuredPatients().put(testPatients.get("brotha").getId(), Boolean.FALSE);
}
Also used : Patient(com.salaboy.jbpm5.dev.guide.model.Patient) Before(org.junit.Before)

Example 7 with Patient

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

the class HospitalInsuranceProcessTest method testPatientNotInsuredProcess.

/**
     * Tests the execution path for a patient NOT having a valid insurance.
     */
@Test
public void testPatientNotInsuredProcess() {
    HashMap<String, Object> input = new HashMap<String, Object>();
    Patient brotha = testPatients.get("brotha");
    input.put("patientName", brotha.getId());
    WorkflowProcessInstance pI = (WorkflowProcessInstance) session.startProcess("NewPatientInsuranceCheck", input);
    assertEquals(ProcessInstance.STATE_COMPLETED, pI.getState());
    assertEquals(Boolean.TRUE, pI.getVariable("patientNotified"));
    assertEquals(600, ((BigDecimal) pI.getVariable("finalAmount")).intValue());
}
Also used : HashMap(java.util.HashMap) Patient(com.salaboy.jbpm5.dev.guide.model.Patient) WorkflowProcessInstance(org.drools.runtime.process.WorkflowProcessInstance) Test(org.junit.Test)

Example 8 with Patient

use of com.salaboy.jbpm5.dev.guide.model.Patient 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)

Example 9 with Patient

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

the class ServiceTaskTest method setUp.

@Before
public void setUp() {
    initializeSession();
    Patient salaboy = new Patient(UUID.randomUUID().toString(), "Salaboy", "SalaboyLastName", "salaboy@gmail.com", "555-15151-515151", 28);
    testPatients.put("salaboy", salaboy);
    Patient nonInsuredBrotha = new Patient(UUID.randomUUID().toString(), "John", "Doe", "gangsta1980@gmail.com", "333-333131-13131", 40);
    testPatients.put("brotha", nonInsuredBrotha);
    SimpleValidationServiceImpl.insuredPatients.put(testPatients.get("salaboy").getId(), Boolean.TRUE);
    SimpleValidationServiceImpl.insuredPatients.put(testPatients.get("brotha").getId(), Boolean.FALSE);
}
Also used : Patient(com.salaboy.jbpm5.dev.guide.model.Patient) Before(org.junit.Before)

Example 10 with Patient

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

the class HospitalInsuranceProcessExecutorTest method setUp.

@Before
public void setUp() {
    initializeWebService();
    Patient salaboy = new Patient(UUID.randomUUID().toString(), "Salaboy", "SalaboyLastName", "salaboy@gmail.com", "555-15151-515151", 28);
    testPatients.put("salaboy", salaboy);
    Patient nonInsuredBrotha = new Patient(UUID.randomUUID().toString(), "John", "Doe", "gangsta1980@gmail.com", "333-333131-13131", 40);
    testPatients.put("brotha", nonInsuredBrotha);
    this.service.getPatients().put(testPatients.get("salaboy").getId(), testPatients.get("salaboy"));
    this.service.getPatients().put(testPatients.get("brotha").getId(), testPatients.get("brotha"));
    this.service.getInsuredPatients().put(testPatients.get("salaboy").getId(), Boolean.TRUE);
    this.service.getInsuredPatients().put(testPatients.get("brotha").getId(), Boolean.FALSE);
    System.out.println(" >>> Insured Patients: " + this.service.getInsuredPatients());
    executor = ExecutorModule.getInstance().getExecutorServiceEntryPoint();
    executor.setThreadPoolSize(1);
    executor.setInterval(3);
    executor.init();
    initializeSession();
}
Also used : Patient(com.salaboy.jbpm5.dev.guide.model.Patient) Before(org.junit.Before)

Aggregations

Patient (com.salaboy.jbpm5.dev.guide.model.Patient)15 HashMap (java.util.HashMap)6 Test (org.junit.Test)6 ConceptCode (com.salaboy.jbpm5.dev.guide.model.ConceptCode)5 InsuranceService (com.salaboy.jbpm5.dev.guide.webservice.InsuranceService)4 BigDecimal (java.math.BigDecimal)4 WorkflowProcessInstance (org.drools.runtime.process.WorkflowProcessInstance)4 Before (org.junit.Before)4 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ExecutionResults (org.jbpm.executor.api.ExecutionResults)2 SimpleValidationServiceImpl (com.salaboy.jbpm5.dev.guide.webservice.SimpleValidationServiceImpl)1 AsyncGenericWorkItemHandler (com.salaboy.jbpm5.dev.guide.workitems.AsyncGenericWorkItemHandler)1 MalformedURLException (java.net.MalformedURLException)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 KnowledgeBase (org.drools.KnowledgeBase)1 KnowledgeBuilder (org.drools.builder.KnowledgeBuilder)1 KnowledgeBuilderError (org.drools.builder.KnowledgeBuilderError)1