private TrackingForQuickRegistrationVo populateDataFromScreen(EmergencyAttendanceForPendingArrivalsVo selectedRecord) { TrackingForQuickRegistrationVo trackingToSave = new TrackingForQuickRegistrationVo(); trackingToSave.setPatient(form.getGlobalContext().Core.getPatientShort()); EmergencyAttendanceForPendingArrivalsVo emergencyAttendanceToSave = form.getLocalContext().getselectedRecord(); trackingToSave.setAttendance(emergencyAttendanceToSave); trackingToSave.setEpisode(emergencyAttendanceToSave.getEpisode()); LocationLiteVo currentLocation = (LocationLiteVo) domain.getCurrentLocation(); trackingToSave.setEDLocation(currentLocation); trackingToSave.setCurrentArea(form.getGlobalContext().Emergency.getTrackingAreaForSendToAreaVo()); TrackingAttendanceStatusVo trackingStatusToSave = populateTrackingAttendanceStatus(ims.emergency.vo.lookups.TrackingStatus.WAITING_TO_BE_TRIAGED); trackingToSave.setCurrentStatus(trackingStatusToSave); trackingToSave.setDischargeLetterStatus(DischargeLetterStatus.IN_PROGRESS);//wdev-17266 return trackingToSave; }
private void checkIfCheckBoxShouldBeDisplayedAnyway(DischargeReadyToLeaveVo voReady) { GP voGP = domain.getPatientsGP(form.getGlobalContext().Core.getPatientShort()); boolean hasEmail = false; if (voGP != null && voGP.getCommChannel(ChannelType.EMAIL) != null) hasEmail = true; DischargeDetailsVo volocalDD = domain.getDischargeDetails(form.getGlobalContext().Core.getCurrentCareContext()); form.getLocalContext().setCurrentDischargeDetailsVo(volocalDD); if ( !hasEmail && volocalDD != null && volocalDD.getDischargeLetterStatusIsNotNull() && volocalDD.getDischargeLetterStatus().equals(DischargeLetterStatus.GENERATED) && (voReady.getHasPatientReceivedCopyOfDischarge() == null || (voReady.getHasPatientReceivedCopyOfDischargeIsNotNull() && ! voReady.getHasPatientReceivedCopyOfDischarge()) ) ) { form.chkLetterGiven().setVisible(true); form.lblLetterGiven().setVisible(true); if (form.getMode().equals(FormMode.EDIT)) form.chkLetterGiven().setEnabled(true); } }
/** * This method will enable/disable other tabs and their components if we are editing any tab * WDEV-12224 - Either disable or enable all tabs depending on need. Do not leave the editing tab header enabled as this * will allow the user to click it and will set the screen in VIEW mode without the press of SAVE or CANCEL buttons */ private void enableDisableTabs(boolean enable) { form.lyrDetails().tabPageSummary().setHeaderEnabled(enable); form.lyrDetails().tabPageDiagnosis().setHeaderEnabled(enable); form.lyrDetails().tabPageClinicalInfo().setHeaderEnabled(enable); form.lyrDetails().tabPageOpsProcs().setHeaderEnabled(enable); form.lyrDetails().tabPageNeonatal().setHeaderEnabled(enable); form.lyrDetails().tabPagePlasticSurgery().setHeaderEnabled(enable); form.lyrDetails().tabPageFuturePlan().setHeaderEnabled(enable); form.lyrDetails().tabPageTTA().setHeaderEnabled(enable); form.lyrDetails().tabPageMedication().setHeaderEnabled(enable); form.lyrDetails().tabPagePharmacyApproval().setHeaderEnabled(enable); form.lyrDetails().tabPagePreview().setHeaderEnabled(enable); form.lyrDetails().tabPageReady().setHeaderEnabled(enable); form.lyrDetails().tabPageSupplementary().setHeaderEnabled(enable); form.lyrDetails().tabPageSupplementary().setHeaderVisible(form.getLocalContext().getSelectedSummaryInstanceIsNotNull() && form.getLocalContext().getSelectedSummaryInstance().isSummaryRecordComplete() && form.getLocalContext().getSelectedSummaryInstance().getDischargeLetterStatusIsNotNull() && form.getLocalContext().getSelectedSummaryInstance().getDischargeLetterStatus().equals(DischargeLetterStatus.GENERATED) ? true : false); }
public void rieDiagnosis(PatientDiagnosisEDischargeListVo diag, FormName formName, Integer patientId, Integer contactId, Integer careContextId, String rieMessage, SummaryRefVo summary) throws StaleObjectException { if (summary!=null && summary.getID_SummaryIsNotNull()) { //Check to see if letter status is generated String sql = "select count(summ.id) from Summary as summ left join summ.dischargeLetterStatus as lookup where (summ.id=:summId and lookup.id = :idGenerated)"; long count = getDomainFactory().countWithHQL(sql, new String[]{"summId","idGenerated"}, new Object[]{summary.getID_Summary(),DischargeLetterStatus.GENERATED.getID()}); if (count >0) throw new StaleObjectException(null); } markAsRie(diag, formName, patientId, contactId, careContextId, rieMessage); }
private TrackingJobVo populateAndSaveTracking(TrackingJobVo tracking) throws StaleObjectException { if(tracking == null) return null; tracking.setDischargeLetterStatus(DischargeLetterStatus.GENERATED); String[] str = tracking.validate(); if (str != null && str.length > 0) { trace("TrackingJobVo has validation errors."); return null; } return saveTracking(tracking); }
private TrackingJobVo populateAndSaveTracking(TrackingJobVo tracking) throws StaleObjectException { if(tracking == null) return null; tracking.setDischargeLetterStatus(DischargeLetterStatus.GENERATED); tracking.getAttendance().setDischargeLetterStatus(DischargeLetterStatus.GENERATED);//WDEV-19441 String[] str = tracking.validate(); if (str != null && str.length > 0) { trace("TrackingJobVo has validation errors."); return null; } return saveTracking(tracking); }
private TrackingJobVo populateAndSaveTracking(TrackingJobVo tracking) throws StaleObjectException { if(tracking == null) return null; tracking.setSupplementaryLetterStatus(DischargeLetterStatus.GENERATED); String[] str = tracking.validate(); if (str != null && str.length > 0) { trace("TrackingJobVo has validation errors."); return null; } return saveTracking(tracking); }
public void initializeComponent() { setTooltips(); populateWards(); form.lblMessage().setVisible(form.getLocalContext().getSelectedRecordIsNotNull()&& form.getLocalContext().getSelectedRecord().getDischargeDetailsIsNotNull() && !(DischargeLetterStatus.GENERATED.equals(form.getLocalContext().getSelectedRecord().getDischargeDetails().getDischargeLetterStatus()))); //WDEV-18845 form.lblMessage().setTextColor(Color.Red);//WDEV-18622 form.ccDischCons().initialize(MosType.MEDIC); form.ccAuthoring().setIsRequiredPropertyToControls(true); form.ccAuthoring().setLabels(AuthoringLabelType.AUTHORISING); //WDEV-18622 form.ccAuthoring().initializeComponent(HcpDisType.MEDICAL); initializeSummaryDynGrid(); //WDEV-18916 clearInstanceControls(); form.getGlobalContext().Clinical.seteDischargeCompleted(false); form.getLocalContext().setisReadonly(false); form.getLocalContext().setbInitialised(null); }
private DischargeDetails getDischargeDetails(PatientDiagnosisVo voDiagnosis) { if (voDiagnosis == null || voDiagnosis.getCareContext() == null || voDiagnosis.getCareContext().getEpisodeOfCare() == null) return null; StringBuilder hql = new StringBuilder(); ArrayList<String> marques = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); DomainFactory domainFactory = getDomainFactory(); hql.append("select dd from DischargeDetails as dd left join dd.careContext as ccontext left join ccontext.episodeOfCare as epis where dd.dischargeLetterStatus.id = :LETTER_STATUS and epis.id = :EPISODE_ID"); marques.add("LETTER_STATUS"); marques.add("EPISODE_ID"); values.add(DischargeLetterStatus.IN_PROGRESS.getID()); values.add(voDiagnosis.getCareContext().getEpisodeOfCare().getID_EpisodeOfCare()); List<?> ddList = domainFactory.find(hql.toString(),marques,values); if (ddList == null || ddList.isEmpty()) return null; return (DischargeDetails) ddList.get(0); }
private void rollback(EDischargeSTHKSummaryVo summaryVo, PatientDocumentVo document, DocumentCategory category) throws ForeignKeyViolationException, StaleObjectException { DomainFactory factory = getDomainFactory(); Summary boSUMM = (Summary) factory.getDomainObject(Summary.class, summaryVo.getID_Summary()); summaryVo = EDischargeSTHKSummaryVoAssembler.create(boSUMM); PatientDocumentVoCollection documents = summaryVo.getDischargeDocuments(); documents.remove(document); summaryVo.setDischargeDocuments(documents); if (category.equals(DocumentCategory.DISCHARGE_SUMMARY)) summaryVo.setDischargeLetterStatus(DischargeLetterStatus.IN_PROGRESS); else if (category.equals(DocumentCategory.DISCHARGE_SUPPLEMENTARY)) summaryVo.setDischargeSupplementaryLetterStatus(DischargeSupplementaryLetterStatus.REQUIRED); String[] str = summaryVo.validate(); if (str != null && str.length > 0) { LOG.error("summaryVo is not validate"); return; } summaryVo = saveSummary(summaryVo); try { deletePatientDocument(document); } catch(Exception e) { throw new StaleObjectException(null); } getDomainFactory().getTransaction().commit(); getDomainFactory().setTransaction(null); }
private void updateSummary(SummaryRefVo summary, TTAStatus status) throws ims.domain.exceptions.StaleObjectException { if(summary == null || status == null) return; DomainFactory factory = getDomainFactory(); Summary doSummary = (Summary)factory.getDomainObject(summary); if (getDomLookup(DischargeLetterStatus.GENERATED).equals(doSummary.getDischargeLetterStatus())) throw new StaleObjectException(null); doSummary.setTTAStatus(getDomLookup(status)); factory.save(doSummary); }
public void updateSummaryIfRequired(IEDischargeSummary record, SummaryRefVo summary, DomainFactory factory) throws ims.domain.exceptions.StaleObjectException { if(summary == null) return; boolean updateRequired = false; Summary doSummary = (Summary)factory.getDomainObject(summary); /* * If in the meantime the Discharge Letter has been generated than it's a SOE */ if (getDomLookup(DischargeLetterStatus.GENERATED).equals(doSummary.getDischargeLetterStatus())) throw new StaleObjectException(null); SummaryDetail doSummaryDetail = (SummaryDetail) doSummary.getSummaryDetails().get(findDetailRecordForType(doSummary.getSummaryDetails(),record.getIEDischargeSummarySection())); if(record.getIEDischargeSummaryIsComplete()) { updateRequired = true; doSummaryDetail.setProgressStatus(getDomLookup(EDischargeSummarySectionStatus.COMPLETED)); } else { updateRequired = true; doSummaryDetail.setProgressStatus(getDomLookup(EDischargeSummarySectionStatus.IN_PROGRESS)); } if(updateRequired) factory.save(doSummaryDetail); }
public void rieProcedure(PatientProcedureProcsComponentLiteVo proc, FormName formName, Integer patientId, Integer contactId, Integer careContextId, String rieMessage, SummaryRefVo summary) throws StaleObjectException { if (summary!=null && summary.getID_SummaryIsNotNull()) { //Check to see if letter status is generated String sql = "select count(summ.id) from Summary as summ left join summ.dischargeLetterStatus as lookup where (summ.id=:summId and lookup.id = :idGenerated)"; long count = getDomainFactory().countWithHQL(sql, new String[]{"summId","idGenerated"}, new Object[]{summary.getID_Summary(),DischargeLetterStatus.GENERATED.getID()}); if (count >0) throw new StaleObjectException(null); } markAsRie(proc, formName, patientId, contactId, careContextId, rieMessage); }
public DischargeReadyToLeaveVo saveReadyToLeave(DischargeReadyToLeaveVo voReady, SummaryRefVo voSummary) throws DomainInterfaceException, StaleObjectException { if(voReady == null) throw new CodingRuntimeException("DischargeReadyToLeaveVo is null"); if(!voReady.isValidated()) throw new CodingRuntimeException("DischargeReadyToLeaveVo Value Object has not been validated"); DomainFactory factory = getDomainFactory(); //There is a situation where is possible that the scheduled jobs have run while you //are editing the ready to leave record. This should be dealt with by throwing a StaleObjectException String hql = "select count(summa.id) from Summary as summa where (summa.id=:sumId and (summa.dischargeLetterStatus.id =:dischLettId or summa.dischargeSupplementaryLetterStatus.id = :dischSuppLettId))"; long isCompleted = factory.countWithHQL(hql, new String[]{"sumId","dischLettId","dischSuppLettId"}, new Object[]{voSummary.getID_Summary(),DischargeLetterStatus.GENERATED.getId(),DischargeSupplementaryLetterStatus.GENERATED.getID()}); if (isCompleted > 0) { throw new StaleObjectException(null); } ReadyToLeave doRTL = DischargeReadyToLeaveVoAssembler.extractReadyToLeave(factory, voReady); factory.save(doRTL); //updating summary WDEV-11348 IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); impl.updateSummaryIfRequired(voReady, voSummary, factory); return DischargeReadyToLeaveVoAssembler.create(doRTL); }
private TrackingJobVoCollection getDischargedTrackings() { DomainFactoryBridge factory = getDomainFactory(); String query = "select tr from Tracking as tr left join tr.dischargeLetterStatus as trStatus where tr.isDischarged = 1 and trStatus.id = :DischargeLetterStatus"; List<?> results = factory.find(query, new String[] {"DischargeLetterStatus"}, new Object[] {DischargeLetterStatus.IN_PROGRESS.getID()}); return TrackingJobVoAssembler.createTrackingJobVoCollectionFromTracking(results); }
private TrackingJobVoCollection getDischargedTrackingsRequiringLetter() { DomainFactoryBridge factory = getDomainFactory(); String query = "select tr from Tracking as tr left join tr.dischargeLetterStatus as trStatus left join tr.attendance as att where tr.isDischarged = true and trStatus.id = :DischargeLetterStatus and att.isDischargeLetterRequired = true"; List<?> results = factory.find(query, new String[] {"DischargeLetterStatus"}, new Object[] {DischargeLetterStatus.IN_PROGRESS.getID()}); return TrackingJobVoAssembler.createTrackingJobVoCollectionFromTracking(results); }
private TrackingJobVoCollection getDischargedTrackingsWithSuppNotes() { DomainFactoryBridge factory = getDomainFactory(); String query = "SELECT tr from Tracking AS tr LEFT JOIN tr.attendance AS att LEFT JOIN att.dischargeLetterStatus AS attletter WHERE tr.isDischarged = :DISCHARGED AND (tr.supplementaryLetterStatus IS NULL OR tr.supplementaryLetterStatus.id = :SUPP_DISCHARGE_LETTER_STATUS) AND attletter.id = :DISCHARGE_LETTER_STATUS AND att.conclusionDateTime is not null AND att.attendanceSupplementaryComment is not null"; List<?> results = factory.find(query, new String[] {"DISCHARGED", "SUPP_DISCHARGE_LETTER_STATUS", "DISCHARGE_LETTER_STATUS"}, new Object[] {Boolean.TRUE,DischargeLetterStatus.IN_PROGRESS.getID(),DischargeLetterStatus.GENERATED.getID()}); if (results.isEmpty()) return null; return TrackingJobVoAssembler.createTrackingJobVoCollectionFromTracking(results); }
private TrackingForQuickRegistrationVo populateTracking() { TrackingForQuickRegistrationVo trackingVo = new TrackingForQuickRegistrationVo(); trackingVo.setPatient(form.getLocalContext().getpatientToSave()); trackingVo.setAttendance(new AttendanceDetailsVo()); trackingVo.setEpisode(form.getLocalContext().getemergencyEpisodeToSave()); trackingVo.setEDLocation(getLocation()); trackingVo.setCurrentArea(form.getGlobalContext().Emergency.getTrackingAreaForSendToAreaVo()); if (QuickRegistrationType.UNC_UNK_PATIENT.equals(form.cmbRegistrationType().getValue()))//WDEV-15959 { trackingVo.setIsUnknownPatient(true); } TrackingAttendanceStatusVo trStatusVo = new TrackingAttendanceStatusVo(); trStatusVo.setPatient(form.getLocalContext().getpatientToSave()); trStatusVo.setAttendance(form.getLocalContext().getcareContextToSave()); trStatusVo.setEpisode(form.getLocalContext().getepisodeToSave()); trStatusVo.setTrackingArea(form.getGlobalContext().Emergency.getTrackingAreaForSendToAreaVo()); trStatusVo.setStatusDatetime(new DateTime()); MemberOfStaffShortVo memberVo = null; if (domain.getMosUser() instanceof MemberOfStaffShortVo) { memberVo = (MemberOfStaffShortVo) domain.getMosUser(); } trStatusVo.setCreatedBy(memberVo); trStatusVo.setStatus(TrackingStatus.WAITING_TO_BE_TRIAGED); trStatusVo.setPrevStatus(null); //WDEV-16777 trackingVo.setCurrentStatus(trStatusVo); trackingVo.setDischargeLetterStatus(DischargeLetterStatus.IN_PROGRESS); //wdev-17110 return trackingVo; }
private Tracking getTrackingForAttendance(EmergencyAttendanceForDischargeLetterVo emergencyAttendance) { if (emergencyAttendance == null || emergencyAttendance.getID_EmergencyAttendance() == null || emergencyAttendance.getAttendanceSupplementaryComment() == null) return null; String hql = "select tr from Tracking as tr left join tr.attendance as att where att.id = :ATT_ID and (att.isRIE is null OR att.isRIE = 0) "; Tracking doTracking = (Tracking) getDomainFactory().findFirst(hql, new String[]{"ATT_ID"},new Object[]{emergencyAttendance.getID_EmergencyAttendance()}); if (doTracking == null || getDomLookup(DischargeLetterStatus.GENERATED).equals(doTracking.getSupplementaryLetterStatus())) return null; return doTracking; }
@Override protected void onFormModeChanged() { if (form.getMode().equals(FormMode.EDIT)) { form.btnSave().setVisible(true); activatedeactivatecontrols(true); form.btnPrintDisch().setEnabled(false); form.btnPrintDisch().setVisible(false); form.imbPrintDisch().setEnabled(false); form.imbPrintDisch().setVisible(false); /* * if (form.getLocalContext().getisReadonly()) * form.btnCompleted().setVisible(form.getMode().equals(FormMode.EDIT) ? * false : false); else { * form.btnCompleted().setVisible(form.getMode().equals(FormMode.EDIT) ? * true : false); * form.btnCompleted().setEnabled(form.getMode().equals(FormMode.EDIT) ? * true : false); } */ } else if (form.getMode().equals(FormMode.VIEW)) { form.btnEdit().setVisible(true);// form.getLocalContext().getisReadonly() // == false ? true : false); form.btnEdit().setEnabled(true);// form.getLocalContext().getisReadonly() // == false ? true : false); } form.lblMessage().setVisible(form.getLocalContext().getSelectedRecordIsNotNull()&& form.getLocalContext().getSelectedRecord().getDischargeDetailsIsNotNull() && !(DischargeLetterStatus.GENERATED.equals(form.getLocalContext().getSelectedRecord().getDischargeDetails().getDischargeLetterStatus()))); //WDEV-18845 }
public void rieDiagnosis(PatientDiagnosisEDischargeListVo diag, FormName formName, PatientRefVo patientRef, Integer contactId, CareContextRefVo careContextRef, String rieMessage, SummaryRefVo summary, Integer whatsBeingRecordedInError, EpisodeofCareShortVo episodeOfCare) throws StaleObjectException { if (summary!=null && summary.getID_SummaryIsNotNull()) { //Check to see if letter status is generated String sql = "select count(summ.id) from Summary as summ left join summ.dischargeLetterStatus as lookup where (summ.id=:summId and lookup.id = :idGenerated)"; long count = getDomainFactory().countWithHQL(sql, new String[]{"summId","idGenerated"}, new Object[]{summary.getID_Summary(),DischargeLetterStatus.GENERATED.getID()}); if (count >0) throw new StaleObjectException(null); } markAsRie(diag, formName, patientRef.getID_Patient(), contactId, careContextRef!=null ? careContextRef.getID_CareContext() : null, rieMessage); //WDEV-18622 DomainFactory factory = getDomainFactory(); RTLSummaryVo rTLSummary = populateRTLSummary(patientRef,careContextRef,episodeOfCare,whatsBeingRecordedInError); RTLSummary rTLSummaryDO = RTLSummaryVoAssembler.extractRTLSummary(factory, rTLSummary); factory.save(rTLSummaryDO); if (whatsBeingRecordedInError== -1) //DIAGNOSIS { PatientNoDiagInfoForCCVo patientNoDiagInfo = populatePatientNoDiagInfo(careContextRef, episodeOfCare, patientRef); if (patientNoDiagInfo != null) { PatientNoDiagInfoForCC patientNoDiagInfoDo = PatientNoDiagInfoForCCVoAssembler.extractPatientNoDiagInfoForCC(factory, patientNoDiagInfo); factory.save(patientNoDiagInfoDo); } } }
public Boolean hasAssessmentSavedOrOneConfiguredForSpecialty(CareContextRefVo careContext, Specialty specialty) { DomainFactory factory = getDomainFactory(); String query = "select count(dd.id) from DischargeDetails dd where dd.careContext.id = :careContextId and dd.patientAssessment is not null"; Object[] count = factory.find(query, new String[] {"careContextId"}, new Object[] {careContext.getID_CareContext()}).toArray(); if(count != null && count.length > 0 && ((Long) count[0]).intValue() > 0) { return true; } else { query = "select count(dd.id) from DischargeDetails dd left join dd.dischargeLetterStatus as dls where dd.careContext.id = :careContextId and dls.id = :Generated"; count = factory.find(query, new String[] {"careContextId", "Generated"}, new Object[] {careContext.getID_CareContext(), DischargeLetterStatus.GENERATED.getID()}).toArray(); if(count != null && count.length > 0 && ((Long) count[0]).intValue() > 0) { return false; } query = "select count(u.id) from UserAssessment u left join u.assessmentSpecialties assSpec where assSpec.instance = :assessmentSpec and u.activeStatus = :actStat"; count = factory.find(query, new String[] {"assessmentSpec", "actStat"}, new Object[] {getDomLookup(specialty), getDomLookup(PreActiveActiveInactiveStatus.ACTIVE)}).toArray(); if(count != null && count.length > 0 && ((Long) count[0]).intValue() > 0) return true; return false; } }