/** * 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); }
/** * update booklist entry on PAS and then save locally if successful */ public void savePendingElectiveAdmission(PendingElectiveAdmissionAdmitVo pendingElective) throws DomainInterfaceException, StaleObjectException { if (pendingElective == null) throw new CodingRuntimeException("pendingElective is null in method savePendingElectiveAdmission"); if (!pendingElective.isValidated()) throw new CodingRuntimeException("pendingElective has not been validated in method savePendingElectiveAdmission"); DomainFactory factory = getDomainFactory(); PendingElectiveAdmission doPendingElective = PendingElectiveAdmissionAdmitVoAssembler.extractPendingElectiveAdmission(factory, pendingElective); BooklistRecord dtoBooklist = null; ims.dto.client.Booklist booklistRec = null; try { booklistRec = (ims.dto.client.Booklist) getDTOInstance(ims.dto.client.Booklist.class); } catch(ResultException e) { throw new DomainInterfaceException("Failed to Connect to PAS - Please check Configuration", e); } booklistRec.Filter.clear(); if(pendingElective.getPasEventIsNotNull() && pendingElective.getPasEvent().getPatientIsNotNull()) { ims.core.vo.PatientId intfId = pendingElective.getPasEvent().getPatient().getHospnum(); Result result = null; if (intfId != null) booklistRec.Filter.Hospnum = intfId.getValue(); else throw new DomainRuntimeException("No valid Interface Patient Identifier supplied."); if(doPendingElective.getTCITime() != null) booklistRec.Filter.Time = DTOHelper.convertToDtoTime(doPendingElective.getTCITime()); else throw new CodingRuntimeException("No valid TCI Time supplied."); if(doPendingElective.getTCIDate() != null) booklistRec.Filter.Date = DTOHelper.convertToDtoDate(doPendingElective.getTCIDate()); else throw new CodingRuntimeException("No valid TCI Date supplied."); result = booklistRec.get(); if(result != null && result.getId() < 0) throw new DomainInterfaceException("Attempt to get from Pas failed " + result.getMessage()); dtoBooklist = booklistRec.DataCollection.get(0); if(doPendingElective.getAllocatedWard() == null) throw new CodingRuntimeException("Allocated Ward not set"); dtoBooklist.Rescode = doPendingElective.getAllocatedWard().getExtCode(TaxonomyType.PAS.getID()); dtoBooklist.Webadt = "Y"; result = booklistRec.update(); if(result != null && result.getId() < 0) throw new DomainInterfaceException("Attempt to save to Pas failed " + result.getMessage()); } factory.save(doPendingElective); }