public ReferralToSpecialtyTeamVo getReferralToSpecialty(ReferralToSpecTeamRefVo referralToSpecialtyRef) { DomainFactory factory = getDomainFactory(); if (referralToSpecialtyRef == null || referralToSpecialtyRef.getID_ReferralToSpecTeam()==null) { throw new CodingRuntimeException("Cannot get ReferralsToSpec on null Id "); } StringBuffer hql = new StringBuffer(); hql.append(" select Referral from ReferralToSpecTeam as Referral where Referral.id = :referralID"); List<?> list = factory.find(hql.toString(), new String[] { "referralID" }, new Object[] { referralToSpecialtyRef.getID_ReferralToSpecTeam() }); if (list != null && list.size() > 0) return ReferralToSpecialtyTeamVoAssembler.createReferralToSpecialtyTeamVoCollectionFromReferralToSpecTeam(list).get(0); return null; }
public ReferralToSpecialtyTeamVoCollection getAllReferralsToSpec(Integer careContextID) { DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); if (careContextID == null) { throw new CodingRuntimeException("Cannot get ReferralsToSpec on null Id "); } StringBuffer hql = new StringBuffer(); hql.append(" select Referral from ReferralToSpecTeam as Referral left join Referral.attendance as contextID where contextID.id = :contextID order by Referral.systemInformation.creationDateTime desc"); //WDEV-17411 markers.add("contextID"); values.add(careContextID); return ReferralToSpecialtyTeamVoAssembler.createReferralToSpecialtyTeamVoCollectionFromReferralToSpecTeam(factory.find(hql.toString(), markers, values)); }
public ReferralToSpecialtyTeamVo getUncompletedReferralToSpecialtyByCareContext(CareContextRefVo careContextRef) { if (careContextRef == null || careContextRef.getID_CareContext() == null) { throw new CodingRuntimeException("Cannot get SeenByHCPVoCollection on null Id for CareContext "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select allRefSpecTeam from ReferralToSpecTeam as allRefSpecTeam where allRefSpecTeam.attendance.id = :attID and allRefSpecTeam.completionDateTime is null and ( allRefSpecTeam.notAccepted is null or allRefSpecTeam.notAccepted = 0) order by allRefSpecTeam.referredDateTime desc "); List<?> list = factory.find(hql.toString(), new String[] { "attID" }, new Object[] { careContextRef.getID_CareContext() }); if (list!=null && list.size()>0) return ReferralToSpecialtyTeamVoAssembler.create((ReferralToSpecTeam)list.get(0)); return null; }
public ReferralToSpecialtyTeamVo getReferralToSpecialty(Integer referralID) { DomainFactory factory = getDomainFactory(); if (referralID == null) { throw new CodingRuntimeException("Cannot get ReferralsToSpec on null Id "); } StringBuffer hql = new StringBuffer(); hql.append(" select Referral from ReferralToSpecTeam as Referral where Referral.id = :referralID"); List<?> list = factory.find(hql.toString(), new String[] { "referralID" }, new Object[] { referralID }); if (list != null && list.size() > 0) return ReferralToSpecialtyTeamVoAssembler.createReferralToSpecialtyTeamVoCollectionFromReferralToSpecTeam(list).get(0); return null; }
public ReferralToSpecialtyTeamVoCollection getAllReferralsToSpec(Integer careContextID) { DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); if (careContextID == null) { throw new CodingRuntimeException("Cannot get ReferralsToSpec on null Id "); } StringBuffer hql = new StringBuffer(); hql.append(" select Referral from ReferralToSpecTeam as Referral left join Referral.attendance as contextID where contextID.id = :contextID order by Referral.referredDateTime desc"); markers.add("contextID"); values.add(careContextID); return ReferralToSpecialtyTeamVoAssembler.createReferralToSpecialtyTeamVoCollectionFromReferralToSpecTeam(factory.find(hql.toString(), markers, values)); }
public AttendanceClinicalNotesVo save(AttendanceClinicalNotesVo attendanceClinicalNoteToSave, ValueObject parentRecord) throws StaleObjectException { if (attendanceClinicalNoteToSave == null) throw new CodingRuntimeException("Cannot save null AttendanceClinicalNotesVo "); if (!attendanceClinicalNoteToSave.isValidated()) throw new DomainRuntimeException("AttendanceClinicalNotesVo Not Validated."); DomainFactory factory = getDomainFactory(); AttendanceClinicalNotes domainAttClinicalNote = AttendanceClinicalNotesVoAssembler.extractAttendanceClinicalNotes(factory, attendanceClinicalNoteToSave); factory.save(domainAttClinicalNote); AttendanceClinicalNotesVo attendanceClinicalNoteSaved = AttendanceClinicalNotesVoAssembler.create(domainAttClinicalNote); if (parentRecord!=null && parentRecord instanceof ReferralToSpecialtyTeamVo) { ReferralToSpecialtyTeamVo referralToSpecialtyToSave = (ReferralToSpecialtyTeamVo)parentRecord; referralToSpecialtyToSave=ReferralToSpecialtyTeamVoAssembler.create((ReferralToSpecTeam) factory.getDomainObject(ReferralToSpecTeam.class, referralToSpecialtyToSave.getID_ReferralToSpecTeam())); referralToSpecialtyToSave.setComments(populateCollComments(referralToSpecialtyToSave.getComments(),attendanceClinicalNoteSaved)); //save referralToSpecialty ReferralToSpecTeam domainReferralToSave = ReferralToSpecialtyTeamVoAssembler.extractReferralToSpecTeam(factory, referralToSpecialtyToSave); factory.save(domainReferralToSave); } else if (parentRecord!=null && parentRecord instanceof SeenByHCPVo) { SeenByHCPVo seenByHcpToSave = (SeenByHCPVo)parentRecord; seenByHcpToSave=SeenByHCPVoAssembler.create((SeenByHCP) factory.getDomainObject(SeenByHCP.class, seenByHcpToSave.getID_SeenByHCP())); seenByHcpToSave.setSeenByHCPNotes(populateCollComments(seenByHcpToSave.getSeenByHCPNotes(),attendanceClinicalNoteSaved)); //save referralToSpecialty SeenByHCP domainSeenByHcpToSave = SeenByHCPVoAssembler.extractSeenByHCP(factory, seenByHcpToSave); factory.save(domainSeenByHcpToSave); } return attendanceClinicalNoteSaved; }
public ims.emergency.vo.EDTransferVo saveEDTransfer(EDTransferVo record, TrackingForTransferVo trackingRecord, EDTransferVo previousRecord, ReferralToSpecialtyTeamVo referralToSpecialty) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if(record == null && trackingRecord == null) throw new CodingRuntimeException("Cannot save a null EDTransfer / Tracking / Partial Admission record."); DomainFactory factory = getDomainFactory(); EDTransfer doEDTransfer = null; if (referralToSpecialty!=null) { ReferralToSpecTeam domainReferralToSpecialtyToBeSaved = ReferralToSpecialtyTeamVoAssembler.extractReferralToSpecTeam(factory, referralToSpecialty); factory.save(domainReferralToSpecialtyToBeSaved); trackingRecord.setCurrentReferral(null); Tracking doTracking = TrackingForTransferVoAssembler.extractTracking(factory, trackingRecord); factory.save(doTracking); trackingRecord = TrackingForTransferVoAssembler.create(doTracking); trackingRecord.validate(); } if (previousRecord != null) { EDTransfer prevRecord = EDTransferVoAssembler.extractEDTransfer(factory, previousRecord); prevRecord.setNotAccepted(true); factory.save(prevRecord); } if (trackingRecord != null ) { if (!trackingRecord.isValidated()) throw new DomainRuntimeException("TrackingForTransferVo Not Validated."); Tracking trackingForTransfer =TrackingForTransferVoAssembler.extractTracking(factory, trackingRecord); factory.save(trackingForTransfer); TrackingForTransferVo tracking = TrackingForTransferVoAssembler.create(trackingForTransfer); if(tracking != null) return tracking.getCurrentTransferRecord(); } if (record != null ) { if (!record.isValidated()) throw new DomainRuntimeException("EDTransferVo Not Validated."); doEDTransfer = EDTransferVoAssembler.extractEDTransfer(factory, record); factory.save(doEDTransfer); return EDTransferVoAssembler.create(doEDTransfer); } return null; }