Java 类ims.core.vo.lookups.PasEventType 实例源码

项目:openMAXIMS    文件:Logic.java   
private PasEventRepatriationVo createPasEvent(PatientRefVo patient, DateTime eventDateTime, MedicRefVo consultant, LocationRefVo location, ServiceLiteVo service, SourceOfReferral sourceOfReferral)
{
    if (patient == null || patient.getID_Patient() == null)
        throw new IllegalArgumentException("'patient' - argument cannot be null or not saved into database.");

    if (eventDateTime == null)
        throw new IllegalArgumentException("'eventDateTime' - cannot be null or not saved into database.");

    PasEventRepatriationVo pasEvent = new PasEventRepatriationVo();

    // Prepare random seed
    Random rand = new Random(System.currentTimeMillis());

    pasEvent.setEventDateTime(eventDateTime);
    pasEvent.setPatient(patient);
    pasEvent.setPasEventId(patient.getID_Patient().toString() + eventDateTime.toString(DateTimeFormat.ISO) + "_" + (new DateTime()).toString(DateTimeFormat.ISO) + "_" + rand.nextInt(1000000000));
    pasEvent.setConsultant(consultant);
    pasEvent.setLocation(location);
    pasEvent.setSpecialty(service != null ? service.getSpecialty() : null);
    pasEvent.setSourceOfReferral(sourceOfReferral);
    pasEvent.setEventType(PasEventType.EMERGENCY);
    pasEvent.setService(service); //WDEV-20900

    return pasEvent;
}
项目:AvoinApotti    文件:Logic.java   
private PasEventShortVo getPASEvent()
{
    if(form.txtWorkflowID().getValue() == null || form.txtWorkflowID().getValue().trim().length() == 0)
        return null;

    PasEventShortVo pasEvent = new PasEventShortVo();

    pasEvent.setEventDateTime(form.dtimCtxStart().getValue());
    pasEvent.setPasEventId(form.txtWorkflowID().getValue());
    pasEvent.setPatient(form.getGlobalContext().Core.getPatientShort());
    pasEvent.setEventType(PasEventType.INPATIENT);
    pasEvent.setSpecialty(form.cmbConSpecialty().getValue());

    return pasEvent;
}
项目:openMAXIMS    文件:Logic.java   
private void editAdmissionDetail()
{
    //WDEV-22326
    boolean isElectiveListAdmission = form.getLocalContext().getAdmissionDetailsIsNotNull() && form.getLocalContext().getAdmissionDetails().getPasEventIsNotNull() && PasEventType.TCI.equals(form.getLocalContext().getAdmissionDetails().getPasEvent().getEventType());

    form.getLocalContext().setShowMessageBoxReviseEstDischargeDate(null);
    form.getGlobalContext().Core.setADTAdmissionDetailUpdate(populateAdmissionDetailToUpdate(form.getLocalContext().getAdmissionDetails()));
    engine.open(form.getForms().Core.ADTUpdateAdmissionDetail, new Object[]{isElectiveListAdmission});
}
项目:openMAXIMS    文件:Logic.java   
private PasEventShortVo getPASEvent()
{
    if(form.txtWorkflowID().getValue() == null || form.txtWorkflowID().getValue().trim().length() == 0)
        return null;

    PasEventShortVo pasEvent = new PasEventShortVo();

    pasEvent.setEventDateTime(form.dtimCtxStart().getValue());
    pasEvent.setPasEventId(form.txtWorkflowID().getValue());
    pasEvent.setPatient(form.getGlobalContext().Core.getPatientShort());
    pasEvent.setEventType(PasEventType.INPATIENT);
    pasEvent.setSpecialty(form.cmbConSpecialty().getValue());

    return pasEvent;
}
项目:openMAXIMS    文件:Logic.java   
private PasEventShortVo getPASEvent()
{
    if(form.txtWorkflowID().getValue() == null || form.txtWorkflowID().getValue().trim().length() == 0)
        return null;

    PasEventShortVo pasEvent = new PasEventShortVo();

    pasEvent.setEventDateTime(form.dtimCtxStart().getValue());
    pasEvent.setPasEventId(form.txtWorkflowID().getValue());
    pasEvent.setPatient(form.getGlobalContext().Core.getPatientShort());
    pasEvent.setEventType(PasEventType.INPATIENT);
    pasEvent.setSpecialty(form.cmbConSpecialty().getValue());

    return pasEvent;
}
项目:openmaxims-linux    文件:Logic.java   
private PasEventShortVo getPASEvent()
{
    if(form.txtWorkflowID().getValue() == null || form.txtWorkflowID().getValue().trim().length() == 0)
        return null;

    PasEventShortVo pasEvent = new PasEventShortVo();

    pasEvent.setEventDateTime(form.dtimCtxStart().getValue());
    pasEvent.setPasEventId(form.txtWorkflowID().getValue());
    pasEvent.setPatient(form.getGlobalContext().Core.getPatientShort());
    pasEvent.setEventType(PasEventType.INPATIENT);
    pasEvent.setSpecialty(form.cmbConSpecialty().getValue());

    return pasEvent;
}
项目:AvoinApotti    文件:Logic.java   
private void initalize() throws FormOpenException
{

    PasEventVo pasEvent = domain.getPasEvent(form.getGlobalContext().Core.getPasEvent());

    if (pasEvent.getEventType().equals(PasEventType.INPATIENT))
    {

        form.lyrCorrespondenceDetail().tabRecipients().lblStart().setValue("Admission Date:");
    }
    else
    {
        form.lyrCorrespondenceDetail().tabRecipients().lblStart().setValue("Clinic Date:");
        form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate().setVisible(false);
        form.lyrCorrespondenceDetail().tabRecipients().lblEnd().setVisible(false);
    }

    form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().setValue(pasEvent.getEventDateTime().getDate());

    form.btnCancel().setImage(form.getImages().Core.Remove);
    form.btnPrintLetter().setImage(form.getImages().Correspondence.Printer);
    form.btnSave().setImage(form.getImages().Core.Save);
    form.btnEMail().setImage(form.getImages().OCRR.Requested);
    form.btnResetTemplate().setImage(form.getImages().OCRR.Reset);

    form.btnSupplementary().setImage(form.getImages().Correspondence.Supplementry);
    form.btnUpdate().setImage(form.getImages().Admin.Edit);
    form.btnPreview().setImage(form.getImages().Core.Preview);

    form.getLocalContext().setsuplementryLetterVisible(new Boolean(ConfigFlag.UI.DISCHARGE_LETTERS_SUPPLEMENTARY_BUTTON.getValue()));

    form.btnSupplementary().setVisible(form.getLocalContext().getsuplementryLetterVisible());

    MemberOfStaffShortVo voMos = (MemberOfStaffShortVo) domain.getMosUser();
    if (null == voMos)
    {
        throw new FormOpenException("Current user not associated with a Member Of Staff");
    }

    form.getLocalContext().setloggedInMos(voMos);

    // get full paseventvo
    form.getLocalContext().setpasEventVo(domain.getPasEvent(form.getGlobalContext().Core.getPasEvent()));

}
项目:AvoinApotti    文件:Logic.java   
private void populateDataFromScreen(CorrespondenceDetailsVo voDocumentDetails)
{
    form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size();
    if (form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size() > 0)
    {
        GenForm.lyrCorrespondenceDetailLayer.tabCorrespondenceContainer.grdCategoriesRow catRow;
        CategoryNotesVoCollection voDocCatColl = new CategoryNotesVoCollection();

        for (int i = 0; i < form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size(); i++)
        {
            catRow = form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().get(i);
            if (catRow.getValue() != null)
            {
                voDocCatColl.add(catRow.getValue());
            }
        }
        voDocumentDetails.setCategories(voDocCatColl);
    }
    // Document Information

    if (form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate() != null)
        voDocumentDetails.setDischargeDate(form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate().getValue());

    if (form.getLocalContext().getpasEventVo().getEventType().equals(PasEventType.INPATIENT))
        voDocumentDetails.setAdmissionDate(form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().getValue());

    if (form.getLocalContext().getpasEventVo().getEventType().equals(PasEventType.OUTPATIENT))
        voDocumentDetails.setDateOfClinic(form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().getValue());

    voDocumentDetails.setDictatedBy(form.lyrCorrespondenceDetail().tabRecipients().qmbDictatedBy().getValue());
    voDocumentDetails.setDictatedByInitials(form.lyrCorrespondenceDetail().tabRecipients().txtDictatedByinitals().getValue());

    voDocumentDetails.setTypedByInitials(form.lyrCorrespondenceDetail().tabRecipients().txtTypedByInitials().getValue());
    voDocumentDetails.setTypedBy(form.lyrCorrespondenceDetail().tabRecipients().qmbTypedBy().getValue());

    voDocumentDetails.setEnquiriesTo(form.lyrCorrespondenceDetail().tabRecipients().qmbEnquiriesTo().getValue());

    voDocumentDetails.setWasTypedWithoutCaseNotes(form.lyrCorrespondenceDetail().tabRecipients().chkTypedWithoutCaseNotes().getValue());

    // Recipients
    if (form.lyrCorrespondenceDetail().tabRecipients().grdAdressee().getRows().size() > 0)
    {
        RecipientVoCollection voDocRecipColl = new RecipientVoCollection();

        voDocRecipColl = form.lyrCorrespondenceDetail().tabRecipients().grdAdressee().getValues();
        voDocumentDetails.setRecipients(voDocRecipColl);
    }

    // signed by
    if (form.lyrCorrespondenceDetail().tabCorrespondence().qmbSignedBy().getValue() != null)
        voDocumentDetails.setSignedBy(form.lyrCorrespondenceDetail().tabCorrespondence().qmbSignedBy().getValue());

    if (form.lyrCorrespondenceDetail().tabCorrespondence().chkSpecialInterest().getValue())
        voDocumentDetails.setSpecialInterest(form.lyrCorrespondenceDetail().tabCorrespondence().cmbType().getValue());

    form.getLocalContext().setcorrespondenceDetails(voDocumentDetails);
}
项目:AvoinApotti    文件:CorrespondenceDetailsImpl.java   
private String savePasDocumentStatus(CorrespondenceDetailsVo voDocDetail,LookupInstVo pasEventType) 
{
    if (voDocDetail != null && voDocDetail.getCurrentStatusIsNotNull())
    {
        DomainFactory factory = getDomainFactory();
        PASEvent domPas = (PASEvent) factory.getDomainObject(PASEvent.class, voDocDetail.getPasEvent().getID_PASEvent());
        PasEventLiteVo voPasEvent = PasEventLiteVoAssembler.create(domPas);
        Result dtoResult;
        String strStatus = "";

        if (pasEventType != null)
        {
            if (pasEventType.equals(PasEventType.INPATIENT))
            {
                Inpatientlist inpat = (Inpatientlist)getDTOInstance(Inpatientlist.class);
                inpat.Filter.clear();

                strStatus = "" + voDocDetail.getCurrentStatus().getId();

                // Update impatient list
                inpat.Filter.Contactno = voPasEvent.getPasEventId();
                dtoResult = inpat.get();
                if (null  != dtoResult)
                    return new String(dtoResult.toString());

                inpat.DataCollection.get(0).Documentstatus = strStatus;
                dtoResult = inpat.update();
                if (null != dtoResult)
                    return new String(dtoResult.toString());
            }
            else if (pasEventType.equals(PasEventType.OUTPATIENT))
            {
                Outpatientlist outpat = (Outpatientlist)getDTOInstance(Outpatientlist.class);
                outpat.Filter.clear();

                strStatus = "" + voDocDetail.getCurrentStatus().getId();

                // Update outpatient list
                outpat.Filter.Contactno = voPasEvent.getPasEventId();                   
                dtoResult = outpat.get();
                if (null  != dtoResult)
                    return new String(dtoResult.toString());

                outpat.DataCollection.get(0).Documentstatus = strStatus;                    

                dtoResult = outpat.update();
                if (null != dtoResult)
                    return new String(dtoResult.toString());                
            }
        }
        else
            return ("No PAS event type found");

        Patientcontacts patientContacts = (Patientcontacts)getDTOInstance(Patientcontacts.class);
        patientContacts.Filter.clear();         

        PatientcontactsRecord patientContactsRecord = patientContacts.new PatientcontactsRecord();
        patientContactsRecord.Contactno = voPasEvent.getPasEventId();
        patientContactsRecord.Documentstatus = strStatus;

        patientContacts.Filter.Contactno = voPasEvent.getPasEventId();
        dtoResult = patientContacts.get();

        if (null != dtoResult)
            return new String (dtoResult.toString());

        patientContacts.DataCollection.get(0).Documentstatus = strStatus;
        dtoResult = patientContacts.update();
        if (null != dtoResult)
            return new String(dtoResult.toString());

    }

    return new String();        
}
项目:AvoinApotti    文件:Logic.java   
private AdmissionDetailVo createAdmissionDetails(PatientShort patient)
{
    // Fill in data into PatientElectiveList.TCIDetails.AdmissionDetail record - create a new one if needed
    AdmissionDetailVo admissionDetails = new AdmissionDetailVo();

        PasEventAdmitVo pasEvent = new PasEventAdmitVo();

        if (form.ccConsultant().getValue() != null)
            pasEvent.setConsultant(domain.getMedic(new HcpRefVo(form.ccConsultant().getValue().getIMosHcpId(), 0)));
        else
            pasEvent.setConsultant(null);

        pasEvent.setEventDateTime(form.dtimAdmit().getValue());
        pasEvent.setEventType(PasEventType.EMERGENCY);
        pasEvent.setLocation(form.cmbWard().getValue());
        patient.setWard(form.cmbWard().getValue());
        pasEvent.setPatient(patient);
        pasEvent.setSpecialty(form.cmbSpecialty().getValue());
        pasEvent.setPasEventId(patient.getID_Patient().toString() + pasEvent.getEventDateTime().toString(DateTimeFormat.ISO));
        pasEvent.setSourceOfReferral(form.cmbSourceOfReferral().getValue());

        admissionDetails.setPasEvent(pasEvent);


    admissionDetails.setAdmissionDateTime(form.dtimAdmit().getValue());
    admissionDetails.setWard(form.cmbWard().getValue());
    if (form.getGlobalContext().Core.getSelectedBedSpaceState() != null)
        admissionDetails.setBed(form.getGlobalContext().Core.getSelectedBedSpaceState().getBedSpace());

    if (form.ccConsultant().getValue() != null)
        admissionDetails.setConsultant(domain.getMedic(new HcpRefVo(form.ccConsultant().getValue().getIMosHcpId(), 0)));
    else
        admissionDetails.setConsultant(null);

    admissionDetails.setSpecialty(form.cmbSpecialty().getValue());
    admissionDetails.setWardType(form.cmbWardType().getValue());
    admissionDetails.setMethodOfAdmission(form.cmbMethod().getValue());
    admissionDetails.setSourceOfAdmission(form.cmbSource().getValue());
    admissionDetails.setReasonForAdmission(form.txtReason().getValue());
    admissionDetails.setEstDischargeDate(form.dteEstDischarge().getValue());
    admissionDetails.setIsChaplainRequired(form.chkChaplain().getValue());
    admissionDetails.setReferringConsultant(form.ccReferringConsultant().getValue());
    admissionDetails.setPatientStatus(form.cmbPatientStatus().getValue());
    admissionDetails.setAnticipatedStay(form.intAntStay().getValue());

    return admissionDetails;
}
项目:AvoinApotti    文件:ADTImpl.java   
/**
*   Populates as many of the PasEvent fields as it can from the PasContact
*  CareContext,IsVip,ReferringGP,SourceOfReferral are left as null 
*  EventDateTime depends on whether we are listing inpatients or outpatients and
*  is populated external to this method.
*/
public PasEventVo createPasEvent(DateTime eventDateTime, PatientRefVo voRefPatient, PasContactVo voPasContact) throws StaleObjectException, UniqueKeyViolationException   
{
    PasEventVo voPasEvent = new PasEventVo();

    voPasEvent.setEventDateTime(eventDateTime);

    if (voPasContact.getConsultant() != null)
    {
        MedicWithMappingsLiteVo medLite = new MedicWithMappingsLiteVo(voPasContact.getConsultant().getID_Hcp(), voPasContact.getConsultant().getVersion_Hcp());
        medLite.setMos(voPasContact.getConsultant().getMos());
        voPasEvent.setConsultant(medLite);          
    }
    voPasEvent.setLocation(voPasContact.getLocation());
    voPasEvent.setSpecialty(voPasContact.getSpecialty());
    voPasEvent.setPasEventId(voPasContact.getContactNumber());
    //      voPasEvent.setPatient(voPasContact.getPatient());
    GpLiteToPracticeLiteVo voGpLiteToPracList = synchronizeGPPracticeDetails(voPasContact.getGPCode());
    if (voGpLiteToPracList != null)
    {
        voPasEvent.setReferringGP(voGpLiteToPracList.getGp());
        if (voGpLiteToPracList.getPracticeIsNotNull() && voGpLiteToPracList.getPractice().getSurgeriesIsNotNull() && voGpLiteToPracList.getPractice().getSurgeries().size() > 0)
            voPasEvent.setReferringGpSurgery(voGpLiteToPracList.getPractice().getSurgeries().get(0));
    }

    if (voPasContact.getAppointmentDateTimeIsNotNull())
        voPasEvent.setEventType(PasEventType.OUTPATIENT);
    else if (voPasContact.getDischargeDateTimeIsNotNull())
        voPasEvent.setEventType(PasEventType.INPATIENT);

    DomainFactory factory = getDomainFactory();
    PASEvent domPasEvent = PasEventVoAssembler.extractPASEvent(factory, voPasEvent);

    ims.core.patient.domain.objects.Patient domPatient = (ims.core.patient.domain.objects.Patient)factory.getDomainObject(ims.core.patient.domain.objects.Patient.class, voRefPatient.getID_Patient().intValue()); 
    domPasEvent.setPatient(domPatient);
    try 
    {
        factory.save(domPasEvent);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException(e.getMessage());
    }

    return PasEventVoAssembler.create(domPasEvent);
}
项目:AvoinApotti    文件:VoMapper.java   
public CareSpellVo createCareSpellVo(PasEventVo pas, PV1 pv)throws HL7Exception
{
    CareSpellVo careSpell=new CareSpellVo();
    if(pas!=null && pas.getEventDateTime()!=null)
        careSpell.setStartDate( pas.getEventDateTime().getDate());
    else
        throw new HL7Exception("Validation of PasEvent failed. Set the Event Date Time in PV1-44");

    careSpell.setPatient(pas.getPatient());
    EpisodeofCareVo episode=new EpisodeofCareVo();
    episode.setCareSpell(careSpell);
    episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.NAT_CONS_CODE, pv.getConsultingDoctor(0).getIDNumber().getValue()));

    // wdev-4883 Check for PAS code mapping if national consultant code not found
    if (!episode.getResponsibleHCPIsNotNull())
    {
        episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.PAS, pv.getConsultingDoctor(1).getIDNumber().getValue()));
    }

    episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
    episode.setSpecialty(pas.getSpecialty());
    episode.setStartDate( pas.getEventDateTime().getDate());
    EpisodeofCareVoCollection episodes=new EpisodeofCareVoCollection();
    episodes.add(episode);
    CareContextVo careContext=new CareContextVo();
    careContext.setEpisodeOfCare(episode);
    ContextType context=new ContextType();
    if (pv.getPatientClass().getValue().equals("I"))
    {
        context = ContextType.INPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.INPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("O"))
    {
        context = ContextType.OUTPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.OUTPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("P"))
    {
        context = ContextType.TCI;
        pas.setEventType(ims.core.vo.lookups.PasEventType.TCI);
    }
    else
    {
        context = ContextType.GHGSURGERY;
    }
    careContext.setContext(context);
    careContext.setStartDateTime(pas.getEventDateTime());
    careContext.setPasEvent(pas);
    careContext.setResponsibleHCP(episode.getResponsibleHCP());

    //WDEV-10231
    careContext.setCurrentStatus(new CareContextStatusHistoryVo());
    careContext.getCurrentStatus().setStatus(CareContextStatus.OPEN);
    careContext.getCurrentStatus().setStatusDateTime(pas.getEventDateTime());

    LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), TaxonomyType.PAS);
    LocSiteRefVo orderingHospRef = new LocSiteRefVo();
    if (loc!=null)
    {
        orderingHospRef.setID_Location(loc.getBoId());
        careContext.setOrderingHospital(orderingHospRef);
    }


    CareContextVoCollection careContexts=new CareContextVoCollection();
    careContexts.add(careContext);
    episode.setCareContexts(careContexts);
    careSpell.setEpisodes(episodes);

    return careSpell;


}
项目:openMAXIMS    文件:Logic.java   
private void initalize() throws FormOpenException
{

    PasEventVo pasEvent = domain.getPasEvent(form.getGlobalContext().Core.getPasEvent());

    if (pasEvent.getEventType().equals(PasEventType.INPATIENT))
    {

        form.lyrCorrespondenceDetail().tabRecipients().lblStart().setValue("Admission Date:");
    }
    else
    {
        form.lyrCorrespondenceDetail().tabRecipients().lblStart().setValue("Clinic Date:");
        form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate().setVisible(false);
        form.lyrCorrespondenceDetail().tabRecipients().lblEnd().setVisible(false);
    }

    form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().setValue(pasEvent.getEventDateTime().getDate());

    form.btnCancel().setImage(form.getImages().Core.Remove);
    form.btnPrintLetter().setImage(form.getImages().Correspondence.Printer);
    form.btnSave().setImage(form.getImages().Core.Save);
    form.btnEMail().setImage(form.getImages().OCRR.Requested);
    form.btnResetTemplate().setImage(form.getImages().OCRR.Reset);

    form.btnSupplementary().setImage(form.getImages().Correspondence.Supplementry);
    form.btnUpdate().setImage(form.getImages().Admin.Edit);
    form.btnPreview().setImage(form.getImages().Core.Preview);

    form.getLocalContext().setsuplementryLetterVisible(new Boolean(ConfigFlag.UI.DISCHARGE_LETTERS_SUPPLEMENTARY_BUTTON.getValue()));

    form.btnSupplementary().setVisible(form.getLocalContext().getsuplementryLetterVisible());

    MemberOfStaffShortVo voMos = (MemberOfStaffShortVo) domain.getMosUser();
    if (null == voMos)
    {
        throw new FormOpenException("Current user not associated with a Member Of Staff");
    }

    form.getLocalContext().setloggedInMos(voMos);

    // get full paseventvo
    form.getLocalContext().setpasEventVo(domain.getPasEvent(form.getGlobalContext().Core.getPasEvent()));

}
项目:openMAXIMS    文件:Logic.java   
private void populateDataFromScreen(CorrespondenceDetailsVo voDocumentDetails)
{
    form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size();
    if (form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size() > 0)
    {
        GenForm.lyrCorrespondenceDetailLayer.tabCorrespondenceContainer.grdCategoriesRow catRow;
        CategoryNotesVoCollection voDocCatColl = new CategoryNotesVoCollection();

        for (int i = 0; i < form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size(); i++)
        {
            catRow = form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().get(i);
            if (catRow.getValue() != null)
            {
                voDocCatColl.add(catRow.getValue());
            }
        }
        voDocumentDetails.setCategories(voDocCatColl);
    }
    // Document Information

    if (form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate() != null)
        voDocumentDetails.setDischargeDate(form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate().getValue());

    if (form.getLocalContext().getpasEventVo().getEventType().equals(PasEventType.INPATIENT))
        voDocumentDetails.setAdmissionDate(form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().getValue());

    if (form.getLocalContext().getpasEventVo().getEventType().equals(PasEventType.OUTPATIENT))
        voDocumentDetails.setDateOfClinic(form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().getValue());

    voDocumentDetails.setDictatedBy(form.lyrCorrespondenceDetail().tabRecipients().qmbDictatedBy().getValue());
    voDocumentDetails.setDictatedByInitials(form.lyrCorrespondenceDetail().tabRecipients().txtDictatedByinitals().getValue());

    voDocumentDetails.setTypedByInitials(form.lyrCorrespondenceDetail().tabRecipients().txtTypedByInitials().getValue());
    voDocumentDetails.setTypedBy(form.lyrCorrespondenceDetail().tabRecipients().qmbTypedBy().getValue());

    voDocumentDetails.setEnquiriesTo(form.lyrCorrespondenceDetail().tabRecipients().qmbEnquiriesTo().getValue());

    voDocumentDetails.setWasTypedWithoutCaseNotes(form.lyrCorrespondenceDetail().tabRecipients().chkTypedWithoutCaseNotes().getValue());

    // Recipients
    if (form.lyrCorrespondenceDetail().tabRecipients().grdAdressee().getRows().size() > 0)
    {
        RecipientVoCollection voDocRecipColl = new RecipientVoCollection();

        voDocRecipColl = form.lyrCorrespondenceDetail().tabRecipients().grdAdressee().getValues();
        voDocumentDetails.setRecipients(voDocRecipColl);
    }

    // signed by
    if (form.lyrCorrespondenceDetail().tabCorrespondence().qmbSignedBy().getValue() != null)
        voDocumentDetails.setSignedBy(form.lyrCorrespondenceDetail().tabCorrespondence().qmbSignedBy().getValue());

    if (form.lyrCorrespondenceDetail().tabCorrespondence().chkSpecialInterest().getValue())
        voDocumentDetails.setSpecialInterest(form.lyrCorrespondenceDetail().tabCorrespondence().cmbType().getValue());

    form.getLocalContext().setcorrespondenceDetails(voDocumentDetails);
}
项目:openMAXIMS    文件:CorrespondenceDetailsImpl.java   
private String savePasDocumentStatus(CorrespondenceDetailsVo voDocDetail,LookupInstVo pasEventType) 
{
    if (voDocDetail != null && voDocDetail.getCurrentStatusIsNotNull())
    {
        DomainFactory factory = getDomainFactory();
        PASEvent domPas = (PASEvent) factory.getDomainObject(PASEvent.class, voDocDetail.getPasEvent().getID_PASEvent());
        PasEventLiteVo voPasEvent = PasEventLiteVoAssembler.create(domPas);
        Result dtoResult;
        String strStatus = "";

        if (pasEventType != null)
        {
            if (pasEventType.equals(PasEventType.INPATIENT))
            {
                Inpatientlist inpat = (Inpatientlist)getDTOInstance(Inpatientlist.class);
                inpat.Filter.clear();

                strStatus = "" + voDocDetail.getCurrentStatus().getId();

                // Update impatient list
                inpat.Filter.Contactno = voPasEvent.getPasEventId();
                dtoResult = inpat.get();
                if (null  != dtoResult)
                    return new String(dtoResult.toString());

                inpat.DataCollection.get(0).Documentstatus = strStatus;
                dtoResult = inpat.update();
                if (null != dtoResult)
                    return new String(dtoResult.toString());
            }
            else if (pasEventType.equals(PasEventType.OUTPATIENT))
            {
                Outpatientlist outpat = (Outpatientlist)getDTOInstance(Outpatientlist.class);
                outpat.Filter.clear();

                strStatus = "" + voDocDetail.getCurrentStatus().getId();

                // Update outpatient list
                outpat.Filter.Contactno = voPasEvent.getPasEventId();                   
                dtoResult = outpat.get();
                if (null  != dtoResult)
                    return new String(dtoResult.toString());

                outpat.DataCollection.get(0).Documentstatus = strStatus;                    

                dtoResult = outpat.update();
                if (null != dtoResult)
                    return new String(dtoResult.toString());                
            }
        }
        else
            return ("No PAS event type found");

        Patientcontacts patientContacts = (Patientcontacts)getDTOInstance(Patientcontacts.class);
        patientContacts.Filter.clear();         

        PatientcontactsRecord patientContactsRecord = patientContacts.new PatientcontactsRecord();
        patientContactsRecord.Contactno = voPasEvent.getPasEventId();
        patientContactsRecord.Documentstatus = strStatus;

        patientContacts.Filter.Contactno = voPasEvent.getPasEventId();
        dtoResult = patientContacts.get();

        if (null != dtoResult)
            return new String (dtoResult.toString());

        patientContacts.DataCollection.get(0).Documentstatus = strStatus;
        dtoResult = patientContacts.update();
        if (null != dtoResult)
            return new String(dtoResult.toString());

    }

    return new String();        
}
项目:openMAXIMS    文件:Logic.java   
private AdmissionDetailVo createAdmissionDetails(PatientLite_IdentifiersVo patient)
{
    // Fill in data into PatientElectiveList.TCIDetails.AdmissionDetail record - create a new one if needed
    AdmissionDetailVo admissionDetails = new AdmissionDetailVo();

        PasEventAdmitVo pasEvent = new PasEventAdmitVo();

        if (form.qmbConsultant().getValue() != null) //WDEV-23376
        {   
            MedicVo medicVo = domain.getMedic(form.qmbConsultant().getValue().toHcpRefVo());
            pasEvent.setConsultant(new MedicRefVo(medicVo.getID_Hcp(), medicVo.getVersion_Hcp()));
        }   
        else
            pasEvent.setConsultant(null);

        pasEvent.setEventDateTime(form.dtimAdmit().getValue());
        pasEvent.setEventType(PasEventType.EMERGENCY);
        pasEvent.setLocation(form.cmbWard().getValue());
        patient.setWard(form.cmbWard().getValue());
        pasEvent.setPatient(patient);
        pasEvent.setSpecialty(form.cmbSpecialty().getValue());
        pasEvent.setPasEventId(patient.getID_Patient().toString() + pasEvent.getEventDateTime().toString(DateTimeFormat.ISO));
        pasEvent.setSourceOfReferral(form.cmbSourceOfReferral().getValue());
        pasEvent.setService(form.qmbService().getValue()); //WDEV-20910

        admissionDetails.setPasEvent(pasEvent);


    admissionDetails.setAdmissionDateTime(form.dtimAdmit().getValue());
    admissionDetails.setWard(form.cmbWard().getValue());
    admissionDetails.setAdmissionWard(form.cmbWard().getValue());

    if (form.getGlobalContext().Core.getSelectedBedSpaceState() != null)
        admissionDetails.setBed(form.getGlobalContext().Core.getSelectedBedSpaceState().getBedSpace());

    if (form.qmbConsultant().getValue() != null)
        admissionDetails.setConsultant(domain.getMedic(new HcpRefVo(form.qmbConsultant().getValue().getIMosHcpId(), 0)));
    else
        admissionDetails.setConsultant(null);

    admissionDetails.setSpecialty(form.cmbSpecialty().getValue());
    admissionDetails.setWardType(form.cmbWardType().getValue());
    admissionDetails.setMethodOfAdmission(form.cmbMethod().getValue());
    admissionDetails.setSourceOfAdmission(form.cmbSource().getValue());
    admissionDetails.setReasonForAdmission(form.txtReason().getValue());
    admissionDetails.setEstDischargeDate(ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS") ? form.dtimEstDischarge().getValue() : (form.dteEstDischarge().getValue() != null ? new DateTime(form.dteEstDischarge().getValue(), new Time(0,0)) : null));
    admissionDetails.setIsChaplainRequired(form.chkChaplain().getValue());
    admissionDetails.setSourceOfEmergencyReferral(form.cmbSourceOfEmergencyReferral().getValue());
    admissionDetails.setReferringConsultant((MedicVo) form.ccReferringConsultant().getValue());
    admissionDetails.setPatientStatus(form.cmbPatientStatus().getValue());
    admissionDetails.setAnticipatedStay(form.intAntStay().getValue());
    admissionDetails.setIsMaternity(form.chkIsMaternity().getValue());
    //WDEV-20323 On Admission, service needs to be saved alongside the specialty - this will be saved in Admission Detail and Consultant Stay
    admissionDetails.setService(form.qmbService().getValue()); //WDEV-20323
    if (ConfigFlag.UI.BED_INFO_UI_TYPE.getValue().equals("MAXIMS"))
    {   
        admissionDetails.setSelfAdmitPatient(form.chkSelfAdmitPatient().getValue());
        admissionDetails.setHealthyLodgerDetails(form.getGlobalContext().Core.getHealthyLodgerDetails());
    }   

    admissionDetails.setUpdateCFL(form.CaseFolderYesNo().getValue() != null && form.CaseFolderYesNo().getValue().equals(CaseFolderYesNoEnumeration.rdoYes));

    return admissionDetails;
}
项目:openMAXIMS    文件:ADTImpl.java   
/**
*   Populates as many of the PasEvent fields as it can from the PasContact
*  CareContext,IsVip,ReferringGP,SourceOfReferral are left as null 
*  EventDateTime depends on whether we are listing inpatients or outpatients and
*  is populated external to this method.
*/
public PasEventVo createPasEvent(DateTime eventDateTime, PatientRefVo voRefPatient, PasContactVo voPasContact) throws StaleObjectException, UniqueKeyViolationException   
{
    PasEventVo voPasEvent = new PasEventVo();

    voPasEvent.setEventDateTime(eventDateTime);

    if (voPasContact.getConsultant() != null)
    {
        MedicWithMappingsLiteVo medLite = new MedicWithMappingsLiteVo(voPasContact.getConsultant().getID_Hcp(), voPasContact.getConsultant().getVersion_Hcp());
        medLite.setMos(voPasContact.getConsultant().getMos());
        voPasEvent.setConsultant(medLite);          
    }
    voPasEvent.setLocation(voPasContact.getLocation());
    voPasEvent.setSpecialty(voPasContact.getSpecialty());
    voPasEvent.setPasEventId(voPasContact.getContactNumber());
    //      voPasEvent.setPatient(voPasContact.getPatient());
    GpLiteToPracticeLiteVo voGpLiteToPracList = synchronizeGPPracticeDetails(voPasContact.getGPCode());
    if (voGpLiteToPracList != null)
    {
        voPasEvent.setReferringGP(voGpLiteToPracList.getGp());
        if (voGpLiteToPracList.getPracticeIsNotNull() && voGpLiteToPracList.getPractice().getSurgeriesIsNotNull() && voGpLiteToPracList.getPractice().getSurgeries().size() > 0)
            voPasEvent.setReferringGpSurgery(voGpLiteToPracList.getPractice().getSurgeries().get(0));
    }

    if (voPasContact.getAppointmentDateTimeIsNotNull())
        voPasEvent.setEventType(PasEventType.OUTPATIENT);
    else if (voPasContact.getDischargeDateTimeIsNotNull())
        voPasEvent.setEventType(PasEventType.INPATIENT);

    DomainFactory factory = getDomainFactory();
    PASEvent domPasEvent = PasEventVoAssembler.extractPASEvent(factory, voPasEvent);

    ims.core.patient.domain.objects.Patient domPatient = (ims.core.patient.domain.objects.Patient)factory.getDomainObject(ims.core.patient.domain.objects.Patient.class, voRefPatient.getID_Patient().intValue()); 
    domPasEvent.setPatient(domPatient);
    try 
    {
        factory.save(domPasEvent);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException(e.getMessage());
    }

    return PasEventVoAssembler.create(domPasEvent);
}
项目:openMAXIMS    文件:VoMapper.java   
public CareSpellVo createCareSpellVo(PasEventVo pas, PV1 pv, ProviderSystemVo providerSystem)throws HL7Exception //WDEV-20278
    {
        CareSpellVo careSpell=new CareSpellVo();
        if(pas!=null && pas.getEventDateTime()!=null)
            careSpell.setStartDate( pas.getEventDateTime().getDate());
        else
            throw new HL7Exception("Validation of PasEvent failed. Set the Event Date Time in PV1-44");

        careSpell.setPatient(pas.getPatient());
        EpisodeofCareVo episode=new EpisodeofCareVo();
        episode.setCareSpell(careSpell);
        episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.NAT_CONS_CODE, pv.getConsultingDoctor(0).getIDNumber().getValue()));

        // wdev-4883 Check for PAS code mapping if national consultant code not found
        if (!episode.getResponsibleHCPIsNotNull())
        {
            episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.PAS, pv.getConsultingDoctor(1).getIDNumber().getValue()));
        }

        episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
        episode.setSpecialty(pas.getSpecialty());
        episode.setStartDate( pas.getEventDateTime().getDate());
        EpisodeofCareVoCollection episodes=new EpisodeofCareVoCollection();
        episodes.add(episode);
        CareContextVo careContext=new CareContextVo();
        careContext.setEpisodeOfCare(episode);
        ContextType context=new ContextType();
        if (pv.getPatientClass().getValue().equals("I"))
        {
            context = ContextType.INPATIENT;
            pas.setEventType(ims.core.vo.lookups.PasEventType.INPATIENT);
        }
        else if (pv.getPatientClass().getValue().equals("O"))
        {
            context = ContextType.OUTPATIENT;
            pas.setEventType(ims.core.vo.lookups.PasEventType.OUTPATIENT);
        }
        else if (pv.getPatientClass().getValue().equals("P"))
        {
            context = ContextType.TCI;
            pas.setEventType(ims.core.vo.lookups.PasEventType.TCI);
        }
        else
        {
            context = ContextType.GHGSURGERY;
        }
        careContext.setContext(context);
        careContext.setStartDateTime(pas.getEventDateTime());
        careContext.setPasEvent(pas);
        careContext.setResponsibleHCP(episode.getResponsibleHCP());

        //WDEV-10231
        careContext.setCurrentStatus(new CareContextStatusHistoryVo());
        careContext.getCurrentStatus().setStatus(CareContextStatus.OPEN);
        careContext.getCurrentStatus().setStatusDateTime(pas.getEventDateTime());

        //WDEV-20278
//      LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), TaxonomyType.PAS);
        LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), providerSystem.getCodeSystem()); //WDEV-20278
        LocSiteRefVo orderingHospRef = new LocSiteRefVo();
        if (loc!=null)
        {
            orderingHospRef.setID_Location(loc.getBoId());
            careContext.setOrderingHospital(orderingHospRef);
        }


        CareContextVoCollection careContexts=new CareContextVoCollection();
        careContexts.add(careContext);
        episode.setCareContexts(careContexts);
        careSpell.setEpisodes(episodes);

        return careSpell;

    }
项目:openMAXIMS    文件:Logic.java   
private void initalize() throws FormOpenException
{

    PasEventVo pasEvent = domain.getPasEvent(form.getGlobalContext().Core.getPasEvent());

    if (pasEvent.getEventType().equals(PasEventType.INPATIENT))
    {

        form.lyrCorrespondenceDetail().tabRecipients().lblStart().setValue("Admission Date:");
    }
    else
    {
        form.lyrCorrespondenceDetail().tabRecipients().lblStart().setValue("Clinic Date:");
        form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate().setVisible(false);
        form.lyrCorrespondenceDetail().tabRecipients().lblEnd().setVisible(false);
    }

    form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().setValue(pasEvent.getEventDateTime().getDate());

    form.btnCancel().setImage(form.getImages().Core.Remove);
    form.btnPrintLetter().setImage(form.getImages().Correspondence.Printer);
    form.btnSave().setImage(form.getImages().Core.Save);
    form.btnEMail().setImage(form.getImages().OCRR.Requested);
    form.btnResetTemplate().setImage(form.getImages().OCRR.Reset);

    form.btnSupplementary().setImage(form.getImages().Correspondence.Supplementry);
    form.btnUpdate().setImage(form.getImages().Admin.Edit);
    form.btnPreview().setImage(form.getImages().Core.Preview);

    form.getLocalContext().setsuplementryLetterVisible(new Boolean(ConfigFlag.UI.DISCHARGE_LETTERS_SUPPLEMENTARY_BUTTON.getValue()));

    form.btnSupplementary().setVisible(form.getLocalContext().getsuplementryLetterVisible());

    MemberOfStaffShortVo voMos = (MemberOfStaffShortVo) domain.getMosUser();
    if (null == voMos)
    {
        throw new FormOpenException("Current user not associated with a Member Of Staff");
    }

    form.getLocalContext().setloggedInMos(voMos);

    // get full paseventvo
    form.getLocalContext().setpasEventVo(domain.getPasEvent(form.getGlobalContext().Core.getPasEvent()));

}
项目:openMAXIMS    文件:Logic.java   
private void populateDataFromScreen(CorrespondenceDetailsVo voDocumentDetails)
{
    form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size();
    if (form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size() > 0)
    {
        GenForm.lyrCorrespondenceDetailLayer.tabCorrespondenceContainer.grdCategoriesRow catRow;
        CategoryNotesVoCollection voDocCatColl = new CategoryNotesVoCollection();

        for (int i = 0; i < form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size(); i++)
        {
            catRow = form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().get(i);
            if (catRow.getValue() != null)
            {
                voDocCatColl.add(catRow.getValue());
            }
        }
        voDocumentDetails.setCategories(voDocCatColl);
    }
    // Document Information

    if (form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate() != null)
        voDocumentDetails.setDischargeDate(form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate().getValue());

    if (form.getLocalContext().getpasEventVo().getEventType().equals(PasEventType.INPATIENT))
        voDocumentDetails.setAdmissionDate(form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().getValue());

    if (form.getLocalContext().getpasEventVo().getEventType().equals(PasEventType.OUTPATIENT))
        voDocumentDetails.setDateOfClinic(form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().getValue());

    voDocumentDetails.setDictatedBy(form.lyrCorrespondenceDetail().tabRecipients().qmbDictatedBy().getValue());
    voDocumentDetails.setDictatedByInitials(form.lyrCorrespondenceDetail().tabRecipients().txtDictatedByinitals().getValue());

    voDocumentDetails.setTypedByInitials(form.lyrCorrespondenceDetail().tabRecipients().txtTypedByInitials().getValue());
    voDocumentDetails.setTypedBy(form.lyrCorrespondenceDetail().tabRecipients().qmbTypedBy().getValue());

    voDocumentDetails.setEnquiriesTo(form.lyrCorrespondenceDetail().tabRecipients().qmbEnquiriesTo().getValue());

    voDocumentDetails.setWasTypedWithoutCaseNotes(form.lyrCorrespondenceDetail().tabRecipients().chkTypedWithoutCaseNotes().getValue());

    // Recipients
    if (form.lyrCorrespondenceDetail().tabRecipients().grdAdressee().getRows().size() > 0)
    {
        RecipientVoCollection voDocRecipColl = new RecipientVoCollection();

        voDocRecipColl = form.lyrCorrespondenceDetail().tabRecipients().grdAdressee().getValues();
        voDocumentDetails.setRecipients(voDocRecipColl);
    }

    // signed by
    if (form.lyrCorrespondenceDetail().tabCorrespondence().qmbSignedBy().getValue() != null)
        voDocumentDetails.setSignedBy(form.lyrCorrespondenceDetail().tabCorrespondence().qmbSignedBy().getValue());

    if (form.lyrCorrespondenceDetail().tabCorrespondence().chkSpecialInterest().getValue())
        voDocumentDetails.setSpecialInterest(form.lyrCorrespondenceDetail().tabCorrespondence().cmbType().getValue());

    form.getLocalContext().setcorrespondenceDetails(voDocumentDetails);
}
项目:openMAXIMS    文件:CorrespondenceDetailsImpl.java   
private String savePasDocumentStatus(CorrespondenceDetailsVo voDocDetail,LookupInstVo pasEventType) 
{
    if (voDocDetail != null && voDocDetail.getCurrentStatusIsNotNull())
    {
        DomainFactory factory = getDomainFactory();
        PASEvent domPas = (PASEvent) factory.getDomainObject(PASEvent.class, voDocDetail.getPasEvent().getID_PASEvent());
        PasEventLiteVo voPasEvent = PasEventLiteVoAssembler.create(domPas);
        Result dtoResult;
        String strStatus = "";

        if (pasEventType != null)
        {
            if (pasEventType.equals(PasEventType.INPATIENT))
            {
                Inpatientlist inpat = (Inpatientlist)getDTOInstance(Inpatientlist.class);
                inpat.Filter.clear();

                strStatus = "" + voDocDetail.getCurrentStatus().getId();

                // Update impatient list
                inpat.Filter.Contactno = voPasEvent.getPasEventId();
                dtoResult = inpat.get();
                if (null  != dtoResult)
                    return new String(dtoResult.toString());

                inpat.DataCollection.get(0).Documentstatus = strStatus;
                dtoResult = inpat.update();
                if (null != dtoResult)
                    return new String(dtoResult.toString());
            }
            else if (pasEventType.equals(PasEventType.OUTPATIENT))
            {
                Outpatientlist outpat = (Outpatientlist)getDTOInstance(Outpatientlist.class);
                outpat.Filter.clear();

                strStatus = "" + voDocDetail.getCurrentStatus().getId();

                // Update outpatient list
                outpat.Filter.Contactno = voPasEvent.getPasEventId();                   
                dtoResult = outpat.get();
                if (null  != dtoResult)
                    return new String(dtoResult.toString());

                outpat.DataCollection.get(0).Documentstatus = strStatus;                    

                dtoResult = outpat.update();
                if (null != dtoResult)
                    return new String(dtoResult.toString());                
            }
        }
        else
            return ("No PAS event type found");

        Patientcontacts patientContacts = (Patientcontacts)getDTOInstance(Patientcontacts.class);
        patientContacts.Filter.clear();         

        PatientcontactsRecord patientContactsRecord = patientContacts.new PatientcontactsRecord();
        patientContactsRecord.Contactno = voPasEvent.getPasEventId();
        patientContactsRecord.Documentstatus = strStatus;

        patientContacts.Filter.Contactno = voPasEvent.getPasEventId();
        dtoResult = patientContacts.get();

        if (null != dtoResult)
            return new String (dtoResult.toString());

        patientContacts.DataCollection.get(0).Documentstatus = strStatus;
        dtoResult = patientContacts.update();
        if (null != dtoResult)
            return new String(dtoResult.toString());

    }

    return new String();        
}
项目:openMAXIMS    文件:Logic.java   
private AdmissionDetailVo createAdmissionDetails(PatientShort patient)
{
    // Fill in data into PatientElectiveList.TCIDetails.AdmissionDetail record - create a new one if needed
    AdmissionDetailVo admissionDetails = new AdmissionDetailVo();

        PasEventAdmitVo pasEvent = new PasEventAdmitVo();

        if (form.ccConsultant().getValue() != null)
            pasEvent.setConsultant(domain.getMedic(new HcpRefVo(form.ccConsultant().getValue().getIMosHcpId(), 0)));
        else
            pasEvent.setConsultant(null);

        pasEvent.setEventDateTime(form.dtimAdmit().getValue());
        pasEvent.setEventType(PasEventType.EMERGENCY);
        pasEvent.setLocation(form.cmbWard().getValue());
        patient.setWard(form.cmbWard().getValue());
        pasEvent.setPatient(patient);
        pasEvent.setSpecialty(form.cmbSpecialty().getValue());
        pasEvent.setPasEventId(patient.getID_Patient().toString() + pasEvent.getEventDateTime().toString(DateTimeFormat.ISO));
        pasEvent.setSourceOfReferral(form.cmbSourceOfReferral().getValue());

        admissionDetails.setPasEvent(pasEvent);


    admissionDetails.setAdmissionDateTime(form.dtimAdmit().getValue());
    admissionDetails.setWard(form.cmbWard().getValue());
    if (form.getGlobalContext().Core.getSelectedBedSpaceState() != null)
        admissionDetails.setBed(form.getGlobalContext().Core.getSelectedBedSpaceState().getBedSpace());

    if (form.ccConsultant().getValue() != null)
        admissionDetails.setConsultant(domain.getMedic(new HcpRefVo(form.ccConsultant().getValue().getIMosHcpId(), 0)));
    else
        admissionDetails.setConsultant(null);

    admissionDetails.setSpecialty(form.cmbSpecialty().getValue());
    admissionDetails.setWardType(form.cmbWardType().getValue());
    admissionDetails.setMethodOfAdmission(form.cmbMethod().getValue());
    admissionDetails.setSourceOfAdmission(form.cmbSource().getValue());
    admissionDetails.setReasonForAdmission(form.txtReason().getValue());
    admissionDetails.setEstDischargeDate(form.dteEstDischarge().getValue());
    admissionDetails.setIsChaplainRequired(form.chkChaplain().getValue());
    admissionDetails.setReferringConsultant(form.ccReferringConsultant().getValue());
    admissionDetails.setPatientStatus(form.cmbPatientStatus().getValue());
    admissionDetails.setAnticipatedStay(form.intAntStay().getValue());

    return admissionDetails;
}
项目:openMAXIMS    文件:ADTImpl.java   
/**
*   Populates as many of the PasEvent fields as it can from the PasContact
*  CareContext,IsVip,ReferringGP,SourceOfReferral are left as null 
*  EventDateTime depends on whether we are listing inpatients or outpatients and
*  is populated external to this method.
*/
public PasEventVo createPasEvent(DateTime eventDateTime, PatientRefVo voRefPatient, PasContactVo voPasContact) throws StaleObjectException, UniqueKeyViolationException   
{
    PasEventVo voPasEvent = new PasEventVo();

    voPasEvent.setEventDateTime(eventDateTime);

    if (voPasContact.getConsultant() != null)
    {
        MedicWithMappingsLiteVo medLite = new MedicWithMappingsLiteVo(voPasContact.getConsultant().getID_Hcp(), voPasContact.getConsultant().getVersion_Hcp());
        medLite.setMos(voPasContact.getConsultant().getMos());
        voPasEvent.setConsultant(medLite);          
    }
    voPasEvent.setLocation(voPasContact.getLocation());
    voPasEvent.setSpecialty(voPasContact.getSpecialty());
    voPasEvent.setPasEventId(voPasContact.getContactNumber());
    //      voPasEvent.setPatient(voPasContact.getPatient());
    GpLiteToPracticeLiteVo voGpLiteToPracList = synchronizeGPPracticeDetails(voPasContact.getGPCode());
    if (voGpLiteToPracList != null)
    {
        voPasEvent.setReferringGP(voGpLiteToPracList.getGp());
        if (voGpLiteToPracList.getPracticeIsNotNull() && voGpLiteToPracList.getPractice().getSurgeriesIsNotNull() && voGpLiteToPracList.getPractice().getSurgeries().size() > 0)
            voPasEvent.setReferringGpSurgery(voGpLiteToPracList.getPractice().getSurgeries().get(0));
    }

    if (voPasContact.getAppointmentDateTimeIsNotNull())
        voPasEvent.setEventType(PasEventType.OUTPATIENT);
    else if (voPasContact.getDischargeDateTimeIsNotNull())
        voPasEvent.setEventType(PasEventType.INPATIENT);

    DomainFactory factory = getDomainFactory();
    PASEvent domPasEvent = PasEventVoAssembler.extractPASEvent(factory, voPasEvent);

    ims.core.patient.domain.objects.Patient domPatient = (ims.core.patient.domain.objects.Patient)factory.getDomainObject(ims.core.patient.domain.objects.Patient.class, voRefPatient.getID_Patient().intValue()); 
    domPasEvent.setPatient(domPatient);
    try 
    {
        factory.save(domPasEvent);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException(e.getMessage());
    }

    return PasEventVoAssembler.create(domPasEvent);
}
项目:openMAXIMS    文件:VoMapper.java   
public CareSpellVo createCareSpellVo(PasEventVo pas, PV1 pv)throws HL7Exception
{
    CareSpellVo careSpell=new CareSpellVo();
    if(pas!=null && pas.getEventDateTime()!=null)
        careSpell.setStartDate( pas.getEventDateTime().getDate());
    else
        throw new HL7Exception("Validation of PasEvent failed. Set the Event Date Time in PV1-44");

    careSpell.setPatient(pas.getPatient());
    EpisodeofCareVo episode=new EpisodeofCareVo();
    episode.setCareSpell(careSpell);
    episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.NAT_CONS_CODE, pv.getConsultingDoctor(0).getIDNumber().getValue()));

    // wdev-4883 Check for PAS code mapping if national consultant code not found
    if (!episode.getResponsibleHCPIsNotNull())
    {
        episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.PAS, pv.getConsultingDoctor(1).getIDNumber().getValue()));
    }

    episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
    episode.setSpecialty(pas.getSpecialty());
    episode.setStartDate( pas.getEventDateTime().getDate());
    EpisodeofCareVoCollection episodes=new EpisodeofCareVoCollection();
    episodes.add(episode);
    CareContextVo careContext=new CareContextVo();
    careContext.setEpisodeOfCare(episode);
    ContextType context=new ContextType();
    if (pv.getPatientClass().getValue().equals("I"))
    {
        context = ContextType.INPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.INPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("O"))
    {
        context = ContextType.OUTPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.OUTPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("P"))
    {
        context = ContextType.TCI;
        pas.setEventType(ims.core.vo.lookups.PasEventType.TCI);
    }
    else
    {
        context = ContextType.GHGSURGERY;
    }
    careContext.setContext(context);
    careContext.setStartDateTime(pas.getEventDateTime());
    careContext.setPasEvent(pas);
    careContext.setResponsibleHCP(episode.getResponsibleHCP());

    //WDEV-10231
    careContext.setCurrentStatus(new CareContextStatusHistoryVo());
    careContext.getCurrentStatus().setStatus(CareContextStatus.OPEN);
    careContext.getCurrentStatus().setStatusDateTime(pas.getEventDateTime());

    LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), TaxonomyType.PAS);
    LocSiteRefVo orderingHospRef = new LocSiteRefVo();
    if (loc!=null)
    {
        orderingHospRef.setID_Location(loc.getBoId());
        careContext.setOrderingHospital(orderingHospRef);
    }


    CareContextVoCollection careContexts=new CareContextVoCollection();
    careContexts.add(careContext);
    episode.setCareContexts(careContexts);
    careSpell.setEpisodes(episodes);

    return careSpell;


}
项目:openmaxims-linux    文件:Logic.java   
private void initalize() throws FormOpenException
{

    PasEventVo pasEvent = domain.getPasEvent(form.getGlobalContext().Core.getPasEvent());

    if (pasEvent.getEventType().equals(PasEventType.INPATIENT))
    {

        form.lyrCorrespondenceDetail().tabRecipients().lblStart().setValue("Admission Date:");
    }
    else
    {
        form.lyrCorrespondenceDetail().tabRecipients().lblStart().setValue("Clinic Date:");
        form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate().setVisible(false);
        form.lyrCorrespondenceDetail().tabRecipients().lblEnd().setVisible(false);
    }

    form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().setValue(pasEvent.getEventDateTime().getDate());

    form.btnCancel().setImage(form.getImages().Core.Remove);
    form.btnPrintLetter().setImage(form.getImages().Correspondence.Printer);
    form.btnSave().setImage(form.getImages().Core.Save);
    form.btnEMail().setImage(form.getImages().OCRR.Requested);
    form.btnResetTemplate().setImage(form.getImages().OCRR.Reset);

    form.btnSupplementary().setImage(form.getImages().Correspondence.Supplementry);
    form.btnUpdate().setImage(form.getImages().Admin.Edit);
    form.btnPreview().setImage(form.getImages().Core.Preview);

    form.getLocalContext().setsuplementryLetterVisible(new Boolean(ConfigFlag.UI.DISCHARGE_LETTERS_SUPPLEMENTARY_BUTTON.getValue()));

    form.btnSupplementary().setVisible(form.getLocalContext().getsuplementryLetterVisible());

    MemberOfStaffShortVo voMos = (MemberOfStaffShortVo) domain.getMosUser();
    if (null == voMos)
    {
        throw new FormOpenException("Current user not associated with a Member Of Staff");
    }

    form.getLocalContext().setloggedInMos(voMos);

    // get full paseventvo
    form.getLocalContext().setpasEventVo(domain.getPasEvent(form.getGlobalContext().Core.getPasEvent()));

}
项目:openmaxims-linux    文件:Logic.java   
private void populateDataFromScreen(CorrespondenceDetailsVo voDocumentDetails)
{
    form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size();
    if (form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size() > 0)
    {
        GenForm.lyrCorrespondenceDetailLayer.tabCorrespondenceContainer.grdCategoriesRow catRow;
        CategoryNotesVoCollection voDocCatColl = new CategoryNotesVoCollection();

        for (int i = 0; i < form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().size(); i++)
        {
            catRow = form.lyrCorrespondenceDetail().tabCorrespondence().grdCategories().getRows().get(i);
            if (catRow.getValue() != null)
            {
                voDocCatColl.add(catRow.getValue());
            }
        }
        voDocumentDetails.setCategories(voDocCatColl);
    }
    // Document Information

    if (form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate() != null)
        voDocumentDetails.setDischargeDate(form.lyrCorrespondenceDetail().tabRecipients().dteDisChargeDate().getValue());

    if (form.getLocalContext().getpasEventVo().getEventType().equals(PasEventType.INPATIENT))
        voDocumentDetails.setAdmissionDate(form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().getValue());

    if (form.getLocalContext().getpasEventVo().getEventType().equals(PasEventType.OUTPATIENT))
        voDocumentDetails.setDateOfClinic(form.lyrCorrespondenceDetail().tabRecipients().dteStartDate().getValue());

    voDocumentDetails.setDictatedBy(form.lyrCorrespondenceDetail().tabRecipients().qmbDictatedBy().getValue());
    voDocumentDetails.setDictatedByInitials(form.lyrCorrespondenceDetail().tabRecipients().txtDictatedByinitals().getValue());

    voDocumentDetails.setTypedByInitials(form.lyrCorrespondenceDetail().tabRecipients().txtTypedByInitials().getValue());
    voDocumentDetails.setTypedBy(form.lyrCorrespondenceDetail().tabRecipients().qmbTypedBy().getValue());

    voDocumentDetails.setEnquiriesTo(form.lyrCorrespondenceDetail().tabRecipients().qmbEnquiriesTo().getValue());

    voDocumentDetails.setWasTypedWithoutCaseNotes(form.lyrCorrespondenceDetail().tabRecipients().chkTypedWithoutCaseNotes().getValue());

    // Recipients
    if (form.lyrCorrespondenceDetail().tabRecipients().grdAdressee().getRows().size() > 0)
    {
        RecipientVoCollection voDocRecipColl = new RecipientVoCollection();

        voDocRecipColl = form.lyrCorrespondenceDetail().tabRecipients().grdAdressee().getValues();
        voDocumentDetails.setRecipients(voDocRecipColl);
    }

    // signed by
    if (form.lyrCorrespondenceDetail().tabCorrespondence().qmbSignedBy().getValue() != null)
        voDocumentDetails.setSignedBy(form.lyrCorrespondenceDetail().tabCorrespondence().qmbSignedBy().getValue());

    if (form.lyrCorrespondenceDetail().tabCorrespondence().chkSpecialInterest().getValue())
        voDocumentDetails.setSpecialInterest(form.lyrCorrespondenceDetail().tabCorrespondence().cmbType().getValue());

    form.getLocalContext().setcorrespondenceDetails(voDocumentDetails);
}
项目:openmaxims-linux    文件:CorrespondenceDetailsImpl.java   
private String savePasDocumentStatus(CorrespondenceDetailsVo voDocDetail,LookupInstVo pasEventType) 
{
    if (voDocDetail != null && voDocDetail.getCurrentStatusIsNotNull())
    {
        DomainFactory factory = getDomainFactory();
        PASEvent domPas = (PASEvent) factory.getDomainObject(PASEvent.class, voDocDetail.getPasEvent().getID_PASEvent());
        PasEventLiteVo voPasEvent = PasEventLiteVoAssembler.create(domPas);
        Result dtoResult;
        String strStatus = "";

        if (pasEventType != null)
        {
            if (pasEventType.equals(PasEventType.INPATIENT))
            {
                Inpatientlist inpat = (Inpatientlist)getDTOInstance(Inpatientlist.class);
                inpat.Filter.clear();

                strStatus = "" + voDocDetail.getCurrentStatus().getId();

                // Update impatient list
                inpat.Filter.Contactno = voPasEvent.getPasEventId();
                dtoResult = inpat.get();
                if (null  != dtoResult)
                    return new String(dtoResult.toString());

                inpat.DataCollection.get(0).Documentstatus = strStatus;
                dtoResult = inpat.update();
                if (null != dtoResult)
                    return new String(dtoResult.toString());
            }
            else if (pasEventType.equals(PasEventType.OUTPATIENT))
            {
                Outpatientlist outpat = (Outpatientlist)getDTOInstance(Outpatientlist.class);
                outpat.Filter.clear();

                strStatus = "" + voDocDetail.getCurrentStatus().getId();

                // Update outpatient list
                outpat.Filter.Contactno = voPasEvent.getPasEventId();                   
                dtoResult = outpat.get();
                if (null  != dtoResult)
                    return new String(dtoResult.toString());

                outpat.DataCollection.get(0).Documentstatus = strStatus;                    

                dtoResult = outpat.update();
                if (null != dtoResult)
                    return new String(dtoResult.toString());                
            }
        }
        else
            return ("No PAS event type found");

        Patientcontacts patientContacts = (Patientcontacts)getDTOInstance(Patientcontacts.class);
        patientContacts.Filter.clear();         

        PatientcontactsRecord patientContactsRecord = patientContacts.new PatientcontactsRecord();
        patientContactsRecord.Contactno = voPasEvent.getPasEventId();
        patientContactsRecord.Documentstatus = strStatus;

        patientContacts.Filter.Contactno = voPasEvent.getPasEventId();
        dtoResult = patientContacts.get();

        if (null != dtoResult)
            return new String (dtoResult.toString());

        patientContacts.DataCollection.get(0).Documentstatus = strStatus;
        dtoResult = patientContacts.update();
        if (null != dtoResult)
            return new String(dtoResult.toString());

    }

    return new String();        
}
项目:openmaxims-linux    文件:Logic.java   
private AdmissionDetailVo createAdmissionDetails(PatientShort patient)
{
    // Fill in data into PatientElectiveList.TCIDetails.AdmissionDetail record - create a new one if needed
    AdmissionDetailVo admissionDetails = new AdmissionDetailVo();

        PasEventAdmitVo pasEvent = new PasEventAdmitVo();

        if (form.ccConsultant().getValue() != null)
            pasEvent.setConsultant(domain.getMedic(new HcpRefVo(form.ccConsultant().getValue().getIMosHcpId(), 0)));
        else
            pasEvent.setConsultant(null);

        pasEvent.setEventDateTime(form.dtimAdmit().getValue());
        pasEvent.setEventType(PasEventType.EMERGENCY);
        pasEvent.setLocation(form.cmbWard().getValue());
        patient.setWard(form.cmbWard().getValue());
        pasEvent.setPatient(patient);
        pasEvent.setSpecialty(form.cmbSpecialty().getValue());
        pasEvent.setPasEventId(patient.getID_Patient().toString() + pasEvent.getEventDateTime().toString(DateTimeFormat.ISO));
        pasEvent.setSourceOfReferral(form.cmbSourceOfReferral().getValue());

        admissionDetails.setPasEvent(pasEvent);


    admissionDetails.setAdmissionDateTime(form.dtimAdmit().getValue());
    admissionDetails.setWard(form.cmbWard().getValue());
    if (form.getGlobalContext().Core.getSelectedBedSpaceState() != null)
        admissionDetails.setBed(form.getGlobalContext().Core.getSelectedBedSpaceState().getBedSpace());

    if (form.ccConsultant().getValue() != null)
        admissionDetails.setConsultant(domain.getMedic(new HcpRefVo(form.ccConsultant().getValue().getIMosHcpId(), 0)));
    else
        admissionDetails.setConsultant(null);

    admissionDetails.setSpecialty(form.cmbSpecialty().getValue());
    admissionDetails.setWardType(form.cmbWardType().getValue());
    admissionDetails.setMethodOfAdmission(form.cmbMethod().getValue());
    admissionDetails.setSourceOfAdmission(form.cmbSource().getValue());
    admissionDetails.setReasonForAdmission(form.txtReason().getValue());
    admissionDetails.setEstDischargeDate(form.dteEstDischarge().getValue());
    admissionDetails.setIsChaplainRequired(form.chkChaplain().getValue());
    admissionDetails.setReferringConsultant(form.ccReferringConsultant().getValue());
    admissionDetails.setPatientStatus(form.cmbPatientStatus().getValue());
    admissionDetails.setAnticipatedStay(form.intAntStay().getValue());

    return admissionDetails;
}
项目:openmaxims-linux    文件:ADTImpl.java   
/**
*   Populates as many of the PasEvent fields as it can from the PasContact
*  CareContext,IsVip,ReferringGP,SourceOfReferral are left as null 
*  EventDateTime depends on whether we are listing inpatients or outpatients and
*  is populated external to this method.
*/
public PasEventVo createPasEvent(DateTime eventDateTime, PatientRefVo voRefPatient, PasContactVo voPasContact) throws StaleObjectException, UniqueKeyViolationException   
{
    PasEventVo voPasEvent = new PasEventVo();

    voPasEvent.setEventDateTime(eventDateTime);

    if (voPasContact.getConsultant() != null)
    {
        MedicWithMappingsLiteVo medLite = new MedicWithMappingsLiteVo(voPasContact.getConsultant().getID_Hcp(), voPasContact.getConsultant().getVersion_Hcp());
        medLite.setMos(voPasContact.getConsultant().getMos());
        voPasEvent.setConsultant(medLite);          
    }
    voPasEvent.setLocation(voPasContact.getLocation());
    voPasEvent.setSpecialty(voPasContact.getSpecialty());
    voPasEvent.setPasEventId(voPasContact.getContactNumber());
    //      voPasEvent.setPatient(voPasContact.getPatient());
    GpLiteToPracticeLiteVo voGpLiteToPracList = synchronizeGPPracticeDetails(voPasContact.getGPCode());
    if (voGpLiteToPracList != null)
    {
        voPasEvent.setReferringGP(voGpLiteToPracList.getGp());
        if (voGpLiteToPracList.getPracticeIsNotNull() && voGpLiteToPracList.getPractice().getSurgeriesIsNotNull() && voGpLiteToPracList.getPractice().getSurgeries().size() > 0)
            voPasEvent.setReferringGpSurgery(voGpLiteToPracList.getPractice().getSurgeries().get(0));
    }

    if (voPasContact.getAppointmentDateTimeIsNotNull())
        voPasEvent.setEventType(PasEventType.OUTPATIENT);
    else if (voPasContact.getDischargeDateTimeIsNotNull())
        voPasEvent.setEventType(PasEventType.INPATIENT);

    DomainFactory factory = getDomainFactory();
    PASEvent domPasEvent = PasEventVoAssembler.extractPASEvent(factory, voPasEvent);

    ims.core.patient.domain.objects.Patient domPatient = (ims.core.patient.domain.objects.Patient)factory.getDomainObject(ims.core.patient.domain.objects.Patient.class, voRefPatient.getID_Patient().intValue()); 
    domPasEvent.setPatient(domPatient);
    try 
    {
        factory.save(domPasEvent);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException(e.getMessage());
    }

    return PasEventVoAssembler.create(domPasEvent);
}
项目:openmaxims-linux    文件:VoMapper.java   
public CareSpellVo createCareSpellVo(PasEventVo pas, PV1 pv)throws HL7Exception
{
    CareSpellVo careSpell=new CareSpellVo();
    if(pas!=null && pas.getEventDateTime()!=null)
        careSpell.setStartDate( pas.getEventDateTime().getDate());
    else
        throw new HL7Exception("Validation of PasEvent failed. Set the Event Date Time in PV1-44");

    careSpell.setPatient(pas.getPatient());
    EpisodeofCareVo episode=new EpisodeofCareVo();
    episode.setCareSpell(careSpell);
    episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.NAT_CONS_CODE, pv.getConsultingDoctor(0).getIDNumber().getValue()));

    // wdev-4883 Check for PAS code mapping if national consultant code not found
    if (!episode.getResponsibleHCPIsNotNull())
    {
        episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.PAS, pv.getConsultingDoctor(1).getIDNumber().getValue()));
    }

    episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
    episode.setSpecialty(pas.getSpecialty());
    episode.setStartDate( pas.getEventDateTime().getDate());
    EpisodeofCareVoCollection episodes=new EpisodeofCareVoCollection();
    episodes.add(episode);
    CareContextVo careContext=new CareContextVo();
    careContext.setEpisodeOfCare(episode);
    ContextType context=new ContextType();
    if (pv.getPatientClass().getValue().equals("I"))
    {
        context = ContextType.INPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.INPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("O"))
    {
        context = ContextType.OUTPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.OUTPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("P"))
    {
        context = ContextType.TCI;
        pas.setEventType(ims.core.vo.lookups.PasEventType.TCI);
    }
    else
    {
        context = ContextType.GHGSURGERY;
    }
    careContext.setContext(context);
    careContext.setStartDateTime(pas.getEventDateTime());
    careContext.setPasEvent(pas);
    careContext.setResponsibleHCP(episode.getResponsibleHCP());

    //WDEV-10231
    careContext.setCurrentStatus(new CareContextStatusHistoryVo());
    careContext.getCurrentStatus().setStatus(CareContextStatus.OPEN);
    careContext.getCurrentStatus().setStatusDateTime(pas.getEventDateTime());

    LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), TaxonomyType.PAS);
    LocSiteRefVo orderingHospRef = new LocSiteRefVo();
    if (loc!=null)
    {
        orderingHospRef.setID_Location(loc.getBoId());
        careContext.setOrderingHospital(orderingHospRef);
    }


    CareContextVoCollection careContexts=new CareContextVoCollection();
    careContexts.add(careContext);
    episode.setCareContexts(careContexts);
    careSpell.setEpisodes(episodes);

    return careSpell;


}