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

项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo getFinalDocument(DocumentStatus status, DocumentAndPatientWrapperVo doc) 
{
    PatientDocumentVo lockedPatientDoc = doc.getDocument();

    if (status != null && lockedPatientDoc.getCurrentDocumentStatus() != null && !status.equals(lockedPatientDoc.getCurrentDocumentStatus().getCorrespondenceStatus()) && !DocumentStatus.COMPLETED.equals(lockedPatientDoc.getCurrentDocumentStatus().getCorrespondenceStatus()))
    {
        PatientDocumentStatusVo finalS = new PatientDocumentStatusVo();
        finalS.setCorrespondenceStatus(status);
        finalS.setRecordingDateTime(new DateTime());
        finalS.setRecordingUser((MemberOfStaffShortVo) domain.getMosUser());

        if (!lockedPatientDoc.getDocumentStatusHistoryIsNotNull())
        {
            lockedPatientDoc.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
        }

        lockedPatientDoc.getDocumentStatusHistory().add(finalS);
        lockedPatientDoc.setCurrentDocumentStatus(finalS);

        String[] errs = lockedPatientDoc.validate();
        if (errs != null && errs.length > 0)
        {
            return null;
        }

        try
        {
            lockedPatientDoc = domain.savePatientDocument(lockedPatientDoc);
        }
        catch (StaleObjectException e)
        {
            e.printStackTrace();
            return null;
        }

    }

    return lockedPatientDoc;
}
项目:openMAXIMS    文件:PatientClinicalNotesforEvolveIngestionJobImpl.java   
private PatientDocumentVo populatePatientDocument(PatientRefVo patientRef, MemberOfStaffRefVo mosRefVo) throws Exception
{
    if(patientRef == null)
        return null;

    PatientDocumentVo vo = new PatientDocumentVo();

    vo.setPatient(patientRef);                  

    vo.setDocumentDate(new ims.framework.utils.Date());
    vo.setName("Patient Clinical Notes Batch Report");
    vo.setServerDocument(populateServerDocument());
    vo.setCreationType(DocumentCreationType.GENERATED);                     
    vo.setCategory(DocumentCategory.CLINICAL_NOTES);

    vo.setRecordingDateTime(new DateTime());
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    PatientDocumentStatusVo status = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.COMPLETED);
    status.setRecordingUser(mosRefVo);
    status.setRecordingDateTime(new DateTime());

    vo.setCurrentDocumentStatus(status);
    vo.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());//wdev-19898
    vo.getDocumentStatusHistory().add(status);//wdev-19898

    vo.setRecordingUser(mosRefVo);//wdev-19898
    vo.setRecordingDateTime(new DateTime());//wdev-19898
    vo.setAuthoringHCP(getHcpForMosRef(mosRefVo));//wdev-19898
    vo.setAuthoringDateTime(new DateTime());//wdev-19898

    return vo;  
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo getFinalDocument(DocumentStatus status, DocumentAndPatientWrapperVo doc) 
{
    PatientDocumentVo lockedPatientDoc = doc.getDocument();

    if (status != null && lockedPatientDoc.getCurrentDocumentStatus() != null && !status.equals(lockedPatientDoc.getCurrentDocumentStatus().getCorrespondenceStatus()) && !DocumentStatus.COMPLETED.equals(lockedPatientDoc.getCurrentDocumentStatus().getCorrespondenceStatus()))
    {
        PatientDocumentStatusVo finalS = new PatientDocumentStatusVo();
        finalS.setCorrespondenceStatus(status);
        finalS.setRecordingDateTime(new DateTime());
        finalS.setRecordingUser((MemberOfStaffShortVo) domain.getMosUser());

        if (!lockedPatientDoc.getDocumentStatusHistoryIsNotNull())
        {
            lockedPatientDoc.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
        }

        lockedPatientDoc.getDocumentStatusHistory().add(finalS);
        lockedPatientDoc.setCurrentDocumentStatus(finalS);

        String[] errs = lockedPatientDoc.validate();
        if (errs != null && errs.length > 0)
        {
            return null;
        }

        try
        {
            lockedPatientDoc = domain.savePatientDocument(lockedPatientDoc);
        }
        catch (StaleObjectException e)
        {
            e.printStackTrace();
            return null;
        }

    }

    return lockedPatientDoc;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo getFinalDocument(DocumentStatus status, DocumentAndPatientWrapperVo doc) 
{
    PatientDocumentVo lockedPatientDoc = doc.getDocument();

    if (status != null && lockedPatientDoc.getCurrentDocumentStatus() != null && !status.equals(lockedPatientDoc.getCurrentDocumentStatus().getCorrespondenceStatus()) && !DocumentStatus.COMPLETED.equals(lockedPatientDoc.getCurrentDocumentStatus().getCorrespondenceStatus()))
    {
        PatientDocumentStatusVo finalS = new PatientDocumentStatusVo();
        finalS.setCorrespondenceStatus(status);
        finalS.setRecordingDateTime(new DateTime());
        finalS.setRecordingUser((MemberOfStaffShortVo) domain.getMosUser());

        if (!lockedPatientDoc.getDocumentStatusHistoryIsNotNull())
        {
            lockedPatientDoc.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
        }

        lockedPatientDoc.getDocumentStatusHistory().add(finalS);
        lockedPatientDoc.setCurrentDocumentStatus(finalS);

        String[] errs = lockedPatientDoc.validate();
        if (errs != null && errs.length > 0)
        {
            return null;
        }

        try
        {
            lockedPatientDoc = domain.savePatientDocument(lockedPatientDoc);
        }
        catch (StaleObjectException e)
        {
            e.printStackTrace();
            return null;
        }

    }

    return lockedPatientDoc;
}
项目:openmaxims-linux    文件:Logic.java   
private PatientDocumentVo getFinalDocument(DocumentStatus status, DocumentAndPatientWrapperVo doc) 
{
    PatientDocumentVo lockedPatientDoc = doc.getDocument();

    if (status != null && lockedPatientDoc.getCurrentDocumentStatus() != null && !status.equals(lockedPatientDoc.getCurrentDocumentStatus().getCorrespondenceStatus()) && !DocumentStatus.COMPLETED.equals(lockedPatientDoc.getCurrentDocumentStatus().getCorrespondenceStatus()))
    {
        PatientDocumentStatusVo finalS = new PatientDocumentStatusVo();
        finalS.setCorrespondenceStatus(status);
        finalS.setRecordingDateTime(new DateTime());
        finalS.setRecordingUser((MemberOfStaffShortVo) domain.getMosUser());

        if (!lockedPatientDoc.getDocumentStatusHistoryIsNotNull())
        {
            lockedPatientDoc.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
        }

        lockedPatientDoc.getDocumentStatusHistory().add(finalS);
        lockedPatientDoc.setCurrentDocumentStatus(finalS);

        String[] errs = lockedPatientDoc.validate();
        if (errs != null && errs.length > 0)
        {
            return null;
        }

        try
        {
            lockedPatientDoc = domain.savePatientDocument(lockedPatientDoc);
        }
        catch (StaleObjectException e)
        {
            e.printStackTrace();
            return null;
        }

    }

    return lockedPatientDoc;
}
项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo) 
{
    if(serverDocumentVo == null)
        return null;

    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());

    vo.setEpisodeofCare(form.cmbEpisode().getValue());
    vo.setCareContext(form.cmbCContext().getValue());
    vo.setClinicalContact(form.cmbCContant().getValue());

    if(form.dyngrdReports().getValue() instanceof DocumentCategoryConfigShortVo)
    {
        DocumentCategoryConfigShortVo templateConfig = (DocumentCategoryConfigShortVo) form.dyngrdReports().getValue();

        vo.setName(templateConfig.getTemplate() != null ? templateConfig.getTemplate().getName() : null);
        vo.setCategory(templateConfig.getCategory());
    }

    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
    vo.setServerDocument(serverDocumentVo);

    vo.setCreationType(DocumentCreationType.GENERATED);

    MemberOfStaffLiteVo mosUser = form.ccTypist().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.ccTypist().getValue() : null;
    vo.setRecordingUser(mosUser);
    vo.setRecordingDateTime(new DateTime());
    vo.setCorrespondenceStatus(DocumentStatus.DRAFT);
    vo.setSpecialty(form.cmbSpecialty().getValue());

    HcpRefVo hcpUser = form.ccAuthoring().getValue() instanceof HcpRefVo ? (HcpRefVo) form.ccAuthoring().getValue() : null;
    vo.setAuthoringHCP(hcpUser);
    vo.setAuthoringDateTime(new DateTime());

    vo.setDocumentDate(form.dteDocumentDate().getValue());

    PatientDocumentStatusVo status  = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.DRAFT);
    status.setRecordingDateTime(new DateTime());
    status.setRecordingUser(mosUser);

    vo.setCurrentDocumentStatus(status);
    vo.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    vo.getDocumentStatusHistory().add(status);

    HcpRefVo responsibleHcp = form.ccResponsibleHcp().getValue() instanceof HcpRefVo ? (HcpRefVo) form.ccResponsibleHcp().getValue() : null;
    vo.setResponsibleHCP(responsibleHcp);

    Boolean copyLetter = new Boolean(form.Group1().getValue().equals(GenForm.Group1Enumeration.rdoYes));
    vo.setCopyPatientOnCorrespondence(copyLetter);

    return vo;
}
项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(PatientShort patient, CareContextMinVo careContext, ClinicRefVo clinic, ServerDocumentVo serverDocumentVo) 
{
    if(serverDocumentVo == null)
        return null;

    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(patient);

    vo.setEpisodeofCare(careContext != null ? careContext.getEpisodeOfCare() : null);
    vo.setCareContext(careContext);

    if(form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue() instanceof TemplateForPatientDocumentVo)
    {
        vo.setName(((TemplateForPatientDocumentVo) form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue()).getName());

        DocumentCategoryConfigShortVo dc = domain.getDocCatConfig((TemplateForPatientDocumentVo) form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue());
        vo.setCategory(dc != null ? dc.getCategory() : null);
    }

    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(DocumentCreationType.GENERATED);
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    MemberOfStaffLiteVo mosUser = form.lyrLetterCreate().tabTemplate().ccTypist().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.lyrLetterCreate().tabTemplate().ccTypist().getValue() : null;
    vo.setRecordingUser(mosUser);
    vo.setRecordingDateTime(new DateTime());

    HcpRefVo hcpUser = form.lyrLetterCreate().tabTemplate().ccAuth().getValue() instanceof HcpRefVo ? (HcpRefVo) form.lyrLetterCreate().tabTemplate().ccAuth().getValue() : null;
    vo.setAuthoringHCP(hcpUser);
    vo.setAuthoringDateTime(new DateTime());

    vo.setSpecialty(form.lyrLetterCreate().tabTemplate().cmbSpecialty().getValue()!=null?form.lyrLetterCreate().tabTemplate().cmbSpecialty().getValue():((careContext != null && careContext.getEpisodeOfCare() != null) ? careContext.getEpisodeOfCare().getSpecialty() : null));

    PatientDocumentStatusVo documentStatus = new PatientDocumentStatusVo();
    documentStatus.setCorrespondenceStatus(DocumentStatus.DRAFT);
    documentStatus.setRecordingUser((MemberOfStaffLiteVo)domain.getMosUser());
    documentStatus.setRecordingDateTime(new DateTime());

    vo.setCurrentDocumentStatus(documentStatus);

    PatientDocumentStatusVoCollection historyStatus = new PatientDocumentStatusVoCollection();
    historyStatus.add(documentStatus);
    vo.setDocumentStatusHistory(historyStatus);

    vo.setDocumentDate(form.lyrLetterCreate().tabTemplate().dteDocDate().getValue()!=null?form.lyrLetterCreate().tabTemplate().dteDocDate().getValue():((careContext != null && careContext.getStartDateTime() != null ) ? careContext.getStartDateTime().getDate() : new Date()));

    //WDEV-12721
    if(form.getLocalContext().getMinDate() == null || vo.getDocumentDate().isLessThan(form.getLocalContext().getMinDate()))
        form.getLocalContext().setMinDate(vo.getDocumentDate());

    //WDEV-12721
    if(form.getLocalContext().getMaxDate() == null || vo.getDocumentDate().isGreaterThan(form.getLocalContext().getMaxDate()))
        form.getLocalContext().setMaxDate(vo.getDocumentDate());

    vo.setClinic(clinic);

    HcpRefVo responsibleHcp = form.lyrLetterCreate().tabTemplate().ccResponsible().getValue() instanceof HcpRefVo ? (HcpRefVo)form.lyrLetterCreate().tabTemplate().ccResponsible().getValue():(careContext != null && careContext.getResponsibleHCP() != null) ? careContext.getResponsibleHCP() : (careContext != null && careContext.getEpisodeOfCare() != null) ? careContext.getEpisodeOfCare().getResponsibleHCP() : null;
    vo.setResponsibleHCP(responsibleHcp);

    return vo;
}
项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocument, ReportVo reportVo)
{
    if (serverDocument==null)
        return null;

    // Create Patient Document VO
    PatientDocumentVo patientDocument = new PatientDocumentVo();

    patientDocument.setPatient(form.getGlobalContext().Core.getPatientShort());

    patientDocument.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    patientDocument.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    patientDocument.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());


    if (reportVo!=null)
    {
        patientDocument.setName(reportVo.getReportName());
    }

    patientDocument.setServerDocument(serverDocument);
    patientDocument.setCreationType(DocumentCreationType.GENERATED);

    patientDocument.setCategory(DocumentCategory.ADHOC_DOCUMENT);

    patientDocument.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    patientDocument.setRecordingUser(domain.getMosUser() instanceof MemberOfStaffRefVo ? (MemberOfStaffRefVo) domain.getMosUser() : null);
    patientDocument.setRecordingDateTime(new DateTime());
    patientDocument.setAuthoringHCP(domain.getHcpLiteUser() instanceof HcpLiteVo ? (HcpRefVo)domain.getHcpLiteUser() : null);
    patientDocument.setAuthoringDateTime(new DateTime());

    // Create a new PatientDocumentStatusVo
    PatientDocumentStatusVo status = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.COMPLETED);
    status.setRecordingUser(patientDocument.getRecordingUser());
    status.setRecordingDateTime(patientDocument.getRecordingDateTime());

    patientDocument.setCurrentDocumentStatus(status);
    patientDocument.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    patientDocument.getDocumentStatusHistory().add(status);

    patientDocument.setDocumentDate(form.getGlobalContext().Core.getCurrentCareContext() != null && form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime()!=null ? form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime().getDate() : patientDocument.getRecordingDateTime().getDate());
    patientDocument.setResponsibleHCP(form.getGlobalContext().Core.getEpisodeofCareShort()!=null ? form.getGlobalContext().Core.getEpisodeofCareShort().getResponsibleHCP():null);
    patientDocument.setSpecialty(form.getGlobalContext().Core.getEpisodeofCareShort()!=null ? form.getGlobalContext().Core.getEpisodeofCareShort().getSpecialty():null);

    return patientDocument;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo) 
{
    if(serverDocumentVo == null)
        return null;

    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());

    vo.setEpisodeofCare(form.cmbEpisode().getValue());
    vo.setCareContext(form.cmbCContext().getValue());
    vo.setClinicalContact(form.cmbCContant().getValue());

    if(form.dyngrdReports().getValue() instanceof DocumentCategoryConfigShortVo)
    {
        DocumentCategoryConfigShortVo templateConfig = (DocumentCategoryConfigShortVo) form.dyngrdReports().getValue();

        vo.setName(templateConfig.getTemplate() != null ? templateConfig.getTemplate().getName() : null);
        vo.setCategory(templateConfig.getCategory());
    }

    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
    vo.setServerDocument(serverDocumentVo);

    vo.setCreationType(DocumentCreationType.GENERATED);

    MemberOfStaffLiteVo mosUser = form.ccTypist().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.ccTypist().getValue() : null;
    vo.setRecordingUser(mosUser);
    vo.setRecordingDateTime(new DateTime());
    vo.setCorrespondenceStatus(DocumentStatus.DRAFT);
    vo.setSpecialty(form.cmbSpecialty().getValue());

    HcpRefVo hcpUser = form.ccAuthoring().getValue() instanceof HcpRefVo ? (HcpRefVo) form.ccAuthoring().getValue() : null;
    vo.setAuthoringHCP(hcpUser);
    vo.setAuthoringDateTime(new DateTime());

    vo.setDocumentDate(form.dteDocumentDate().getValue());

    PatientDocumentStatusVo status  = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.DRAFT);
    status.setRecordingDateTime(new DateTime());
    status.setRecordingUser(mosUser);

    vo.setCurrentDocumentStatus(status);
    vo.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    vo.getDocumentStatusHistory().add(status);

    HcpRefVo responsibleHcp = form.ccResponsibleHcp().getValue() instanceof HcpRefVo ? (HcpRefVo) form.ccResponsibleHcp().getValue() : null;
    vo.setResponsibleHCP(responsibleHcp);

    Boolean copyLetter = new Boolean(form.Group1().getValue().equals(GenForm.Group1Enumeration.rdoYes));
    vo.setCopyPatientOnCorrespondence(copyLetter);

    return vo;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(PatientShort patient, CareContextMinVo careContext, ClinicRefVo clinic, ServerDocumentVo serverDocumentVo) 
{
    if(serverDocumentVo == null)
        return null;

    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(patient);

    vo.setEpisodeofCare(careContext != null ? careContext.getEpisodeOfCare() : null);
    vo.setCareContext(careContext);

    if(form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue() instanceof TemplateForPatientDocumentVo)
    {
        vo.setName(((TemplateForPatientDocumentVo) form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue()).getName());

        DocumentCategoryConfigShortVo dc = domain.getDocCatConfig((TemplateForPatientDocumentVo) form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue());
        vo.setCategory(dc != null ? dc.getCategory() : null);
    }

    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(DocumentCreationType.GENERATED);
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    MemberOfStaffLiteVo mosUser = form.lyrLetterCreate().tabTemplate().ccTypist().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.lyrLetterCreate().tabTemplate().ccTypist().getValue() : null;
    vo.setRecordingUser(mosUser);
    vo.setRecordingDateTime(new DateTime());

    HcpRefVo hcpUser = form.lyrLetterCreate().tabTemplate().ccAuth().getValue() instanceof HcpRefVo ? (HcpRefVo) form.lyrLetterCreate().tabTemplate().ccAuth().getValue() : null;
    vo.setAuthoringHCP(hcpUser);
    vo.setAuthoringDateTime(new DateTime());

    vo.setSpecialty(form.lyrLetterCreate().tabTemplate().cmbSpecialty().getValue()!=null?form.lyrLetterCreate().tabTemplate().cmbSpecialty().getValue():((careContext != null && careContext.getEpisodeOfCare() != null) ? careContext.getEpisodeOfCare().getSpecialty() : null));

    PatientDocumentStatusVo documentStatus = new PatientDocumentStatusVo();
    documentStatus.setCorrespondenceStatus(DocumentStatus.DRAFT);
    documentStatus.setRecordingUser((MemberOfStaffLiteVo)domain.getMosUser());
    documentStatus.setRecordingDateTime(new DateTime());

    vo.setCurrentDocumentStatus(documentStatus);

    PatientDocumentStatusVoCollection historyStatus = new PatientDocumentStatusVoCollection();
    historyStatus.add(documentStatus);
    vo.setDocumentStatusHistory(historyStatus);

    vo.setDocumentDate(form.lyrLetterCreate().tabTemplate().dteDocDate().getValue()!=null?form.lyrLetterCreate().tabTemplate().dteDocDate().getValue():((careContext != null && careContext.getStartDateTime() != null ) ? careContext.getStartDateTime().getDate() : new Date()));

    //WDEV-12721
    if(form.getLocalContext().getMinDate() == null || vo.getDocumentDate().isLessThan(form.getLocalContext().getMinDate()))
        form.getLocalContext().setMinDate(vo.getDocumentDate());

    //WDEV-12721
    if(form.getLocalContext().getMaxDate() == null || vo.getDocumentDate().isGreaterThan(form.getLocalContext().getMaxDate()))
        form.getLocalContext().setMaxDate(vo.getDocumentDate());

    vo.setClinic(clinic);

    HcpRefVo responsibleHcp = form.lyrLetterCreate().tabTemplate().ccResponsible().getValue() instanceof HcpRefVo ? (HcpRefVo)form.lyrLetterCreate().tabTemplate().ccResponsible().getValue():(careContext != null && careContext.getResponsibleHCP() != null) ? careContext.getResponsibleHCP() : (careContext != null && careContext.getEpisodeOfCare() != null) ? careContext.getEpisodeOfCare().getResponsibleHCP() : null;
    vo.setResponsibleHCP(responsibleHcp);

    return vo;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(byte[] reportContent)
{
    if (reportContent==null)
        return null;

    // Create Patient Document VO
    PatientDocumentVo patientDocument = new PatientDocumentVo();

    patientDocument.setPatient(form.getGlobalContext().Core.getPatientShort());

    patientDocument.setEpisodeofCare(form.getGlobalContext().Core.getCurrentCareContext()!=null ? form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCare() : null);
    patientDocument.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());

    patientDocument.setName("TCI Details");

    patientDocument.setServerDocument(populateServerDocument(reportContent));
    patientDocument.setCreationType(DocumentCreationType.GENERATED);

    patientDocument.setCategory(DocumentCategory.ADHOC_DOCUMENT);

    patientDocument.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    patientDocument.setRecordingUser(domain.getMosUser() instanceof MemberOfStaffRefVo ? (MemberOfStaffRefVo) domain.getMosUser() : null);
    patientDocument.setRecordingDateTime(new DateTime());
    patientDocument.setAuthoringHCP(domain.getHcpLiteUser() instanceof HcpLiteVo ? (HcpRefVo)domain.getHcpLiteUser() : null);
    patientDocument.setAuthoringDateTime(new DateTime());

    // Create a new PatientDocumentStatusVo
    PatientDocumentStatusVo status = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.COMPLETED);
    status.setRecordingUser(patientDocument.getRecordingUser());
    status.setRecordingDateTime(patientDocument.getRecordingDateTime());

    patientDocument.setCurrentDocumentStatus(status);
    patientDocument.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    patientDocument.getDocumentStatusHistory().add(status);

    patientDocument.setDocumentDate(form.getGlobalContext().Core.getCurrentCareContext() != null && form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime()!=null ? form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime().getDate() : patientDocument.getRecordingDateTime().getDate());
    patientDocument.setResponsibleHCP(form.getGlobalContext().Core.getCurrentCareContext() != null  && form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCareIsNotNull() ? form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCare().getResponsibleHCP() : null);
    patientDocument.setSpecialty(form.getGlobalContext().Core.getCurrentCareContext() != null  && form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCareIsNotNull() ? form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCare().getSpecialty() : null);

    return patientDocument;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocument, ReportVo reportVo)
{
    if (serverDocument==null)
        return null;

    // Create Patient Document VO
    PatientDocumentVo patientDocument = new PatientDocumentVo();

    patientDocument.setPatient(form.getGlobalContext().Core.getPatientShort());

    patientDocument.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    patientDocument.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    patientDocument.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());


    if (reportVo!=null)
    {
        patientDocument.setName(reportVo.getReportName());
    }

    patientDocument.setServerDocument(serverDocument);
    patientDocument.setCreationType(DocumentCreationType.GENERATED);

    patientDocument.setCategory(DocumentCategory.ADHOC_DOCUMENT);

    patientDocument.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    patientDocument.setRecordingUser(domain.getMosUser() instanceof MemberOfStaffRefVo ? (MemberOfStaffRefVo) domain.getMosUser() : null);
    patientDocument.setRecordingDateTime(new DateTime());
    patientDocument.setAuthoringHCP(domain.getHcpLiteUser() instanceof HcpLiteVo ? (HcpRefVo)domain.getHcpLiteUser() : null);
    patientDocument.setAuthoringDateTime(new DateTime());

    // Create a new PatientDocumentStatusVo
    PatientDocumentStatusVo status = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.COMPLETED);
    status.setRecordingUser(patientDocument.getRecordingUser());
    status.setRecordingDateTime(patientDocument.getRecordingDateTime());

    patientDocument.setCurrentDocumentStatus(status);
    patientDocument.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    patientDocument.getDocumentStatusHistory().add(status);

    patientDocument.setDocumentDate(form.getGlobalContext().Core.getCurrentCareContext() != null && form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime()!=null ? form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime().getDate() : patientDocument.getRecordingDateTime().getDate());
    patientDocument.setResponsibleHCP(form.getGlobalContext().Core.getEpisodeofCareShort()!=null ? form.getGlobalContext().Core.getEpisodeofCareShort().getResponsibleHCP():null);
    patientDocument.setSpecialty(form.getGlobalContext().Core.getEpisodeofCareShort()!=null ? form.getGlobalContext().Core.getEpisodeofCareShort().getSpecialty():null);

    return patientDocument;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo changeStatus(DocumentStatus newStatus, PatientDocumentVo doc, boolean showErrors,boolean isBatch)
{   
    if (doc == null)
        throw new CodingRuntimeException("There is no document selected to change status for");

    errorS = null;

    PatientDocumentStatusVo newDocStatus = new PatientDocumentStatusVo();
    newDocStatus.setCorrespondenceStatus(newStatus);
    newDocStatus.setRecordingDateTime(new DateTime());
    newDocStatus.setRecordingUser((MemberOfStaffLiteVo) domain.getMosUser());

    if (!doc.getDocumentStatusHistoryIsNotNull())
    {
        doc.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    }
    doc.getDocumentStatusHistory().add(newDocStatus);
    doc.setCurrentDocumentStatus(newDocStatus);

    String[] errors = doc.validate();
    if (errors != null && errors.length > 0 )
    {
        errorS = "Could not change status.\nThe document is not valid";

        if (showErrors)
            engine.showErrors(errors);

        return null;
    }

    PatientDocumentVo patDoc = null;
    if (newStatus.equals(DocumentStatus.READY_TO_SEND))
    {
        if (isStale(doc))
        {
            errorS ="Could not finalise document.\nThe document has been modified by another user";
            if (showErrors)
            {
                engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue(), "Unable to change status", MessageButtons.OK, MessageIcon.ERROR);
                open();
            }

            return null;
        }
        patDoc = lockPatientDoc(doc, false, null);
        if (patDoc == null)
        {
            errorS = "Could not finalise document";
            if (showErrors)
            {
                engine.showErrors(new String[] { errorS});
                open();
            }

            return null;
        }
    }
    else
    {
        try
        {
            patDoc = domain.savePatientDocument(doc);
        }
        catch (StaleObjectException e)
        {
            errorS= "Could not change status.\nThe document has been modified by another user";
            if (showErrors)
            {
                engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue(), "Unable to change status", MessageButtons.OK, MessageIcon.ERROR);
                open();
            }

            return null;
        }
    }

    return patDoc;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocument, ReportVo reportVo)
{
    if (serverDocument==null)
        return null;

    // Create Patient Document VO
    PatientDocumentVo patientDocument = new PatientDocumentVo();

    patientDocument.setPatient(form.getGlobalContext().Core.getPatientShort());

    patientDocument.setEpisodeofCare(form.getGlobalContext().Core.getCurrentCareContext()!=null ? form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCare() : null);
    patientDocument.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());

    if (reportVo!=null)
    {
        patientDocument.setName(reportVo.getReportName());
    }

    patientDocument.setServerDocument(serverDocument);
    patientDocument.setCreationType(DocumentCreationType.GENERATED);

    patientDocument.setCategory(DocumentCategory.ADHOC_DOCUMENT);

    patientDocument.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    patientDocument.setRecordingUser(domain.getMosUser() instanceof MemberOfStaffRefVo ? (MemberOfStaffRefVo) domain.getMosUser() : null);
    patientDocument.setRecordingDateTime(new DateTime());
    patientDocument.setAuthoringHCP(domain.getHcpLiteUser() instanceof HcpLiteVo ? (HcpRefVo)domain.getHcpLiteUser() : null);
    patientDocument.setAuthoringDateTime(new DateTime());

    // Create a new PatientDocumentStatusVo
    PatientDocumentStatusVo status = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.COMPLETED);
    status.setRecordingUser(patientDocument.getRecordingUser());
    status.setRecordingDateTime(patientDocument.getRecordingDateTime());

    patientDocument.setCurrentDocumentStatus(status);
    patientDocument.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    patientDocument.getDocumentStatusHistory().add(status);

    patientDocument.setDocumentDate(form.getGlobalContext().Core.getCurrentCareContext() != null && form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime()!=null ? form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime().getDate() : patientDocument.getRecordingDateTime().getDate());
    patientDocument.setResponsibleHCP(form.getGlobalContext().Core.getCurrentCareContext() != null  && form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCareIsNotNull() ? form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCare().getResponsibleHCP() : null);
    patientDocument.setSpecialty(form.getGlobalContext().Core.getCurrentCareContext() != null  && form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCareIsNotNull() ? form.getGlobalContext().Core.getCurrentCareContext().getEpisodeOfCare().getSpecialty() : null);

    return patientDocument;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo) 
{
    if(serverDocumentVo == null)
        return null;

    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());

    vo.setEpisodeofCare(form.cmbEpisode().getValue());
    vo.setCareContext(form.cmbCContext().getValue());
    vo.setClinicalContact(form.cmbCContant().getValue());

    if(form.dyngrdReports().getValue() instanceof DocumentCategoryConfigShortVo)
    {
        DocumentCategoryConfigShortVo templateConfig = (DocumentCategoryConfigShortVo) form.dyngrdReports().getValue();

        vo.setName(templateConfig.getTemplate() != null ? templateConfig.getTemplate().getName() : null);
        vo.setCategory(templateConfig.getCategory());
    }

    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
    vo.setServerDocument(serverDocumentVo);

    vo.setCreationType(DocumentCreationType.GENERATED);

    MemberOfStaffLiteVo mosUser = form.ccTypist().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.ccTypist().getValue() : null;
    vo.setRecordingUser(mosUser);
    vo.setRecordingDateTime(new DateTime());
    vo.setCorrespondenceStatus(DocumentStatus.DRAFT);
    vo.setSpecialty(form.cmbSpecialty().getValue());

    HcpRefVo hcpUser = form.ccAuthoring().getValue() instanceof HcpRefVo ? (HcpRefVo) form.ccAuthoring().getValue() : null;
    vo.setAuthoringHCP(hcpUser);
    vo.setAuthoringDateTime(new DateTime());

    vo.setDocumentDate(form.dteDocumentDate().getValue());

    PatientDocumentStatusVo status  = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.DRAFT);
    status.setRecordingDateTime(new DateTime());
    status.setRecordingUser(mosUser);

    vo.setCurrentDocumentStatus(status);
    vo.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    vo.getDocumentStatusHistory().add(status);

    HcpRefVo responsibleHcp = form.ccResponsibleHcp().getValue() instanceof HcpRefVo ? (HcpRefVo) form.ccResponsibleHcp().getValue() : null;
    vo.setResponsibleHCP(responsibleHcp);

    Boolean copyLetter = new Boolean(form.Group1().getValue().equals(GenForm.Group1Enumeration.rdoYes));
    vo.setCopyPatientOnCorrespondence(copyLetter);

    return vo;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(PatientShort patient, CareContextMinVo careContext, ClinicRefVo clinic, ServerDocumentVo serverDocumentVo) 
{
    if(serverDocumentVo == null)
        return null;

    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(patient);

    vo.setEpisodeofCare(careContext != null ? careContext.getEpisodeOfCare() : null);
    vo.setCareContext(careContext);

    if(form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue() instanceof TemplateForPatientDocumentVo)
    {
        vo.setName(((TemplateForPatientDocumentVo) form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue()).getName());

        DocumentCategoryConfigShortVo dc = domain.getDocCatConfig((TemplateForPatientDocumentVo) form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue());
        vo.setCategory(dc != null ? dc.getCategory() : null);
    }

    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(DocumentCreationType.GENERATED);
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    MemberOfStaffLiteVo mosUser = form.lyrLetterCreate().tabTemplate().ccTypist().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.lyrLetterCreate().tabTemplate().ccTypist().getValue() : null;
    vo.setRecordingUser(mosUser);
    vo.setRecordingDateTime(new DateTime());

    HcpRefVo hcpUser = form.lyrLetterCreate().tabTemplate().ccAuth().getValue() instanceof HcpRefVo ? (HcpRefVo) form.lyrLetterCreate().tabTemplate().ccAuth().getValue() : null;
    vo.setAuthoringHCP(hcpUser);
    vo.setAuthoringDateTime(new DateTime());

    vo.setSpecialty(form.lyrLetterCreate().tabTemplate().cmbSpecialty().getValue()!=null?form.lyrLetterCreate().tabTemplate().cmbSpecialty().getValue():((careContext != null && careContext.getEpisodeOfCare() != null) ? careContext.getEpisodeOfCare().getSpecialty() : null));

    PatientDocumentStatusVo documentStatus = new PatientDocumentStatusVo();
    documentStatus.setCorrespondenceStatus(DocumentStatus.DRAFT);
    documentStatus.setRecordingUser((MemberOfStaffLiteVo)domain.getMosUser());
    documentStatus.setRecordingDateTime(new DateTime());

    vo.setCurrentDocumentStatus(documentStatus);

    PatientDocumentStatusVoCollection historyStatus = new PatientDocumentStatusVoCollection();
    historyStatus.add(documentStatus);
    vo.setDocumentStatusHistory(historyStatus);

    vo.setDocumentDate(form.lyrLetterCreate().tabTemplate().dteDocDate().getValue()!=null?form.lyrLetterCreate().tabTemplate().dteDocDate().getValue():((careContext != null && careContext.getStartDateTime() != null ) ? careContext.getStartDateTime().getDate() : new Date()));

    //WDEV-12721
    if(form.getLocalContext().getMinDate() == null || vo.getDocumentDate().isLessThan(form.getLocalContext().getMinDate()))
        form.getLocalContext().setMinDate(vo.getDocumentDate());

    //WDEV-12721
    if(form.getLocalContext().getMaxDate() == null || vo.getDocumentDate().isGreaterThan(form.getLocalContext().getMaxDate()))
        form.getLocalContext().setMaxDate(vo.getDocumentDate());

    vo.setClinic(clinic);

    HcpRefVo responsibleHcp = form.lyrLetterCreate().tabTemplate().ccResponsible().getValue() instanceof HcpRefVo ? (HcpRefVo)form.lyrLetterCreate().tabTemplate().ccResponsible().getValue():(careContext != null && careContext.getResponsibleHCP() != null) ? careContext.getResponsibleHCP() : (careContext != null && careContext.getEpisodeOfCare() != null) ? careContext.getEpisodeOfCare().getResponsibleHCP() : null;
    vo.setResponsibleHCP(responsibleHcp);

    return vo;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocument, ReportVo reportVo)
{
    if (serverDocument==null)
        return null;

    // Create Patient Document VO
    PatientDocumentVo patientDocument = new PatientDocumentVo();

    patientDocument.setPatient(form.getGlobalContext().Core.getPatientShort());

    patientDocument.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    patientDocument.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    patientDocument.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());


    if (reportVo!=null)
    {
        patientDocument.setName(reportVo.getReportName());
    }

    patientDocument.setServerDocument(serverDocument);
    patientDocument.setCreationType(DocumentCreationType.GENERATED);

    patientDocument.setCategory(DocumentCategory.ADHOC_DOCUMENT);

    patientDocument.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    patientDocument.setRecordingUser(domain.getMosUser() instanceof MemberOfStaffRefVo ? (MemberOfStaffRefVo) domain.getMosUser() : null);
    patientDocument.setRecordingDateTime(new DateTime());
    patientDocument.setAuthoringHCP(domain.getHcpLiteUser() instanceof HcpLiteVo ? (HcpRefVo)domain.getHcpLiteUser() : null);
    patientDocument.setAuthoringDateTime(new DateTime());

    // Create a new PatientDocumentStatusVo
    PatientDocumentStatusVo status = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.COMPLETED);
    status.setRecordingUser(patientDocument.getRecordingUser());
    status.setRecordingDateTime(patientDocument.getRecordingDateTime());

    patientDocument.setCurrentDocumentStatus(status);
    patientDocument.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    patientDocument.getDocumentStatusHistory().add(status);

    patientDocument.setDocumentDate(form.getGlobalContext().Core.getCurrentCareContext() != null && form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime()!=null ? form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime().getDate() : patientDocument.getRecordingDateTime().getDate());
    patientDocument.setResponsibleHCP(form.getGlobalContext().Core.getEpisodeofCareShort()!=null ? form.getGlobalContext().Core.getEpisodeofCareShort().getResponsibleHCP():null);
    patientDocument.setSpecialty(form.getGlobalContext().Core.getEpisodeofCareShort()!=null ? form.getGlobalContext().Core.getEpisodeofCareShort().getSpecialty():null);

    return patientDocument;
}
项目:openmaxims-linux    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo) 
{
    if(serverDocumentVo == null)
        return null;

    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());

    vo.setEpisodeofCare(form.cmbEpisode().getValue());
    vo.setCareContext(form.cmbCContext().getValue());
    vo.setClinicalContact(form.cmbCContant().getValue());

    if(form.dyngrdReports().getValue() instanceof DocumentCategoryConfigShortVo)
    {
        DocumentCategoryConfigShortVo templateConfig = (DocumentCategoryConfigShortVo) form.dyngrdReports().getValue();

        vo.setName(templateConfig.getTemplate() != null ? templateConfig.getTemplate().getName() : null);
        vo.setCategory(templateConfig.getCategory());
    }

    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
    vo.setServerDocument(serverDocumentVo);

    vo.setCreationType(DocumentCreationType.GENERATED);

    MemberOfStaffLiteVo mosUser = form.ccTypist().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.ccTypist().getValue() : null;
    vo.setRecordingUser(mosUser);
    vo.setRecordingDateTime(new DateTime());
    vo.setCorrespondenceStatus(DocumentStatus.DRAFT);
    vo.setSpecialty(form.cmbSpecialty().getValue());

    HcpRefVo hcpUser = form.ccAuthoring().getValue() instanceof HcpRefVo ? (HcpRefVo) form.ccAuthoring().getValue() : null;
    vo.setAuthoringHCP(hcpUser);
    vo.setAuthoringDateTime(new DateTime());

    vo.setDocumentDate(form.dteDocumentDate().getValue());

    PatientDocumentStatusVo status  = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.DRAFT);
    status.setRecordingDateTime(new DateTime());
    status.setRecordingUser(mosUser);

    vo.setCurrentDocumentStatus(status);
    vo.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    vo.getDocumentStatusHistory().add(status);

    HcpRefVo responsibleHcp = form.ccResponsibleHcp().getValue() instanceof HcpRefVo ? (HcpRefVo) form.ccResponsibleHcp().getValue() : null;
    vo.setResponsibleHCP(responsibleHcp);

    Boolean copyLetter = new Boolean(form.Group1().getValue().equals(GenForm.Group1Enumeration.rdoYes));
    vo.setCopyPatientOnCorrespondence(copyLetter);

    return vo;
}
项目:openmaxims-linux    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(PatientShort patient, CareContextMinVo careContext, ClinicRefVo clinic, ServerDocumentVo serverDocumentVo) 
{
    if(serverDocumentVo == null)
        return null;

    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(patient);

    vo.setEpisodeofCare(careContext != null ? careContext.getEpisodeOfCare() : null);
    vo.setCareContext(careContext);

    if(form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue() instanceof TemplateForPatientDocumentVo)
    {
        vo.setName(((TemplateForPatientDocumentVo) form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue()).getName());

        DocumentCategoryConfigShortVo dc = domain.getDocCatConfig((TemplateForPatientDocumentVo) form.lyrLetterCreate().tabTemplate().dyngrdReports().getValue());
        vo.setCategory(dc != null ? dc.getCategory() : null);
    }

    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(DocumentCreationType.GENERATED);
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    MemberOfStaffLiteVo mosUser = form.lyrLetterCreate().tabTemplate().ccTypist().getValue() instanceof MemberOfStaffLiteVo ? (MemberOfStaffLiteVo) form.lyrLetterCreate().tabTemplate().ccTypist().getValue() : null;
    vo.setRecordingUser(mosUser);
    vo.setRecordingDateTime(new DateTime());

    HcpRefVo hcpUser = form.lyrLetterCreate().tabTemplate().ccAuth().getValue() instanceof HcpRefVo ? (HcpRefVo) form.lyrLetterCreate().tabTemplate().ccAuth().getValue() : null;
    vo.setAuthoringHCP(hcpUser);
    vo.setAuthoringDateTime(new DateTime());

    vo.setSpecialty(form.lyrLetterCreate().tabTemplate().cmbSpecialty().getValue()!=null?form.lyrLetterCreate().tabTemplate().cmbSpecialty().getValue():((careContext != null && careContext.getEpisodeOfCare() != null) ? careContext.getEpisodeOfCare().getSpecialty() : null));

    PatientDocumentStatusVo documentStatus = new PatientDocumentStatusVo();
    documentStatus.setCorrespondenceStatus(DocumentStatus.DRAFT);
    documentStatus.setRecordingUser((MemberOfStaffLiteVo)domain.getMosUser());
    documentStatus.setRecordingDateTime(new DateTime());

    vo.setCurrentDocumentStatus(documentStatus);

    PatientDocumentStatusVoCollection historyStatus = new PatientDocumentStatusVoCollection();
    historyStatus.add(documentStatus);
    vo.setDocumentStatusHistory(historyStatus);

    vo.setDocumentDate(form.lyrLetterCreate().tabTemplate().dteDocDate().getValue()!=null?form.lyrLetterCreate().tabTemplate().dteDocDate().getValue():((careContext != null && careContext.getStartDateTime() != null ) ? careContext.getStartDateTime().getDate() : new Date()));

    //WDEV-12721
    if(form.getLocalContext().getMinDate() == null || vo.getDocumentDate().isLessThan(form.getLocalContext().getMinDate()))
        form.getLocalContext().setMinDate(vo.getDocumentDate());

    //WDEV-12721
    if(form.getLocalContext().getMaxDate() == null || vo.getDocumentDate().isGreaterThan(form.getLocalContext().getMaxDate()))
        form.getLocalContext().setMaxDate(vo.getDocumentDate());

    vo.setClinic(clinic);

    HcpRefVo responsibleHcp = form.lyrLetterCreate().tabTemplate().ccResponsible().getValue() instanceof HcpRefVo ? (HcpRefVo)form.lyrLetterCreate().tabTemplate().ccResponsible().getValue():(careContext != null && careContext.getResponsibleHCP() != null) ? careContext.getResponsibleHCP() : (careContext != null && careContext.getEpisodeOfCare() != null) ? careContext.getEpisodeOfCare().getResponsibleHCP() : null;
    vo.setResponsibleHCP(responsibleHcp);

    return vo;
}
项目:openmaxims-linux    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocument, ReportVo reportVo)
{
    if (serverDocument==null)
        return null;

    // Create Patient Document VO
    PatientDocumentVo patientDocument = new PatientDocumentVo();

    patientDocument.setPatient(form.getGlobalContext().Core.getPatientShort());

    patientDocument.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    patientDocument.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    patientDocument.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());


    if (reportVo!=null)
    {
        patientDocument.setName(reportVo.getReportName());
    }

    patientDocument.setServerDocument(serverDocument);
    patientDocument.setCreationType(DocumentCreationType.GENERATED);

    patientDocument.setCategory(DocumentCategory.ADHOC_DOCUMENT);

    patientDocument.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    patientDocument.setRecordingUser(domain.getMosUser() instanceof MemberOfStaffRefVo ? (MemberOfStaffRefVo) domain.getMosUser() : null);
    patientDocument.setRecordingDateTime(new DateTime());
    patientDocument.setAuthoringHCP(domain.getHcpLiteUser() instanceof HcpLiteVo ? (HcpRefVo)domain.getHcpLiteUser() : null);
    patientDocument.setAuthoringDateTime(new DateTime());

    // Create a new PatientDocumentStatusVo
    PatientDocumentStatusVo status = new PatientDocumentStatusVo();
    status.setCorrespondenceStatus(DocumentStatus.COMPLETED);
    status.setRecordingUser(patientDocument.getRecordingUser());
    status.setRecordingDateTime(patientDocument.getRecordingDateTime());

    patientDocument.setCurrentDocumentStatus(status);
    patientDocument.setDocumentStatusHistory(new PatientDocumentStatusVoCollection());
    patientDocument.getDocumentStatusHistory().add(status);

    patientDocument.setDocumentDate(form.getGlobalContext().Core.getCurrentCareContext() != null && form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime()!=null ? form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime().getDate() : patientDocument.getRecordingDateTime().getDate());
    patientDocument.setResponsibleHCP(form.getGlobalContext().Core.getEpisodeofCareShort()!=null ? form.getGlobalContext().Core.getEpisodeofCareShort().getResponsibleHCP():null);
    patientDocument.setSpecialty(form.getGlobalContext().Core.getEpisodeofCareShort()!=null ? form.getGlobalContext().Core.getEpisodeofCareShort().getSpecialty():null);

    return patientDocument;
}