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

项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo)
{
    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());
    vo.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
    vo.setReferral(null);
    vo.setName(form.txtName().getValue());
    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(form.cmbType().getValue());
    vo.setCategory(form.cmbSource().getValue());
    vo.setDocumentDate(form.getGlobalContext().Core.getCurrentCareContextIsNotNull() ? form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime().getDate() : (form.getGlobalContext().Core.getEpisodeofCareShortIsNotNull() ? form.getGlobalContext().Core.getEpisodeofCareShort().getStartDate() : new Date()));//   WDEV-13638, WDEV-12356
    vo.setRecordingUser((MemberOfStaffRefVo)domain.getMosUser(engine.getLoggedInUser().getUsername()));
    vo.setRecordingDateTime(new DateTime());
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    vo.setResponsibleHCP(form.getGlobalContext().Core.getEpisodeofCareShortIsNotNull() ? form.getGlobalContext().Core.getEpisodeofCareShort().getResponsibleHCP() : null);//WDEV-13338
    vo.setSpecialty(form.getGlobalContext().Core.getEpisodeofCareShortIsNotNull() ? form.getGlobalContext().Core.getEpisodeofCareShort().getSpecialty() : null);//WDEV-13338
    return vo;
}
项目:AvoinApotti    文件:Logic.java   
private void openDocForEditFromWorkArea(PatientDocumentVo doc)
{
    validateNonFinalDocument(doc);

    String winPath = engine.getLocalSettings().getWordEditorPath();

    if ((winPath == null || winPath.length() == 0) && ConfigFlag.GEN.AUTODETECT_DOCUMENT_EDITOR.getValue() == false)     //WDEV-12231
    {
        form.getLocalContext().setShouldOpenAfterPathIsSet(true);
        engine.open(form.getForms().Core.LocalSettingsDialog);
        return;
    }

    selectPatient(doc.getPatient());

    String filePath = (getCheckOutWorkArea() + doc.getServerDocument().getFileName()).replace("/", "\\");//WDEV-13366

    form.getGlobalContext().Core.setPatientCorrespondence(doc);
    engine.open(form.getForms().Core.PatientDocumentEdit, false);

    if(ConfigFlag.GEN.AUTODETECT_DOCUMENT_EDITOR.getValue() == true)    //WDEV-12231
        engine.runExternalApplication(filePath, true, false);
    else
        engine.runExternalApplication(winPath + " " + filePath, false);
}
项目:AvoinApotti    文件:Logic.java   
private boolean validateNonFinalDocument(PatientDocumentVo selectedDocument)
{
    if (selectedDocument == null)
        throw new CodingRuntimeException("Trying to validate null document");

    String[] errors = selectedDocument.validate();
    if (errors != null && errors.length > 0)
    {
        throw new CodingRuntimeException("The document is not valid. Posible data corruption");

    }
    if (isDocumentFinal(selectedDocument) || !FileType.DOC.equals(selectedDocument.getServerDocument().getFileType()))
    {
        //This is a stale exception
        engine.showErrors(new String[] { ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue() });
        form.getLocalContext().setSelectedDocument(null);
        form.getLocalContext().setOldSelectedDocument(null);//WDEV-13546
        open();
        return false;

    }

    return true;
}
项目:AvoinApotti    文件:Logic.java   
private String undoCheckOut(PatientDocumentVo doc) throws StaleObjectException
{
    validateNonFinalDocument(doc);

    String fileName = doc.getServerDocument().getFileName();
    if (!deleteFile((getCheckOutWorkArea() + fileName).replace("/", "\\")))//WDEV-13753
    {
        if (isStale(doc))
        {
            return ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue();
        }
        return "Could not remove document from work area.\nPlease make sure that Microsoft Word is closed\nDocument will remain checked-out";
    }

    doc.setIsLockedForEditing(false);
    doc.setLockedByUser(null);
    doc.setLockedOnDateTime(null);
    doc.validate();

    form.getLocalContext().setSelectedDocument(domain.savePatientDocument(doc));

    return null;
}
项目:AvoinApotti    文件:Logic.java   
private boolean validateNonFinalDocument(PatientDocumentVo selectedDocument)
{
    if (selectedDocument == null)
        throw new CodingRuntimeException("Trying to validate null document");

    String[] errors = selectedDocument.validate();

    if (errors != null && errors.length > 0)
    {
        showError("The document is not valid. Posible data corruption");
        return false;
    }

    if (isDocumentFinal(selectedDocument))
    {
        throw new CodingRuntimeException("The document is not draft");
    }

    if (!FileType.DOC.equals(selectedDocument.getServerDocument().getFileType()))
    {
        showError("The document is not the right type. Posible data corruption");
        return false;
    }

    return true;
}
项目:AvoinApotti    文件:DocumentWorklistImpl.java   
public void deletePatientDocument(PatientDocumentVo patDoc) throws ForeignKeyViolationException, StaleObjectException
{

    PatientDocument patDO = PatientDocumentVoAssembler.extractPatientDocument(getDomainFactory(), patDoc);
    if (patDO == null )
        throw new StaleObjectException(patDO);

    long count  = getDomainFactory().countWithHQL("select count(patDoc.id) " +
            "from PatientDocument as patDoc where " +
            "(patDoc.id = :patDocId and patDoc.version=:patVersion)"
            ,new String[]{"patDocId","patVersion"},
            new Object[]{patDoc.getID_PatientDocument(),patDoc.getVersion_PatientDocument()});

    if (count == 0)
        throw new StaleObjectException(patDO);

    //getDomainFactory().delete(patDO);
    patDO.setIsRIE(true);//WDEV-15417
    getDomainFactory().save(patDO);//WDEV-15417
}
项目:AvoinApotti    文件:DocumentWorklistImpl.java   
public PatientDocumentVo savePatientDocument(PatientDocumentVo document) throws StaleObjectException
{
    if(document == null)
        throw new CodingRuntimeException("Can not save a null PatientDocumentVo.");

    if(!document.isValidated())
        throw new CodingRuntimeException("PatientDocumentVo not validated");

    DomainFactory factory = getDomainFactory();
    PatientDocument doc = PatientDocumentVoAssembler.extractPatientDocument(factory, document);
    if (doc == null)
        throw new StaleObjectException(doc);
    factory.save(doc);  

    return PatientDocumentVoAssembler.create(doc);
}
项目:AvoinApotti    文件:DnaBatchUpdateImpl.java   
@SuppressWarnings("unchecked")
public void savePatientDocument(ims.core.vo.PatientDocumentVo document, ims.RefMan.vo.CatsReferralVo catReferral) throws ims.domain.exceptions.StaleObjectException
{
    if (document != null)
    {
        if (!document.isValidated())
            throw new DomainRuntimeException("PatientDocumentVo not validated");
    }

    DomainFactory factory = getDomainFactory();
    PatientDocument doc = PatientDocumentVoAssembler.extractPatientDocument(factory, document);
    factory.save(doc);              

    CatsReferral doCatsReferral = CatsReferralVoAssembler.extractCatsReferral(factory, catReferral);
        doCatsReferral.getReferralDocuments().add(doc); 

    doCatsReferral.setHasDocuments(Boolean.TRUE);

    //wdev-8288
    doCatsReferral.setHasDNAApptsForReview(Boolean.TRUE);

    factory.save(doCatsReferral);
}
项目:AvoinApotti    文件:DnaBatchUpdateImpl.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo, CatsReferralVo catReferral)
{
    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(catReferral.getPatient());
    vo.setEpisodeofCare(null);
    vo.setCareContext(null);
    vo.setClinicalContact(null);
    vo.setReferral(null);

    vo.setName("Letter to patient DNA");
    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(DocumentCreationType.GENERATED);
    vo.setCategory(DocumentCategory.LETTER_TO_PATIENT_DNA);

    vo.setRecordingUser(null);
    vo.setRecordingDateTime(new DateTime());
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
    return vo;
}
项目:AvoinApotti    文件:DischargeSummaryScheduleSTHKFormImpl.java   
private PatientDocumentVo populatePatientDocumentVo(PatientEdischargeBatchVo patVo, ServerDocumentVo serverDocumentVo, EDischargeSTHKSummaryVo summaryVo, String docName, DocumentCategory category)
{       
    if (summaryVo != null)
    {
        if (summaryVo.getCareContextIsNotNull())
        {
            PatientDocumentVo vo = new PatientDocumentVo();
            vo.setPatient(patVo);                   
            vo.setCareContext(summaryVo.getCareContext());                  

            vo.setName(docName);
            vo.setServerDocument(serverDocumentVo);
            vo.setCreationType(DocumentCreationType.GENERATED);                     
            vo.setCategory(category);

            vo.setRecordingUser(getMosUser() != null ? (MemberOfStaffLiteVo) getMosUser() : null);
            vo.setRecordingDateTime(new DateTime());
            vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
            vo.setResponsibleHCP(getResponsibleHCPForCareContext(summaryVo.getCareContext()));

            return vo;                  
        }           
    }

    return null;    
}
项目:AvoinApotti    文件:Logic.java   
private boolean saveReport(String fileName, String documentName, DocumentCategory documentCategory)
{
    PatientDocumentVo document = populatePatientDocument(populateServerDocument(fileName), documentName, documentCategory);

    String[] errors = document.validate();

    if (errors != null && errors.length > 0)
    {
        engine.showErrors(errors);
        return false;
    }

    try
    {
        domain.saveDocument(document, form.getGlobalContext().RefMan.getCatsReferral(), form.getLocalContext().getDischargeSummaryPacuAndWard().getIsCurrent());
        String url = "<IFRAME id=\"PostFrame\" name=\"PostFrame\" width=\"100%\" height=\"100%\" frameborder=0 src='" + ConfigFlag.GEN.FILE_SERVER_URL.getValue() + document.getServerDocument().getFileName() +  "'></IFRAME>";
        form.getLocalContext().setDocumentURL(url);         
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        return false;
    }

    return true;
}
项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo populatePatientDocument(ServerDocumentVo serverDocument, String documentName, DocumentCategory documentCategory)
{
    PatientDocumentVo document = new PatientDocumentVo();

    document.setPatient(domain.getPatientRef(form.getGlobalContext().RefMan.getCatsReferral()));
    document.setCareContext(domain.getCareContextRef(form.getGlobalContext().RefMan.getCatsReferral()));
    document.setEpisodeofCare(domain.getEpisodeOfCareRef(form.getGlobalContext().RefMan.getCatsReferral()));
    document.setReferral(null);

    document.setName(documentName);
    document.setServerDocument(serverDocument);
    document.setCreationType(DocumentCreationType.GENERATED);
    document.setCategory(documentCategory);

    document.setRecordingUser((MemberOfStaffRefVo) domain.getMosUser(engine.getLoggedInUser().getUsername()));
    document.setRecordingDateTime(new DateTime());
    document.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    return document;
}
项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo, String patientDocumentName, DocumentCategory patientDocumentCategory)
{
    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());
    vo.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
    vo.setReferral(null);

    vo.setName(patientDocumentName);
    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(DocumentCreationType.GENERATED);
    vo.setCategory(patientDocumentCategory);

    vo.setRecordingUser((MemberOfStaffRefVo)domain.getMosUser(engine.getLoggedInUser().getUsername()));
    vo.setRecordingDateTime(new DateTime());
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
    return vo;
}
项目:AvoinApotti    文件:Logic.java   
private boolean saveReport(String fileName, String documentName, DocumentCategory documentCategory)
{
    PatientDocumentVo document = populatePatientDocument(populateServerDocument(fileName), documentName, documentCategory);

    String[] errors = document.validate();

    if (errors != null && errors.length > 0)
    {
        engine.showErrors(errors);
        return false;
    }

    try
    {
        domain.saveReport(document, form.getGlobalContext().RefMan.getCatsReferral());
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        return false;
    }

    return true;
}
项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo populatePatientDocument(ServerDocumentVo serverDocument, String documentName, DocumentCategory documentCategory)
{
    PatientDocumentVo document = new PatientDocumentVo();

    document.setPatient(domain.getPatientRef(form.getGlobalContext().RefMan.getCatsReferral()));
    document.setCareContext(domain.getCareContextRef(form.getGlobalContext().RefMan.getCatsReferral()));
    document.setEpisodeofCare(domain.getEpisodeOfCareRef(form.getGlobalContext().RefMan.getCatsReferral()));
    document.setReferral(null);

    document.setName(documentName);
    document.setServerDocument(serverDocument);
    document.setCreationType(DocumentCreationType.GENERATED);
    document.setCategory(documentCategory);

    document.setRecordingUser((MemberOfStaffRefVo) domain.getMosUser(engine.getLoggedInUser().getUsername()));
    document.setRecordingDateTime(new DateTime());
    document.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    return document;
}
项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo, String patientDocumentName, DocumentCategory patientDocumentCategory)
{
    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());
    vo.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
    vo.setReferral(null);

    vo.setName(patientDocumentName);
    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(DocumentCreationType.GENERATED);
    vo.setCategory(patientDocumentCategory);

    vo.setRecordingUser((MemberOfStaffRefVo)domain.getMosUser(engine.getLoggedInUser().getUsername()));
    vo.setRecordingDateTime(new DateTime());
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
    return vo;
}
项目:AvoinApotti    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo, String patientDocumentName, DocumentCategory patientDocumentCategory)
{
    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());
    vo.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
    vo.setReferral(null);

    vo.setName(patientDocumentName);
    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(DocumentCreationType.GENERATED);
    vo.setCategory(patientDocumentCategory);

    vo.setRecordingUser((MemberOfStaffRefVo) domain.getMosUser(engine.getLoggedInUser().getUsername()));
    vo.setRecordingDateTime(new DateTime());
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
    return vo;
}
项目:AvoinApotti    文件:PatientSpecialtyAssessmentsImpl.java   
public Boolean savePatientDocument(PatientDocumentVo patientDocument, PatientAssessmentVo patientAssessment) throws StaleObjectException
{
    if (patientDocument == null)
        throw new DomainRuntimeException("Invalid PatientDocument record");
    if (!patientDocument.isValidated())
        throw new DomainRuntimeException("PatientDocument record not validated");
    if(patientAssessment == null)
        throw new DomainRuntimeException("Invalid patient assessment");
    if(!patientAssessment.isValidated())
        throw new DomainRuntimeException("User assessment not validated");

    DomainFactory factory = getDomainFactory();

    // Save PatientDocumet record
    PatientDocument domainPatientDocument = PatientDocumentVoAssembler.extractPatientDocument(factory, patientDocument);
    factory.save(domainPatientDocument);

    // Save PatientAssessment record
    PatientAssessment domainObject = PatientAssessmentVoAssembler.extractPatientAssessment(factory, patientAssessment);
    factory.save(domainObject);

    return true;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocument(ServerDocumentVo serverDocument, String documentName, DocumentCategory documentCategory)
{
    PatientDocumentVo document = new PatientDocumentVo();

    document.setPatient(domain.getPatientRef(form.getGlobalContext().RefMan.getCatsReferral()));
    document.setCareContext(domain.getCareContextRef(form.getGlobalContext().RefMan.getCatsReferral()));
    document.setEpisodeofCare(domain.getEpisodeOfCareRef(form.getGlobalContext().RefMan.getCatsReferral()));
    document.setReferral(null);

    document.setName(documentName);
    document.setServerDocument(serverDocument);
    document.setCreationType(DocumentCreationType.GENERATED);
    document.setCategory(documentCategory);

    document.setRecordingUser((MemberOfStaffRefVo) domain.getMosUser(engine.getLoggedInUser().getUsername()));
    document.setRecordingDateTime(new DateTime());
    document.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    return document;
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo, String patientDocumentName, DocumentCategory patientDocumentCategory)
{
    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());
    vo.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
    vo.setReferral(null);

    vo.setName(patientDocumentName);
    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(DocumentCreationType.GENERATED);
    vo.setCategory(patientDocumentCategory);

    vo.setRecordingUser((MemberOfStaffRefVo)domain.getMosUser(engine.getLoggedInUser().getUsername()));
    vo.setRecordingDateTime(new DateTime());
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);
    return vo;
}
项目:openMAXIMS    文件:PatientSpecialtyAssessmentsImpl.java   
public Boolean savePatientDocument(PatientDocumentVo patientDocument, PatientAssessmentVo patientAssessment) throws StaleObjectException
{
    if (patientDocument == null)
        throw new DomainRuntimeException("Invalid PatientDocument record");
    if (!patientDocument.isValidated())
        throw new DomainRuntimeException("PatientDocument record not validated");
    if(patientAssessment == null)
        throw new DomainRuntimeException("Invalid patient assessment");
    if(!patientAssessment.isValidated())
        throw new DomainRuntimeException("User assessment not validated");

    DomainFactory factory = getDomainFactory();

    // Save PatientDocumet record
    PatientDocument domainPatientDocument = PatientDocumentVoAssembler.extractPatientDocument(factory, patientDocument);
    factory.save(domainPatientDocument);

    // Save PatientAssessment record
    PatientAssessment domainObject = PatientAssessmentVoAssembler.extractPatientAssessment(factory, patientAssessment);
    factory.save(domainObject);

    return true;
}
项目:openMAXIMS    文件:Logic.java   
private boolean saveReport(String fileName, String documentName, DocumentCategory documentCategory)
{
    PatientDocumentVo document = populatePatientDocument(populateServerDocument(fileName), documentName, documentCategory);

    String[] errors = document.validate();

    if (errors != null && errors.length > 0)
    {
        engine.showErrors(errors);
        return false;
    }

    try
    {
        domain.saveReport(document, form.getGlobalContext().RefMan.getCatsReferral());
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        return false;
    }

    return true;
}
项目:openMAXIMS    文件:Logic.java   
private void openDocForEditFromWorkArea(PatientDocumentVo doc)
{
    validateNonFinalDocument(doc);

    String winPath = engine.getLocalSettings().getWordEditorPath();

    if ((winPath == null || winPath.length() == 0) && ConfigFlag.GEN.AUTODETECT_DOCUMENT_EDITOR.getValue() == false)     //WDEV-12231
    {
        form.getLocalContext().setShouldOpenAfterPathIsSet(true);
        engine.open(form.getForms().Core.LocalSettingsDialog);
        return;
    }

    selectPatient(doc.getPatient());

    String filePath = (getCheckOutWorkArea() + doc.getServerDocument().getFileName()).replace("/", "\\");//WDEV-13366

    form.getGlobalContext().Core.setPatientCorrespondence(doc);
    engine.open(form.getForms().Core.PatientDocumentEdit, false);

    if(ConfigFlag.GEN.AUTODETECT_DOCUMENT_EDITOR.getValue() == true)    //WDEV-12231
        engine.runExternalApplication(filePath, true, false);
    else
        engine.runExternalApplication(winPath + " " + filePath, false);
}
项目:openMAXIMS    文件:Logic.java   
private boolean validateNonFinalDocument(PatientDocumentVo selectedDocument)
{
    if (selectedDocument == null)
        throw new CodingRuntimeException("Trying to validate null document");

    String[] errors = selectedDocument.validate();

    if (errors != null && errors.length > 0)
    {
        showError("The document is not valid. Posible data corruption");
        return false;
    }

    if (isDocumentFinal(selectedDocument))
    {
        throw new CodingRuntimeException("The document is not draft");
    }

    if (!FileType.DOC.equals(selectedDocument.getServerDocument().getFileType()))
    {
        showError("The document is not the right type. Posible data corruption");
        return false;
    }

    return true;
}
项目:openMAXIMS    文件:DocumentWorklistImpl.java   
public PatientDocumentVo savePatientDocument(PatientDocumentVo document) throws StaleObjectException
{
    if(document == null)
        throw new CodingRuntimeException("Can not save a null PatientDocumentVo.");

    if(!document.isValidated())
        throw new CodingRuntimeException("PatientDocumentVo not validated");

    DomainFactory factory = getDomainFactory();
    PatientDocument doc = PatientDocumentVoAssembler.extractPatientDocument(factory, document);
    if (doc == null)
        throw new StaleObjectException(doc);
    factory.save(doc);  

    return PatientDocumentVoAssembler.create(doc);
}
项目:openmaxims-linux    文件:DocumentWorklistImpl.java   
public PatientDocumentVo savePatientDocument(PatientDocumentVo document) throws StaleObjectException
{
    if(document == null)
        throw new CodingRuntimeException("Can not save a null PatientDocumentVo.");

    if(!document.isValidated())
        throw new CodingRuntimeException("PatientDocumentVo not validated");

    DomainFactory factory = getDomainFactory();
    PatientDocument doc = PatientDocumentVoAssembler.extractPatientDocument(factory, document);
    if (doc == null)
        throw new StaleObjectException(doc);
    factory.save(doc);  

    return PatientDocumentVoAssembler.create(doc);
}
项目:openMAXIMS    文件:Logic.java   
private boolean saveReport(String fileName, String documentName, DocumentCategory documentCategory)
{
    PatientDocumentVo document = populatePatientDocument(populateServerDocument(fileName), documentName, documentCategory);

    String[] errors = document.validate();

    if (errors != null && errors.length > 0)
    {
        engine.showErrors(errors);
        return false;
    }

    try
    {
        domain.saveDocument(document, form.getGlobalContext().RefMan.getCatsReferral(), form.getLocalContext().getDischargeSummaryPacuAndWard().getIsCurrent());
        String url = "<IFRAME id=\"PostFrame\" name=\"PostFrame\" width=\"100%\" height=\"100%\" frameborder=0 src='" + ConfigFlag.GEN.FILE_SERVER_URL.getValue() + document.getServerDocument().getFileName() +  "'></IFRAME>";
        form.getLocalContext().setDocumentURL(url);         
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        return false;
    }

    return true;
}
项目:openmaxims-linux    文件:DocumentWorklistImpl.java   
public void deletePatientDocument(PatientDocumentVo patDoc) throws ForeignKeyViolationException, StaleObjectException
{

    PatientDocument patDO = PatientDocumentVoAssembler.extractPatientDocument(getDomainFactory(), patDoc);
    if (patDO == null )
        throw new StaleObjectException(patDO);

    long count  = getDomainFactory().countWithHQL("select count(patDoc.id) " +
            "from PatientDocument as patDoc where " +
            "(patDoc.id = :patDocId and patDoc.version=:patVersion)"
            ,new String[]{"patDocId","patVersion"},
            new Object[]{patDoc.getID_PatientDocument(),patDoc.getVersion_PatientDocument()});

    if (count == 0)
        throw new StaleObjectException(patDO);

    //getDomainFactory().delete(patDO);
    patDO.setIsRIE(true);//WDEV-15417
    getDomainFactory().save(patDO);//WDEV-15417
}
项目:openMAXIMS    文件:Logic.java   
private PatientDocumentVo populatePatientDocumentVo(ServerDocumentVo serverDocumentVo)
{
    PatientDocumentVo vo = new PatientDocumentVo();
    vo.setPatient(form.getGlobalContext().Core.getPatientShort());
    vo.setEpisodeofCare(form.getGlobalContext().Core.getEpisodeofCareShort());
    vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
    vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
    vo.setReferral(null);
    vo.setName(form.txtName().getValue());
    vo.setServerDocument(serverDocumentVo);
    vo.setCreationType(form.cmbType().getValue());
    vo.setCategory(form.cmbSource().getValue());
    vo.setDocumentDate(form.getGlobalContext().Core.getCurrentCareContextIsNotNull() ? form.getGlobalContext().Core.getCurrentCareContext().getStartDateTime().getDate() : (form.getGlobalContext().Core.getEpisodeofCareShortIsNotNull() ? form.getGlobalContext().Core.getEpisodeofCareShort().getStartDate() : new Date()));//   WDEV-13638, WDEV-12356
    vo.setRecordingUser((MemberOfStaffRefVo)domain.getMosUser(engine.getLoggedInUser().getUsername()));
    vo.setRecordingDateTime(new DateTime());
    vo.setStatus(PreActiveActiveInactiveStatus.ACTIVE);

    vo.setResponsibleHCP(form.getGlobalContext().Core.getEpisodeofCareShortIsNotNull() ? form.getGlobalContext().Core.getEpisodeofCareShort().getResponsibleHCP() : null);//WDEV-13338
    vo.setSpecialty(form.getGlobalContext().Core.getEpisodeofCareShortIsNotNull() ? form.getGlobalContext().Core.getEpisodeofCareShort().getSpecialty() : null);//WDEV-13338
    return vo;
}
项目:openMAXIMS    文件:Logic.java   
private void openDocForEditFromWorkArea(PatientDocumentVo doc)
{
    validateNonFinalDocument(doc);

    String winPath = engine.getLocalSettings().getWordEditorPath();

    if ((winPath == null || winPath.length() == 0) && ConfigFlag.GEN.AUTODETECT_DOCUMENT_EDITOR.getValue() == false)     //WDEV-12231
    {
        form.getLocalContext().setShouldOpenAfterPathIsSet(true);
        engine.open(form.getForms().Core.LocalSettingsDialog);
        return;
    }

    selectPatient(doc.getPatient());

    String filePath = (getCheckOutWorkArea() + doc.getServerDocument().getFileName()).replace("/", "\\");//WDEV-13366

    form.getGlobalContext().Core.setPatientDocumentsCollection(form.grdDocuments().getValues());//WDEV-18815
    form.getGlobalContext().Core.setPatientCorrespondence(doc);
    engine.open(form.getForms().Core.PatientDocumentEdit, false);

    if(ConfigFlag.GEN.AUTODETECT_DOCUMENT_EDITOR.getValue() == true)    //WDEV-12231
        engine.runExternalApplication(filePath, true, false);
    else
        engine.runExternalApplication(winPath + " " + filePath, false);
}
项目:openMAXIMS    文件:Logic.java   
private boolean validateNonFinalDocument(PatientDocumentVo selectedDocument)
{
    if (selectedDocument == null)
        throw new CodingRuntimeException("Trying to validate null document");

    String[] errors = selectedDocument.validate();
    if (errors != null && errors.length > 0)
    {
        throw new CodingRuntimeException("The document is not valid. Posible data corruption");

    }
    if (isDocumentFinal(selectedDocument) || !FileType.DOC.equals(selectedDocument.getServerDocument().getFileType()))
    {
        //This is a stale exception
        engine.showErrors(new String[] { ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue() });
        form.getLocalContext().setSelectedDocument(null);
        form.getLocalContext().setOldSelectedDocument(null);//WDEV-13546
        open();
        return false;

    }

    return true;
}
项目:openMAXIMS    文件:DnaBatchUpdateImpl.java   
@SuppressWarnings("unchecked")
public void savePatientDocument(ims.core.vo.PatientDocumentVo document, ims.RefMan.vo.CatsReferralVo catReferral) throws ims.domain.exceptions.StaleObjectException
{
    if (document != null)
    {
        if (!document.isValidated())
            throw new DomainRuntimeException("PatientDocumentVo not validated");
    }

    DomainFactory factory = getDomainFactory();
    PatientDocument doc = PatientDocumentVoAssembler.extractPatientDocument(factory, document);
    factory.save(doc);              

    CatsReferral doCatsReferral = CatsReferralVoAssembler.extractCatsReferral(factory, catReferral);
        doCatsReferral.getReferralDocuments().add(doc); 

    doCatsReferral.setHasDocuments(Boolean.TRUE);

    //wdev-8288
    doCatsReferral.setHasDNAApptsForReview(Boolean.TRUE);

    factory.save(doCatsReferral);
}
项目:openMAXIMS    文件:Logic.java   
private void  convertDraftPatientDoc(PatientDocumentVo patientDocument)
    {
        if (patientDocument == null)
            return;

        String rtfFileName = null;

        ServerDocumentVo document = patientDocument.getServerDocument();
        String pdfFileName = null;
        if (document != null)
        {
            rtfFileName = document.getFileName();
            pdfFileName = convertDrafRtfToPdf(rtfFileName);

            if(pdfFileName == null)
                return;

//          document.setFileName(pdfFileName);
//          document.setFileType(FileType.PDF);
        }
        patientDocument.setServerDocument(document);
        form.getLocalContext().setDraftPDFFileName(pdfFileName);
    }
项目:openMAXIMS    文件:Logic.java   
private void viewDocument() 
{
    if(form.getLocalContext().getSelectedDocumentIsNotNull())
    {
        PatientDocumentVo selectedPatDocumentVo = form.getLocalContext().getSelectedDocument();
        String fullPath = "";
        boolean isDraft = selectedPatDocumentVo != null  && isDraft(selectedPatDocumentVo.getCurrentDocumentStatus());
        boolean showWarningMessage = ConfigFlag.UI.PATIENT_DOCUMENTS_VIEW_DRAFT_WARNING_MESSAGE.getValue() != null && ConfigFlag.UI.PATIENT_DOCUMENTS_VIEW_DRAFT_WARNING_MESSAGE.getValue().length() > 0 && isDraft;
        if (isDraft)
        {
            if(!loadSelectedDocument())
                return;
            convertDraftPatientDoc(selectedPatDocumentVo);
            fullPath = EnvironmentConfig.getAplicationURL() + (ConfigFlag.GEN.FILE_UPLOAD_DIR.getValue().endsWith("/") ? ConfigFlag.GEN.FILE_UPLOAD_DIR.getValue().replace("/", "") : ConfigFlag.GEN.FILE_UPLOAD_DIR.getValue()) + "/" + getBaseName(form.getLocalContext().getDraftPDFFileName());
        }
        ServerDocumentVo document = form.getLocalContext().getSelectedDocument().getServerDocument();
        if(document != null)
        {
            if (FileType.PDF.equals(document.getFileType()))
            {
                fullPath = getFullPath(document);
            }
            engine.open(form.getForms().Core.PatientDocumentView, new Object[] {fullPath.replace("/", "\\"),showWarningMessage},true,true);//WDEV-18651 //WDEV-1867         
        }
    }
}
项目:openMAXIMS    文件:PatientSpecialtyAssessmentsImpl.java   
public Boolean savePatientDocument(PatientDocumentVo patientDocument, PatientAssessmentVo patientAssessment) throws StaleObjectException
{
    if (patientDocument == null)
        throw new DomainRuntimeException("Invalid PatientDocument record");
    if (!patientDocument.isValidated())
        throw new DomainRuntimeException("PatientDocument record not validated");
    if(patientAssessment == null)
        throw new DomainRuntimeException("Invalid patient assessment");
    if(!patientAssessment.isValidated())
        throw new DomainRuntimeException("User assessment not validated");

    DomainFactory factory = getDomainFactory();

    // Save PatientDocumet record
    PatientDocument domainPatientDocument = PatientDocumentVoAssembler.extractPatientDocument(factory, patientDocument);
    factory.save(domainPatientDocument);

    // Save PatientAssessment record
    PatientAssessment domainObject = PatientAssessmentVoAssembler.extractPatientAssessment(factory, patientAssessment);
    factory.save(domainObject);

    return true;
}
项目:openmaxims-linux    文件:Logic.java   
private boolean validateNonFinalDocument(PatientDocumentVo selectedDocument)
{
    if (selectedDocument == null)
        throw new CodingRuntimeException("Trying to validate null document");

    String[] errors = selectedDocument.validate();
    if (errors != null && errors.length > 0)
    {
        throw new CodingRuntimeException("The document is not valid. Posible data corruption");

    }
    if (isDocumentFinal(selectedDocument) || !FileType.DOC.equals(selectedDocument.getServerDocument().getFileType()))
    {
        //This is a stale exception
        engine.showErrors(new String[] { ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue() });
        form.getLocalContext().setSelectedDocument(null);
        form.getLocalContext().setOldSelectedDocument(null);//WDEV-13546
        open();
        return false;

    }

    return true;
}
项目:openmaxims-linux    文件:Logic.java   
private void openDocForEditFromWorkArea(PatientDocumentVo doc)
{
    validateNonFinalDocument(doc);

    String winPath = engine.getLocalSettings().getWordEditorPath();

    if ((winPath == null || winPath.length() == 0) && ConfigFlag.GEN.AUTODETECT_DOCUMENT_EDITOR.getValue() == false)     //WDEV-12231
    {
        form.getLocalContext().setShouldOpenAfterPathIsSet(true);
        engine.open(form.getForms().Core.LocalSettingsDialog);
        return;
    }

    selectPatient(doc.getPatient());

    String filePath = (getCheckOutWorkArea() + doc.getServerDocument().getFileName()).replace("/", "\\");//WDEV-13366

    form.getGlobalContext().Core.setPatientCorrespondence(doc);
    engine.open(form.getForms().Core.PatientDocumentEdit, false);

    if(ConfigFlag.GEN.AUTODETECT_DOCUMENT_EDITOR.getValue() == true)    //WDEV-12231
        engine.runExternalApplication(filePath, true, false);
    else
        engine.runExternalApplication(winPath + " " + filePath, false);
}
项目:openMAXIMS    文件:DocumentWorklistImpl.java   
public void deletePatientDocument(PatientDocumentVo patDoc) throws ForeignKeyViolationException, StaleObjectException
{

    PatientDocument patDO = PatientDocumentVoAssembler.extractPatientDocument(getDomainFactory(), patDoc);
    if (patDO == null )
        throw new StaleObjectException(patDO);

    long count  = getDomainFactory().countWithHQL("select count(patDoc.id) " +
            "from PatientDocument as patDoc where " +
            "(patDoc.id = :patDocId and patDoc.version=:patVersion)"
            ,new String[]{"patDocId","patVersion"},
            new Object[]{patDoc.getID_PatientDocument(),patDoc.getVersion_PatientDocument()});

    if (count == 0)
        throw new StaleObjectException(patDO);

    //getDomainFactory().delete(patDO);
    patDO.setIsRIE(true);//WDEV-15417
    getDomainFactory().save(patDO);//WDEV-15417
}
项目:openMAXIMS    文件:DocumentWorklistImpl.java   
public PatientDocumentVo savePatientDocument(PatientDocumentVo document) throws StaleObjectException
{
    if(document == null)
        throw new CodingRuntimeException("Can not save a null PatientDocumentVo.");

    if(!document.isValidated())
        throw new CodingRuntimeException("PatientDocumentVo not validated");

    DomainFactory factory = getDomainFactory();
    PatientDocument doc = PatientDocumentVoAssembler.extractPatientDocument(factory, document);
    if (doc == null)
        throw new StaleObjectException(doc);
    factory.save(doc);  

    return PatientDocumentVoAssembler.create(doc);
}
项目:openmaxims-linux    文件:DnaBatchUpdateImpl.java   
@SuppressWarnings("unchecked")
public void savePatientDocument(ims.core.vo.PatientDocumentVo document, ims.careuk.vo.CatsReferralVo catReferral) throws ims.domain.exceptions.StaleObjectException
{
    if (document != null)
    {
        if (!document.isValidated())
            throw new DomainRuntimeException("PatientDocumentVo not validated");
    }

    DomainFactory factory = getDomainFactory();
    PatientDocument doc = PatientDocumentVoAssembler.extractPatientDocument(factory, document);
    factory.save(doc);              

    CatsReferral doCatsReferral = CatsReferralVoAssembler.extractCatsReferral(factory, catReferral);
        doCatsReferral.getReferralDocuments().add(doc); 

    doCatsReferral.setHasDocuments(Boolean.TRUE);

    //wdev-8288
    doCatsReferral.setHasDNAApptsForReview(Boolean.TRUE);

    factory.save(doCatsReferral);
}