/** * listPendingElectiveAdmission */ public ims.core.vo.PendingElectiveAdmissionAdmitVoCollection listPendingElectiveAdmission(LocationRefVo voLocation) { if(voLocation == null) throw new CodingRuntimeException("voLocation is null in method listPendingElectiveAdmission"); DomainFactory factory = getDomainFactory(); List pendingElectives = factory.find("from PendingElectiveAdmission pea where (pea.tCIDate = :today or pea.tCIDate = :yesterday) and pea.allocatedWard.id = :idWard and pea.electiveAdmissionStatus = :status and pea.tCIType = :tciType ", new String[]{"today","yesterday", "idWard","status","tciType"}, new Object[]{new Date().getDate(),new Date().addDay(-1).getDate(), voLocation.getID_Location(), getDomLookup(ElectiveAdmissionStatus.TCI), getDomLookup(TCIType.BOOKED)}); return PendingElectiveAdmissionAdmitVoAssembler.createPendingElectiveAdmissionAdmitVoCollectionFromPendingElectiveAdmission(pendingElectives); }
public PendingElectiveAdmissionAdmitVoCollection listPlannedElectiveAdmission(Date dateFrom, Date dateTo, LocationRefVo ward) { if(dateFrom == null) throw new CodingRuntimeException("dateFrom is mandatory in method listPlannedElectiveAdmission"); if(dateTo == null) throw new CodingRuntimeException("dateTo is mandatory in method listPlannedElectiveAdmission"); if(ward == null) throw new CodingRuntimeException("ward is null in method listPlannedElectiveAdmission"); DomainFactory factory = getDomainFactory(); List pendingElectives = factory.find("from PendingElectiveAdmission pea where pea.tCIDate >= :dateFrom and pea.tCIDate <= :dateTo and pea.allocatedWard.id = :idWard and pea.electiveAdmissionStatus = :status and pea.tCIType = :tciType ", new String[]{"dateFrom","dateTo","idWard","status", "tciType"}, new Object[]{dateFrom.getDate(), dateTo.getDate(), ward.getID_Location(), getDomLookup(ElectiveAdmissionStatus.TCI), getDomLookup(TCIType.PLANNED)}); return PendingElectiveAdmissionAdmitVoAssembler.createPendingElectiveAdmissionAdmitVoCollectionFromPendingElectiveAdmission(pendingElectives); }
public PendingElectiveAdmissionAdmitVoCollection listPendingElectiveAdmission(LocationRefVo voLocation) { if(voLocation == null) throw new CodingRuntimeException("voLocation is null in method listPendingElectiveAdmission"); DomainFactory factory = getDomainFactory(); List pendingElectives = factory.find("from PendingElectiveAdmission pea where (pea.tCIDate = :today or pea.tCIDate = :yesterday) and pea.allocatedWard.id = :idWard and pea.electiveAdmissionStatus = :status", new String[]{"today","yesterday", "idWard","status"}, new Object[]{new Date().getDate(), new Date().addDay(-1).getDate(),voLocation.getID_Location(), getDomLookup(ElectiveAdmissionStatus.TCI)}); return PendingElectiveAdmissionAdmitVoAssembler.createPendingElectiveAdmissionAdmitVoCollectionFromPendingElectiveAdmission(pendingElectives); }
public InpatientEpisodeVo readmitPatient(PatientShort patVo, InpatientEpisodeVo episVo) throws StaleObjectException { if (!patVo.isValidated()) { throw new CodingRuntimeException("Patient VO has not been validated!"); } if (!episVo.isValidated()) { throw new CodingRuntimeException("Episode VO has not been validated!"); } if(patVo.getID_Patient() == null) { throw new CodingRuntimeException("Internal Patient ID must be valued."); } DomainFactory factory = getDomainFactory(); ims.core.patient.domain.objects.Patient domPatient = (ims.core.patient.domain.objects.Patient)factory.getDomainObject(ims.core.patient.domain.objects.Patient.class, patVo.getID_Patient().intValue()); PASEvent domTCIPas=null; if (episVo!=null&&episVo.getPreAdmitNumber()!=null) domTCIPas = PASEvent.getPASEventFrompasevent_unq1(factory, domPatient, episVo.getPreAdmitNumber()); PendingElectiveAdmission domPEA = getDomPendingElectiveAdmission(domPatient,domTCIPas); if(null!=domPEA) { domPEA.setElectiveAdmissionStatus(getDomLookup(ElectiveAdmissionStatus.ADMITTED)); factory.save(domPEA); } InpatientEpisode ipDo = InpatientEpisodeVoAssembler.extractInpatientEpisode(factory, episVo); if (ipDo!=null) { WardStay ws = new WardStay(); ws.setTransferDateTime(ipDo.getAdmissionDateTime()); if (ipDo.getPasEvent()!=null) ws.setWard(ipDo.getPasEvent().getLocation()); ws.setWardType(ipDo.getWardType()); if(ipDo.getPasEvent()!=null&&ipDo.getPasEvent().getConsultant()!=null) { ConsultantStay cs = new ConsultantStay(); cs.setConsultant(ipDo.getPasEvent().getConsultant()); cs.setTransferDateTime(ipDo.getAdmissionDateTime()); ipDo.getConsultantStays().add(cs); } ipDo.getWardStays().add(ws); } factory.save(ipDo); AdmissionDetail ad = populateAdmissionDetailfromInpatientEpisode(ipDo,episVo, null); factory.save(ad); domPatient.setWard(ipDo.getPasEvent().getLocation()); // WDEV-17867 - Set Current Responsible Clinician to Patient record domPatient.setCurrentResponsibleConsultant(ipDo.getPasEvent().getConsultant()); factory.save(domPatient); return InpatientEpisodeVoAssembler.create(ipDo); }
public InpatientEpisodeVo readmitPatient(PatientShort patVo, InpatientEpisodeVo episVo) throws StaleObjectException { if (!patVo.isValidated()) { throw new CodingRuntimeException("Patient VO has not been validated!"); } if (!episVo.isValidated()) { throw new CodingRuntimeException("Episode VO has not been validated!"); } if(patVo.getID_Patient() == null) { throw new CodingRuntimeException("Internal Patient ID must be valued."); } DomainFactory factory = getDomainFactory(); ims.core.patient.domain.objects.Patient domPatient = (ims.core.patient.domain.objects.Patient)factory.getDomainObject(ims.core.patient.domain.objects.Patient.class, patVo.getID_Patient().intValue()); PASEvent domTCIPas=null; if (episVo!=null&&episVo.getPreAdmitNumber()!=null) domTCIPas = PASEvent.getPASEventFrompasevent_unq1(factory, domPatient, episVo.getPreAdmitNumber()); PendingElectiveAdmission domPEA = getDomPendingElectiveAdmission(domPatient,domTCIPas); if(null!=domPEA) { domPEA.setElectiveAdmissionStatus(getDomLookup(ElectiveAdmissionStatus.ADMITTED)); factory.save(domPEA); } InpatientEpisode ipDo = InpatientEpisodeVoAssembler.extractInpatientEpisode(factory, episVo); if (ipDo!=null) { WardStay ws = new WardStay(); ws.setTransferDateTime(ipDo.getAdmissionDateTime()); if (ipDo.getPasEvent()!=null) ws.setWard(ipDo.getPasEvent().getLocation()); ws.setWardType(ipDo.getWardType()); if(ipDo.getPasEvent()!=null&&ipDo.getPasEvent().getConsultant()!=null) { ConsultantStay cs = new ConsultantStay(); cs.setConsultant(ipDo.getPasEvent().getConsultant()); cs.setTransferDateTime(ipDo.getAdmissionDateTime()); cs.setSpecialty(ipDo.getPasEvent().getSpecialty()); ipDo.getConsultantStays().add(cs); } ipDo.getWardStays().add(ws); } factory.save(ipDo); AdmissionDetail ad = populateAdmissionDetailfromInpatientEpisode(ipDo,episVo, null); factory.save(ad); domPatient.setWard(ipDo.getPasEvent().getLocation()); // WDEV-17867 - Set Current Responsible Clinician to Patient record domPatient.setCurrentResponsibleConsultant(ipDo.getPasEvent().getConsultant()); factory.save(domPatient); return InpatientEpisodeVoAssembler.create(ipDo); }