public SpecimenWorkListItemListVo saveWorkListItem(SpecimenWorkListItemListVo orderSpecimenVo) throws StaleObjectException { if(orderSpecimenVo == null) throw new CodingRuntimeException("Cannot save null SpecimenWorkListItemListVo"); DomainFactory factory = getDomainFactory(); SpecimenWorkListItem doSpecimenWorkListItem = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, orderSpecimenVo); if(orderSpecimenVo.getCollectionStatusIsNotNull() && orderSpecimenVo.getCollectionStatus().equals(SpecimenCollectionStatus.COLLECTIONCOMPLETE) && doSpecimenWorkListItem.getSpecimen() != null) { java.util.Set investigations = doSpecimenWorkListItem.getSpecimen().getInvestigations(); for (java.util.Iterator iter = investigations.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof OrderInvestigation) { OrderInvestigation element = (OrderInvestigation) obj; element.setDisplayDateTime(orderSpecimenVo.getSpecimen().getCollDateTimePlacer().getJavaDate()); element.setDisplayFlag(getDomLookup(OcsDisplayFlag.SPEC_COLL)); } } } factory.save(doSpecimenWorkListItem); return SpecimenWorkListItemListVoAssembler.create(doSpecimenWorkListItem); }
public SpecimenWorkListItemListVo saveWorkListItem(SpecimenWorkListItemListVo orderSpecimenVo) throws StaleObjectException { if (orderSpecimenVo == null) throw new CodingRuntimeException("Cannot save null SpecimenWorkListItemListVo"); DomainFactory factory = getDomainFactory(); SpecimenWorkListItem doSpecimenWorkListItem = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, orderSpecimenVo); if(doSpecimenWorkListItem.getSpecimen()!=null && orderSpecimenVo.getCollectionStatusIsNotNull() && orderSpecimenVo.getCollectionStatus().equals(SpecimenCollectionStatus.COLLECTIONCOMPLETE)) { java.util.Set investigations = doSpecimenWorkListItem.getSpecimen().getInvestigations(); for (java.util.Iterator iter = investigations.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof OrderInvestigation) { OrderInvestigation element = (OrderInvestigation) obj; element.setDisplayDateTime(orderSpecimenVo.getSpecimen().getCollDateTimePlacer().getJavaDate()); element.setDisplayFlag(getDomLookup(OcsDisplayFlag.SPEC_COLL)); } } } factory.save(doSpecimenWorkListItem); return SpecimenWorkListItemListVoAssembler.create(doSpecimenWorkListItem); }
public SpecimenWorkListItemListVo saveWorkListItem(SpecimenWorkListItemListVo orderSpecimenVo) throws StaleObjectException { if(orderSpecimenVo == null) throw new CodingRuntimeException("Cannot save null SpecimenWorkListItemListVo"); DomainFactory factory = getDomainFactory(); SpecimenWorkListItem doSpecimenWorkListItem = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, orderSpecimenVo); if(orderSpecimenVo.getCollectionStatusIsNotNull() && orderSpecimenVo.getCollectionStatus().equals(SpecimenCollectionStatus.COLLECTIONCOMPLETE)) { java.util.Set investigations = doSpecimenWorkListItem.getSpecimen().getInvestigations(); for (java.util.Iterator iter = investigations.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof OrderInvestigation) { OrderInvestigation element = (OrderInvestigation) obj; element.setDisplayDateTime(orderSpecimenVo.getSpecimen().getCollDateTimePlacer().getJavaDate()); element.setDisplayFlag(getDomLookup(OcsDisplayFlag.SPEC_COLL)); } } } factory.save(doSpecimenWorkListItem); return SpecimenWorkListItemListVoAssembler.create(doSpecimenWorkListItem); }
public IfOrderSpecimenVo updateNonResultableInvestigations(OrderSpecimenRefVo spc) throws StaleObjectException { // wdev-2748 27/03/2007 // For each investigation within the specimen, check whether it is // non resultable. If so, set the status to accepted (if it is currently sent) // and set the display datetime values DomainFactory factory = getDomainFactory(); OrderSpecimen domSpc = (OrderSpecimen)factory.getDomainObject(OrderSpecimen.class, spc.getID_OrderSpecimen().intValue()); Iterator it = domSpc.getInvestigations().iterator(); while (it.hasNext()) { OrderInvestigation ordInv = (OrderInvestigation) it.next(); if (ordInv.getOrdInvCurrentStatus().getOrdInvStatus().getId() == OrderInvStatus.SENT.getId() && ordInv.getInvestigation().getInvestigationIndex().getOrderability().getId() == InvestigationOrderability.ORDERONLY.getId()) { OrderedInvestigationStatus newStat = new OrderedInvestigationStatus(); newStat.setChangeDateTime(new java.util.Date()); newStat.setChangeUser("HL7InboundEngine"); newStat.setOrdInvStatus(getDomLookup(OrderInvStatus.ACCEPTED)); newStat.setStatusReason("Non-Resultable, set to accepted from related investigations"); ordInv.setOrdInvCurrentStatus(newStat); if (domSpc.getCollDateTimeFiller() != null) ordInv.setDisplayDateTime(domSpc.getCollDateTimeFiller()); else ordInv.setDisplayDateTime(domSpc.getCollDateTimePlacer()); ordInv.setDisplayFlag(getDomLookup(OcsDisplayFlag.SPEC_COLL)); } } factory.save(domSpc); return IfOrderSpecimenVoAssembler.create(domSpc); }
private Set createOrderInvestigations(List invs, Booking_Appointment doNewAppt, OcsOrderSession doOcsOrder) { Set orderInvs = new HashSet(); Iterator it = invs.iterator(); while (it.hasNext()) { Investigation doInv = (Investigation) it.next(); OrderInvestigation doOrderInv = new OrderInvestigation(); doOrderInv.setInvestigation(doInv); doOrderInv.setAppointmentDate(doNewAppt != null ? doNewAppt.getAppointmentDate() : null); doOrderInv.setOrderDetails(doOcsOrder); OrderedInvestigationStatus status = new OrderedInvestigationStatus(); status.setOrdInvStatus(getDomLookup(OrderInvStatus.ORDERED)); status.setChangeDateTime(new java.util.Date()); status.setProcessedDateTime(new java.util.Date()); status.setChangeUser("ICAB"); doOrderInv.setOrdInvCurrentStatus(status); doOrderInv.getOrdInvStatusHistory().add(status); doOrderInv.setWasOrdered(true); doOrderInv.setDisplayDateTime(new DateTime().getJavaDate()); doOrderInv.setDisplayTimeSupplied(true); doOrderInv.setDisplayFlag(getDomLookup(OcsDisplayFlag.REQUESTED)); doOrderInv.setOrdInvSeq(new Integer(0)); doOrderInv.setWasProcessed(false); orderInvs.add(doOrderInv); } return orderInvs; }
private void fillPATHInvestigationFromOBR(IfOrderInvestigationVo invVo, OBR obr, IfInvestigationLiteVo cfgInv,ProviderSystemVo providerSystem) throws Exception { LOG.debug("R01VoMapper fillPATHInvestigationFromOBR: entry"); invVo.setInvestigation(cfgInv); invVo.setFillerOrdNum(obr.getFillerOrderNumber().getEntityIdentifier().getValue()); invVo.setResultStatus((ResultStatus) svc.getLocalLookup(ResultStatus.class, ResultStatus.TYPE_ID, providerSystem.getCodeSystem().getText(), obr.getResultStatus().getValue())); //http://jira/browse/WDEV-15552 SPS sps = obr.getSpecimenSource(); LookupInstVo resultSpecimenSource=svc.getLocalLookup(LookupInstVo.class, ResultSpecimenTypes.TYPE_ID, providerSystem.getCodeSystem().getText(), sps.getSpecimenSourceNameOrCode().getIdentifier().getValue().trim()); invVo.setResultSpecimenType(resultSpecimenSource); //End http://jira/browse/WDEV-15552 // wdev-2746 ResultStatus must map to a valid lookup value if (obr.getResultStatus().getValue() != null && !invVo.getResultStatusIsNotNull()) throw new HL7Exception("ResultStatus (OBR-25) does not map to a valid local lookup (ResultStatus) - Message Rejected"); if (obr.getRequestedDateTime() != null && obr.getRequestedDateTime().getTimeOfAnEvent().getValue() != null) { invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getRequestedDateTime())); invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getRequestedDateTime()))); invVo.setDisplayFlag(OcsDisplayFlag.REQUESTED); } if (obr.getResultsRptStatusChngDateTime() != null && obr.getResultsRptStatusChngDateTime().getTimeOfAnEvent().getValue() != null) { DateTime dt = populateDateTimeVoFromTS(obr.getResultsRptStatusChngDateTime()); //JME: 20061205: Change to handle WinPath sending 189912300000 in OBR.22 instead of a null date/time if (!dt.equals(new DateTime("189912300000"))) { invVo.setDisplayDateTime(dt); invVo.setRepDateTime(dt); invVo.setResultSortDate(dt);//http://jira/browse/WDEV-18025 invVo.setRepTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getResultsRptStatusChngDateTime()))); invVo.setDisplayFlag(OcsDisplayFlag.REPORTED); invVo.setDisplayTimeSupplied(invVo.getRepTimeSupplied()); } } if (obr.getSpecimenReceivedDateTime() != null && obr.getSpecimenReceivedDateTime().getTimeOfAnEvent().getValue() != null) { invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getSpecimenReceivedDateTime())); invVo.setDisplayFlag(OcsDisplayFlag.SPEC_RECVD); invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getSpecimenReceivedDateTime()))); // WDEV-16384 - Check if expected turnaround values configured. If they are, calculated the expected result datetime invVo.setExpectedDateTime(ocsIfInbound.calculateExpectedDateTime(invVo.getInvestigation(), invVo.getDisplayDateTime())); } if (obr.getObservationDateTime() != null && obr.getObservationDateTime().getTimeOfAnEvent().getValue() != null) { invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime())); invVo.setDisplayFlag(OcsDisplayFlag.SPEC_COLL); invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getObservationDateTime()))); } /* * etc investVo.setOrderPriority(); investVo.setOrdInvCurrentStatus(); */ LOG.debug("R01VoMapper fillPATHInvestigationFromOBR: exit"); }
private void fillRADInvestigationFromOBR(IfOrderInvestigationVo invVo, OBR obr, IfInvestigationLiteVo cfgInv,ProviderSystemVo providerSystem) throws Exception { LOG.debug("R01VoMapper fillRADInvestigationFromOBR: entry"); invVo.setInvestigation(cfgInv); invVo.setFillerOrdNum(obr.getFillerOrderNumber().getEntityIdentifier().getValue()); invVo.setResultStatus((ResultStatus) svc.getLocalLookup(ResultStatus.class, ResultStatus.TYPE_ID, providerSystem.getCodeSystem().getText(), obr.getResultStatus().getValue())); // http://jira/browse/WDEV-9727 String accession = obr.getFillerField2().getValue(); if (accession!=null && !Hl7Null.equals(accession)) { invVo.setAccessionNumber(accession); } // wdev-2746 ResultStatus must map to a valid lookup value if (obr.getResultStatus().getValue() != null && !invVo.getResultStatusIsNotNull()) throw new HL7Exception("ResultStatus (OBR-25) does not map to a valid local lookup (ResultStatus) - Message Rejected"); if (obr.getRequestedDateTime() != null && obr.getRequestedDateTime().getTimeOfAnEvent().getValue() !=null) { invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getRequestedDateTime())); invVo.setDisplayFlag(OcsDisplayFlag.REQUESTED); invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getRequestedDateTime()))); } if (obr.getObservationDateTime() != null && obr.getObservationDateTime().getTimeOfAnEvent().getValue() != null) { invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime())); invVo.setDisplayFlag(OcsDisplayFlag.EXAMINED); invVo.setDisplayTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getObservationDateTime()))); // WDEV-16384 - Check if expected turnaround values configured. If they are, calculated the expected result datetime invVo.setExpectedDateTime(ocsIfInbound.calculateExpectedDateTime(invVo.getInvestigation(), invVo.getDisplayDateTime())); } if (obr.getResultsRptStatusChngDateTime() != null && obr.getResultsRptStatusChngDateTime().getTimeOfAnEvent().getValue() != null) { invVo.setRepDateTime(populateDateTimeVoFromTS(obr.getResultsRptStatusChngDateTime())); invVo.setResultSortDate(populateDateTimeVoFromTS(obr.getResultsRptStatusChngDateTime())); //http://jira/browse/WDEV-18025 invVo.setRepTimeSupplied( Boolean.valueOf(isTimeSupplied(obr.getResultsRptStatusChngDateTime()))); } else { invVo.setRepDateTime(null); invVo.setResultSortDate(null); //http://jira/browse/WDEV-18025 invVo.setRepTimeSupplied(Boolean.FALSE); // invVo.setDisplayFlag(OcsDisplayFlag.REQUESTED); // invVo.setDisplayTimeSupplied(false); // invVo.setDisplayDateTime(populateDateTimeVoFromTS(obr.getObservationDateTime())); } /* * etc investVo.setOrderPriority(); investVo.setOrdInvCurrentStatus(); */ LOG.debug("R01VoMapper fillRADInvestigationFromOBR: exit"); }
/** * Remove OrderSpecimens from OrderInvestigation created in error for DFT * @param state */ private void clearOrderSpecimensFromOrderInvestigationsDFT(OcsOrderVo ocsOrder, ORDERSTATE state) { OrderSpecimenVoCollection specimens = new OrderSpecimenVoCollection(); OrderInvestigationRefVoCollection investigationsDFT = new OrderInvestigationRefVoCollection(); for (OrderInvestigationVo investigation : ocsOrder.getInvestigations()) { if (InvEventType.TIME_SERIES.equals(investigation.getInvestigation().getEventType())) { investigation.setSpecimen(null); investigationsDFT.add(investigation); // Do not change the status of Cancelled or Cancel Requests orders if (investigation.getOrdInvCurrentStatus() == null || (!OrderInvStatus.CANCEL_REQUEST.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus()) && !OrderInvStatus.CANCELLED.equals(investigation.getOrdInvCurrentStatus().getOrdInvStatus()))) { // Set status as requested if (ORDERSTATE.AUTHORISING.equals(state)) { investigation.getOrdInvCurrentStatus().setOrdInvStatus(OrderInvStatus.ORDERED); investigation.setDisplayFlag(OcsDisplayFlag.REQUESTED); } else { investigation.getOrdInvCurrentStatus().setOrdInvStatus(OrderInvStatus.AWAITING_AUTHORISATION); investigation.setDisplayFlag(OcsDisplayFlag.REQUESTED); } } } } for (OrderSpecimenVo specimen : ocsOrder.getSpecimens()) { OrderInvestigationRefVoCollection investigationNonDFT = getNonDFTInvestigation(specimen, investigationsDFT); if (investigationNonDFT != null && investigationNonDFT.size() > 0) { specimen.setInvestigations(investigationNonDFT); specimens.add(specimen); } } ocsOrder.setSpecimens(specimens); }
public SpecimenWorkListItemListVo saveWorkListItemRecord(SpecimenWorkListItemVo record, OrderSpecimenVo specimenVo) throws StaleObjectException { DomainFactory factory = getDomainFactory(); SpecimenWorkListItem newBo = null; SpecimenWorkListItem bo = SpecimenWorkListItemVoAssembler.extractSpecimenWorkListItem(factory, record); bo.getSpecimen().setCollectorComment(specimenVo.getCollectorComment()); if(record.getCollectionStatus().equals(SpecimenCollectionStatus.COULDNOTCOLLECT)) { SpecimenWorkListItemVo newItem = new SpecimenWorkListItemVo(); newItem.setListType(SpecimenCollectionMethod.WARDCOLLECTION); newItem.setDateToCollect(new Date()); newItem.setTimeToCollect(new Time()); newItem.setCollectionStatus(SpecimenCollectionStatus.PHLEBCOULDNOTCOLLECT); newBo = SpecimenWorkListItemVoAssembler.extractSpecimenWorkListItem(factory, newItem); newBo.setSpecimen(bo.getSpecimen()); } else if(record.getCollectionStatus().equals(SpecimenCollectionStatus.COLLECTIONCOMPLETE)) { bo.getSpecimen().setCollDateTimePlacer(specimenVo.getCollDateTimePlacer().getJavaDate()); bo.getSpecimen().setCollectingMos((MemberOfStaff) factory.getDomainObject(MemberOfStaff.class, specimenVo.getCollectingMos().getID_MemberOfStaff())); java.util.Set investigations = bo.getSpecimen().getInvestigations(); for (java.util.Iterator iter = investigations.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof OrderInvestigation) { OrderInvestigation element = (OrderInvestigation) obj; element.setDisplayDateTime(bo.getSpecimen().getCollDateTimePlacer()); element.setDisplayFlag(getDomLookup(OcsDisplayFlag.SPEC_COLL)); } } } factory.save(bo); if(newBo != null) factory.save(newBo); return SpecimenWorkListItemListVoAssembler.create(bo); }