Java 类ims.core.vo.CatsReferralEmergencyAdmissionVo 实例源码

项目:openMAXIMS    文件:AdmitToWardImpl.java   
public CatsReferralEmergencyAdmissionVo getReferralForAdmission(Booking_AppointmentRefVo appointment)
{
    if (appointment == null || appointment.getID_Booking_Appointment() == null)
        return null;

    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    StringBuilder query = new StringBuilder("SELECT referral ");
    query.append(" FROM CatsReferral AS referral LEFT JOIN referral.appointments AS appointment");

    query.append(" WHERE ");

    query.append(" appointment.id = :APPOINTMENT_ID ");

    paramNames.add("APPOINTMENT_ID");
    paramValues.add(appointment.getID_Booking_Appointment());

    return CatsReferralEmergencyAdmissionVoAssembler.create((CatsReferral) getDomainFactory().findFirst(query.toString(), paramNames, paramValues));
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public CatsReferralEmergencyAdmissionVo getReferralForAdmission(Booking_AppointmentRefVo appointment)
{
    if (appointment == null || appointment.getID_Booking_Appointment() == null)
        return null;

    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    StringBuilder query = new StringBuilder("SELECT referral ");
    query.append(" FROM CatsReferral AS referral LEFT JOIN referral.appointments AS appointment");

    query.append(" WHERE ");

    query.append(" appointment.id = :APPOINTMENT_ID ");

    paramNames.add("APPOINTMENT_ID");
    paramValues.add(appointment.getID_Booking_Appointment());

    return CatsReferralEmergencyAdmissionVoAssembler.create((CatsReferral) getDomainFactory().findFirst(query.toString(), paramNames, paramValues));
}
项目:AvoinApotti    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createNewCatsReferralForAdmission(PatientShort patientShort, PatientWithGPForCCGVo patient, CareSpellVo careSpell, AdmissionDetailVo admission, ContractConfigShortVo contract)
{
    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patientShort);
    referral.setCareContext(careSpell.getEpisodes().get(0).getCareContexts().get(0));

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    String codeCCG = getCCGCode(patient);
    referral.setContract(contract);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setService(form.cmbService().getValue());
        referralDetails.setConsultant(domain.getHcpFromIMos(form.ccConsultant().getValue()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        referralDetails.setDateReferralReceived(new Date());
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(calculateEnd18WW(contract));
        referralDetails.setPCT(codeCCG);
        referralDetails.setGPName(patient.getGp());
        referralDetails.setPractice(getPatientGpDefaultPractice(patient));

    referral.setReferralDetails(referralDetails);

    return referral;
}
项目:openMAXIMS    文件:AdmitToWardImpl.java   
public CatsReferralEmergencyAdmissionVo getReferralForAdmission(CatsReferralRefVo referral)
{
    if (referral == null || referral.getID_CatsReferral() == null)
        return null;

    return CatsReferralEmergencyAdmissionVoAssembler.create((CatsReferral) getDomainFactory().getDomainObject(CatsReferral.class, referral.getID_CatsReferral()));
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public CatsReferralEmergencyAdmissionVo getReferralForAdmission(CatsReferralRefVo referral)
{
    if (referral == null || referral.getID_CatsReferral() == null)
        return null;

    return CatsReferralEmergencyAdmissionVoAssembler.create((CatsReferral) getDomainFactory().getDomainObject(CatsReferral.class, referral.getID_CatsReferral()));
}
项目:openMAXIMS    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createNewCatsReferralForAdmission(PatientShort patientShort, PatientWithGPForCCGVo patient, CareSpellVo careSpell, AdmissionDetailVo admission, ContractConfigShortVo contract)
{
    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patientShort);
    referral.setCareContext(careSpell.getEpisodes().get(0).getCareContexts().get(0));

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    String codeCCG = getCCGCode(patient);
    referral.setContract(contract);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setService(form.cmbService().getValue());
        referralDetails.setConsultant(domain.getHcpFromIMos(form.ccConsultant().getValue()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        referralDetails.setDateReferralReceived(new Date());
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(calculateEnd18WW(contract));
        referralDetails.setPCT(codeCCG);
        referralDetails.setGPName(patient.getGp());
        referralDetails.setPractice(getPatientGpDefaultPractice(patient));

    referral.setReferralDetails(referralDetails);

    return referral;
}
项目:openmaxims-linux    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createNewCatsReferralForAdmission(PatientShort patientShort, PatientWithGPForCCGVo patient, CareSpellVo careSpell, AdmissionDetailVo admission, ContractConfigShortVo contract)
{
    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patientShort);
    referral.setCareContext(careSpell.getEpisodes().get(0).getCareContexts().get(0));

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    String codeCCG = getCCGCode(patient);
    referral.setContract(contract);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setService(form.cmbService().getValue());
        referralDetails.setConsultant(domain.getHcpFromIMos(form.ccConsultant().getValue()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        referralDetails.setDateReferralReceived(new Date());
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(calculateEnd18WW(contract));
        referralDetails.setPCT(codeCCG);
        referralDetails.setGPName(patient.getGp());
        referralDetails.setPractice(getPatientGpDefaultPractice(patient));

    referral.setReferralDetails(referralDetails);

    return referral;
}
项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo saveEmergencyAdmissionInElectiveCase(AdmissionDetailVo admission, CareSpellVo careSpell, CatsReferralEmergencyAdmissionVo catsReferral, BedSpaceStateLiteVo bedSpaceState, WardStayVo wardStay, ConsultantStayVo consultant) throws DomainInterfaceException, StaleObjectException
{
    if (admission == null)
        throw new CodingRuntimeException("Admission Details parameter is mandatory.");

    if (careSpell == null)
        throw new CodingRuntimeException("Care Spell parameter is mandatory.");

    if (catsReferral == null)
        throw new CodingRuntimeException("Cats Referral parameter is mandatory.");


    PatientPathwayJourneyRefVo journey = createPatientJourney(catsReferral, admission);
    catsReferral.setJourney(journey);

    @SuppressWarnings("rawtypes")
    HashMap domMap = new HashMap();
    AdmissionDetail domAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admission, domMap);
    CareSpell domCareSpell = CareSpellVoAssembler.extractCareSpell(getDomainFactory(), careSpell, domMap);
    CatsReferral domCatsReferral = CatsReferralEmergencyAdmissionVoAssembler.extractCatsReferral(getDomainFactory(), catsReferral, domMap);
    domCatsReferral.getCareContext().setPasEvent(domAdmissionDetail.getPasEvent());

    getDomainFactory().save(domAdmissionDetail);
    getDomainFactory().save(domCareSpell);
    getDomainFactory().save(domCatsReferral);

    InpatientEpisode inpatEpisode = new InpatientEpisode();
    inpatEpisode.setPasEvent(domAdmissionDetail.getPasEvent());
    inpatEpisode.getPasEvent().setConsultant(domAdmissionDetail.getConsultant());
    inpatEpisode.setAdmissionDateTime(domAdmissionDetail.getAdmissionDateTime());
    inpatEpisode.setEstDischargeDate(null);
    inpatEpisode.setWardType(domAdmissionDetail.getWardType());

    if (wardStay != null)
        inpatEpisode.getWardStays().add(WardStayVoAssembler.extractWardStay(getDomainFactory(), wardStay, domMap));
    if (consultant != null)
        inpatEpisode.getConsultantStays().add(ConsultantStayVoAssembler.extractConsultantStay(getDomainFactory(), consultant, domMap));

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState, domMap);   
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(inpatEpisode);  
        inpatEpisode.setBed(doBedSpaceState);
        inpatEpisode.setBedNo(doBedSpaceState.getBedSpace().getBedNumber());
    }

    if (wardStay != null && wardStay.getWardIsNotNull() && ConfigFlag.UI.VTE_RISK_ASSESSMENT_FUNCTIONALITY.getValue() == true)
    {
        Location doloc = getLocation(wardStay.getWard().getID_Location(), getDomainFactory());
        if (doloc != null && !Boolean.TRUE.equals(doloc.isVTEAsessmentNotRequired()))
        {
            inpatEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.REQUIRED));
        }
    }

    getDomainFactory().save(inpatEpisode);

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createCatsReferral(PatientLite_IdentifiersVo patient, AdmissionDetailVo admission, CareSpellAdmitVo careSpell)
{
    if (careSpell == null || careSpell.getEpisodes() == null || careSpell.getEpisodes().size() < 1
            || careSpell.getEpisodes().get(0).getCareContexts() == null)
        throw new CodingRuntimeException("Invalid care spell created.");

    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patient);

    for (CareContextAdmitVo careContext : careSpell.getEpisodes().get(0).getCareContexts())
    {
        if (ContextType.REFERRAL.equals(careContext.getContext()))
        {
            referral.setCareContext(careContext);
            referral.setEpisodeOfCare(careSpell.getEpisodes().get(0));
            break;
        }
    }

    //WDEV-22214
    PatientWithGPForCCGVo patientWithGP = domain.getPatientForCCG(patient);
    String codeCCG = getCCGCode(patientWithGP);

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    referral.setContract(null);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setReferrerType(form.cmbSourceOfReferral().getValue() != null ? form.cmbSourceOfReferral().getValue() : SourceOfReferral.ED);
        referralDetails.setService(admission.getService());
        referralDetails.setConsultant(domain.getHcpFromIMos(admission.getConsultant()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        //referralDetails.setDateReferralReceived(new Date());WDEV-22688
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(null);
        referralDetails.setPCT(codeCCG);

    referral.setReferralDetails(referralDetails);
    referral.setIsEmergencyReferral(Boolean.TRUE);
    referral.setUrgency(ReferralUrgency.EMERGENCY); //WDEV-22229

    return referral;
}
项目:openMAXIMS    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createCatsReferral(PatientLite_IdentifiersVo patient, AdmissionDetailVo admission, CareSpellAdmitVo careSpell)
{
    if (careSpell == null || careSpell.getEpisodes() == null || careSpell.getEpisodes().size() < 1
            || careSpell.getEpisodes().get(0).getCareContexts() == null)
        throw new CodingRuntimeException("Invalid care spell created.");

    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patient);

    for (CareContextAdmitVo careContext : careSpell.getEpisodes().get(0).getCareContexts())
    {
        if (ContextType.REFERRAL.equals(careContext.getContext()))
        {
            referral.setCareContext(careContext);
            referral.setEpisodeOfCare(careSpell.getEpisodes().get(0));
            break;
        }
    }
    PatientWithGPForCCGVo patientWithGP = domain.getPatientForCCG(patient);
    String codeCCG = getCCGCode(patientWithGP);

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    referral.setContract(null);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setReferrerType(form.cmbSourceOfReferral().getValue() != null ? form.cmbSourceOfReferral().getValue() : SourceOfReferral.ED);
        referralDetails.setService(admission.getService());
        referralDetails.setConsultant(domain.getHcpFromIMos(admission.getConsultant()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        //referralDetails.setDateReferralReceived(new Date());//WDEV-22688
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(null);
        referralDetails.setPCT(codeCCG);

    referral.setReferralDetails(referralDetails);
    referral.setIsEmergencyReferral(Boolean.TRUE);
    referral.setUrgency(ReferralUrgency.EMERGENCY); //WDEV-22229

    return referral;
}
项目:openMAXIMS    文件:AdmitToWardImpl.java   
public Boolean saveAdmissionAndUpdateList(AdmissionDetailVo admissionDetail, WardStayVo wardStay, ConsultantStayVo consultantStay, CareSpellAdmitVo careSpell, CatsReferralEmergencyAdmissionVo referral, Object selectedAdmissionData, PatientCaseNoteTransferVoCollection caseNoteTransfers) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException
    {
//      AdmissionDetail domAdmissionDetail = AdmissionDetailShortVoAssembler.extractAdmissionDetail(getDomainFactory(), admissionDetail);
//      getDomainFactory().save(domAdmissionDetail);

//      AdmissionDetailVo admissionDetails = AdmissionDetailVoAssembler.create(domAdmissionDetail);
//      admissionDetails.validate();


        PendingElectiveAdmissionAdmitVo pendingBookedElectiveAdmission = selectedAdmissionData instanceof PendingElectiveAdmissionAdmitVo ? (PendingElectiveAdmissionAdmitVo) selectedAdmissionData : null;
        PendingEmergencyAdmissionAdmitVo pendingEDEmergency = selectedAdmissionData instanceof PendingEmergencyAdmissionAdmitVo ? (PendingEmergencyAdmissionAdmitVo) selectedAdmissionData : null;
        PendingElectiveAdmissionAdmitVo pendingElectiveAdmission = selectedAdmissionData instanceof PendingElectiveAdmissionAdmitVo ? (PendingElectiveAdmissionAdmitVo) selectedAdmissionData : null;
        CatsReferralPendingEmergencyNonEDAdmissionListVo pendingEmergencyAdmission = selectedAdmissionData instanceof CatsReferralPendingEmergencyNonEDAdmissionListVo ? (CatsReferralPendingEmergencyNonEDAdmissionListVo) selectedAdmissionData : null;


        PatientElectiveListBedAdmissionVo patientTCI_ElectiveList = selectedAdmissionData instanceof PatientElectiveListBedAdmissionVo ? (PatientElectiveListBedAdmissionVo) selectedAdmissionData : null;

        AdmissionType admissionType = AdmissionType.EMERGENCY;


        BedAdmissionComponent impl = (BedAdmissionComponent) getDomainImpl(BedAdmissionComponentImpl.class);

        if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) && selectedAdmissionData instanceof PatientElectiveListBedAdmissionVo)
        {
            PatientElectiveListBedAdmissionVo electiveAdmission = impl.saveTCIAdmissionAndUpdateList(patientTCI_ElectiveList, null, wardStay, consultantStay, null, null, null, caseNoteTransfers);

            impl.createCaseNoteRequests(electiveAdmission);
        }
//      else if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()) && selectedAdmissionData instanceof PatientLite_IdentifiersVo)
//      {
//          CareSpellVo careSpell = createCareSpell((PatientLite_IdentifiersVo) selectedAdmissionData, admissionDetail.getPasEvent(), admissionDetail.getAdmissionDateTime(), admissionDetail.getConsultant(), admissionDetail.getService());
//          CatsReferralEmergencyAdmissionVo catsReferral = createCatsReferral((PatientLite_IdentifiersVo) selectedAdmissionData, admissionDetail, careSpell);
//          
//          impl.saveEmergencyAdmissionInElectiveCase(admissionDetail,              // Admission Detail 
//                                                    careSpell,                    // Care Spell
//                                                    catsReferral,                 // Cats Referral
//                                                    null,                         // Bed Space State - null when Admitting to Ward
//                                                    wardStay,                     // Ward Stay
//                                                    consultantStay,               // Consultant Stay
//                                                    null,                         // Admission Reason 
//                                                    null,                         // Ward Mixed Sex Breach 
//                                                    null,                         // Ward Bay Config
//                                                    caseNoteTransfers);           // Patient Case Note Transfer
//      }
        else
        {
            impl.saveAdmissionAndUpdateList(admissionDetail,                        // Admission Detail
                                            null,                                   // Bed Space State - null when Admitting to Ward
                                            careSpell,
                                            referral,
                                            wardStay,                               // Ward Stay
                                            consultantStay,                         // Consultant Stay
                                            pendingBookedElectiveAdmission,         // Pending Elective Admission - Planned (Booked)
                                            pendingEDEmergency,                     // Pending Emergency Admission - ED
                                            pendingElectiveAdmission,               // Pending Elective Admission - (TCI)
                                            pendingEmergencyAdmission,              // Pending Emergency Admission - Non ED
                                            admissionType,                          // Admission Type
                                            null,                                   // Admission Reason
                                            null,                                   // Ward Mixed Sex Breach
                                            null,                                   // Ward Bay Config
                                            caseNoteTransfers);                     // Patient Case Note Transfer
        }

        //WDEV-21973 make sure patient has a Case Note Folder
        impl.createCaseNoteFolderIfNone(admissionDetail.getPasEvent().getPatient());

        return true;
    }
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo saveEmergencyAdmissionInElectiveCase(AdmissionDetailVo admission, CareSpellVo careSpell, CatsReferralEmergencyAdmissionVo catsReferral, BedSpaceStateLiteVo bedSpaceState, WardStayVo wardStay, ConsultantStayVo consultant) throws DomainInterfaceException, StaleObjectException
{
    if (admission == null)
        throw new CodingRuntimeException("Admission Details parameter is mandatory.");

    if (careSpell == null)
        throw new CodingRuntimeException("Care Spell parameter is mandatory.");

    if (catsReferral == null)
        throw new CodingRuntimeException("Cats Referral parameter is mandatory.");


    PatientPathwayJourneyRefVo journey = createPatientJourney(catsReferral, admission);
    catsReferral.setJourney(journey);

    @SuppressWarnings("rawtypes")
    HashMap domMap = new HashMap();
    AdmissionDetail domAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admission, domMap);
    CareSpell domCareSpell = CareSpellVoAssembler.extractCareSpell(getDomainFactory(), careSpell, domMap);
    CatsReferral domCatsReferral = CatsReferralEmergencyAdmissionVoAssembler.extractCatsReferral(getDomainFactory(), catsReferral, domMap);
    domCatsReferral.getCareContext().setPasEvent(domAdmissionDetail.getPasEvent());

    getDomainFactory().save(domAdmissionDetail);
    getDomainFactory().save(domCareSpell);
    getDomainFactory().save(domCatsReferral);

    InpatientEpisode inpatEpisode = new InpatientEpisode();
    inpatEpisode.setPasEvent(domAdmissionDetail.getPasEvent());
    inpatEpisode.getPasEvent().setConsultant(domAdmissionDetail.getConsultant());
    inpatEpisode.setAdmissionDateTime(domAdmissionDetail.getAdmissionDateTime());
    inpatEpisode.setEstDischargeDate(null);
    inpatEpisode.setWardType(domAdmissionDetail.getWardType());

    if (wardStay != null)
        inpatEpisode.getWardStays().add(WardStayVoAssembler.extractWardStay(getDomainFactory(), wardStay, domMap));
    if (consultant != null)
        inpatEpisode.getConsultantStays().add(ConsultantStayVoAssembler.extractConsultantStay(getDomainFactory(), consultant, domMap));

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState, domMap);   
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(inpatEpisode);  
        inpatEpisode.setBed(doBedSpaceState);
        inpatEpisode.setBedNo(doBedSpaceState.getBedSpace().getBedNumber());
    }

    if (wardStay != null && wardStay.getWardIsNotNull() && ConfigFlag.UI.VTE_RISK_ASSESSMENT_FUNCTIONALITY.getValue() == true)
    {
        Location doloc = getLocation(wardStay.getWard().getID_Location(), getDomainFactory());
        if (doloc != null && !Boolean.TRUE.equals(doloc.isVTEAsessmentNotRequired()))
        {
            inpatEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.REQUIRED));
        }
    }

    getDomainFactory().save(inpatEpisode);

    return null;
}
项目:openmaxims-linux    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo saveEmergencyAdmissionInElectiveCase(AdmissionDetailVo admission, CareSpellVo careSpell, CatsReferralEmergencyAdmissionVo catsReferral, BedSpaceStateLiteVo bedSpaceState, WardStayVo wardStay, ConsultantStayVo consultant) throws DomainInterfaceException, StaleObjectException
{
    if (admission == null)
        throw new CodingRuntimeException("Admission Details parameter is mandatory.");

    if (careSpell == null)
        throw new CodingRuntimeException("Care Spell parameter is mandatory.");

    if (catsReferral == null)
        throw new CodingRuntimeException("Cats Referral parameter is mandatory.");


    PatientPathwayJourneyRefVo journey = createPatientJourney(catsReferral, admission);
    catsReferral.setJourney(journey);

    @SuppressWarnings("rawtypes")
    HashMap domMap = new HashMap();
    AdmissionDetail domAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admission, domMap);
    CareSpell domCareSpell = CareSpellVoAssembler.extractCareSpell(getDomainFactory(), careSpell, domMap);
    CatsReferral domCatsReferral = CatsReferralEmergencyAdmissionVoAssembler.extractCatsReferral(getDomainFactory(), catsReferral, domMap);
    domCatsReferral.getCareContext().setPasEvent(domAdmissionDetail.getPasEvent());

    getDomainFactory().save(domAdmissionDetail);
    getDomainFactory().save(domCareSpell);
    getDomainFactory().save(domCatsReferral);

    InpatientEpisode inpatEpisode = new InpatientEpisode();
    inpatEpisode.setPasEvent(domAdmissionDetail.getPasEvent());
    inpatEpisode.getPasEvent().setConsultant(domAdmissionDetail.getConsultant());
    inpatEpisode.setAdmissionDateTime(domAdmissionDetail.getAdmissionDateTime());
    inpatEpisode.setEstDischargeDate(null);
    inpatEpisode.setWardType(domAdmissionDetail.getWardType());

    if (wardStay != null)
        inpatEpisode.getWardStays().add(WardStayVoAssembler.extractWardStay(getDomainFactory(), wardStay, domMap));
    if (consultant != null)
        inpatEpisode.getConsultantStays().add(ConsultantStayVoAssembler.extractConsultantStay(getDomainFactory(), consultant, domMap));

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState, domMap);   
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(inpatEpisode);  
        inpatEpisode.setBed(doBedSpaceState);
        inpatEpisode.setBedNo(doBedSpaceState.getBedSpace().getBedNumber());
    }

    if (wardStay != null && wardStay.getWardIsNotNull() && ConfigFlag.UI.VTE_RISK_ASSESSMENT_FUNCTIONALITY.getValue() == true)
    {
        Location doloc = getLocation(wardStay.getWard().getID_Location(), getDomainFactory());
        if (doloc != null && !Boolean.TRUE.equals(doloc.isVTEAsessmentNotRequired()))
        {
            inpatEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.REQUIRED));
        }
    }

    getDomainFactory().save(inpatEpisode);

    return null;
}