private MergedPatientVo createPatientBeforeMerge() { if(form.getLocalContext().getDestinationPatient() == null) return null; MergedPatientVo patientBeforeMerge = new MergedPatientVo(); patientBeforeMerge.setDestiantionPatient(form.getLocalContext().getDestinationPatient()); patientBeforeMerge.setName(form.getLocalContext().getDestinationPatient().getName()); patientBeforeMerge.setSex(form.getLocalContext().getDestinationPatient().getSex()); patientBeforeMerge.setDob(form.getLocalContext().getDestinationPatient().getDob()); patientBeforeMerge.setDod(form.getLocalContext().getDestinationPatient().getDod()); patientBeforeMerge.setEthnicOrigin(form.getLocalContext().getDestinationPatient().getEthnicOrigin()); patientBeforeMerge.setReligion(form.getLocalContext().getDestinationPatient().getReligion()); patientBeforeMerge.setMaritalStatus(form.getLocalContext().getDestinationPatient().getMaritalStatus()); patientBeforeMerge.setOccupation(form.getLocalContext().getDestinationPatient().getOccupation()); patientBeforeMerge.setLanguage(form.getLocalContext().getDestinationPatient().getLanguage()); patientBeforeMerge.setAddress(form.getLocalContext().getDestinationPatient().getAddress()); patientBeforeMerge.setAddresses(form.getLocalContext().getDestinationPatient().getAddresses()); patientBeforeMerge.setIdentifiers(form.getLocalContext().getDestinationPatient().getIdentifiers()); patientBeforeMerge.setGp(form.getLocalContext().getDestinationPatient().getGp()); patientBeforeMerge.setGpSurgery(form.getLocalContext().getDestinationPatient().getGpSurgery()); patientBeforeMerge.setNok(form.getLocalContext().getDestinationPatient().getNok()); patientBeforeMerge.setInsurance(form.getLocalContext().getDestinationPatient().getInsurance()); patientBeforeMerge.setCommChannels(form.getLocalContext().getDestinationPatient().getCommChannels()); return patientBeforeMerge; }
private MergedPatientVo createPatientBeforeMerge() { if(form.getLocalContext().getDestinationPatient() == null) return null; MergedPatientVo patientBeforeMerge = new MergedPatientVo(); patientBeforeMerge.setDestiantionPatient(form.getLocalContext().getDestinationPatient()); patientBeforeMerge.setName(form.getLocalContext().getDestinationPatient().getName()); patientBeforeMerge.setSex(form.getLocalContext().getDestinationPatient().getSex()); patientBeforeMerge.setDob(form.getLocalContext().getDestinationPatient().getDob()); patientBeforeMerge.setDod(form.getLocalContext().getDestinationPatient().getDod()); patientBeforeMerge.setEthnicOrigin(form.getLocalContext().getDestinationPatient().getEthnicOrigin()); patientBeforeMerge.setReligion(form.getLocalContext().getDestinationPatient().getReligion()); patientBeforeMerge.setMaritalStatus(form.getLocalContext().getDestinationPatient().getMaritalStatus()); patientBeforeMerge.setOccupation(form.getLocalContext().getDestinationPatient().getOccupation()); patientBeforeMerge.setLanguage(form.getLocalContext().getDestinationPatient().getLanguage()); patientBeforeMerge.setAddress(form.getLocalContext().getDestinationPatient().getAddress()); patientBeforeMerge.setAddresses(form.getLocalContext().getDestinationPatient().getAddresses()); //http://jira/browse/WDEV-20242 // patientBeforeMerge.setIdentifiers(form.getLocalContext().getDestinationPatient().getIdentifiers()); patientBeforeMerge.setIdentifiers(getNonUniqueIds(form.getLocalContext().getDestinationPatient().getIdentifiers())); //WDEV-20421 patientBeforeMerge.setGp(form.getLocalContext().getDestinationPatient().getGp()); patientBeforeMerge.setGpSurgery(form.getLocalContext().getDestinationPatient().getGpSurgery()); patientBeforeMerge.setNok(form.getLocalContext().getDestinationPatient().getNok()); patientBeforeMerge.setInsurance(form.getLocalContext().getDestinationPatient().getNationalHealthCover()); patientBeforeMerge.setCommChannels(form.getLocalContext().getDestinationPatient().getCommChannels()); return patientBeforeMerge; }
public ims.core.vo.Patient savePatientAndmergeRequest(ims.core.vo.Patient patient, MergedPatientVo patientBeforeMerged, MergeRequestVo mergeRequest, ims.core.vo.Patient sourcePatient, PatientIdCollection sourceDUPIdentifiers) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException { if(patientBeforeMerged != null) { if(!patientBeforeMerged.isValidated()) throw new CodingRuntimeException("MergedPatientVo is not validated."); DomainFactory factory = getDomainFactory(); MergedPatient doMergedPatient = MergedPatientVoAssembler.extractMergedPatient(factory, patientBeforeMerged); factory.save(doMergedPatient); } PatientMerge mergeImpl = (PatientMerge) getDomainImpl(PatientMergeImpl.class); mergeImpl.saveMergeRequest(mergeRequest); Demographics impl = (Demographics) getDomainImpl(DemographicsImpl.class); if(sourcePatient != null) { sourcePatient = impl.savePatient(sourcePatient, false); } ims.core.vo.Patient dest = impl.savePatient(patient, false); if(sourcePatient != null) { if(sourceDUPIdentifiers != null) { for(PatientId iden : sourceDUPIdentifiers) { if(sourcePatient.getIdentifiers() == null) sourcePatient.setIdentifiers(new PatientIdCollection()); sourcePatient.getIdentifiers().add(iden); } sourcePatient.validate(); impl.savePatient(sourcePatient, false); } } return dest; }