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 SpecimenWorkListItemListVo getSpecimenWorklistItem(Integer id) { if (id == null) throw new CodingRuntimeException("Cannot get SpecimenWorklistItem on null Id."); return SpecimenWorkListItemListVoAssembler.create((SpecimenWorkListItem) getDomainFactory().getDomainObject(SpecimenWorkListItem.class, id)); }
public void saveWorkListItem(SpecimenWorkListItemListVo specimenWorkListItem) throws StaleObjectException { if (specimenWorkListItem == null) throw new CodingRuntimeException("Cannot save null specimenWorkListItem"); if (!specimenWorkListItem.isValidated()) throw new DomainRuntimeException("SpecimenWorkListItemVo Not Validated."); DomainFactory factory = getDomainFactory(); SpecimenWorkListItem domainSpecimenWorkListItem = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, specimenWorkListItem); factory.save(domainSpecimenWorkListItem); }
public SpecimenWorkListItemListVo getWorkListItem(Integer workListItemId) { if(workListItemId == null) throw new CodingRuntimeException("Cannot get SpecimenWorkListItemListVo for null id"); DomainFactory factory = getDomainFactory(); SpecimenWorkListItem doSpecimenWorkListItem = (SpecimenWorkListItem) factory.getDomainObject(SpecimenWorkListItem.class, workListItemId); return SpecimenWorkListItemListVoAssembler.create(doSpecimenWorkListItem); }
public SpecimenWorkListItemListVo saveWorkListItem(SpecimenWorkListItemListVo specimenWorkListItem, SpecimenWorkListItemListVo prevSpecimenWorkListItem) throws StaleObjectException { if(specimenWorkListItem == null || prevSpecimenWorkListItem == null) throw new CodingRuntimeException("Cannot save null SpecimenWorkListItemListVo"); if(specimenWorkListItem.isValidated() == false) { throw new RuntimeException("Current SpecimenWorkListItemListVo is not validated"); } if(prevSpecimenWorkListItem.isValidated() == false) { throw new RuntimeException("Parent SpecimenWorkListItemListVo is not validated"); } DomainFactory factory = getDomainFactory(); //Save previous specimen SpecimenWorkListItem doPrevSpecimen = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, prevSpecimenWorkListItem); factory.save(doPrevSpecimen); SpecimenWorkListItemListVo voPrevSpecimen = SpecimenWorkListItemListVoAssembler.create(doPrevSpecimen); //Avoid stale object Exception by setting again the specimen and setting the comment from the old vo OrderSpecimenListVo newSpecimen = voPrevSpecimen.getSpecimen(); specimenWorkListItem.getSpecimen().setCollectorComment(newSpecimen.getCollectorComment()); specimenWorkListItem.setSpecimen(newSpecimen); //Save the newly created specimen SpecimenWorkListItem doSpecimen = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, specimenWorkListItem); factory.save(doSpecimen); return voPrevSpecimen; }
public SpecimenWorkListItemListVoCollection markWorkListItemsAsPrinted(SpecimenWorkListItemListVoCollection workListItemCollection) throws StaleObjectException { SpecimenWorkListItemListVoCollection voColl = new SpecimenWorkListItemListVoCollection(); DomainFactory factory = getDomainFactory(); for (int i = 0; i < workListItemCollection.size(); i++) { SpecimenWorkListItem doSpecimenWorkListItem = SpecimenWorkListItemListVoAssembler.extractSpecimenWorkListItem(factory, workListItemCollection.get(i)); factory.save(doSpecimenWorkListItem); voColl.add(SpecimenWorkListItemListVoAssembler.create(doSpecimenWorkListItem)); } return voColl; }
public SpecimenWorkListItemListVo getSpecimenWorkListItem(Integer specimenId) { if(specimenId == null) throw new CodingRuntimeException("Cannot get Specimen on null Id."); return SpecimenWorkListItemListVoAssembler.create((SpecimenWorkListItem) getDomainFactory().getDomainObject(SpecimenWorkListItem.class, specimenId)); }
public SpecimenWorkListItemListVoCollection listWorkListItems(Integer patientId, SpecimenCollectionMethod listType, SpecimenCollectionStatus status) { if (patientId == null) throw new CodingRuntimeException("Cannot get SpecimenWorkListItem for null patientId"); if (listType == null) throw new CodingRuntimeException("Cannot get SpecimenWorkListItem for null ListType"); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); StringBuffer hql = new StringBuffer(" select sp from SpecimenWorkListItem as sp left join sp.specimen as spec left join spec.order as ord left join ord.patient as pat left join sp.dFTOrderInvestigation as dft left join dft.orderDetails as dftDetails left join dftDetails.patient as dftPat"); String sqlClause = " where "; if(patientId != null) { hql.append(sqlClause); hql.append("((spec is not null and pat.id = :PATID) OR (spec is null and dftPat.id = :PATID))"); markers.add("PATID"); values.add(patientId); sqlClause = " and "; } if(listType != null) { hql.append(sqlClause); hql.append(" sp.listType = :LT"); markers.add("LT"); values.add(getDomLookup(listType)); sqlClause = " and "; } if(status != null) { hql.append(sqlClause); hql.append(" sp.collectionStatus = :STID"); markers.add("STID"); values.add(getDomLookup(status)); } else { //WDEV-12906 hql.append(sqlClause); hql.append(" ( sp.collectionStatus != :STATUS and sp.collectionStatus != :STATUS2 ) "); markers.add("STATUS"); values.add(getDomLookup(SpecimenCollectionStatus.AWAITING_AUTHORISATION)); markers.add("STATUS2"); values.add(getDomLookup(SpecimenCollectionStatus.CANCELLED)); } List list = getDomainFactory().find(hql.toString(), markers, values); return SpecimenWorkListItemListVoAssembler.createSpecimenWorkListItemListVoCollectionFromSpecimenWorkListItem(list).sort(); }
public SpecimenWorkListItemListVoCollection listWorkListItems(CareContextRefVo careContextRefVo, SpecimenCollectionMethod listType, SpecimenCollectionStatus specimenCollectionStatus) { if (careContextRefVo == null) throw new CodingRuntimeException("Cannot get SpecimenWorkListItem for null careContextRefVo"); if (listType == null) throw new CodingRuntimeException("Cannot get SpecimenWorkListItem for null ListType"); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); StringBuffer hql = new StringBuffer(" from SpecimenWorkListItem sp "); String sqlClause = " where "; if(listType != null) { hql.append(sqlClause); hql.append(" sp.listType = :LT"); markers.add("LT"); values.add(getDomLookup(listType)); sqlClause = " and "; } if(specimenCollectionStatus != null) { hql.append(sqlClause); hql.append(" sp.collectionStatus = :STID"); markers.add("STID"); values.add(getDomLookup(specimenCollectionStatus)); } else { //WDEV-12906 hql.append(sqlClause); hql.append(" ( sp.collectionStatus != :STATUS and sp.collectionStatus != :STATUS2 ) "); markers.add("STATUS"); values.add(getDomLookup(SpecimenCollectionStatus.AWAITING_AUTHORISATION)); markers.add("STATUS2"); values.add(getDomLookup(SpecimenCollectionStatus.CANCELLED)); } hql.append(" and sp.specimen.id in ( select o2_1.id from CatsReferral as c1_1 left join c1_1.investigationOrders as o1_1 left join o1_1.specimens as o2_1 where (c1_1.careContext.id = :CC))"); markers.add("CC"); values.add(careContextRefVo.getID_CareContext()); List list = getDomainFactory().find(hql.toString(), markers, values); return SpecimenWorkListItemListVoAssembler.createSpecimenWorkListItemListVoCollectionFromSpecimenWorkListItem(list).sort(); }
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); }
public SpecimenWorkListItemListVo getWorkListItemListRecord(Integer itemId) { return SpecimenWorkListItemListVoAssembler.create( (SpecimenWorkListItem)getDomainFactory().getDomainObject(SpecimenWorkListItem.class, itemId)); }