private void searchMergeRequest() { PatientId sourcePatient = new PatientId(); sourcePatient.setType(form.lyrPatMerge().tabRequests().cmbSourceIdType().getValue()); sourcePatient.setValue(form.lyrPatMerge().tabRequests().txtSourceValue().getValue()); PatientId destinationPatient = new PatientId(); destinationPatient.setType(form.lyrPatMerge().tabRequests().cmbDestIdType().getValue()); destinationPatient.setValue(form.lyrPatMerge().tabRequests().txtDestValue().getValue()); MergeRequestVoCollection mergeColl = domain.listOutstandingRequests(form.lyrPatMerge().tabRequests().dteFrom().getValue(), form.lyrPatMerge().tabRequests().dteTo().getValue(), form.lyrPatMerge().tabRequests().ccRequesteBy().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo)form.lyrPatMerge().tabRequests().ccRequesteBy().getValue() : null , sourcePatient, destinationPatient); form.lyrPatMerge().tabRequests().grdMerge().getRows().clear(); if (mergeColl != null && mergeColl.size() > 0) { GenForm.lyrPatMergeLayer.tabRequestsContainer.grdMergeRow row; for (int i=0; i<mergeColl.size(); i++) { MergeRequestVo request = mergeColl.get(i); row = form.lyrPatMerge().tabRequests().grdMerge().getRows().newRow(); row.setValue(request); row.setcolComment(request.getComment()); row.setcolDestinationPatient(request.getDestinationPatId().toString()); row.setcolRequestedBy(request.getRequestedByIsNotNull()?request.getRequestedBy().getIMosName():""); row.setcolSourcePatient(request.getSourcePatId().toString()); row.setcolOccurred(request.getSysinfo().getCreationDateTime().getDate()); row.setTooltip(request.getComment()); } } form.lyrPatMerge().tabRequests().grdAffectedItems().setVisible(false); form.lyrPatMerge().tabRequests().grdType().setVisible(false); }
private MergeRequestVo populateMergeRequest(boolean wasModified) { MergeRequestVo voMergeRequest = new MergeRequestVo(); Object mos = domain.getMosUser(); if(mos != null) voMergeRequest.setRequestedBy((MemberOfStaffShortVo) mos); voMergeRequest.setSourcePatId(form.getLocalContext().getSourcePatient().getID_Patient()); voMergeRequest.setDestinationPatId(form.getLocalContext().getResultPatient().getID_Patient()); voMergeRequest.setStatus(Boolean.FALSE); voMergeRequest.setMergeIdentifiers(!wasModified); return voMergeRequest; }
private int doMerges(MergeRequestVoCollection patList) { if (patList == null || patList.size() == 0) return 0; for (int i=0; i<patList.size(); i++) { MergeRequestVo req = patList.get(i); try { patMergeImpl.performPatientMerge(req, tablesList, pMergeConfig.mergePatientIds, pMergeConfig.processOcsCounts); numSuccessMerges++; } catch (Exception e) { // An exception occurred, so let's log this error try { if (e.getMessage() == null) patMergeImpl.logMergeError(req, "Null Exception Received"); else patMergeImpl.logMergeError(req, e.getMessage()); numFailedMerges++; } catch (StaleObjectException e1) { localLogger.error("StaleObjectException occurred logging Merge Error - " + e.getMessage(),e1); } } } return patList.size(); }
public void saveMergeRequest(MergeRequestVo mergeRequest) throws DomainInterfaceException, StaleObjectException { if(!mergeRequest.isValidated()) throw new DomainRuntimeException("MergeRequestVo not validated"); DomainFactory factory = getDomainFactory(); if(!validateMergeRequest(mergeRequest)) throw new DomainInterfaceException("A pending Merge Request involving a selected patient exists"); MergeRequest doMergeRequest = MergeRequestVoAssembler.extractMergeRequest(factory, mergeRequest); factory.save(doMergeRequest); }
public Boolean validateMergeRequest(MergeRequestVo mergeRequest) { DomainFactory factory = getDomainFactory(); //if any of the patients from the current attempted save are involved in pending merges(status set to false) List merges = factory.find("from MergeRequest m where m.status = :status and (m.sourcePatId = :sourcePatId or m.sourcePatId = :destPatId) and (m.destinationPatId = :sourcePatId or m.destinationPatId = :destPatId)", new String[]{"status","sourcePatId","destPatId"},new Object[]{mergeRequest.getStatus(),mergeRequest.getSourcePatId(),mergeRequest.getDestinationPatId()}); if(merges.size() > 0) return false; return true; }
private boolean validateMergeRequest(MergeRequestVo mergeRequest) { DomainFactory factory = getDomainFactory(); //if any of the patients from the current attempted save are involved in pending merges(status set to false) List merges = factory.find("from MergeRequest m where m.status = :status and (m.sourcePatId = :sourcePatId or m.sourcePatId = :destPatId) and (m.destinationPatId = :sourcePatId or m.destinationPatId = :destPatId)", new String[]{"status","sourcePatId","destPatId"},new Object[]{mergeRequest.getStatus(),mergeRequest.getSourcePatId(),mergeRequest.getDestinationPatId()}); if(merges.size() > 0) return false; return true; }
/** * Save a merge request */ public void saveMergeRequest(ims.core.vo.MergeRequestVo mergeRequest) throws ims.domain.exceptions.DomainInterfaceException, ims.domain.exceptions.StaleObjectException { if(mergeRequest == null) throw new RuntimeException("Cannot save null value for MergeRequest"); if(!mergeRequest.isValidated()) throw new DomainRuntimeException("MergeRequest not validated before save"); if(!validateMergeRequest(mergeRequest)) throw new DomainInterfaceException("A pending Merge Request involving a selected patient exists"); getDomainFactory().save(MergeRequestVoAssembler.extractMergeRequest(getDomainFactory(), mergeRequest)); }
private MergeRequestVo populateMergeRequest() { MergeRequestVo voMergeRequest = new MergeRequestVo(); Object mos = domain.getMosUser(); if(mos != null) voMergeRequest.setRequestedBy((MemberOfStaffShortVo) mos); voMergeRequest.setSourcePatId(form.getLocalContext().getSourcePatient().getID_Patient()); voMergeRequest.setDestinationPatId(form.getLocalContext().getResultPatient().getID_Patient()); voMergeRequest.setStatus(Boolean.FALSE); //voMergeRequest.setMergeIdentifiers(!wasModified); //WDEV-23721 return voMergeRequest; }
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; }
private boolean validateMergeRequest(MergeRequestVo mergeRequest) { PatientSearch impl = (PatientSearch) getDomainImpl (ims.core.domain.impl.PatientSearchImpl.class); return impl.validateMergeRequest(mergeRequest); }
private void searchMergeRequest() { PatientId sourcePatient = new PatientId(); sourcePatient.setType(form.lyrPatMerge().tabRequests().cmbSourceIdType().getValue()); sourcePatient.setValue(form.lyrPatMerge().tabRequests().txtSourceValue().getValue()); PatientId destinationPatient = new PatientId(); destinationPatient.setType(form.lyrPatMerge().tabRequests().cmbDestIdType().getValue()); destinationPatient.setValue(form.lyrPatMerge().tabRequests().txtDestValue().getValue()); MergeRequestVoCollection mergeColl = domain.listOutstandingRequests(form.lyrPatMerge().tabRequests().dteFrom().getValue(), form.lyrPatMerge().tabRequests().dteTo().getValue(), form.lyrPatMerge().tabRequests().ccRequesteBy().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo)form.lyrPatMerge().tabRequests().ccRequesteBy().getValue() : null , sourcePatient, destinationPatient); form.lyrPatMerge().tabRequests().grdMerge().getRows().clear(); // WDEV-18871 - start if (mergeColl == null || mergeColl.size() == 0) { engine.showMessage("No records matching your search criteria were found!", "No results",MessageButtons.OK, MessageIcon.INFORMATION); } // WDEV-18871 - end if (mergeColl != null && mergeColl.size() > 0) { GenForm.lyrPatMergeLayer.tabRequestsContainer.grdMergeRow row; for (int i=0; i<mergeColl.size(); i++) { MergeRequestVo request = mergeColl.get(i); row = form.lyrPatMerge().tabRequests().grdMerge().getRows().newRow(); row.setValue(request); row.setcolComment(request.getComment()); row.setcolDestinationPatient(request.getDestinationPatId().toString()); row.setcolRequestedBy(request.getRequestedByIsNotNull()?request.getRequestedBy().getIMosName():""); row.setcolSourcePatient(request.getSourcePatId().toString()); row.setcolOccurred(request.getSysinfo().getCreationDateTime().getDate()); row.setTooltip(request.getComment()); } } form.lyrPatMerge().tabRequests().grdAffectedItems().setVisible(false); form.lyrPatMerge().tabRequests().grdType().setVisible(false); }