public CatsReferralEmergencyAdmissionVo getReferralForAdmission(Booking_AppointmentRefVo appointment) { if (appointment == null || appointment.getID_Booking_Appointment() == null) return null; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); StringBuilder query = new StringBuilder("SELECT referral "); query.append(" FROM CatsReferral AS referral LEFT JOIN referral.appointments AS appointment"); query.append(" WHERE "); query.append(" appointment.id = :APPOINTMENT_ID "); paramNames.add("APPOINTMENT_ID"); paramValues.add(appointment.getID_Booking_Appointment()); return CatsReferralEmergencyAdmissionVoAssembler.create((CatsReferral) getDomainFactory().findFirst(query.toString(), paramNames, paramValues)); }
public CatsReferralEmergencyAdmissionVo getReferralForAdmission(CatsReferralRefVo referral) { if (referral == null || referral.getID_CatsReferral() == null) return null; return CatsReferralEmergencyAdmissionVoAssembler.create((CatsReferral) getDomainFactory().getDomainObject(CatsReferral.class, referral.getID_CatsReferral())); }
public AdmissionDetailVo saveEmergencyAdmissionInElectiveCase(AdmissionDetailVo admission, CareSpellVo careSpell, CatsReferralEmergencyAdmissionVo catsReferral, BedSpaceStateLiteVo bedSpaceState, WardStayVo wardStay, ConsultantStayVo consultant) throws DomainInterfaceException, StaleObjectException { if (admission == null) throw new CodingRuntimeException("Admission Details parameter is mandatory."); if (careSpell == null) throw new CodingRuntimeException("Care Spell parameter is mandatory."); if (catsReferral == null) throw new CodingRuntimeException("Cats Referral parameter is mandatory."); PatientPathwayJourneyRefVo journey = createPatientJourney(catsReferral, admission); catsReferral.setJourney(journey); @SuppressWarnings("rawtypes") HashMap domMap = new HashMap(); AdmissionDetail domAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admission, domMap); CareSpell domCareSpell = CareSpellVoAssembler.extractCareSpell(getDomainFactory(), careSpell, domMap); CatsReferral domCatsReferral = CatsReferralEmergencyAdmissionVoAssembler.extractCatsReferral(getDomainFactory(), catsReferral, domMap); domCatsReferral.getCareContext().setPasEvent(domAdmissionDetail.getPasEvent()); getDomainFactory().save(domAdmissionDetail); getDomainFactory().save(domCareSpell); getDomainFactory().save(domCatsReferral); InpatientEpisode inpatEpisode = new InpatientEpisode(); inpatEpisode.setPasEvent(domAdmissionDetail.getPasEvent()); inpatEpisode.getPasEvent().setConsultant(domAdmissionDetail.getConsultant()); inpatEpisode.setAdmissionDateTime(domAdmissionDetail.getAdmissionDateTime()); inpatEpisode.setEstDischargeDate(null); inpatEpisode.setWardType(domAdmissionDetail.getWardType()); if (wardStay != null) inpatEpisode.getWardStays().add(WardStayVoAssembler.extractWardStay(getDomainFactory(), wardStay, domMap)); if (consultant != null) inpatEpisode.getConsultantStays().add(ConsultantStayVoAssembler.extractConsultantStay(getDomainFactory(), consultant, domMap)); BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState, domMap); if(doBedSpaceState != null) { doBedSpaceState.setInpatientEpisode(inpatEpisode); inpatEpisode.setBed(doBedSpaceState); inpatEpisode.setBedNo(doBedSpaceState.getBedSpace().getBedNumber()); } if (wardStay != null && wardStay.getWardIsNotNull() && ConfigFlag.UI.VTE_RISK_ASSESSMENT_FUNCTIONALITY.getValue() == true) { Location doloc = getLocation(wardStay.getWard().getID_Location(), getDomainFactory()); if (doloc != null && !Boolean.TRUE.equals(doloc.isVTEAsessmentNotRequired())) { inpatEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.REQUIRED)); } } getDomainFactory().save(inpatEpisode); return null; }