private boolean careSpellContainsInpatient(CareSpellVo careSpellVo) { int count = 0; for (int i = 0; i < careSpellVo.getEpisodes().size(); i++) { for (int j = 0; j < careSpellVo.getEpisodes().get(i).getCareContexts().size(); j++) { if(careSpellVo.getEpisodes().get(i).getCareContexts().get(j).getContext().equals(ContextType.INPATIENT)) count++; } } if (count > 0) return true; return false; }
private void populateCareSpellRows(CareSpellVoCollection voCollCareSpells, PersonName name) { grdPatientsRow careSpellRow; for (int i = 0; i < voCollCareSpells.size(); i++) { careSpellRow = form.grdPatients().getRows().newRow(); CareSpellVo careSpellVo = voCollCareSpells.get(i); careSpellRow.setcolStartDateEndDate(name.toString()); //setStartDateEndDateAndTooltip(careSpellRow, careSpellVo); careSpellRow.setCollapsedImage(form.getImages().Core.CareSpell); careSpellRow.setExpandedImage(form.getImages().Core.CareSpell); careSpellRow.setBackColor(Color.Bisque); careSpellRow.setBold(true); careSpellRow.setValue(careSpellVo); if (careSpellVo.getEndDateIsNotNull()) form.getLocalContext().setParentEnded(Boolean.TRUE); boolean bCollapseAll = populateEpisodeOfCareRows(careSpellVo.getEpisodes().sort(), careSpellRow); careSpellRow.setExpanded(!bCollapseAll); } }
private EpisodeofCareVoCollection createNewEpisodeOfCare(CareSpellVo voCareSpell) { EpisodeofCareVoCollection voCollEpisodeOfCare = new EpisodeofCareVoCollection(); EpisodeofCareVo voEpisodeOfCare = new EpisodeofCareVo(); if (form.dtimArrival().getValue() != null) { voEpisodeOfCare.setStartDate(form.dtimArrival().getValue().getDate()); } voEpisodeOfCare.setSpecialty(Specialty.EMERGENCY); voEpisodeOfCare.setCareSpell(voCareSpell); voEpisodeOfCare.setCareContexts(createNewCareContext(voEpisodeOfCare)); voCollEpisodeOfCare.add(voEpisodeOfCare); form.getLocalContext().setepisodeToSave(voEpisodeOfCare); return voCollEpisodeOfCare; }
private EpisodeofCareVoCollection createNewEpisodeOfCare(CareSpellVo voCareSpell) { EpisodeofCareVoCollection voCollEpisodeOfCare = new EpisodeofCareVoCollection(); EpisodeofCareVo voEpisodeOfCare = new EpisodeofCareVo(); if (form.dtimRegistration().getValue() != null) // wdev-16070 voEpisodeOfCare.setStartDate(form.dtimRegistration().getValue().getDate()); voEpisodeOfCare.setSpecialty(Specialty.EMERGENCY); voEpisodeOfCare.setCareSpell(voCareSpell); voEpisodeOfCare.setCareContexts(createNewCareContext(voEpisodeOfCare)); voCollEpisodeOfCare.add(voEpisodeOfCare); form.getLocalContext().setCurrentEpisodeOfCare(voEpisodeOfCare); return voCollEpisodeOfCare; }
private void reselectGrid() { CareSpellVo vocareSpell = form.getGlobalContext().Clinical.PatientSummary.getCareSpell(); ClinicalContactShortVo voContact = form.getGlobalContext().Core.getCurrentClinicalContact(); CareContextShortVo voCareContext = form.getGlobalContext().Core.getCurrentCareContext(); EpisodeofCareShortVo voEpisodeOfCare = form.getGlobalContext().Core.getEpisodeofCareShort(); if (voContact != null) form.dyngrdList().setValue(voContact); else if (voCareContext != null) form.dyngrdList().setValue(voCareContext); else if (voEpisodeOfCare != null) form.dyngrdList().setValue(voEpisodeOfCare); else if (vocareSpell != null) // WDEV-14578 form.dyngrdList().setValue(vocareSpell); else { updateControlsState(); return; } gridListSelectionChanged(); }
private void populateCareSpellRows(CareSpellVoCollection voCollCareSpells) { DynamicGridRow careSpellRow; for (int i = 0; i < voCollCareSpells.size(); i++) { careSpellRow = form.dyngrdList().getRows().newRow(); CareSpellVo careSpellVo = voCollCareSpells.get(i); setStartDateEndDateAndTooltip(careSpellRow, careSpellVo); careSpellRow.setCollapsedImage(form.getImages().Core.CareSpell); careSpellRow.setExpandedImage(form.getImages().Core.CareSpell); careSpellRow.setBackColor(Color.Bisque); careSpellRow.setBold(true); careSpellRow.setValue(careSpellVo); //cellCareSpell.setColumnHistoryEmpty(true); // wdev-13896 // wdev-13977 if (voCollCareSpells.get(i).getCurrentStatusIsNotNull() && voCollCareSpells.get(i).getCurrentStatus().getStatusIsNotNull() && voCollCareSpells.get(i).getCurrentStatus().getStatus().equals(ProblemGroupStatus.CANCELLED)) careSpellRow.setBackColor(ConfigFlag.UI.DISPLAY_COLOUR_FOR_CANCELLED_PROBLEM_GROUPS.getValue()); // ------- if (careSpellVo.getEndDateIsNotNull()) form.getLocalContext().setParentEnded(Boolean.TRUE); boolean bCollapseAll = populateEpisodeOfCareRows(careSpellVo.getEpisodes().sort(), careSpellRow); careSpellRow.setExpanded(!bCollapseAll); } }
protected boolean checkIfCareSpellCanBeCancelled(CareSpellVo careSpell) { boolean CareSpellItem = false; if (careSpell == null) return CareSpellItem; if (careSpell.getCurrentStatus() == null || ProblemGroupStatus.OPEN.equals(careSpell.getCurrentStatus().getStatus()))// WDEV-14910 { CareSpellItem = true; for (int i = 0; careSpell.getEpisodesIsNotNull() && i < careSpell.getEpisodes().size(); i++) { if (checkIfEpisodeOfCaresAreNotOpened(careSpell.getEpisodes().get(i)) == false) CareSpellItem = false; } } return CareSpellItem; }
private void reselectGrid() { CareSpellVo vocareSpell = form.getGlobalContext().Clinical.PatientSummary.getCareSpell(); ClinicalContactShortVo voContact = form.getGlobalContext().Core.getCurrentClinicalContact(); CareContextShortVo voCareContext = form.getGlobalContext().Core.getCurrentCareContext(); EpisodeofCareShortVo voEpisodeOfCare = form.getGlobalContext().Core.getEpisodeofCareShort(); if(voContact != null) form.grdList().setValue(voContact); else if(voCareContext != null) form.grdList().setValue(voCareContext); else if(voEpisodeOfCare != null) form.grdList().setValue(voEpisodeOfCare); else if (vocareSpell != null) //WDEV-14578 form.grdList().setValue(vocareSpell); else { updateControlsState(); return; } gridListSelectionChanged(); }
protected boolean checkIfCareSpellCanBeCancelled(CareSpellVo careSpell) { boolean CareSpellItem = false; if( careSpell == null ) return CareSpellItem; if(careSpell.getCurrentStatus() == null || ProblemGroupStatus.OPEN.equals(careSpell.getCurrentStatus().getStatus()))// WDEV-14910 { CareSpellItem = true; for(int i = 0; careSpell.getEpisodesIsNotNull() && i < careSpell.getEpisodes().size();i++) { if( checkIfEpisodeOfCaresAreNotOpened(careSpell.getEpisodes().get(i)) == false) CareSpellItem = false; } } return CareSpellItem; }
private CareSpellVo copyFromShort(CareSpellWithoutEpisodesVo shortVo) { CareSpellVo tempVo = new CareSpellVo(shortVo.getID_CareSpell(), shortVo.getVersion_CareSpell()); if (shortVo == null) return null; tempVo.setID_CareSpell(shortVo.getID_CareSpell()); tempVo.setEndDate(shortVo.getEndDate()); tempVo.setStartDate(shortVo.getStartDate()); tempVo.setIsRIE(shortVo.getIsRIE()); tempVo.setPatient(shortVo.getPatient()); tempVo.setSysInfo(shortVo.getSysInfo()); tempVo.setEpisodes(new EpisodeofCareVoCollection()); tempVo.setCurrentStatus(shortVo.getCurrentStatus()); tempVo.setStatusHistory(shortVo.getStatusHistory()); return tempVo; }
private CareSpellVo copyFromShort(CareSpellWithoutEpisodesVo shortVo) { CareSpellVo tempVo = new CareSpellVo(shortVo.getID_CareSpell(),shortVo.getVersion_CareSpell()); if(shortVo == null) return null; tempVo.setID_CareSpell(shortVo.getID_CareSpell()); tempVo.setEndDate(shortVo.getEndDate()); tempVo.setStartDate(shortVo.getStartDate()); tempVo.setIsRIE(shortVo.getIsRIE()); tempVo.setPatient(shortVo.getPatient()); tempVo.setSysInfo(shortVo.getSysInfo()); tempVo.setEpisodes( new EpisodeofCareVoCollection()); tempVo.setCurrentStatus(shortVo.getCurrentStatus()); tempVo.setStatusHistory(shortVo.getStatusHistory()); return tempVo; }
private Integer getPatientId(CareContextRefVo voCurrentCareContext) { DomainFactory factory = getDomainFactory(); CareContext doCareContext = (CareContext)factory.getDomainObject(CareContext.class, voCurrentCareContext.getID_CareContext()); CareContextVo voCareContext = CareContextVoAssembler.create(doCareContext); CareSpell doCareSpell = (CareSpell)factory.getDomainObject(CareSpell.class, voCareContext.getEpisodeOfCare().getCareSpell().getID_CareSpell()); CareSpellVo voCareSpell = CareSpellVoAssembler.create(doCareSpell); return voCareSpell.getPatient().getID_Patient(); }
private Integer getPatientId(CareContextRefVo voCurrentCareContext) { DomainFactory factory = getDomainFactory(); CareContext doCareContext = (CareContext) factory.getDomainObject(CareContext.class, voCurrentCareContext.getID_CareContext()); CareContextVo voCareContext = CareContextVoAssembler.create(doCareContext); CareSpell doCareSpell = (CareSpell) factory.getDomainObject(CareSpell.class, voCareContext.getEpisodeOfCare().getCareSpell().getID_CareSpell()); CareSpellVo voCareSpell = CareSpellVoAssembler.create(doCareSpell); return voCareSpell.getPatient().getID_Patient(); }
private void populateCareSpellRows(CareSpellVoCollection voCollCareSpells) { grdListRow careSpellRow; for (int i = 0; i < voCollCareSpells.size(); i++) { if (isOutsideRange(voCollCareSpells.get(i).getStartDate()) && !(careSpellContainsInpatient(voCollCareSpells.get(i)))) continue; careSpellRow = form.grdList().getRows().newRow(); CareSpellVo careSpellVo = voCollCareSpells.get(i); careSpellRow.setcolStartDateEndDate(careSpellVo.createDisplayString()); careSpellRow.setTooltip(careSpellVo.createDisplayString()); careSpellRow.setCollapsedImage(form.getImages().Core.CareSpell); careSpellRow.setExpandedImage(form.getImages().Core.CareSpell); careSpellRow.setBackColor(Color.Bisque); careSpellRow.setBold(true); careSpellRow.setValue(careSpellVo); if (careSpellVo.getEndDateIsNotNull()) form.getLocalContext().setParentEnded(Boolean.TRUE); if (careSpellVo.getEpisodesIsNotNull()) { boolean bCollapseAll = populateEpisodeOfCareRows(careSpellVo.getEpisodes().sort(), careSpellRow); careSpellRow.setExpanded(!bCollapseAll); careSpellRow.setSelectable(false); } } }
private CareSpellVo createCareSpell() { CareSpellVo careSpell = new CareSpellVo(); careSpell.setPatient(form.getGlobalContext().Core.getPatientShort()); careSpell.setStartDate(form.dtimAdmissionDateTime().getValue()!=null ? form.dtimAdmissionDateTime().getValue().getDate():null); EpisodeofCareVoCollection voCollEpisodeOfCare = new EpisodeofCareVoCollection(); voCollEpisodeOfCare.add(createEpisodeOfCare(careSpell)); careSpell.setEpisodes(voCollEpisodeOfCare); return careSpell; }
private boolean problemGroupLaterThanEpisodeOfCare() { if(form.dteCsStart().getValue() != null) { CareSpellVo voCareSpell = form.getGlobalContext().Clinical.PatientSummary.getCareSpell(); for(int i=0; voCareSpell != null && voCareSpell.getEpisodesIsNotNull() && i < voCareSpell.getEpisodes().size();i++) //wdev-13248 { if(voCareSpell.getEpisodes().get(i).getStartDateIsNotNull() && voCareSpell.getEpisodes().get(i).getStartDate().isLessThan(form.dteCsStart().getValue())) return true; } } return false; }
private CatsReferralEmergencyAdmissionVo createNewCatsReferralForAdmission(PatientShort patientShort, PatientWithGPForCCGVo patient, CareSpellVo careSpell, AdmissionDetailVo admission, ContractConfigShortVo contract) { CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo(); referral.setPatient(patientShort); referral.setCareContext(careSpell.getEpisodes().get(0).getCareContexts().get(0)); CatsReferralStatusVo referralStatus = new CatsReferralStatusVo(); referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED); referralStatus.setStatusDateTime(new DateTime()); referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser()); referral.setCurrentStatus(referralStatus); referral.setStatusHistory(new CATSReferralStatusRefVoCollection()); referral.getStatusHistory().add(referralStatus); String codeCCG = getCCGCode(patient); referral.setContract(contract); referral.setHasAppointments(false); referral.setAdmissions(new AdmissionDetailVoCollection()); referral.getAdmissions().add(admission); ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo(); referralDetails.setService(form.cmbService().getValue()); referralDetails.setConsultant(domain.getHcpFromIMos(form.ccConsultant().getValue())); referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser()); referralDetails.setAuthoringDateTime(new DateTime()); referralDetails.setDateReferralReceived(new Date()); referralDetails.setDateOfReferral(new Date()); referralDetails.setEnd18WW(calculateEnd18WW(contract)); referralDetails.setPCT(codeCCG); referralDetails.setGPName(patient.getGp()); referralDetails.setPractice(getPatientGpDefaultPractice(patient)); referral.setReferralDetails(referralDetails); return referral; }
public CareSpellVo saveCareSpell(CareSpellVo voCareSpell) throws StaleObjectException { if (voCareSpell == null || !voCareSpell.isValidated()) throw new CodingRuntimeException("Care Spell is null or has not been validated"); DomainFactory factory = getDomainFactory(); CareSpell doCareSpell = CareSpellVoAssembler.extractCareSpell(factory, voCareSpell); //WDEV-10231 - add any new cc status record to the history maintainCareContextStatusHistory(doCareSpell); factory.save(doCareSpell); return CareSpellVoAssembler.create(doCareSpell); }
private void createNewCareSpell() { CareSpellVo voCareSpell = new CareSpellVo(); voCareSpell.setStartDate(form.dtimArrival().getValue().getDate()); voCareSpell.setPatient(form.getLocalContext().getpatientToSave()); voCareSpell.setEpisodes(createNewEpisodeOfCare(voCareSpell)); form.getLocalContext().setcareSpellToSave(voCareSpell); }
private void createCareContextForAttendance(EpisodeDetailsVo voEpisodeDetails, AttendanceDetailsVo voAttendanceDetails) { EpisodeofCareVo episodeOfCare = domain.getEpisodeOfCare(voEpisodeDetails.getEpisodeOfCare().getID_EpisodeOfCare()); CareSpellVo careSpell = domain.getCareSpellByEpisodeOfCare(voEpisodeDetails.getEpisodeOfCare().getID_EpisodeOfCare()); EpisodeofCareVoCollection episodeOfCareColl = careSpell.getEpisodes(); episodeOfCare.setCareContexts(createNewCareContext(episodeOfCare)); episodeOfCareColl.add(episodeOfCare); form.getLocalContext().setCurrentEpisodeOfCare(episodeOfCare); careSpell.setEpisodes(episodeOfCareColl); voAttendanceDetails.setCareContext(form.getLocalContext().getCurrentCareContext()); }
private void createNewCareSpell() { CareSpellVo voCareSpell = new CareSpellVo(); // InjuryDateTime if (form.dtimRegistration().getValue() != null) voCareSpell.setStartDate(form.dtimRegistration().getValue().getDate()); // Set Patient voCareSpell.setPatient(form.getGlobalContext().Core.getPatientShort()); voCareSpell.setEpisodes(createNewEpisodeOfCare(voCareSpell)); form.getLocalContext().setCurrentCareSpell(voCareSpell); }
public CareSpellVo getCareSpellByEpisodeOfCare(Integer id) { if(id == null) throw new CodingRuntimeException("Patient not provided"); DomainFactory factory = getDomainFactory(); String hsql = "select cs from EpisodeOfCare as eoc left join eoc.careSpell as cs"; hsql += " where eoc.id = :id"; List careSpell = factory.find(hsql, new String[] {"id"}, new Object[] {id.intValue()}); return CareSpellVoAssembler.createCareSpellVoCollectionFromCareSpell(careSpell).get(0); }