public CareContextRefVo getCareContextRef(CatsReferralRefVo referral) { if (referral == null || referral.getID_CatsReferral() == null) throw new CodingRuntimeException("Logical error - referral is null or missing ID"); String hql = "from CareContext as care where (care.id in (select cr.careContext.id from CatsReferral as cr where cr.id = :refID))"; ArrayList<String> paramNames = new ArrayList<String>(); paramNames.add("refID"); ArrayList<Object> paramValues = new ArrayList<Object>(); paramValues.add(referral.getID_CatsReferral()); DomainFactory factory = getDomainFactory(); return CareContextLiteVoAssembler.create((CareContext) (factory.find(hql, paramNames, paramValues)).get(0)); }
public PatientAssessmentLiteVoCollection listPatientAssessments(CareContextRefVo careContextRef, UserAssessmentRefVo assessmentRef) { // If no assembler or care context is passes return null // Do not throw any exception or crash code - this is the domain of a component // Try to handle the execution exception if (assessmentRef == null || careContextRef == null) return null; CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().getDomainObject(CareContext.class, careContextRef.getID_CareContext())); if (careContext == null) return null; String query = " from PatientAssessment as pa where pa.assessmentData.userAssessment.id = :ASS_ID and ((pa.careContext.id = :CC_ID and pa.careContext.context.id != :CC_TYPE)" + " or (pa.careContext.episodeOfCare.id = :EP_ID and pa.careContext.context.id = :CC_TYPE)) order by pa.authoringInformation.authoringDateTime desc"; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ASS_ID"); paramValues.add(assessmentRef.getID_UserAssessment()); paramNames.add("CC_ID"); paramValues.add(careContextRef.getID_CareContext()); paramNames.add("CC_TYPE"); paramValues.add(ContextType.INPATIENT.getID()); paramNames.add("EP_ID"); paramValues.add(careContext.getEpisodeOfCare().getID_EpisodeOfCare()); return PatientAssessmentLiteVoAssembler.createPatientAssessmentLiteVoCollectionFromPatientAssessment(getDomainFactory().find(query, paramNames, paramValues)); }
public PatientAssessmentLiteVoCollection listPatientGraphicAssessments(CareContextRefVo careContextRef, GraphicAssessmentRefVo graphicalAssessmentRef) { // If no assembler or care context is passes return null // Do not throw any exception or crash code - this is the domain of a component // Try to handle the execution exception if (graphicalAssessmentRef == null || careContextRef == null) return null; CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().getDomainObject(CareContext.class, careContextRef.getID_CareContext())); if (careContext == null) return null; String query = " from PatientAssessment as pa where pa.assessmentData.graphic.id = :GASS_ID and ((pa.careContext.id = :CC_ID and pa.careContext.context.id != :CC_TYPE)" + " or (pa.careContext.episodeOfCare.id = :EP_ID and pa.careContext.context.id = :CC_TYPE)) order by pa.authoringInformation.authoringDateTime desc"; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("GASS_ID"); paramValues.add(graphicalAssessmentRef.getID_GraphicAssessment()); paramNames.add("CC_ID"); paramValues.add(careContextRef.getID_CareContext()); paramNames.add("CC_TYPE"); paramValues.add(ContextType.INPATIENT.getID()); paramNames.add("EP_ID"); paramValues.add(careContext.getEpisodeOfCare().getID_EpisodeOfCare()); return PatientAssessmentLiteVoAssembler.createPatientAssessmentLiteVoCollectionFromPatientAssessment(getDomainFactory().find(query, paramNames, paramValues)); }
public ims.core.vo.CareContextLiteVo getCareContext(ims.RefMan.vo.CatsReferralRefVo catsRefVo) { DomainFactory factory = getDomainFactory(); if (catsRefVo != null && catsRefVo.getID_CatsReferralIsNotNull()) { java.util.List list = factory.find("select careContext from CatsReferral cats where cats.id = :catsID", new String[]{"catsID"}, new Object[]{catsRefVo.getID_CatsReferral()}); if (list != null && list.size() >0) return CareContextLiteVoAssembler.create((CareContext)list.get(0)); else return null; } return null; }
public ims.core.vo.CareContextLiteVo getCareContext(ims.RefMan.vo.CatsReferralRefVo catsRefVo) { DomainFactory factory = getDomainFactory(); if (catsRefVo != null && catsRefVo.getID_CatsReferralIsNotNull()) { java.util.List list = factory.find("select careContext from CatsReferral cats where cats.id = :catsID", new String[] { "catsID" }, new Object[] { catsRefVo.getID_CatsReferral() }); if (list != null && list.size() > 0) return CareContextLiteVoAssembler.create((CareContext) list.get(0)); else return null; } return null; }
public CareContextShortVo admitPatient(PatientShort patVo, InpatientEpisodeVo episVo, CareContextRefVo careContectRefVo, CatsReferralRefVo voCats) throws DomainInterfaceException, StaleObjectException, ForeignKeyViolationException, UniqueKeyViolationException { if (patVo == null || patVo.getID_Patient() == null) throw new CodingRuntimeException("patVo is null or id not provide for method admitPatient"); if (episVo == null) throw new CodingRuntimeException("episVo is null or id not provide for method admitPatient"); if (careContectRefVo == null || careContectRefVo.getID_CareContext() == null) throw new CodingRuntimeException("careContectRefVo is null or id not provide for method admitPatient"); ADT implLoc = (ADT)getDomainImpl(ADTImpl.class); //InpatientEpisodeVo voIP = implLoc.admitPatient(patVo, episVo); InpatientEpisodeVo voIP; try { voIP = implLoc.admitPatient(patVo, episVo, null); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException(e.getMessage()); } if ( !voIP.getAdmissionDateTime().equals(episVo.getAdmissionDateTime())) { throw new DomainInterfaceException("Patient is already an inpatient. Cannot Admit."); } DomainFactory factory = getDomainFactory(); //wdev-8305 CatsReferral domCats = (CatsReferral) factory.getDomainObject(CatsReferral.class, voCats.getID_CatsReferral()); domCats.setRequiresDischargeRep(null); domCats.setDischargeDate(null);////wdev-11889 factory.save(domCats); CatsReferralWizardVo catsRefWizVO = CatsReferralWizardVoAssembler.create(domCats); // Update the CareContext with PASEvent (WDEV-8364) CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().getDomainObject(CareContext.class, catsRefWizVO.getCareContext().getID_CareContext())); careContext.setPasEvent(voIP.getPasEvent()); CareContext domCareContext = CareContextLiteVoAssembler.extractCareContext(getDomainFactory(), careContext); factory.save(domCareContext); // Update the ICP with PASEVent List picps = getDomainFactory().find("select picp from PatientICP picp where picp.careContext = '" + careContectRefVo.getID_CareContext() + "' and picp.completedDateTime = null"); if (picps != null && picps.size() == 1) { PatientICPFullVo voPatientICP = PatientICPFullVoAssembler.create((PatientICP) picps.get(0)); if (voPatientICP != null) { voPatientICP.setPasEvent(voIP.getPasEvent()); PatientICP doICP = PatientICPFullVoAssembler.extractPatientICP(factory, voPatientICP); factory.save(doICP); } } return CareContextShortVoAssembler.create(domCareContext); }
public PatientMedicationLiteVoCollection listPatientLastMedication(PatientShort patient, DateTime startDateTime) { if (patient == null || !patient.getID_PatientIsNotNull()) return null; // Get last care context (of type INPATIET) StringBuilder ccQuery = new StringBuilder(); ccQuery.append("select cc from PatientMedication as pmed join pmed.careContext as cc where pmed.patient.id = :PAT_ID and cc.context.id = :CC_TYPE and (pmed.isRIE is null or pmed.isRIE = 0) and (pmed.isDiscontinued is null or pmed.isDiscontinued = 0)"); ArrayList<String> paramCCNames = new ArrayList<String>(); ArrayList<Object> paramCCValues = new ArrayList<Object>(); paramCCNames.add("PAT_ID"); paramCCNames.add("CC_TYPE"); paramCCValues.add(patient.getID_Patient()); paramCCValues.add(ContextType.INPATIENT.getID()); if (startDateTime != null) { ccQuery.append(" and cc.startDateTime <= :DATE"); paramCCNames.add("DATE"); paramCCValues.add(startDateTime.getJavaDate()); } ccQuery.append(" order by cc.startDateTime desc"); CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().findFirst(ccQuery.toString(), paramCCNames, paramCCValues)); if (careContext == null || !careContext.getID_CareContextIsNotNull()) return null; String hqlQuery = "select pmed from PatientMedication as pmed where pmed.patient.id = :PAT_ID and pmed.careContext.id = :CC_ID"; ArrayList<String> paramPMedNames = new ArrayList<String>(); ArrayList<Object> paramPMedValues = new ArrayList<Object>(); paramPMedNames.add("PAT_ID"); paramPMedNames.add("CC_ID"); paramPMedValues.add(patient.getID_Patient()); paramPMedValues.add(careContext.getID_CareContext()); return PatientMedicationLiteVoAssembler.createPatientMedicationLiteVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery, paramPMedNames, paramPMedValues)); }
public PatientMedicationVoCollection listMedications(PatientRefVo patientRef, DateTime startDateTime) { // Check patient if (patientRef == null || !patientRef.getID_PatientIsNotNull()) return null; // Get last care context (of type INPATIET) StringBuilder ccQuery = new StringBuilder(); ccQuery.append("select cc from PatientMedication as pmed join pmed.careContext as cc where pmed.patient.id = :PAT_ID and cc.context.id = :CC_TYPE and (pmed.isRIE is null or pmed.isRIE = 0) and (pmed.isDiscontinued is null or pmed.isDiscontinued = 0)"); ArrayList<String> paramCCNames = new ArrayList<String>(); ArrayList<Object> paramCCValues = new ArrayList<Object>(); paramCCNames.add("PAT_ID"); paramCCNames.add("CC_TYPE"); paramCCValues.add(patientRef.getID_Patient()); paramCCValues.add(ContextType.INPATIENT.getID()); if (startDateTime != null) { ccQuery.append(" and cc.startDateTime <= :DATE"); paramCCNames.add("DATE"); paramCCValues.add(startDateTime.getJavaDate()); } ccQuery.append(" order by cc.startDateTime desc"); CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().findFirst(ccQuery.toString(), paramCCNames, paramCCValues)); if (careContext == null || !careContext.getID_CareContextIsNotNull()) return null; String hqlQuery = "select pmed from PatientMedication as pmed where pmed.patient.id = :PAT_ID and pmed.careContext.id = :CC_ID and (pmed.isDiscontinued is null or pmed.isDiscontinued is false)"; ArrayList<String> paramPMedNames = new ArrayList<String>(); ArrayList<Object> paramPMedValues = new ArrayList<Object>(); paramPMedNames.add("PAT_ID"); paramPMedNames.add("CC_ID"); paramPMedValues.add(patientRef.getID_Patient()); paramPMedValues.add(careContext.getID_CareContext()); return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery, paramPMedNames, paramPMedValues)); }
public PatientAssessmentLiteVoCollection listPatientAssessments(CareContextRefVo careContextRef, UserAssessmentRefVo assessmentRef) { // If no assembler or care context is passes return null // Do not throw any exception or crash code - this is the domain of a component // Try to handle the execution exception if (assessmentRef == null || careContextRef == null) return null; CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().getDomainObject(CareContext.class, careContextRef.getID_CareContext())); if (careContext == null) return null; String query = null; if(ConfigFlag.FW.USE_REFERRAL_CARECONTEXT.getValue()) //http://jira/browse/WDEV-20263 { query = " from PatientAssessment as pa where pa.assessmentData.userAssessment.id = :ASS_ID and ((pa.careContext.id = :CC_ID )" + " or (pa.careContext.episodeOfCare.id = :EP_ID )) order by pa.authoringInformation.authoringDateTime desc"; } else { query = " from PatientAssessment as pa where pa.assessmentData.userAssessment.id = :ASS_ID and ((pa.careContext.id = :CC_ID and pa.careContext.context.id != :CC_TYPE)" + " or (pa.careContext.episodeOfCare.id = :EP_ID and pa.careContext.context.id = :CC_TYPE)) order by pa.authoringInformation.authoringDateTime desc"; } ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ASS_ID"); paramValues.add(assessmentRef.getID_UserAssessment()); paramNames.add("CC_ID"); paramValues.add(careContextRef.getID_CareContext()); if(!ConfigFlag.FW.USE_REFERRAL_CARECONTEXT.getValue()) //http://jira/browse/WDEV-20263 { paramNames.add("CC_TYPE"); paramValues.add(ContextType.INPATIENT.getID()); } paramNames.add("EP_ID"); paramValues.add(careContext.getEpisodeOfCare().getID_EpisodeOfCare()); return PatientAssessmentLiteVoAssembler.createPatientAssessmentLiteVoCollectionFromPatientAssessment(getDomainFactory().find(query, paramNames, paramValues)); }