Changeset 2594
- Timestamp:
- 02/05/10 15:10:05 (2 years ago)
- Files:
-
- his-extensions/plugins/trunk/opinio/his-plugin/src/main/java/org/joiningtracks/his/plugin/integration/opinio/provider/QuestionnaireProvider.java (modified) (2 diffs)
- his-extensions/plugins/trunk/opinio/his-plugin/src/main/java/org/joiningtracks/his/plugin/integration/opinio/rest/server/ResponsesResource.java (modified) (6 diffs)
- his-extensions/plugins/trunk/opinio/his-plugin/src/main/resources/META-INF/spring/bundle-config.xml (modified) (1 diff)
- his-extensions/plugins/trunk/samples/pathway-plugin/src/main/java/org/joiningtracks/his/pathway/sample/TherapyPossibleDecision.java (modified) (3 diffs)
- his-extensions/plugins/trunk/samples/pathway-plugin/src/main/java/org/joiningtracks/his/pathway/sample/intakeform/IntakeFormPanel.java (modified) (3 diffs)
- his-extensions/plugins/trunk/samples/pathway-plugin/src/main/resources/META-INF/spring/bundle-config.xml (modified) (1 diff)
- his-extensions/plugins/trunk/samples/pathway-plugin/src/test/java/org/joiningtracks/his/pathway/sample/JpdlSamplePathwayTest.java (modified) (2 diffs)
- his-extensions/plugins/trunk/treatment/importer/src/main/resources/META-INF/spring/bundle-config.xml (modified) (1 diff)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/PatientAppointmentSignOffPanel.java (modified) (8 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/PatientSignOffPanel.java (modified) (4 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/form/TreatmentFormDetailsPanel.java (modified) (9 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/form/TreatmentFormPanel.java (modified) (4 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/questionnaire/DisplayQuestionnairePanel.java (modified) (5 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/questionnaire/QuestionnairePanel.java (modified) (3 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/bloodvalues/BloodValueFormPanel.java (modified) (4 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/data/model/AppointmentDocument.java (modified) (1 diff)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/data/model/FormDocument.java (modified) (2 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/frontend/TreatmentGroupOverviewPanel.java (modified) (2 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/surgical/OperatiePlanningFormPanel.java (modified) (8 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/surgical/post/OperatieVerwerkingFormTaskPanel.java (modified) (7 diffs)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/tasks/SelectPatientGroupPanel.java (modified) (1 diff)
- his-extensions/plugins/trunk/treatment/treatment-base/src/main/resources/META-INF/spring/bundle-config.xml (modified) (1 diff)
- his-extensions/plugins/trunk/treatment/treatment-base/src/test/java/org/joiningtracks/his/pathway/nok/treatment/surgical/post/OperatieVerwerkingFormTest.java (modified) (2 diffs)
- his/trunk/README.txt (modified) (2 diffs)
- his/trunk/data/etc/create_db.sql (modified) (2 diffs)
- his/trunk/data/etc/upgrade_1.9.7-to-1.9.8.sql (added)
- his/trunk/data/src/main/java/org/joiningtracks/his/data/dao/HealthDocumentDao.java (modified) (3 diffs)
- his/trunk/data/src/main/java/org/joiningtracks/his/data/dao/jpa/JpaHealthDocumentDao.java (modified) (2 diffs)
- his/trunk/data/src/main/java/org/joiningtracks/his/data/model/HisHealthDocument.java (modified) (6 diffs)
- his/trunk/frontend/internal/src/main/java/org/joiningtracks/his/frontend/employee/patient/dossier/form/FormsTabPanel.java (modified) (1 diff)
- his/trunk/service/src/main/java/org/joiningtracks/his/service/healthdocument/HealthDocumentService.java (modified) (3 diffs)
- his/trunk/service/src/main/java/org/joiningtracks/his/service/healthdocument/impl/DefaultHealthDocumentService.java (modified) (4 diffs)
- his/trunk/service/src/main/java/org/joiningtracks/his/service/pathway/impl/DefaultPathwayParticipationService.java (modified) (5 diffs)
- his/trunk/service/src/main/java/org/joiningtracks/his/service/patient/impl/DefaultPatientService.java (modified) (4 diffs)
- his/trunk/service/src/main/resources/context/services.xml (modified) (2 diffs)
- his/trunk/service/src/test/java/org/joiningtracks/his/service/pathway/impl/DefaultPathwayParticipationServiceTest.java (modified) (4 diffs)
- his/trunk/service/src/test/java/org/joiningtracks/his/service/patient/impl/DefaultPatientServiceTest.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
his-extensions/plugins/trunk/opinio/his-plugin/src/main/java/org/joiningtracks/his/plugin/integration/opinio/provider/QuestionnaireProvider.java
r1888 r2594 1 1 package org.joiningtracks.his.plugin.integration.opinio.provider; 2 2 3 import org.joiningtracks.his.data.model.HealthDocument;4 3 import org.joiningtracks.his.data.model.HealthDocumentMetaData; 4 import org.joiningtracks.his.data.model.HisHealthDocument; 5 5 import org.joiningtracks.his.plugin.integration.opinio.data.model.Questionnaire; 6 6 import org.joiningtracks.his.plugin.integration.opinio.data.model.Respondent; … … 29 29 * @return the transformed questionnaire response 30 30 */ 31 H ealthDocument processQuestionnaireResponse(Respondent respondent,HealthDocument questionnaireResponse);31 HisHealthDocument processQuestionnaireResponse(Respondent respondent, HisHealthDocument questionnaireResponse); 32 32 33 33 HealthDocumentMetaData getHealthDocumentMetaData(); his-extensions/plugins/trunk/opinio/his-plugin/src/main/java/org/joiningtracks/his/plugin/integration/opinio/rest/server/ResponsesResource.java
r1877 r2594 3 3 import org.apache.wicket.injection.web.InjectorHolder; 4 4 import org.apache.wicket.spring.injection.annot.SpringBean; 5 import org.joiningtracks.his.data.model.HealthDocument;6 5 import org.joiningtracks.his.data.model.HealthDocumentMetaData; 6 import org.joiningtracks.his.data.model.HisHealthDocument; 7 7 import org.joiningtracks.his.data.model.PathwayParticipation; 8 8 import org.joiningtracks.his.plugin.integration.opinio.data.model.Respondent; 9 9 import org.joiningtracks.his.plugin.integration.opinio.provider.QuestionnaireProvider; 10 10 import org.joiningtracks.his.plugin.integration.opinio.service.QuestionnaireIntegrationService; 11 import org.joiningtracks.his.service.health record.HealthRecordService;11 import org.joiningtracks.his.service.healthdocument.HealthDocumentService; 12 12 import org.joiningtracks.his.service.pathway.PathwayParticipationService; 13 13 import org.joiningtracks.his.support.util.xml.XmlUtils; … … 17 17 import org.slf4j.Logger; 18 18 import org.slf4j.LoggerFactory; 19 import org.w3c.dom. Node;19 import org.w3c.dom.Document; 20 20 21 21 /** … … 26 26 27 27 @SpringBean 28 private Health RecordService healthRecordService;28 private HealthDocumentService healthDocumentService; 29 29 30 30 @SpringBean … … 111 111 } 112 112 113 H ealthDocument healthDocument = createHealthDocument(healthDocumentData, metaData);113 HisHealthDocument healthDocument = createHealthDocument(healthDocumentData, metaData, pathwayParticipation); 114 114 if(healthDocument == null) { 115 115 respondent.setStatus(Respondent.Status.results_store_failed); … … 129 129 130 130 try { 131 String healthDocumentId = addHealthDocument(healthDocument, pathwayParticipation);132 respondent.setHealthDocumentId( healthDocumentId);131 HisHealthDocument savedHealthDocument = healthDocumentService.create(healthDocument); 132 respondent.setHealthDocumentId(Long.toString(savedHealthDocument.getId())); 133 133 } catch (Exception e){ 134 134 respondent.setStatus(Respondent.Status.results_store_failed); … … 157 157 } 158 158 159 private String addHealthDocument(HealthDocument healthDocument, PathwayParticipation pathwayParticipation) {160 String id = healthRecordService.add(healthDocument, pathwayParticipation);161 return id;162 }159 private HisHealthDocument createHealthDocument(String healthDocumentData, HealthDocumentMetaData metaData, PathwayParticipation pathwayParticipation) { 160 Document data = XmlUtils.loadDocument(healthDocumentData); 161 HisHealthDocument newHd = new HisHealthDocument(metaData.getVersion(), metaData.getType(), pathwayParticipation, data); 162 newHd.setFormId(metaData.getFormId()); 163 163 164 private HealthDocument createHealthDocument(String healthDocumentData, HealthDocumentMetaData metaData) { 165 Node data = XmlUtils.loadDocument(healthDocumentData); 166 return new HealthDocument(data, metaData); 164 return newHd; 167 165 } 168 166 } his-extensions/plugins/trunk/opinio/his-plugin/src/main/resources/META-INF/spring/bundle-config.xml
r2577 r2594 48 48 49 49 <osgi:reference id="pathwayParticipationService" interface="org.joiningtracks.his.service.pathway.PathwayParticipationService"/> 50 <osgi:reference id="health RecordService" interface="org.joiningtracks.his.service.healthrecord.HealthRecordService"/>50 <osgi:reference id="healthDocumentService" interface="org.joiningtracks.his.service.healthdocument.HealthDocumentService"/> 51 51 52 52 <osgi:reference id="eventChannel" interface="org.springframework.integration.core.MessageChannel"/> his-extensions/plugins/trunk/samples/pathway-plugin/src/main/java/org/joiningtracks/his/pathway/sample/TherapyPossibleDecision.java
r1483 r2594 18 18 import org.jbpm.graph.exe.ExecutionContext; 19 19 import org.jbpm.graph.node.DecisionHandler; 20 import org.joiningtracks.his.data.model.H ealthDocument;20 import org.joiningtracks.his.data.model.HisHealthDocument; 21 21 import org.joiningtracks.his.support.util.xml.XPathUtils; 22 22 import org.slf4j.Logger; … … 46 46 */ 47 47 public String decide(ExecutionContext executionContext) throws Exception { 48 H ealthDocument document = (HealthDocument) executionContext.getVariable("healthDocument");48 HisHealthDocument document = (HisHealthDocument) executionContext.getVariable("healthDocument"); 49 49 // Be sure that the decision is not taken when there is no proper information as the process continues 50 50 // without the right base for it's decision, this puts unwanted risk in the real life process. … … 52 52 throw new Exception("there is no healthDocument found in the executionContext"); 53 53 } 54 if (document.get MetaData().getType().equalsIgnoreCase("intakeform")) {55 Node contentNode = document.get Data();54 if (document.getDocumentType().equalsIgnoreCase("intakeform")) { 55 Node contentNode = document.getHealthDocument(); 56 56 String decision = XPathUtils.resolveString("/intakeform/therapyrequired/text()", contentNode); 57 57 logger.debug("healthdocument intakeform contains a " + decision + " for grouptherapy"); his-extensions/plugins/trunk/samples/pathway-plugin/src/main/java/org/joiningtracks/his/pathway/sample/intakeform/IntakeFormPanel.java
r1652 r2594 9 9 import org.jbpm.taskmgmt.exe.PooledActor; 10 10 import org.jbpm.taskmgmt.exe.TaskInstance; 11 import org.joiningtracks.his.data.model.HealthDocument; 12 import org.joiningtracks.his.data.model.HealthDocumentMetaData; 13 import org.joiningtracks.his.data.model.PathwayParticipation; 14 import org.joiningtracks.his.data.model.Patient; 11 import org.joiningtracks.his.data.model.*; 15 12 import org.joiningtracks.his.frontend.common.wicket.form.FormWithAssociatedMarkup; 16 13 import org.joiningtracks.his.frontend.common.wicket.form.dom.DocumentSubmissionHandler; 17 14 import org.joiningtracks.his.frontend.common.wicket.taskpanel.AbstractTaskPanel; 18 import org.joiningtracks.his.service.health record.HealthRecordService;15 import org.joiningtracks.his.service.healthdocument.HealthDocumentService; 19 16 import org.joiningtracks.his.service.pathway.PathwayParticipationService; 20 17 import org.joiningtracks.his.service.process.TaskService; … … 28 25 private PathwayParticipationService pathwayParticipationService; 29 26 @SpringBean 30 private Health RecordService healthRecordService;27 private HealthDocumentService healthDocumentService; 31 28 @SpringBean 32 29 private TaskService taskService; … … 56 53 intakeForm = intakeFormFactory.createForm("intake_form", new DocumentSubmissionHandler() { 57 54 public void handle(FormWithAssociatedMarkup form, Document document) { 58 HealthDocumentMetaData metaData = new HealthDocumentMetaData(IntakeFormFactory.FORM_NAME, IntakeFormFactory.FORM_VERSION);59 final HealthDocument healthDocument = new HealthDocument(document, metaData);60 55 final PathwayParticipation pp = pathwayParticipationService.findPathwayParticipationByProcessInstance(taskInstance.getProcessInstance().getId()); 56 final HisHealthDocument healthDocument = new HisHealthDocument(IntakeFormFactory.FORM_VERSION, 57 IntakeFormFactory.FORM_NAME, pp, document); 61 58 62 59 transactionTemplate.runInTransaction(new TransactionCallback<Object>() { 63 60 public Object execute() { 64 61 taskService.setVariable(taskInstance, "healthDocument", healthDocument); 65 health RecordService.add(healthDocument, pp);62 healthDocumentService.create(healthDocument); 66 63 taskService.markTaskAsCompleted(taskInstance); 67 64 return null; his-extensions/plugins/trunk/samples/pathway-plugin/src/main/resources/META-INF/spring/bundle-config.xml
r1652 r2594 49 49 interface="org.joiningtracks.his.service.pathway.PathwayParticipationService"/> 50 50 51 <osgi:reference id="health RecordService"52 interface="org.joiningtracks.his.service.health record.HealthRecordService"/>51 <osgi:reference id="healthDocumentService" 52 interface="org.joiningtracks.his.service.healthdocument.HealthDocumentService"/> 53 53 54 54 <osgi:reference id="transactionTemplate" interface="org.joiningtracks.his.service.transaction.TransactionTemplate"/> his-extensions/plugins/trunk/samples/pathway-plugin/src/test/java/org/joiningtracks/his/pathway/sample/JpdlSamplePathwayTest.java
r2593 r2594 22 22 import org.jbpm.taskmgmt.exe.TaskInstance; 23 23 import org.joda.time.DateTime; 24 import org.joiningtracks.his.data.model.HealthDocument;25 24 import org.joiningtracks.his.data.model.HealthDocumentMetaData; 26 import org.joiningtracks.his.data.model. Patient;25 import org.joiningtracks.his.data.model.HisHealthDocument; 27 26 import org.joiningtracks.his.data.util.jbpm.JbpmTemplate; 28 import org.joiningtracks.his.support.util.event.EventListener;29 27 import org.slf4j.Logger; 30 28 import org.slf4j.LoggerFactory; … … 115 113 } 116 114 HealthDocumentMetaData metaData = new HealthDocumentMetaData("intakeform", "1.0", "formId"); 117 HealthDocument newDoc = new HealthDocument("testid", new DateTime(), doc.getDocumentElement(), metaData); 115 HisHealthDocument newDoc = new HisHealthDocument(1L); 116 newDoc.setDocumentType(metaData.getType()); 117 newDoc.setDocumentVersion(metaData.getVersion()); 118 newDoc.setFormId(metaData.getFormId()); 119 newDoc.setHealthDocument(doc); 120 newDoc.setCreated(new DateTime()); 118 121 119 122 processInstance.getContextInstance().setVariable("healthDocument", newDoc); his-extensions/plugins/trunk/treatment/importer/src/main/resources/META-INF/spring/bundle-config.xml
r2326 r2594 57 57 <osgi:reference id="pathwayPluginService" interface="org.joiningtracks.his.plugin.bridge.pathway.PathwayPluginService"/> 58 58 59 <osgi:reference id="health RecordService"60 interface="org.joiningtracks.his.service.health record.HealthRecordService"/>59 <osgi:reference id="healthDocumentService" 60 interface="org.joiningtracks.his.service.healthdocument.HealthDocumentService"/> 61 61 62 62 <osgi:reference id="clinicalPathwayService" his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/PatientAppointmentSignOffPanel.java
r2507 r2594 37 37 import org.joiningtracks.his.pathway.nok.treatment.data.model.PatientGroupDocument; 38 38 import org.joiningtracks.his.service.appointment.AppointmentService; 39 import org.joiningtracks.his.service.health record.HealthRecordService;39 import org.joiningtracks.his.service.healthdocument.HealthDocumentService; 40 40 import org.joiningtracks.his.service.pathway.PathwayParticipationService; 41 41 import org.joiningtracks.his.service.patientgroup.PatientGroupService; … … 53 53 private AppointmentService appointmentService; 54 54 @SpringBean 55 private Health RecordService healthRecordService;55 private HealthDocumentService healthDocumentService; 56 56 @SpringBean 57 57 private PathwayParticipationService pathwayParticipationService; … … 84 84 if (!patientGroups.isEmpty()) { 85 85 patientGroup = patientGroups.iterator().next(); 86 }87 88 // for existing groups if the repository is not present create one89 // we cannot create the repository in the his-core module as this requirement is only90 // for treatment group. In that case, core would need the knowledge of all the supported groups91 if (patientGroup.getUniqueIdentifier() == null) {92 healthRecordService.createRepository(patientGroup);93 patientGroup = patientGroupService.update(patientGroup);94 86 } 95 87 … … 271 263 */ 272 264 private void derivePatientGroupDocument() { 273 List<H ealthDocumentInfo> groupHealthDocuments = healthRecordService.getAllHealthRecordInfo(patientGroup);265 List<HisHealthDocument> groupHealthDocuments = healthDocumentService.findByPatientGroup(patientGroup); 274 266 if (groupHealthDocuments.size() == 0) { 275 267 patientGroupDocument = new PatientGroupDocument(); 276 268 } else { 277 269 // Retrieve from XML 278 for (HealthDocumentInfo healthDocumentInfo : groupHealthDocuments) { 279 HealthDocument healthDocument = healthRecordService.get(healthDocumentInfo.getId(), patientGroup); 280 patientGroupDocument = PatientGroupDocument.fromXML(XmlUtils.getAsString(healthDocument.getData())); 270 for (HisHealthDocument healthDocument : groupHealthDocuments) { 271 patientGroupDocument = PatientGroupDocument.fromXML(XmlUtils.getAsString(healthDocument.getHealthDocument())); 281 272 } 282 273 } … … 295 286 Patient patient = (Patient) attendeeReference.getAttendee(); 296 287 PatientDetail patientDetail = new PatientDetail(patient, patientGroup); 297 List<H ealthDocumentInfo> healthdocuments = healthRecordService.getAllHealthRecordInfo(patientDetail.getPathwayParticipation(), metaData.getFormId());288 List<HisHealthDocument> healthdocuments = healthDocumentService.getAllHealthRecordInfo(patientDetail.getPathwayParticipation(), metaData.getFormId()); 298 289 299 290 if (healthdocuments.size() == 0) { … … 302 293 } else { 303 294 // Retrieve from XML 304 for (HealthDocumentInfo healthDocumentInfo : healthdocuments) { 305 HealthDocument healthDocument = healthRecordService.get(healthDocumentInfo.getId(), patientDetail.getPathwayParticipation()); 306 patientDocument = PatientDocument.fromXML(XmlUtils.getAsString(healthDocument.getData())); 295 for (HisHealthDocument healthDocument : healthdocuments) { 296 patientDocument = PatientDocument.fromXML(XmlUtils.getAsString(healthDocument.getHealthDocument())); 307 297 } 308 298 } … … 394 384 private void saveOrUpdatePatientGroupDocument() { 395 385 Document document = XmlUtils.loadDocument(patientGroupDocument.toXML()); 396 HealthDocumentMetaData metaData = new HealthDocumentMetaData(PatientHealthDocumentFormFactory.FORM_NAME, PatientHealthDocumentFormFactory.FORM_VERSION); 397 398 List<HealthDocumentInfo> healthdocuments = healthRecordService.getAllHealthRecordInfo(patientGroup); 386 387 List<HisHealthDocument> healthdocuments = healthDocumentService.findByPatientGroup(patientGroup); 399 388 if (healthdocuments.size() == 0) { 400 389 // Create new 401 final HealthDocument healthDocument = new HealthDocument(document, metaData); 402 healthRecordService.add(healthDocument, patientGroup); 390 final HisHealthDocument healthDocument = new HisHealthDocument(PatientHealthDocumentFormFactory.FORM_VERSION, 391 PatientHealthDocumentFormFactory.FORM_NAME, patientGroup, document); 392 393 healthDocumentService.create(healthDocument); 403 394 404 395 } else { 405 396 // Update existing 406 for (HealthDocumentInfo healthDocumentInfo : healthdocuments) { 407 HealthDocument healthDocument = healthRecordService.get(healthDocumentInfo.getId(), patientGroup); 397 for (HisHealthDocument healthDocument : healthdocuments) { 408 398 if (healthDocument != null) { 409 healthDocument.set Data(document.getDocumentElement());410 health RecordService.update(healthDocument, patientGroup);399 healthDocument.setHealthDocument(document); 400 healthDocumentService.update(healthDocument); 411 401 } 412 402 } … … 462 452 private void updatePatientDocument(PatientDocument patientDocument, PathwayParticipation pathwayParticipation) { 463 453 Document document = XmlUtils.loadDocument(patientDocument.toXML()); 464 HealthDocumentMetaData metaData = new HealthDocumentMetaData(PatientHealthDocumentFormFactory.FORM_NAME, PatientHealthDocumentFormFactory.FORM_VERSION); 465 466 List<HealthDocumentInfo> healthdocuments = healthRecordService.getAllHealthRecordInfo(pathwayParticipation, metaData.getFormId());454 455 List<HisHealthDocument> healthdocuments = healthDocumentService.getAllHealthRecordInfo(pathwayParticipation, 456 PatientHealthDocumentFormFactory.FORM_NAME + "_" + PatientHealthDocumentFormFactory.FORM_VERSION); 467 457 if (healthdocuments.size() == 0) { 468 458 // Create new 469 final HealthDocument healthDocument = new HealthDocument(document, metaData); 470 healthRecordService.add(healthDocument, pathwayParticipation); 459 final HisHealthDocument healthDocument = new HisHealthDocument(PatientHealthDocumentFormFactory.FORM_VERSION, 460 PatientHealthDocumentFormFactory.FORM_NAME, pathwayParticipation, document); 461 healthDocumentService.create(healthDocument); 471 462 } else { 472 463 // Update existing 473 for (HealthDocumentInfo healthDocumentInfo : healthdocuments) { 474 HealthDocument healthDocument = healthRecordService.get(healthDocumentInfo.getId(), pathwayParticipation); 464 for (HisHealthDocument healthDocument : healthdocuments) { 475 465 if (healthDocument != null) { 476 healthDocument.set Data(document.getDocumentElement());477 health RecordService.update(healthDocument, pathwayParticipation);466 healthDocument.setHealthDocument(document); 467 healthDocumentService.update(healthDocument); 478 468 } 479 469 } his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/PatientSignOffPanel.java
r2507 r2594 24 24 import org.joiningtracks.his.pathway.nok.treatment.data.model.PatientDocument; 25 25 import org.joiningtracks.his.service.appointment.AppointmentService; 26 import org.joiningtracks.his.service.health record.HealthRecordService;26 import org.joiningtracks.his.service.healthdocument.HealthDocumentService; 27 27 import org.joiningtracks.his.service.ldap.LdapEmployeeService; 28 28 import org.joiningtracks.his.support.util.xml.XmlUtils; … … 45 45 protected LdapEmployeeService ldapEmployeeService; 46 46 @SpringBean 47 protected Health RecordService healthRecordService;47 protected HealthDocumentService healthDocumentService; 48 48 @SpringBean 49 49 protected AppointmentService appointmentService; … … 74 74 PatientDocument patientDocument = patientDetail.getPatientDocument(); 75 75 Document document = XmlUtils.loadDocument(patientDocument.toXML()); 76 HealthDocumentMetaData metaData = new HealthDocumentMetaData(PatientHealthDocumentFormFactory.FORM_NAME, PatientHealthDocumentFormFactory.FORM_VERSION);77 List<HealthDocumentInfo> healthdocuments = healthRecordService.getAllHealthRecordInfo(patientDetail.getPathwayParticipation(), metaData.getFormId());76 List<HisHealthDocument> healthdocuments = healthDocumentService.getAllHealthRecordInfo(patientDetail.getPathwayParticipation(), 77 PatientHealthDocumentFormFactory.FORM_NAME + "_" + PatientHealthDocumentFormFactory.FORM_VERSION); 78 78 if (healthdocuments.size() == 0) { 79 79 // Create new 80 final HealthDocument healthDocument = new HealthDocument(document, metaData); 81 healthRecordService.add(healthDocument, patientDetail.getPathwayParticipation()); 80 final HisHealthDocument healthDocument = new HisHealthDocument(PatientHealthDocumentFormFactory.FORM_VERSION, 81 PatientHealthDocumentFormFactory.FORM_NAME, patientDetail.getPathwayParticipation(), document); 82 healthDocumentService.create(healthDocument); 82 83 } else { 83 84 // Update existing 84 for (HealthDocumentInfo healthDocumentInfo : healthdocuments) { 85 HealthDocument healthDocument = healthRecordService.get(healthDocumentInfo.getId(), patientDetail.getPathwayParticipation()); 85 for (HisHealthDocument healthDocument : healthdocuments) { 86 86 if (healthDocument != null) { 87 healthDocument.set Data(document.getDocumentElement());88 health RecordService.update(healthDocument, patientDetail.getPathwayParticipation());87 healthDocument.setHealthDocument(document); 88 healthDocumentService.update(healthDocument); 89 89 } 90 90 } … … 97 97 */ 98 98 protected PatientDetail getUpdatedPatientDocument(PatientDetail patientDetail) { 99 HealthDocumentMetaData metaData = new HealthDocumentMetaData(PatientHealthDocumentFormFactory.FORM_NAME, PatientHealthDocumentFormFactory.FORM_VERSION);100 List<HealthDocumentInfo> healthdocuments = healthRecordService.getAllHealthRecordInfo(patientDetail.getPathwayParticipation(), metaData.getFormId());99 List<HisHealthDocument> healthdocuments = healthDocumentService.getAllHealthRecordInfo(patientDetail.getPathwayParticipation(), 100 PatientHealthDocumentFormFactory.FORM_NAME + "_" + PatientHealthDocumentFormFactory.FORM_VERSION); 101 101 // Get updated document 102 for (HealthDocumentInfo healthDocumentInfo : healthdocuments) { 103 HealthDocument healthDocument = healthRecordService.get(healthDocumentInfo.getId(), patientDetail.getPathwayParticipation()); 102 for (HisHealthDocument healthDocument : healthdocuments) { 104 103 if (healthDocument != null) { 105 PatientDocument existingDocument = PatientDocument.fromXML(XmlUtils.getAsString(healthDocument.get Data()));104 PatientDocument existingDocument = PatientDocument.fromXML(XmlUtils.getAsString(healthDocument.getHealthDocument())); 106 105 patientDetail.setPatientDocument(existingDocument); 107 106 } his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/form/TreatmentFormDetailsPanel.java
r2507 r2594 21 21 import org.apache.wicket.markup.html.panel.Panel; 22 22 import org.apache.wicket.spring.injection.annot.SpringBean; 23 import org.joiningtracks.his.data.model.HealthDocument; 24 import org.joiningtracks.his.data.model.HealthDocumentMetaData; 23 import org.joiningtracks.his.data.model.HisHealthDocument; 25 24 import org.joiningtracks.his.data.model.PathwayParticipation; 26 25 import org.joiningtracks.his.frontend.common.wicket.form.FormWithAssociatedMarkup; … … 30 29 import org.joiningtracks.his.plugin.form.FormFactory; 31 30 import org.joiningtracks.his.plugin.form.FormManager; 32 import org.joiningtracks.his.service.health record.HealthRecordService;31 import org.joiningtracks.his.service.healthdocument.HealthDocumentService; 33 32 import org.joiningtracks.his.service.transaction.TransactionCallback; 34 33 import org.joiningtracks.his.service.transaction.TransactionTemplate; … … 51 50 private PathwayPluginService pathwayPluginService; 52 51 @SpringBean 53 private Health RecordService healthRecordService;52 private HealthDocumentService healthDocumentService; 54 53 @SpringBean 55 54 private TransactionTemplate transactionTemplate; … … 57 56 private FormManager formManager; 58 57 59 private H ealthDocument healthDocument;60 private String documentId;58 private HisHealthDocument healthDocument; 59 private Long documentId; 61 60 62 61 /** … … 68 67 * @param documentId document id 69 68 */ 70 public TreatmentFormDetailsPanel(String id, FormConfig formConfig, PathwayParticipation pathwayParticipation, String documentId) {69 public TreatmentFormDetailsPanel(String id, FormConfig formConfig, PathwayParticipation pathwayParticipation, Long documentId) { 71 70 super(id); 72 71 setOutputMarkupId(true); … … 85 84 // get the healthDocument (if it already exists) 86 85 if (documentId != null) { 87 healthDocument = health RecordService.get(documentId, pathwayParticipation);86 healthDocument = healthDocumentService.getById(documentId); 88 87 } 89 88 addForm(formConfig, pathwayParticipation); … … 93 92 final FormFactory factory = pathwayPluginService.getFormFactoryForProvidedForm(formConfig.getType(), formConfig.getVersion()); 94 93 Form foundForm; 95 if (healthDocument != null && healthDocument.get Data() != null) {96 foundForm = factory.createForm("theProvidedForm", XmlUtils.resolveDocument(healthDocument.get Data()), new DocumentSubmissionHandler() {94 if (healthDocument != null && healthDocument.getHealthDocument() != null) { 95 foundForm = factory.createForm("theProvidedForm", XmlUtils.resolveDocument(healthDocument.getHealthDocument()), new DocumentSubmissionHandler() { 97 96 public void handle(FormWithAssociatedMarkup form, Document document) { 98 healthDocument.set Data(document.getDocumentElement());97 healthDocument.setHealthDocument(document); 99 98 100 99 transactionTemplate.runInTransaction(new TransactionCallback<Object>() { 101 100 public Object execute() { 102 health RecordService.update(healthDocument, pathwayParticipation);101 healthDocumentService.update(healthDocument); 103 102 return null; 104 103 } … … 110 109 foundForm = factory.createForm("theProvidedForm", new DocumentSubmissionHandler() { 111 110 public void handle(FormWithAssociatedMarkup form, Document document) { 112 HealthDocumentMetaData metaData = new HealthDocumentMetaData(formConfig.getType(), formConfig.getVersion()); 113 final HealthDocument healthDocument = new HealthDocument(formConfig.getIdentifier(), new DateTime(), document, metaData); 111 final HisHealthDocument healthDocument = new HisHealthDocument(formConfig.getVersion(), 112 formConfig.getType(), pathwayParticipation, document); 113 healthDocument.setFormId(formConfig.getIdentifier()); 114 114 transactionTemplate.runInTransaction(new TransactionCallback<Object>() { 115 115 public Object execute() { 116 documentId = health RecordService.add(healthDocument, pathwayParticipation);116 documentId = healthDocumentService.create(healthDocument).getId(); 117 117 return null; 118 118 } … … 144 144 145 145 146 abstract void handleSave( String healthRecordId);146 abstract void handleSave(Long healthRecordId); 147 147 148 148 abstract void handleCancel(AjaxRequestTarget target); his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/form/TreatmentFormPanel.java
r2507 r2594 127 127 theFormConfig, patientDetail.getPathwayParticipation(), formDocument.getDocumentId()) { 128 128 129 void handleSave( String healthRecordId) {129 void handleSave(Long healthRecordId) { 130 130 saveForm(healthRecordId, theFormConfig); 131 131 … … 162 162 } 163 163 164 private void saveForm( String healthRecordId, FormConfig theFormConfig) {164 private void saveForm(Long healthRecordId, FormConfig theFormConfig) { 165 165 getUpdatedPatientDocument(patientDetail); 166 166 formDocument = patientDetail.getPatientDocument().getAppointmentByIdentifier(appointment.getAppointmentNumber()) … … 171 171 } 172 172 173 private FormDocument createOrRetrieveFormDocument(String documentId) {173 private FormDocument createOrRetrieveFormDocument(String formId) { 174 174 AppointmentDocument appointmentDocument = patientDetail.getPatientDocument().getAppointmentByIdentifier(appointment.getAppointmentNumber()); 175 175 if (appointmentDocument == null) { … … 177 177 patientDetail.getPatientDocument().addAppointment(appointmentDocument); 178 178 } 179 FormDocument formDocument = appointmentDocument.getFormByDocumentId( documentId);179 FormDocument formDocument = appointmentDocument.getFormByDocumentId(formId); 180 180 if (formDocument == null) { 181 formDocument = new FormDocument( documentId);181 formDocument = new FormDocument(formId); 182 182 appointmentDocument.addForm(formDocument); 183 183 updatePatientDocument(patientDetail); his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/questionnaire/DisplayQuestionnairePanel.java
r2581 r2594 24 24 import org.apache.wicket.markup.html.panel.Panel; 25 25 import org.apache.wicket.spring.injection.annot.SpringBean; 26 import org.joiningtracks.his.data.model.HealthDocument; 27 import org.joiningtracks.his.data.model.HealthDocumentInfo; 26 import org.joiningtracks.his.data.model.HisHealthDocument; 28 27 import org.joiningtracks.his.data.model.PathwayParticipation; 29 import org.joiningtracks.his.frontend.employee.patient.dossier.form.FormPanel;30 28 import org.joiningtracks.his.frontend.employee.patient.dossier.form.StaticXmlFormPanel; 31 29 import org.joiningtracks.his.plugin.form.FormDescriptor; 32 30 import org.joiningtracks.his.plugin.form.FormManager; 33 import org.joiningtracks.his.service.healthdocument.HealthDocumentService;34 import org.joiningtracks.his.service.healthrecord.HealthRecordService;35 import org.w3c.dom.Document;36 31 37 32 /** … … 45 40 FormManager formManager; 46 41 47 public DisplayQuestionnairePanel(String id, H ealthDocument healthDocument, PathwayParticipation pathwayParticipation) {42 public DisplayQuestionnairePanel(String id, HisHealthDocument healthDocument, PathwayParticipation pathwayParticipation) { 48 43 super(id); 49 44 initUI(healthDocument, pathwayParticipation); … … 51 46 } 52 47 53 private void initUI(H ealthDocument healthDocument, PathwayParticipation pathwayParticipation) {48 private void initUI(HisHealthDocument healthDocument, PathwayParticipation pathwayParticipation) { 54 49 55 50 addFormPanel(healthDocument, pathwayParticipation); … … 64 59 } 65 60 66 public final void addFormPanel(H ealthDocument healthDocument, PathwayParticipation pathwayParticipation) {61 public final void addFormPanel(HisHealthDocument healthDocument, PathwayParticipation pathwayParticipation) { 67 62 68 StaticXmlFormPanel formPanel = new StaticXmlFormPanel("questionnaire", healthDocument.get Data());63 StaticXmlFormPanel formPanel = new StaticXmlFormPanel("questionnaire", healthDocument.getHealthDocument()); 69 64 add(formPanel); 70 65 71 FormDescriptor formDescriptor = formManager.getFormDescriptor(healthDocument .getMetaData());66 FormDescriptor formDescriptor = formManager.getFormDescriptor(healthDocument); 72 67 // we couldn't find the appropriate form that can edit the document, so we just show the xml document. 73 68 if (formDescriptor == null) { … … 76 71 formPanel.setVisible(false); 77 72 78 Form form = formDescriptor.getFormFactory().createForm("questionnaireform", (Document) healthDocument.getData(), null, pathwayParticipation.getPatient(), pathwayParticipation);73 Form form = formDescriptor.getFormFactory().createForm("questionnaireform", healthDocument.getHealthDocument(), null, pathwayParticipation.getPatient(), pathwayParticipation); 79 74 add(form); 80 75 disableFormElements(form); his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/appointment/signoff/questionnaire/QuestionnairePanel.java
r2581 r2594 31 31 import org.apache.wicket.spring.injection.annot.SpringBean; 32 32 import org.joiningtracks.his.data.model.Appointment; 33 import org.joiningtracks.his.data.model.H ealthDocument;33 import org.joiningtracks.his.data.model.HisHealthDocument; 34 34 import org.joiningtracks.his.pathway.nok.treatment.appointment.signoff.PatientSignOffPanel; 35 35 import org.joiningtracks.his.pathway.nok.treatment.config.AppointmentConfig; … … 96 96 private QuestionnaireIntegrationService questionnaireIntegrationService; 97 97 98 private H ealthDocument healthDocument;98 private HisHealthDocument healthDocument; 99 99 private QuestionnaireDocument questionnaireDocument; 100 100 private FeedbackPanel feedbackPanel; … … 156 156 String healthDocumentId = respondent.getHealthDocumentId(); 157 157 if (healthDocumentId != null) { 158 healthDocument = health RecordService.get(healthDocumentId, patientDetail.getPathwayParticipation());158 healthDocument = healthDocumentService.getById(new Long(healthDocumentId)); 159 159 if (healthDocument != null) { 160 160 isAnsweredField.setModel(new Model<Boolean>(true)); his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/bloodvalues/BloodValueFormPanel.java
r2586 r2594 5 5 import org.apache.wicket.spring.injection.annot.SpringBean; 6 6 import org.jbpm.taskmgmt.exe.TaskInstance; 7 import org.joiningtracks.his.data.model.HealthDocument; 8 import org.joiningtracks.his.data.model.HealthDocumentMetaData; 9 import org.joiningtracks.his.data.model.PathwayParticipation; 10 import org.joiningtracks.his.data.model.Patient; 7 import org.joiningtracks.his.data.model.*; 11 8 import org.joiningtracks.his.frontend.common.wicket.form.FormWithAssociatedMarkup; 12 9 import org.joiningtracks.his.frontend.common.wicket.form.dom.DocumentSubmissionHandler; 13 10 import org.joiningtracks.his.frontend.common.wicket.taskpanel.AbstractTaskPanel; 14 import org.joiningtracks.his.service.health record.HealthRecordService;11 import org.joiningtracks.his.service.healthdocument.HealthDocumentService; 15 12 import org.joiningtracks.his.service.pathway.PathwayParticipationService; 16 13 import org.joiningtracks.his.service.process.TaskService; … … 24 21 private PathwayParticipationService pathwayParticipationService; 25 22 @SpringBean 26 private Health RecordService healthRecordService;23 private HealthDocumentService healthDocumentService; 27 24 @SpringBean 28 25 private TaskService taskService; … … 33 30 34 31 private final BloodValueForm bloodValueForm; 35 private H ealthDocument healthDocument;32 private HisHealthDocument healthDocument; 36 33 37 34 /** … … 81 78 bloodValueForm = (BloodValueForm) bloodValueFormFactory.createForm("blood_value_form", new DocumentSubmissionHandler() { 82 79 public void handle(FormWithAssociatedMarkup form, Document document) { 83 HealthDocumentMetaData metaData = new HealthDocumentMetaData(BloodValueFormFactory.FORM_NAME, BloodValueFormFactory.FORM_VERSION);84 final HealthDocument healthDocument = new HealthDocument(document, metaData);80 final HisHealthDocument healthDocument = new HisHealthDocument(BloodValueFormFactory.FORM_VERSION, 81 BloodValueFormFactory.FORM_NAME, pathwayParticipation, document); 85 82 86 83 transactionTemplate.runInTransaction(new TransactionCallback<Object>() { 87 84 public Object execute() { 88 String recordId = healthRecordService.add(healthDocument, pathwayParticipation);89 taskService.setVariable(taskInstance, "BloodValue_recordId", recordId);85 HisHealthDocument savedDocument = healthDocumentService.create(healthDocument); 86 taskService.setVariable(taskInstance, "BloodValue_recordId", savedDocument.getId()); 90 87 91 88 return null; his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/data/model/AppointmentDocument.java
r2507 r2594 87 87 FormDocument formDocument = null; 88 88 for (FormDocument form : forms) { 89 if (form.get DocumentId().equals(identifier)) {89 if (form.getFormId().equals(identifier)) { 90 90 formDocument = form; 91 91 break; his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/data/model/FormDocument.java
r2507 r2594 25 25 public class FormDocument implements Serializable { 26 26 27 private String documentId; 27 private Long documentId; 28 private String formId; 28 29 private boolean filled; 29 30 30 public FormDocument( String documentId, boolean filled) {31 public FormDocument(Long documentId, boolean filled) { 31 32 this.documentId = documentId; 32 33 this.filled = filled; … … 36 37 } 37 38 38 public FormDocument(String documentId) { 39 public FormDocument(String formId) { 40 this.formId = formId; 41 } 42 43 public Long getDocumentId() { 44 return documentId; 45 } 46 47 public void setDocumentId(Long documentId) { 39 48 this.documentId = documentId; 40 49 } 41 50 42 public String get DocumentId() {43 return documentId;51 public String getFormId() { 52 return formId; 44 53 } 45 54 46 public void set DocumentId(String documentId) {47 this. documentId = documentId;55 public void setFormId(String formId) { 56 this.formId = formId; 48 57 } 49 58 his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/frontend/TreatmentGroupOverviewPanel.java
r2507 r2594 38 38 import org.joiningtracks.his.pathway.nok.treatment.data.model.TreatmentTrajectData; 39 39 import org.joiningtracks.his.service.appointment.AppointmentService; 40 import org.joiningtracks.his.service.healthrecord.HealthRecordService;41 40 import org.joiningtracks.his.service.pathway.ClinicalPathwayService; 42 41 import org.joiningtracks.his.service.patientgroup.PatientGroupService; … … 57 56 @SpringBean 58 57 private AppointmentService appointmentService; 59 60 @SpringBean61 private HealthRecordService healthRecordService;62 63 58 64 59 private ProcessDefinition pathway; his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/surgical/OperatiePlanningFormPanel.java
r2507 r2594 20 20 import org.apache.wicket.spring.injection.annot.SpringBean; 21 21 import org.jbpm.taskmgmt.exe.TaskInstance; 22 import org.joiningtracks.his.data.model.HealthDocument; 23 import org.joiningtracks.his.data.model.HealthDocumentMetaData; 22 import org.joiningtracks.his.data.model.HisHealthDocument; 24 23 import org.joiningtracks.his.data.model.PathwayParticipation; 25 24 import org.joiningtracks.his.data.model.Patient; … … 27 26 import org.joiningtracks.his.frontend.common.wicket.form.dom.DocumentSubmissionHandler; 28 27 import org.joiningtracks.his.frontend.common.wicket.taskpanel.AbstractTaskPanel; 29 import org.joiningtracks.his.service.health record.HealthRecordService;28 import org.joiningtracks.his.service.healthdocument.HealthDocumentService; 30 29 import org.joiningtracks.his.service.pathway.PathwayParticipationService; 31 30 import org.joiningtracks.his.service.process.TaskService; … … 35 34 import org.w3c.dom.Document; 36 35 36 import java.util.List; 37 37 import java.util.Map; 38 38 … … 47 47 private PathwayParticipationService pathwayParticipationService; 48 48 @SpringBean 49 private Health RecordService healthRecordService;49 private HealthDocumentService healthDocumentService; 50 50 @SpringBean 51 51 private TaskService taskService; … … 56 56 57 57 private final OperatiePlanningForm operatiePlanningForm; 58 private H ealthDocument healthDocument;58 private HisHealthDocument healthDocument; 59 59 60 60 /** … … 102 102 Patient patient = pathwayParticipation.getPatient(); 103 103 104 String operatiePlanningRecordId = (String) taskService.getVariable(taskInstance, "OperatiePlanning_recordId");104 Long operatiePlanningRecordId = (Long) taskService.getVariable(taskInstance, "OperatiePlanning_recordId"); 105 105 // get the healthDocument (if it already exists) "operatie planning_1.0.0" 106 106 if (operatiePlanningRecordId != null) { 107 healthDocument = health RecordService.get(operatiePlanningRecordId, pathwayParticipation);107 healthDocument = healthDocumentService.getById(operatiePlanningRecordId); 108 108 } 109 109 //if the healthDocument could not be collected the via the variable, scan for the healthDocument. There should only be one per participation. 110 110 if (healthDocument == null) { 111 Map<String, HealthDocument> allDocs = healthRecordService.getAllDocuments(pathwayParticipation);112 for ( Map.Entry<String, HealthDocument> entry : allDocs.entrySet()) {113 if ( entry.getValue().getMetaData().getFormId().equals(OperatiePlanningFormFactory.FORM_NAME + "_" + OperatiePlanningFormFactory.FORM_VERSION)) {114 healthDocument = entry.getValue();111 List<HisHealthDocument> allDocs = healthDocumentService.findByPathwayParticipation(pathwayParticipation); 112 for (HisHealthDocument hd : allDocs) { 113 if (hd.getFormId().equals(OperatiePlanningFormFactory.FORM_NAME + "_" + OperatiePlanningFormFactory.FORM_VERSION)) { 114 healthDocument = hd; 115 115 break; 116 116 } … … 118 118 } 119 119 120 if (healthDocument != null && healthDocument.get Data() != null) {121 operatiePlanningForm = (OperatiePlanningForm) operatiePlanningFormFactory.createForm("operatie_planning_form", XmlUtils.resolveDocument(healthDocument.get Data()), new DocumentSubmissionHandler() {120 if (healthDocument != null && healthDocument.getHealthDocument() != null) { 121 operatiePlanningForm = (OperatiePlanningForm) operatiePlanningFormFactory.createForm("operatie_planning_form", XmlUtils.resolveDocument(healthDocument.getHealthDocument()), new DocumentSubmissionHandler() { 122 122 public void handle(FormWithAssociatedMarkup form, Document document) { 123 healthDocument.set Data(document.getDocumentElement());123 healthDocument.setHealthDocument(document); 124 124 125 125 transactionTemplate.runInTransaction(new TransactionCallback<Object>() { 126 126 public Object execute() { 127 health RecordService.update(healthDocument, pathwayParticipation);127 healthDocumentService.update(healthDocument); 128 128 if (operatiePlanningForm.isCompleted()) { 129 129 taskService.markTaskAsCompleted(taskInstance); … … 137 137 operatiePlanningForm = (OperatiePlanningForm) operatiePlanningFormFactory.createForm("operatie_planning_form", new DocumentSubmissionHandler() { 138 138 public void handle(FormWithAssociatedMarkup form, Document document) { 139 HealthDocumentMetaData metaData = new HealthDocumentMetaData(OperatiePlanningFormFactory.FORM_NAME, OperatiePlanningFormFactory.FORM_VERSION);140 final HealthDocument healthDocument = new HealthDocument(document, metaData);139 final HisHealthDocument healthDocument = new HisHealthDocument(OperatiePlanningFormFactory.FORM_VERSION, 140 OperatiePlanningFormFactory.FORM_NAME, pathwayParticipation, document); 141 141 142 142 transactionTemplate.runInTransaction(new TransactionCallback<Object>() { 143 143 public Object execute() { 144 String recordId = healthRecordService.add(healthDocument, pathwayParticipation);145 taskService.setVariable(taskInstance, "OperatiePlanning_recordId", recordId);144 HisHealthDocument savedDoc = healthDocumentService.create(healthDocument); 145 taskService.setVariable(taskInstance, "OperatiePlanning_recordId", savedDoc.getId()); 146 146 if (operatiePlanningForm.isCompleted()) { 147 147 taskService.markTaskAsCompleted(taskInstance); his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/surgical/post/OperatieVerwerkingFormTaskPanel.java
r2507 r2594 20 20 import org.apache.wicket.spring.injection.annot.SpringBean; 21 21 import org.jbpm.taskmgmt.exe.TaskInstance; 22 import org.joiningtracks.his.data.model.HealthDocument; 23 import org.joiningtracks.his.data.model.HealthDocumentMetaData; 24 import org.joiningtracks.his.data.model.PathwayParticipation; 25 import org.joiningtracks.his.data.model.Patient; 22 import org.joiningtracks.his.data.model.*; 26 23 import org.joiningtracks.his.frontend.common.wicket.form.FormWithAssociatedMarkup; 27 24 import org.joiningtracks.his.frontend.common.wicket.form.dom.DocumentSubmissionHandler; 28 25 import org.joiningtracks.his.frontend.common.wicket.taskpanel.AbstractTaskPanel; 29 import org.joiningtracks.his.service.health record.HealthRecordService;26 import org.joiningtracks.his.service.healthdocument.HealthDocumentService; 30 27 import org.joiningtracks.his.service.pathway.PathwayParticipationService; 31 28 import org.joiningtracks.his.service.process.TaskService; … … 35 32 import org.w3c.dom.Document; 36 33 34 import java.util.List; 37 35 import java.util.Map; 38 36 … … 47 45 private PathwayParticipationService pathwayParticipationService; 48 46 @SpringBean 49 private Health RecordService healthRecordService;47 private HealthDocumentService healthDocumentService; 50 48 @SpringBean 51 49 private TaskService taskService; … … 56 54 57 55 private final OperatieVerwerkingForm operatieVerwerkingForm; 58 private H ealthDocument healthDocument;56 private HisHealthDocument healthDocument; 59 57 60 58 /** … … 107 105 Patient patient = pathwayParticipation.getPatient(); 108 106 109 String operatieVerwerkingRecordId = (String) taskService.getVariable(taskInstance, "OperatieVerwerking_recordId");107 Long operatieVerwerkingRecordId = (Long) taskService.getVariable(taskInstance, "OperatieVerwerking_recordId"); 110 108 // get the healthDocument (if it already exists) "operatie verwerking_1.0.0" 111 109 if (operatieVerwerkingRecordId != null) { 112 healthDocument = health RecordService.get(operatieVerwerkingRecordId, pathwayParticipation);110 healthDocument = healthDocumentService.getById(operatieVerwerkingRecordId); 113 111 } 114 112 //if the healthDocument could not be collected the via the variable, scan for the healthDocument. There should only be one per participation. 115 113 if (healthDocument == null) { 116 Map<String, HealthDocument> allDocs = healthRecordService.getAllDocuments(pathwayParticipation);117 for ( Map.Entry<String, HealthDocument> entry : allDocs.entrySet()) {118 if ( entry.getValue().getMetaData().getFormId().equals(OperatieVerwerkingFormFactory.FORM_NAME + "_" + OperatieVerwerkingFormFactory.FORM_VERSION)) {119 healthDocument = entry.getValue();114 List<HisHealthDocument> allDocs = healthDocumentService.findByPathwayParticipation(pathwayParticipation); 115 for (HisHealthDocument thd : allDocs) { 116 if (thd.getFormId().equals(OperatieVerwerkingFormFactory.FORM_NAME + "_" + OperatieVerwerkingFormFactory.FORM_VERSION)) { 117 healthDocument = thd; 120 118 break; 121 119 } … … 123 121 } 124 122 125 if (healthDocument != null && healthDocument.getData() != null) { 126 operatieVerwerkingForm = (OperatieVerwerkingForm) operatieVerwerkingFormFactory.createForm("operatie_verwerking_form", XmlUtils.resolveDocument(healthDocument.getData()), new DocumentSubmissionHandler() { 123 if (healthDocument != null && healthDocument.getHealthDocument() != null) { 124 operatieVerwerkingForm = (OperatieVerwerkingForm) operatieVerwerkingFormFactory.createForm("operatie_verwerking_form", 125 XmlUtils.resolveDocument(healthDocument.getHealthDocument()), new DocumentSubmissionHandler() { 127 126 public void handle(FormWithAssociatedMarkup form, Document document) { 128 healthDocument.set Data(document.getDocumentElement());127 healthDocument.setHealthDocument(document); 129 128 130 129 transactionTemplate.runInTransaction(new TransactionCallback<Object>() { 131 130 public Object execute() { 132 health RecordService.update(healthDocument, pathwayParticipation);131 healthDocumentService.update(healthDocument); 133 132 if (operatieVerwerkingForm.isCompleted()) { 134 133 taskService.markTaskAsCompleted(taskInstance); … … 142 141 operatieVerwerkingForm = (OperatieVerwerkingForm) operatieVerwerkingFormFactory.createForm("operatie_verwerking_form", new DocumentSubmissionHandler() { 143 142 public void handle(FormWithAssociatedMarkup form, Document document) { 144 HealthDocumentMetaData metaData = new HealthDocumentMetaData(OperatieVerwerkingFormFactory.FORM_NAME, OperatieVerwerkingFormFactory.FORM_VERSION);145 final HealthDocument healthDocument = new HealthDocument(document, metaData);143 final HisHealthDocument healthDocument = new HisHealthDocument(OperatieVerwerkingFormFactory.FORM_VERSION, 144 OperatieVerwerkingFormFactory.FORM_NAME, pathwayParticipation, document); 146 145 147 146 transactionTemplate.runInTransaction(new TransactionCallback<Object>() { 148 147 public Object execute() { 149 String recordId = healthRecordService.add(healthDocument, pathwayParticipation);150 taskService.setVariable(taskInstance, "OperatieVerwerking_recordId", recordId);148 HisHealthDocument savedDoc = healthDocumentService.create(healthDocument); 149 taskService.setVariable(taskInstance, "OperatieVerwerking_recordId", savedDoc.getId()); 151 150 if (operatieVerwerkingForm.isCompleted()) { 152 151 taskService.markTaskAsCompleted(taskInstance); his-extensions/plugins/trunk/treatment/treatment-base/src/main/java/org/joiningtracks/his/pathway/nok/treatment/tasks/SelectPatientGroupPanel.java
r2507 r2594 97 97 @Override 98 98 protected void populateItem(ListItem item) { 99 final PatientGroup patientGroup = (PatientGroup) item.getDefaultModelObject(); 99 PatientGroup pg = (PatientGroup) item.getDefaultModelObject(); 100 final PatientGroup patientGroup = patientGroupService.getById(pg.getId()); 100 101 101 102 item.add(new Radio("radio", item.getDefaultModel())); his-extensions/plugins/trunk/treatment/treatment-base/src/main/resources/META-INF/spring/bundle-config.xml
r2586 r2594 99 99 <osgi:reference id="pathwayPluginService" interface="org.joiningtracks.his.plugin.bridge.pathway.PathwayPluginService"/> 100 100 101 <osgi:reference id="health RecordService"102 interface="org.joiningtracks.his.service.health record.HealthRecordService"/>101 <osgi:reference id="healthDocumentService" 102 interface="org.joiningtracks.his.service.healthdocument.HealthDocumentService"/> 103 103 104 104 <osgi:reference id="appointmentService" interface="org.joiningtracks.his.service.appointment.AppointmentService"/> his-extensions/plugins/trunk/treatment/treatment-base/src/test/java/org/joiningtracks/his/pathway/nok/treatment/surgical/post/OperatieVerwerkingFormTest.java
r2507 r2594 18 18 import org.apache.wicket.markup.html.WebPage; 19 19 import org.apache.wicket.model.CompoundPropertyModel; 20 import org.apache.wicket.model.Model;21 20 import org.apache.wicket.spring.injection.annot.SpringComponentInjector; 22 21 import org.apache.wicket.spring.test.ApplicationContextMock; … … 26 25 import org.joiningtracks.his.data.model.PathwayParticipation; 27 26 import org.joiningtracks.his.data.model.Patient; 28 import org.joiningtracks.his.data.model.HealthDocument;29 27 import org.joiningtracks.his.frontend.common.wicket.form.dom.DocumentSubmissionHandler; 30 28 import org.joiningtracks.his.frontend.common.wicket.form.FormWithAssociatedMarkup; his/trunk/README.txt
r1300 r2594 58 58 59 59 60 61 2. Installing eXist 1.2.1. 62 63 For healthrecords a XML database is used, in our case the open source XML 64 database eXist. The release we use is: 1.2.1.. 65 66 - Download eXist 1.2.1 from http://exist.sourceforge.net/download.html 67 - Start the installation by running 'java -jar eXist-xxx.jar' 68 - See http://exist.sourceforge.net/quickstart.html for more information 69 - Open http://localhost:8080/exist/admin/admin.xql with username admin 70 - Create the collection: /his/healthrecords 71 - Create user 'build'. 72 Group: build. 73 Pasword: build. 74 Home collection: /his/healthrecords. 75 - Change 'data/src/test/resources/test.properties' 76 'configuration/default/tomcat/conf/his.properties' 77 'configuration/production/tomcat/conf/his.properties' 78 to contain the right eXist connection parameters. 79 xmldb.url=xmldb:exist://localhost:8080/exist/xmlrpc/db 80 xmldb.username=build 81 xmldb.password=build 82 83 3. Installing LDAP 60 2. Installing LDAP 84 61 85 62 So to fully test the system, you will have to setup an LDAP directory … … 96 73 ldap.password=password 97 74 98 4. Installing the certificate for the communication with the Vecozo webservice.75 3. Installing the certificate for the communication with the Vecozo webservice. 99 76 100 77 We use one of the Vecozo webservices to verify and support the creation of new patients in the system. his/trunk/data/etc/create_db.sql
r2291 r2594 598 598 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, 599 599 version BIGINT(20) NOT NULL default 0, 600 patient_id BIGINT(20) UNSIGNED NOT NULL,600 patient_id BIGINT(20) UNSIGNED, 601 601 pathway_participation_id BIGINT(20) UNSIGNED, 602 patientgroup_id BIGINT(20) UNSIGNED, 602 603 document_version varchar(10) NOT NULL, 603 604 document_type varchar(255) NOT NULL, … … 614 615 CONSTRAINT fk_healthdocument_pathway_participation_id FOREIGN KEY (pathway_participation_id) 615 616 REFERENCES pathway_participation(id) 617 ON DELETE RESTRICT ON UPDATE RESTRICT, 618 619 CONSTRAINT fk_healthdocument_patientgroup_id FOREIGN KEY (patientgroup_id) 620 REFERENCES patientgroup(id) 616 621 ON DELETE RESTRICT ON UPDATE RESTRICT 617 622 his/trunk/data/src/main/java/org/joiningtracks/his/data/dao/HealthDocumentDao.java
r2593 r2594 19 19 import org.joiningtracks.his.data.model.PathwayParticipation; 20 20 import org.joiningtracks.his.data.model.Patient; 21 import org.joiningtracks.his.data.model.PatientGroup; 21 22 import org.joiningtracks.his.support.data.dao.Dao; 22 23 … … 27 28 * 28 29 * @author Daan van Etten 30 * @author Wouter Ketting 29 31 */ 30 32 public interface HealthDocumentDao extends Dao<HisHealthDocument>{ … … 37 39 38 40 List<HisHealthDocument> findByPatient(Patient patient); 41 42 List<HisHealthDocument> findByPatientGroup(PatientGroup patientGroup); 39 43 } his/trunk/data/src/main/java/org/joiningtracks/his/data/dao/jpa/JpaHealthDocumentDao.java
r2593 r2594 20 20 import org.joiningtracks.his.data.model.PathwayParticipation; 21 21 import org.joiningtracks.his.data.model.Patient; 22 import org.joiningtracks.his.data.model.PatientGroup; 22 23 import org.joiningtracks.his.support.data.dao.jpa.AbstractJpaDao; 23 24 … … 119 120 return resultList; 120 121 } 122 123 public List<HisHealthDocument> findByPatientGroup(PatientGroup patientGroup) { 124 Map<String, Object> parameters = new HashMap<String, Object>(); 125 parameters.put("patientGroup", patientGroup); 126 127 StringBuilder jql = new StringBuilder(); 128 jql.append("select h from HisHealthDocument h WHERE h.patientGroup = :patientGroup "); 129 130 Query query = getEntityManager().createQuery(jql.toString()); 131 for (Map.Entry<String, Object> entry : parameters.entrySet()) { 132 query.setParameter(entry.getKey(), entry.getValue()); 133 } 134 135 List<HisHealthDocument> resultList = query.getResultList(); 136 137 return resultList; 138 } 121 139 } 122 140 his/trunk/data/src/main/java/org/joiningtracks/his/data/model/HisHealthDocument.java
r2593 r2594 54 54 private PathwayParticipation pathwayParticipation; 55 55 56 @OneToOne(optional = false, cascade = CascadeType.MERGE)57 @JoinColumn(name = "patient_id" )56 @OneToOne(optional = true, cascade = CascadeType.MERGE) 57 @JoinColumn(name = "patient_id", nullable = true) 58 58 private Patient patient; 59 60 @OneToOne(optional = true, cascade = CascadeType.MERGE) 61 @JoinColumn(name = "patientgroup_id", nullable = true) 62 private PatientGroup patientGroup; 59 63 60 64 @Column(name = "document") … … 87 91 } 88 92 93 public HisHealthDocument(PatientGroup patientGroup){ 94 this.patientGroup = patientGroup; 95 this.created = new DateTime(); 96 } 97 89 98 public HisHealthDocument(String documentVersion, String documentType, String formId, Document xmlDocument) { 90 99 this.documentVersion = documentVersion; … … 93 102 this.created = new DateTime(); 94 103 setHealthDocument(xmlDocument); 104 } 105 106 public HisHealthDocument(String documentVersion, String documentType, PatientGroup patientGroup, Document healthDocument) { 107 this.documentVersion = documentVersion; 108 this.documentType = documentType; 109 this.formId = documentType + "_" + documentVersion; 110 this.patientGroup = patientGroup; 111 this.created = new DateTime(); 112 setHealthDocument(healthDocument); 95 113 } 96 114 … … 124 142 .append(pathwayParticipation, other.pathwayParticipation) 125 143 .append(patient, other.patient) 144 .append(patientGroup, other.patientGroup) 126 145 .append(document, other.document) 127 146 .isEquals(); … … 137 156 append(pathwayParticipation). 138 157 append(patient). 158 append(patientGroup). 139 159 append(document). 140 160 toHashCode(); … … 187 207 public void setPatient(Patient patient) { 188 208 this.patient = patient; 209 } 210 211 public PatientGroup getPatientGroup() { 212 return patientGroup; 213 } 214 215 public void setPatientGroup(PatientGroup patientGroup) { 216 this.patientGroup = patientGroup; 189 217 } 190 218 his/trunk/frontend/internal/src/main/java/org/joiningtracks/his/frontend/employee/patient/dossier/form/FormsTabPanel.java
r2593 r2594 64 64 add(new Panel(getContentId())); 65 65 66 // HealthRecordVerificationResult result = healthRecordService.verifyAvailability(patient);67 // switch (result) {68 // case REGISTERED_NOT_AVAILABLE: {69 // error(getString("formsTabPanel.error.healthRecord.notAvailable"));70 // break;71 // }72 //73 // case NOT_REGISTERED: {74 // healthRecordService.createRepository(patient);75 // info("formsTabPanel.info.healthRecord.created");76 // break;77 // }78 //79 // case AVAILABLE: {80 // do nothing81 // break;82 // }83 // }84 66 showDashboard(); 85 67 } his/trunk/service/src/main/java/org/joiningtracks/his/service/healthdocument/HealthDocumentService.java
r2593 r2594 19 19 import org.joiningtracks.his.data.model.PathwayParticipation; 20 20 import org.joiningtracks.his.data.model.Patient; 21 import org.joiningtracks.his.data.model.PatientGroup; 21 22 22 23 import java.util.List; … … 26 27 * 27 28 * @author Daan van Etten 29 * @author Wouter Ketting 28 30 */ 29 31 public interface HealthDocumentService { … … 62 64 List<HisHealthDocument> findByPatient(Patient patient); 63 65 66 List<HisHealthDocument> findByPatientGroup(PatientGroup patientGroup); 67 64 68 HisHealthDocument removeById(long id); 65 69 } his/trunk/service/src/main/java/org/joiningtracks/his/service/healthdocument/impl/DefaultHealthDocumentService.java
r2593 r2594 20 20 import org.joiningtracks.his.data.model.PathwayParticipation; 21 21 import org.joiningtracks.his.data.model.Patient; 22 import org.joiningtracks.his.data.model.PatientGroup; 22 23 import org.joiningtracks.his.service.healthdocument.HealthDocumentService; 23 24 import org.springframework.beans.factory.annotation.Required; 25 import org.springframework.transaction.annotation.Transactional; 24 26 25 27 import java.util.List; … … 29 31 * 30 32 * @author Daan van Etten 33 * @author Wouter Ketting 31 34 */ 35 @Transactional 32 36 public class DefaultHealthDocumentService implements HealthDocumentService { 33 37 34 38 private HealthDocumentDao healthDocumentDao; 35 39 36 public finalHisHealthDocument getById(long id) {40 public HisHealthDocument getById(long id) { 37 41 return healthDocumentDao.getById(id); 38 42 } 39 43 40 public final HisHealthDocument create(HisHealthDocument healthDocumentReference) {41 long id = healthDocumentDao.save(healthDocument Reference);44 public HisHealthDocument create(HisHealthDocument healthDocument) { 45 long id = healthDocumentDao.save(healthDocument); 42 46 return healthDocumentDao.getById(id); 43 47 } 44 48 45 public final HisHealthDocument update(HisHealthDocument healthDocumentReference) {46 return healthDocumentDao.update(healthDocument Reference);49 public HisHealthDocument update(HisHealthDocument healthDocument) { 50 return healthDocumentDao.update(healthDocument); 47 51 } 48 52 … … 63 67 } 64 68 69 public List<HisHealthDocument> findByPatientGroup(PatientGroup patientGroup) { 70 return healthDocumentDao.findByPatientGroup(patientGroup); 71 } 72 65 73 public HisHealthDocument removeById(long id) { 66 74 return healthDocumentDao.removeById(id); … … 68 76 69 77 @Required 70 public finalvoid setHealthDocumentDao(HealthDocumentDao healthDocumentDao) {78 public void setHealthDocumentDao(HealthDocumentDao healthDocumentDao) { 71 79 this.healthDocumentDao = healthDocumentDao; 72 80 } his/trunk/service/src/main/java/org/joiningtracks/his/service/pathway/impl/DefaultPathwayParticipationService.java
r2493 r2594 27 27 import org.joiningtracks.his.data.util.jbpm.JbpmTemplate; 28 28 import org.joiningtracks.his.events.RaisesEvent; 29 import org.joiningtracks.his.service.healthrecord.HealthRecordService;30 29 import org.joiningtracks.his.service.pathway.PathwayParticipationService; 31 30 import org.joiningtracks.his.service.pathway.PathwayParticipationAlreadyCancelledException; … … 54 53 private PathwayParticipationCancellationDao pathwayParticipationCancellationDao; 55 54 private JbpmTemplate jbpmTemplate; 56 private HealthRecordService healthRecordService;57 55 58 56 public PathwayParticipation getById(long id) { … … 72 70 pathwayParticipation.setPatient(patient); 73 71 pathwayParticipationDao.save(pathwayParticipation); 74 75 healthRecordService.createRepository(pathwayParticipation);76 72 77 73 try { … … 102 98 pathwayParticipation.setPayingParties(payingParties); 103 99 pathwayParticipationDao.save(pathwayParticipation); 104 105 healthRecordService.createRepository(pathwayParticipation);106 100 107 101 try { … … 308 302 this.jbpmTemplate = jbpmTemplate; 309 303 } 310 311 @Required312 public void setHealthRecordService(HealthRecordService healthRecordService) {313 this.healthRecordService = healthRecordService;314 }315 316 304 } his/trunk/service/src/main/java/org/joiningtracks/his/service/patient/impl/DefaultPatientService.java
r1631 r2594 25 25 import org.joiningtracks.his.data.model.Patient; 26 26 import org.joiningtracks.his.events.RaisesEvent; 27 import org.joiningtracks.his.service.healthrecord.HealthRecordService;28 27 import org.joiningtracks.his.service.mail.MailService; 29 28 import org.joiningtracks.his.service.patient.PatientService; … … 50 49 51 50 private PatientDao patientDao; 52 private HealthRecordService healthRecordService;53 51 private MailService mailService; 54 52 … … 69 67 Patient updatedPatient; 70 68 try { 71 patientDao.save(patient); 72 healthRecordService.createRepository(patient); 73 updatedPatient = patientDao.update(patient); 69 long patientId = patientDao.save(patient); 70 updatedPatient = getById(patientId); 74 71 } catch (RuntimeException ex) { 75 72 // Catch any exception thrown to allow reporting this exception by sending an mail. … … 152 149 153 150 @Required 154 public void setHealthRecordService(HealthRecordService healthRecordService) {155 this.healthRecordService = healthRecordService;156 }157 158 @Required159 151 public void setMailService(MailService mailService) { 160 152 this.mailService = mailService; his/trunk/service/src/main/resources/context/services.xml
r2283 r2594 25 25 <bean id="patientService" class="org.joiningtracks.his.service.patient.impl.DefaultPatientService"> 26 26 <property name="patientDao" ref="patientDao"/> 27 <property name="healthRecordService" ref="healthRecordService"/>28 27 <property name="mailService" ref="mailService"/> 29 28 </bean> … … 115 114 <property name="pathwayParticipationDao" ref="pathwayParticipationDao"/> 116 115 <property name="jbpmTemplate" ref="jbpmTemplate"/> 117 <property name="healthRecordService" ref="healthRecordService"/>118 116 <property name="pathwayParticipationCancellationDao" ref="pathwayParticipationCancellationDao"/> 119 117 </bean> his/trunk/service/src/test/java/org/joiningtracks/his/service/pathway/impl/DefaultPathwayParticipationServiceTest.java
r1570 r2594 28 28 import org.joiningtracks.his.data.model.Patient; 29 29 import org.joiningtracks.his.data.util.jbpm.JbpmTemplate; 30 import org.joiningtracks.his.service.healthrecord.HealthRecordService;31 import org.joiningtracks.his.service.location.LocationService;32 30 import org.junit.Assert; 33 31 import org.junit.Before; … … 73 71 }, LogicalOperator.EQUAL))).andReturn(1L); 74 72 75 HealthRecordService mockHealthRecordService = createMock(HealthRecordService.class);76 mockHealthRecordService.createRepository(EasyMock.isA(PathwayParticipation.class));77 expectLastCall().once();78 79 replay(mockHealthRecordService);80 81 73 defaultPathwayParticipationService.setPathwayParticipationDao(mockParticipationDao); 82 74 defaultPathwayParticipationService.setJbpmTemplate(jbpmTemplate); 83 defaultPathwayParticipationService.setHealthRecordService(mockHealthRecordService);84 75 85 76 ProcessDefinition pathway = new ProcessDefinition("pathway 1"); … … 95 86 Assert.assertSame(mockProcessInstance, result.getProcessInstance()); 96 87 97 verify(jbpmTemplate, mockProcessInstance, mockParticipationDao , mockHealthRecordService);88 verify(jbpmTemplate, mockProcessInstance, mockParticipationDao); 98 89 } 99 90 … … 101 92 public void testFindAllPatientsWithNoPayingParties() { 102 93 PathwayParticipationDao mockParticipationDao = createMock(PathwayParticipationDao.class); 103 LocationService mockLocationService = createMock(LocationService.class);104 94 105 95 defaultPathwayParticipationService.setPathwayParticipationDao(mockParticipationDao); his/trunk/service/src/test/java/org/joiningtracks/his/service/patient/impl/DefaultPatientServiceTest.java
r1625 r2594 21 21 import org.joiningtracks.his.data.dao.query.QueryParams; 22 22 import org.joiningtracks.his.data.model.Patient; 23 import org.joiningtracks.his.service.healthrecord.HealthRecordService;24 23 import org.joiningtracks.his.service.mail.MailService; 25 24 import org.junit.Assert; … … 43 42 private DefaultPatientService patientService; 44 43 private PatientDao patientDao; 45 private HealthRecordService healthRecordService;46 44 private MailService mailService; 47 45 … … 51 49 52 50 patientDao = createMock(PatientDao.class); 53 healthRecordService = createMock(HealthRecordService.class);54 51 mailService = createMock(MailService.class); 55 52 } … … 58 55 public void testCreate() { 59 56 patientService.setPatientDao(patientDao); 60 patientService.setHealthRecordService(healthRecordService);61 57 final long expectedId = 1L; 62 58 Patient expectedPatient = new Patient(expectedId); 63 59 expect(patientDao.save(expectedPatient)).andReturn(expectedId); 64 expect(patientDao.update(expectedPatient)).andReturn(expectedPatient); 65 healthRecordService.createRepository(expectedPatient); 66 expectLastCall(); 67 replay(patientDao, healthRecordService); 60 expect(patientDao.getById(1L)).andReturn(expectedPatient); 61 replay(patientDao); 68 62 69 63 Patient patient = patientService.create(expectedPatient); 70 64 71 verify(patientDao , healthRecordService);65 verify(patientDao); 72 66 Assert.assertSame(expectedPatient, patient); 73 67 } … … 90 84 } catch (RuntimeException expected) { 91 85 verify(patientDao, mailService); 92 }93 }94 95 @Test96 public void testCreate_PropagatesExceptionsFromHealthRecordService() throws Exception {97 patientService.setPatientDao(patientDao);98 patientService.setHealthRecordService(healthRecordService);99 patientService.setMailService(mailService);100 final long expectedId = 1L;101 Patient patient = new Patient(expectedId);102 RuntimeException ex = new RuntimeException("Supposed failure creating repository for patient");103 104 expect(patientDao.save(patient)).andReturn(expectedId);105 expectLastCall();106 healthRecordService.createRepository(patient);107 expectLastCall().andThrow(ex);108 mailService.sendPatientCreateFailureNotificationEmail(patient, ex);109 expectLastCall();110 111 replay(patientDao, healthRecordService, mailService);112 113 try {114 patientService.create(patient);115 Assert.fail("Exception expected");116 } catch (RuntimeException expected) {117 verify(patientDao, healthRecordService, mailService);118 86 } 119 87 }
