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);
}
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);
}
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);
}
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());
}
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());
}
Aggregations