Search in sources :

Example 1 with Patient

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

the class GenericWebServiceTaskTest method initializeWebService.

private void initializeWebService() {
    this.service = new SimpleValidationServiceImpl();
    this.endpoint = Endpoint.publish("http://127.0.0.1:19999/WebServiceExample/insurance", service);
    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 : SimpleValidationServiceImpl(com.salaboy.jbpm5.dev.guide.webservice.SimpleValidationServiceImpl) Patient(com.salaboy.jbpm5.dev.guide.model.Patient)

Example 2 with Patient

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

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

the class PatientDataServiceWorkItemHandler method executeWorkItem.

public void executeWorkItem(WorkItem wi, WorkItemManager wim) {
    String patientId = (String) wi.getParameter("gatherdata_patientName");
    Patient patientData = null;
    InsuranceService client = getClient();
    patientData = client.getPatientData(patientId);
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("gatherdata_patient", patientData);
    wim.completeWorkItem(wi.getId(), result);
}
Also used : InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) HashMap(java.util.HashMap) Patient(com.salaboy.jbpm5.dev.guide.model.Patient)

Example 4 with Patient

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

the class HospitalInsuranceProcessExecutorTest method testPatientNonInsuredProcessWithExecutor.

/**
     * Tests the execution path for a patient NOT having a valid insurance.
     */
@Test
public void testPatientNonInsuredProcessWithExecutor() throws InterruptedException {
    HashMap<String, Object> input = new HashMap<String, Object>();
    Patient brotha = testPatients.get("brotha");
    input.put("patientName", brotha.getId());
    SessionStoreUtil.sessionCache.put("sessionId=" + session.getId(), session);
    WorkflowProcessInstance pI = (WorkflowProcessInstance) session.startProcess("NewPatientInsuranceCheck", input);
    //Our application can continue doing other things, the executor will do the rest
    Thread.sleep(25000);
    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 5 with Patient

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

the class HospitalInsuranceProcessTest method testPatientInsuredProcess.

/**
     * Tests the execution path for a patient having a valid insurance.
     */
@Test
public void testPatientInsuredProcess() {
    HashMap<String, Object> input = new HashMap<String, Object>();
    Patient salaboy = testPatients.get("salaboy");
    input.put("patientName", salaboy.getId());
    WorkflowProcessInstance pI = (WorkflowProcessInstance) session.startProcess("NewPatientInsuranceCheck", input);
    assertEquals(ProcessInstance.STATE_COMPLETED, pI.getState());
    assertEquals(Boolean.TRUE, pI.getVariable("patientNotified"));
    assertEquals(50, ((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)

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