private boolean isQuestionInvalidForPatient(Question_InformationVo question) { PatientAssessmentInfoVo patInfo = form.getLocalContext().getPatientInfo(); if (patInfo == null) return false; if (question.getGenderSpecificIsNotNull()) { if (GenderSpecific.MALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.MALE.equals(patInfo.getSex()))) return true; else if (GenderSpecific.FEMALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.FEMALE.equals(patInfo.getSex()))) return true; } if (question.getAgeRangeMaxIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge() > question.getAgeRangeMax())) return true; if (question.getAgeRangeMinIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge() < question.getAgeRangeMin())) return true; return false; }
private boolean isQuestionInvalidForPatient(QuestionInformationVo question) { PatientAssessmentInfoVo patInfo = form.getLocalContext().getPatientInfo(); if (patInfo == null) return false; if (question.getGenderSpecificIsNotNull()) { if (GenderSpecific.MALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.MALE.equals(patInfo.getSex()))) return true; else if (GenderSpecific.FEMALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.FEMALE.equals(patInfo.getSex()))) return true; } if (question.getAgeRangeMaxIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge() > question.getAgeRangeMax())) return true; if (question.getAgeRangeMinIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge() < question.getAgeRangeMin())) return true; return false; }
private boolean isQuestionInvalidForPatient(QuestionInformationVo question) { if (patInfo == null) return false; if (question.getGenderSpecificIsNotNull() ) { if (GenderSpecific.MALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.MALE.equals(patInfo.getSex()))) return true; else if (GenderSpecific.FEMALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.FEMALE.equals(patInfo.getSex()) )) return true; } if (question.getAgeRangeMaxIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge()>question.getAgeRangeMax())) return true; if (question.getAgeRangeMinIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge()<question.getAgeRangeMin())) return true; return false; }
private boolean isQuestionInvalidForPatient(Question_InformationVo question) { if (patInfo == null) return false; if (question.getGenderSpecificIsNotNull() ) { if (GenderSpecific.MALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.MALE.equals(patInfo.getSex()))) return true; else if (GenderSpecific.FEMALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.FEMALE.equals(patInfo.getSex()) )) return true; } if (question.getAgeRangeMaxIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge()>question.getAgeRangeMax())) return true; if (question.getAgeRangeMinIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge()<question.getAgeRangeMin())) return true; return false; }
private void initialize() { String query = ""; boolean isFemale = form.getGlobalContext().Core.getPatientShort().getSexIsNotNull() && form.getGlobalContext().Core.getPatientShort().getSex().equals(Sex.FEMALE); if(isFemale) query = "These investigations have been configured as appropriate for patients of Male gender.\nDo you still wish to include these items in the order for this patient?"; else query = "These investigations have been configured as appropriate for patients of Female gender.\nDo you still wish to include these items in the order for this patient?"; form.lblQuestion().setValue(query); form.grdInvestigations().setSelectable(false); populateInvestigationGrid(); }
private Sex getTempGenderToInstateForPreviousBay(WardConfigLiteVo wardConfigLiteVo,BayConfigLiteVo bayConfig) { if (wardConfigLiteVo == null || bayConfig == null) return null; Integer intMales = countMalePatientsOnTheWard(wardConfigLiteVo.getWard(), bayConfig.getBay()); Integer intFemales = countFemalePatientsOnTheWard(wardConfigLiteVo.getWard(), bayConfig.getBay()); if (bayConfig != null && bayConfig.getNumOfOccupiedBedsIsNotNull() && bayConfig.getNumOfOccupiedBeds() > 0) { if ((intFemales == null || intFemales == 0) && (intMales != null && intMales >= 0 && !Sex.MALE.equals(bayConfig.getTemporaryBayGender()))) return Sex.MALE; if ((intMales == null || intMales == 0) && intFemales != null && intFemales >= 0 && !Sex.FEMALE.equals(bayConfig.getTemporaryBayGender())) return Sex.FEMALE; } return null; }
public Integer countMalePatientsOnTheWard(LocationRefVo ward, LocationRefVo bay) { if (ward == null || ward.getID_Location() == null) return 0; StringBuilder query = new StringBuilder("SELECT COUNT (inpat.id) "); query.append(" FROM BedSpaceState as bs LEFT JOIN bs.inpatientEpisode as inpat LEFT JOIN inpat.bed AS bed "); query.append(" LEFT JOIN inpat.pasEvent AS pas LEFT JOIN pas.patient AS patient "); query.append(" WHERE "); query.append(" bs.ward.id = :WARD_ID AND bs.bay.id = :BAY_ID AND bed is not null AND patient.sex.id = :MALE_SEX "); String[] paramNames = new String[] {"WARD_ID", "BAY_ID", "MALE_SEX" }; Object[] paramValues = new Object[] {ward.getID_Location(),bay.getID_Location(), Sex.MALE.getID()}; return (int) getDomainFactory().countWithHQL(query.toString(), paramNames, paramValues); }
public Integer countFemalePatientsOnTheWard(LocationRefVo ward, LocationRefVo bay) { if (ward == null || ward.getID_Location() == null) return 0; StringBuilder query = new StringBuilder("SELECT COUNT (inpat.id) "); query.append(" FROM BedSpaceState as bs LEFT JOIN bs.inpatientEpisode as inpat LEFT JOIN inpat.bed AS bed "); query.append(" LEFT JOIN inpat.pasEvent AS pas LEFT JOIN pas.patient AS patient "); query.append(" WHERE "); query.append(" bs.ward.id = :WARD_ID AND bs.bay.id = :BAY_ID AND bed is not null AND patient.sex.id = :FEMALE_SEX "); String[] paramNames = new String[] {"WARD_ID", "BAY_ID", "FEMALE_SEX" }; Object[] paramValues = new Object[] {ward.getID_Location(), bay.getID_Location(), Sex.FEMALE.getID()}; return (int) getDomainFactory().countWithHQL(query.toString(), paramNames, paramValues); }
private void populatePasContactFromDtoOutpatient(PasContactVo voPasContact, OutpatientlistRecord dtoOutpatient) { String extSystem = ConfigFlag.DOM.DEMOGRAPHICS_EXT_SYSTEM.getValue(); LocShortVo voLoc = new LocShortVo(); OrganisationAndLocation locImpl = (OrganisationAndLocation)getDomainImpl(OrganisationAndLocationImpl.class); voLoc = locImpl.getLocationByLocalCode(dtoOutpatient.Cliniccode,LocationType.CLINIC); voPasContact.setLocation(voLoc); HcpAdmin hcpAdmin = (HcpAdmin)getDomainImpl(HcpAdminImpl.class); MedicWithMappingsLiteVo voMedicWithMappingsLite = hcpAdmin.getMedicMedicMappingsByPasCode(dtoOutpatient.Hcpcode); voPasContact.setConsultant(voMedicWithMappingsLite == null ? null : voMedicWithMappingsLite); Specialty specialty = (Specialty)getLookupService().getLocalLookup(Specialty.class, Specialty.TYPE_ID, extSystem, dtoOutpatient.Specialty); voPasContact.setSpecialty(specialty); //Contact Number voPasContact.setContactNumber(dtoOutpatient.Contactno); try { voPasContact.setAppointmentDateTime(new DateTime (dtoOutpatient.Apptdate, "1000")); } catch (ParseException e) { voPasContact.setAppointmentDateTime(null); } PatientShort voPatientShort = new PatientShort(); voPatientShort.setName(dtoOutpatient.Snm, dtoOutpatient.Fnm1, null); voPatientShort.addId(PatIdType.HOSPNUM, dtoOutpatient.Hospnum); voPatientShort.addId(PatIdType.CHARTNUM, dtoOutpatient.Chartnum); if(dtoOutpatient.Dob != null && dtoOutpatient.Dob != "") voPatientShort.setDob(new PartialDate(dtoOutpatient.Dob)); else voPatientShort.setDob(null); if(dtoOutpatient.Dod != null && dtoOutpatient.Dod != "") { try {voPatientShort.setDod(new Date(dtoOutpatient.Dod,DateFormat.ISO)); } catch (ParseException e2) { e2.printStackTrace(); } } if(dtoOutpatient.Dob != null && dtoOutpatient.Dob != "") voPatientShort.calculateAge(); voPatientShort.setWard(voPasContact.getLocation()); voPatientShort.setSex((Sex)getLookupService().getLocalLookup(Sex.class, Sex.TYPE_ID, extSystem, dtoOutpatient.Sex)); voPasContact.setPatient(voPatientShort); voPasContact.setGPCode(dtoOutpatient.Gpcode); if (dtoOutpatient.Documentstatus != "" && Integer.valueOf(dtoOutpatient.Documentstatus).intValue() == DocumentStatus.LETTERREQUIRED.getId()) { voPasContact.setDocumentStatus((DocumentStatus)getLookupService().getLookupInstance(DocumentStatus.class,Integer.valueOf(dtoOutpatient.Documentstatus).intValue())); } else { if (isLetterRequired(voMedicWithMappingsLite, specialty ,null, null) == Boolean.FALSE) voPasContact.setDocumentStatus(DocumentStatus.NOLETTERREQUIRED); else voPasContact.setDocumentStatus(DocumentStatus.LETTERREQUIRED); } }
@Override protected void onBtnCalculateHeightClick() throws PresentationLogicException { if (form.decHeight().getValue()!=null) { engine.showMessage("A value for Height already exist.\nHeight field should be empty to be able to calculate it using ULNA radius."); form.decUlna().setValue(null); return; } if (form.decUlna().getValue() == null) { engine.showMessage("Please enter the value for ULNA to calculate the Height"); return; } Integer patAge = form.getGlobalContext().Core.getPatientShort().getAge(); Sex patSex = form.getGlobalContext().Core.getPatientShort().getSex(); if (patAge != null && patSex != null && (patSex.equals(ims.core.vo.lookups.Sex.MALE) || patSex.equals(ims.core.vo.lookups.Sex.FEMALE))) { Float heights = domain.getHeight(form.decUlna().getValue().toString(), patAge, patSex); if (heights == null) { engine.showMessage("Please enter a valid value for ULNA"); return; } form.decHeight().setValue(heights); } else { engine.showMessage("When calculating the Height using ULNA radius the patient age and sex are mandatory!"); } }
public Float getHeight(String ulnaValue, Integer age, Sex sex) { StringBuffer hql = new StringBuffer(); DomainFactory factory = getDomainFactory(); if (age<65) { if (sex.equals(ims.core.vo.lookups.Sex.MALE)) { hql.append("select patHeights.menUnder65HeightM "); } else if (sex.equals(ims.core.vo.lookups.Sex.FEMALE)) { hql.append("select patHeights.womenUnder65HeightM "); } } else { if (sex.equals(ims.core.vo.lookups.Sex.MALE)) { hql.append("select patHeights.menOver65HeightM"); } else if (sex.equals(ims.core.vo.lookups.Sex.FEMALE)) { hql.append("select patHeights.womenOver65HeightM "); } } hql.append(" from PatientHeightEstimationULNAConfig patHeights where patHeights.uLNALengthCM = " + ulnaValue); List <?> list = factory.find(hql.toString()); if (list!=null && list.size()>0) return (Float)list.get(0); return null; }
private void copyHomeleaveToDto(Homeleave homeLeaveRec, HomeLeaveVo voHomeLeave, InPatientEpisodeADTVo inpatientEpisode) { HomeleaveRecord hlRec = homeLeaveRec.DataCollection.get(0); hlRec.Pkey = getPatientIdValue(inpatientEpisode, PatIdType.PKEY); hlRec.Hospnum = getPatientIdValue(inpatientEpisode, PatIdType.HOSPNUM); InpatientEpisode doInpat = InPatientEpisodeADTVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode); hlRec.Rescode = doInpat.getPasEvent() != null && doInpat.getPasEvent().getLocation() != null ? doInpat.getPasEvent().getLocation().getExtCode(TaxonomyType.PAS.getID()) : null; hlRec.Mors = DTOHelper.getPasMapping(doInpat.getWardType()); hlRec.Leavedt = voHomeLeave.getDateOnHomeLeaveIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getDateOnHomeLeave().getDate()) : ""; hlRec.Leavetm = voHomeLeave.getTimeOnHomeLeaveIsNotNull() ? voHomeLeave.getTimeOnHomeLeave().toString(TimeFormat.FLAT4) : ""; hlRec.Exdt = voHomeLeave.getExpectedDateOfReturnIsNotNull() ? DTOHelper.convertToDtoDate(voHomeLeave.getExpectedDateOfReturn().getDate()) : ""; hlRec.Extm = voHomeLeave.getExpectedTimeOfReturnIsNotNull() ? voHomeLeave.getExpectedTimeOfReturn().toString(TimeFormat.FLAT4) : ""; if(hlRec.Mors.equals("M")) { if(doInpat.getPasEvent().getPatient().getSex() != null) { if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.MALE))) hlRec.Btyp = "M"; else if(doInpat.getPasEvent().getPatient().getSex().equals(getDomLookup(Sex.FEMALE))) hlRec.Btyp = "F"; else //defaulting Male for unknown sex hlRec.Btyp = "M"; } else //defaulting Male for unknown sex hlRec.Btyp = "M"; } else if(hlRec.Mors.equals("S")) hlRec.Btyp = "S"; hlRec.Hlfl = "Y"; //"Y" on an insert hlRec.Webadt = "Y"; }
private MyOrderQuestionsPopulation getMyOrderQuestionPopulationHelperFactory() { PatientShort voPatShort = form.getGlobalContext().Core.getPatientShort(); Integer age = voPatShort != null ? voPatShort.calculateAge() : null; Sex sex = voPatShort != null ? voPatShort.getSex() : null; return new MyOrderQuestionsPopulation(form.lyrTemplates().tabPreview().lyrPreview().tabQuestions().dynGrdQuestions(), form.getImages().OCRR.Question, form.getImages().OCRR.Information, form.getImages().Core.MandatoryQuestion, form.getImages().OCRR.Investigation, age, sex); }
private MyOrderQuestionsPopulation getMyOrderQuestionPopulationHelperFactory() { PatientShort voPatShort = form.getGlobalContext().OCRR.getQuestionsNotes().getPatient(); Integer age = voPatShort != null ? voPatShort.calculateAge() : null; Sex sex = voPatShort != null ? voPatShort.getSex() : null; return new MyOrderQuestionsPopulation(form.lyrDisplay().tabQuestionsNotes().dyngrdQuestions(), form.getImages().OCRR.Question, form.getImages().OCRR.Information, form.getImages().Core.MandatoryQuestion, form.getImages().OCRR.Investigation, age, sex, engine); }
private MyOrderQuestionsPopulation getMyOrderQuestionPopulationHelperFactory() { PatientShort voPatShort = form.getGlobalContext().Core.getPatientShort(); Integer age = voPatShort != null ? voPatShort.calculateAge() : null; Sex sex = voPatShort != null ? voPatShort.getSex() : null; return new MyOrderQuestionsPopulation(form.lyrDetails().tabClinicalNotes().dyngrdQuestions(), form.getImages().OCRR.Question, form.getImages().OCRR.Information, form.getImages().Core.MandatoryQuestion, form.getImages().OCRR.Investigation, age, sex); }
private boolean selectedPatientSexIsKnown() { if(form.getLocalContext().getPatientShort() == null) return false; if(form.getLocalContext().getPatientShort().getSex() == null) return false; if(form.getLocalContext().getPatientShort().getSex().equals(Sex.MALE)) return true; if(form.getLocalContext().getPatientShort().getSex().equals(Sex.FEMALE)) return true; return false; }
private Boolean selectedPatientIsMale() { if(!selectedPatientSexIsKnown()) return null; if(form.getLocalContext().getPatientShort().getSex().equals(Sex.MALE)) return Boolean.TRUE; return Boolean.FALSE; }
private boolean selectedPatientSexIsKnown() { if (form.getGlobalContext().Core.getPatientShort() == null) return false; if (form.getGlobalContext().Core.getPatientShort().getSex() == null) return false; if (form.getGlobalContext().Core.getPatientShort().getSex().equals(Sex.MALE)) return true; if (form.getGlobalContext().Core.getPatientShort().getSex().equals(Sex.FEMALE)) return true; return false; }
private Boolean selectedPatientIsMale() { if (!selectedPatientSexIsKnown()) return null; if (form.getGlobalContext().Core.getPatientShort().getSex().equals(Sex.MALE)) return Boolean.TRUE; return Boolean.FALSE; }
public MyOrderQuestionsPopulation(DynamicGrid gridQuestions, Image questionImage, Image infoImage, Image mandatoryQuestionImage, Image investigationImage, Integer age, Sex sex) { this.gridQuestions = gridQuestions; this.questionImage = questionImage; this.infoImage = infoImage; this.mandatoryQuestionImage = mandatoryQuestionImage; this.investigationImage = investigationImage; setAge(age); setSex(sex); }
public MyOrderQuestionsPopulation(DynamicGrid gridQuestions, Image questionImage, Image infoImage, Image mandatoryQuestionImage, Image investigationImage, Integer age, Sex sex, UIEngine uiEngine) { this.gridQuestions = gridQuestions; this.questionImage = questionImage; this.infoImage = infoImage; this.mandatoryQuestionImage = mandatoryQuestionImage; this.investigationImage = investigationImage; setAge(age); setSex(sex); engine = uiEngine; }