Java 类ims.ocrr.vo.ProviderSystemVo 实例源码

项目:AvoinApotti    文件:VoMapper.java   
public ProviderSystemVo getProviderSystem(String sendingApplication) throws HL7Exception
{
    LOG.debug("VoMapper getProviderSystem for SendingApplication = " + sendingApplication);
    ProviderSystemVo vo = ocsIf.getProviderSystem(sendingApplication);
    if (vo == null)
    {
        LOG.warn("Provider System not found for sendingApplication = " + sendingApplication);
        throw new HL7Exception("Provider System not found for sendingApplication = " + sendingApplication);         
    }
    if (null==vo.getCodeSystem()||null==vo.getCodeSystem().getText())
    {
        throw new HL7Exception("Provider System Coding configuration incorrect for = " + sendingApplication);
    }
    LOG.info("Provider System " + vo.getCodeSystem().getText() + " found for sendingApplication" + sendingApplication);     
    LOG.debug("VoMapper getProviderSystem - CurrentProviderExternalCode = " + vo.getCodeSystem().getText());
    return vo;
}
项目:AvoinApotti    文件:Logic.java   
private void populateConfigurationItemsControl(ProviderSystemVo voProviderSystem)
{
    if (!voProviderSystem.getConfigItemsIsNotNull())
        return;

    GenForm.grdConfigurationItemsRow row;
    for (int i = 0; i < form.grdConfigurationItems().getRows().size(); i++)
    {
        row = form.grdConfigurationItems().getRows().get(i);
        ConfigPropertyVo vo = voProviderSystem.getConfigurationProperty(row.getProperty());
        if (vo != null)
        {
            row.setValue(vo);
            row.setColValue(vo.getPropertyValue());
        }
    }

}
项目:AvoinApotti    文件:LocationServiceProviderSysImpl.java   
public ProviderSystemVo saveProviderSystem(ProviderSystemVo voProviderSystem) throws StaleObjectException, UniqueKeyViolationException 
{
    if(voProviderSystem == null)
        throw new RuntimeException("Cannot save null value for ProviderSystemVo");
    if(!voProviderSystem.isValidated())
    {
        throw new CodingRuntimeException("Provider System Value Object has not been validated");
    }
    DomainFactory factory = getDomainFactory();
    ProviderSystem doProviderSystem = ProviderSystemVoAssembler.extractProviderSystem(factory, voProviderSystem);           
    try
    {
        factory.save(doProviderSystem);
    }
    catch(UnqViolationUncheckedException e)
    {
        throw new ims.domain.exceptions.UniqueKeyViolationException("A System called " + (voProviderSystem.getSystemNameIsNotNull()?voProviderSystem.getSystemName():"") + "or an HL7 Application called " + (voProviderSystem.getHl7ApplicationIsNotNull()?voProviderSystem.getHl7Application():"") + " already exists. Duplicates not allowed.", e);
    }
    return ProviderSystemVoAssembler.create(doProviderSystem);
}
项目:AvoinApotti    文件:VoMapper.java   
protected final void renderPatientVoToPID(Patient patVo, PID pid, ProviderSystemVo providerSystem) throws Exception
{
    LOG.debug("VoMapper renderPatientVoToPID: entry");
    if (patVo == null)
        return;

    renderPatientShortVoToPID(patVo, pid, providerSystem);

    for (int i = 0; i < patVo.getOtherNames().size(); i++)
    {
        renderNameVoToXPN(patVo.getOtherNames().get(i), pid.getPatientName(i+1),providerSystem);
    }

    for (int i = 0; i < patVo.getAddresses().size(); i++)
    {
        if (!patVo.getAddressIsNotNull()) // First instance will not have been populated if permanent address was null
            renderAddressVoToXAD(patVo.getAddresses().get(i), pid.getPatientAddress(i),providerSystem);
        else
            renderAddressVoToXAD(patVo.getAddresses().get(i), pid.getPatientAddress(i+1),providerSystem);
    }

    if (patVo.getMaritalStatusIsNotNull())
        pid.getMaritalStatus().getIdentifier().setValue(svc.getRemoteLookup(patVo.getMaritalStatus().getID(), providerSystem.getCodeSystem().getText()));

    LOG.debug("VoMapper renderPatientVoToPID: exit (" + pid.toString() + ")");
}
项目:AvoinApotti    文件:VoMapper.java   
protected final void renderNameVoToXPN(PersonName name, XPN xpn,ProviderSystemVo providerSystem) throws Exception
{
    LOG.debug("VoMapper renderNameVoToXPN: entry");
    if (name == null)
        return;

    xpn.getFamilyName().getSurname().setValue(name.getSurname());
    xpn.getGivenName().setValue(name.getForename());
    xpn.getSecondAndFurtherGivenNamesOrInitialsThereof().setValue(name.getMiddleName());
    if (name.getTitleIsNotNull())
        xpn.getPrefixEgDR().setValue(svc.getRemoteLookup(name.getTitle().getID(), providerSystem.getCodeSystem().getText()));
    if (name.getNameTypeIsNotNull())
    {
        xpn.getNameTypeCode().setValue(svc.getRemoteLookup(name.getNameType().getID(), providerSystem.getCodeSystem().getText()));
    }
    else
    {
        xpn.getNameTypeCode().setValue(svc.getRemoteLookup( NameType.LEGAL.getID(), providerSystem.getCodeSystem().getText()));
    }

    LOG.debug("VoMapper renderNameVoToXPN: exit (" + xpn.toString() + ")");
}
项目:AvoinApotti    文件:Logic.java   
private void populateConfigurationItemsControl(ProviderSystemVo voProviderSystem)
{
    if (!voProviderSystem.getConfigItemsIsNotNull())
        return;

    GenForm.grdConfigurationItemsRow row;
    for (int i = 0; i < form.grdConfigurationItems().getRows().size(); i++)
    {
        row = form.grdConfigurationItems().getRows().get(i);
        ConfigPropertyVo vo = voProviderSystem.getConfigurationProperty(row.getProperty());
        if (vo != null)
        {
            row.setValue(vo);
            row.setColValue(vo.getPropertyValue());
        }
    }

}
项目:AvoinApotti    文件:M05VoMapper.java   
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception 
{

    try
    {
        if (isClinicType(msg))
            processClinic(msg, providerSystem);
        else
            processLocation(msg,providerSystem);
    }
    catch (Exception ex)
    {
        LOG.error(ex.getMessage(), ex);
        return HL7Utils.buildRejAck( msg.get("MSH"), "Exception. " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
    }

    Message ack = HL7Utils.buildPosAck( msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems()));
    return ack;
}
项目:AvoinApotti    文件:Logic.java   
private DynamicGridRow searchForProvider(ExternalEventMappingVo vo, DynamicGridRow row) 
{
        int size = form.dyngrdList().getRows().size();
        for (int i = 0; i < size; i++) 
        {
            ProviderSystemVo voProvoder = vo.getProviderSystem();

            if (form.dyngrdList().getRows().get(i).getIdentifier().equals(PROVIDER) &&
                    form.dyngrdList().getRows().get(i).getCells().get(getColumn(COLPROVIDER)).getValue().equals("<b>"+voProvoder.getSystemName()+"</b>")&&
                        form.dyngrdList().getRows().get(i).getCells().get(getColumn(COLGROUP)).getValue().equals("<b>"+vo.getGroup().getText()+"</b>") &&
                            form.dyngrdList().getRows().get(i).getCells().get(getColumn(COLDETAIL)).getValue().equals("<b>"+vo.getDetail().getText()+"</b>"))// &&
                            //(vo.getClinicCodeIsNotNull() || vo.getConsultantIsNotNull()) )
                                return form.dyngrdList().getRows().get(i);
        }

    return form.dyngrdList().getRows().newRow();
}
项目:AvoinApotti    文件:O01VoMapper.java   
private String getAlertsText(PatientRefVo patient,ProviderSystemVo provider )
{
String [] alerts = demog.listPatientAlertsTextByTaxonomy(patient, true, provider.getCodeSystem());
if (alerts==null||alerts.length==0)
{
    return null;
}
String alertText = "Patient has alert(s): ";
for (int i=0;i<alerts.length;i++)
{
    if(i<(alerts.length-1))
    {
        alertText+=(alerts[i]+", ");
    }
    else
    {
        alertText+=(alerts[i]+"\r");
    }
}
return alertText;
}
项目:AvoinApotti    文件:Logic.java   
protected void populateScreenFromData(ProviderSystemVo voProviderSystem)
{
    if (voProviderSystem == null)
        return;

    form.cmbIdComp().setValue(voProviderSystem.getIdtypeComponent());
    super.populateScreenFromData(voProviderSystem);

    // Populate Configuration Items
    if (voProviderSystem.getConfigItemsIsNotNull())
    {
        GenForm.grdConfigItemsRow row;
        form.grdConfigItems().getRows().clear();
        for (int i=0; i<voProviderSystem.getConfigItems().size(); i++)
        {
            ConfigPropertyVo vo = voProviderSystem.getConfigItems().get(i);
            row = form.grdConfigItems().getRows().newRow();
            row.setProperty(vo.getPropertyName());
            if (vo.getPropertyValueIsNotNull())
            {
                //TODO review
                row.setColValue(vo.getPropertyValue().equals("TRUE")?true:false);
            }
        }
    }
}
项目:AvoinApotti    文件:OcsIfImpl.java   
public ProviderSystemVo getProviderSystem(String sendingApplication)
{
    if (sendingApplication == null)
        return null;

    DomainFactory factory = getDomainFactory();
    List lst = factory.find(" from ProviderSystem ps where ps.hl7Application = '" + sendingApplication + "'");
    if (lst == null || lst.size() == 0)
        return null;

    return ProviderSystemVoAssembler.create((ProviderSystem) lst.get(0));

}
项目:AvoinApotti    文件:OcsIfImpl.java   
public ProviderSystemVo getProviderSystem(InvestigationRefVo invVo)
{
    if (invVo == null)
        return null;

    DomainFactory factory = getDomainFactory();
    Investigation domInv = (Investigation)factory.getDomainObject(Investigation.class, invVo.getID_Investigation());
    return ProviderSystemVoAssembler.create(domInv.getProviderService().getProviderSystem());
}
项目:AvoinApotti    文件:Logic.java   
private void bindCmbProviderSystem()
{
    ProviderSystemVoCollection providerSystems = domain.listProviderSystems();

    if (providerSystems != null)
    {
        for (ProviderSystemVo providerSystemVo : providerSystems)
        {
            form.cmbProviderSystem().newRow(providerSystemVo, providerSystemVo.getSystemName());
        }
    }
}
项目:AvoinApotti    文件:Logic.java   
private void populateProviderSystem()
{
    ProviderSystemVo selectedProviderSystem = form.cmbProviderSystem().getValue();

    if(selectedProviderSystem instanceof ProviderSystemVo)
    {
        form.txtHost().setValue(selectedProviderSystem.getIPAddress());
        form.intPort().setValue(selectedProviderSystem.getIPPort());
    }
}
项目:AvoinApotti    文件:VoMapper.java   
protected final void renderNextOfKinVoToNK1(NextOfKin nok, NK1 nk1,ProviderSystemVo providerSystem) throws Exception
{
    LOG.debug("VoMapper renderNextOfKinVoToNK1: entry");
    if (nok == null)
        return;

    renderNameVoToXPN(nok.getName(), nk1.getNKName(0),providerSystem);
    renderAddressVoToXAD(nok.getAddress(), nk1.getAddress(0),providerSystem);

    CommChannelVo voWork = nok.getCommunicationChannel(ChannelType.WORK_PHONE);
    if (voWork != null)
        nk1.getBusinessPhoneNumber(0).getAnyText().setValue(voWork.getCommValue());
    CommChannelVo vo = nok.getCommunicationChannel(ChannelType.HOME_PHONE);
    if (vo != null)
    {
        nk1.getPhoneNumber(0).getAnyText().setValue(vo.getCommValue());
    }
    else
    {
        // wdev-3087 Check if home phone is set at address level
        if (nok.getAddressIsNotNull() && nok.getAddress().getPhoneIsNotNull())
            nk1.getPhoneNumber(0).getAnyText().setValue(nok.getAddress().getPhone());
    }

    if (nok.getRelationshipIsNotNull())
        nk1.getRelationship().getIdentifier().setValue(svc.getRemoteLookup(nok.getRelationship().getID(), providerSystem.getCodeSystem().getText()));

    LOG.debug("VoMapper renderNextOfKinVoToNK1: exit (" + nk1.toString() + ")");
}
项目:AvoinApotti    文件:I14VoMapper.java   
private void processMessage(Message msg, ProviderSystemVo providerSystem) throws Exception 
{
    RF1 rf1 = (RF1) msg.get("RF1");

    // Identify the Patient, Register if required
    Patient patient = savePatient(msg, providerSystem);


    // Get the external referral identifier which is unique per referral
    String rkey = rf1.getOriginatingReferralIdentifier().getEntityIdentifier().getValue();

    // See if a referral exists for this patient and referral key
    // if so, we will update it, if not, create it
    HL7ReferralVo referral = hL7PathwayIf.getReferralByPatientAndRKEY(patient, rkey);

    // If this message is an instance of I13 and the referral is not found, reject
    // the message as I13 is a referral update message
    if (referral == null)
        throw new HL7Exception("Referral not found, this referral cannot be cancelled");

    referral.setIsActive(Boolean.FALSE);
    String[] errors = referral.validate();
    if (errors != null && errors.length > 0)
    {
        StringBuffer errStr = new StringBuffer();
        for (int i=0; i<errors.length; i++)
        {
            if (i >0)
                errStr.append(". ");
            errStr.append(errors[i]);
        }
        throw new HL7Exception("Referral Validation Failed - " + errStr.toString());
    }
    hL7PathwayIf.saveReferral(referral);

    // Message Processed
    return;
}
项目:AvoinApotti    文件:HL7EngineOutbound.java   
private String generateA40Message(PatientRefVo patient, PatientRefVo priorPatient, PatientIdCollection priorPatIds, String hl7Application, ProviderSystemVo providerSystem) throws HL7Exception
{
    Message msg;
    a40mapper.processedCount++;
    try
    {
        msg = a40mapper.populateMessage(patient, priorPatient, priorPatIds, hl7Application, providerSystem);
        if (msg != null)
        {
            String ret = parser.encode(msg);
            a40mapper.successCount++;
            a40mapper.lastSuccessDateTime = new DateTime();
            a40mapper.lastSuccessMessage = ret;
            return ret;
        }
    }
    catch (Exception e)
    {
        a40mapper.errorCount++;
        a40mapper.lastFailedDateTime = new DateTime();
        throw new HL7Exception("Exception occurred generating ADT Message for HL7App - " + hl7Application + " - " + e.getMessage(), e);
    }

    a40mapper.errorCount++;
    a40mapper.lastFailedDateTime = new DateTime();
    throw new HL7Exception("generateA40Message: A null message cannot be parsed!");
}
项目:AvoinApotti    文件:VoMapper.java   
private PersonTitle getTitleLookup(String titleTxt,ProviderSystemVo providerSystem)
{
    if (titleTxt == null)
        return null;
    String modifiedText = titleTxt.toUpperCase().trim().replaceAll("\\.", "");
    PersonTitle titleValue =(PersonTitle) svc.getLocalLookup(PersonTitle.class, PersonTitle.TYPE_ID, providerSystem.getCodeSystem().getText(), modifiedText);
    if (titleValue != null)
        return titleValue;
    else
        return (PersonTitle)addLookupInstanceMapping(PersonTitle.class, PersonTitle.TYPE_ID, titleTxt, modifiedText, providerSystem.getCodeSystem().getText());
}
项目:AvoinApotti    文件:VoMapper.java   
protected final void renderAddressVoToXAD(PersonAddress pa, XAD xad,ProviderSystemVo providerSystem) throws Exception
{
    LOG.debug("VoMapper renderAddressVoToXAD: entry");
    if (pa == null)
        return;

    xad.getStreetAddress().getStreetOrMailingAddress().setValue(pa.getLine1());
    xad.getOtherDesignation().setValue(pa.getLine2());
    xad.getCity().setValue(pa.getLine3());
    xad.getStateOrProvince().setValue(pa.getLine4());
    xad.getOtherGeographicDesignation().setValue(pa.getLine5());
    xad.getZipOrPostalCode().setValue(pa.getPostCode());

    if (pa.getCountyIsNotNull())
        xad.getCountyParishCode().setValue(svc.getRemoteLookup(pa.getCounty().getID(), providerSystem.getCodeSystem().getText()));

    if(pa.getAddressTypeIsNotNull())
    {
        xad.getAddressType().setValue(svc.getRemoteLookup(pa.getAddressType().getID(), providerSystem.getCodeSystem().getText()));
    }
    else
    {
        xad.getAddressType().setValue(svc.getRemoteLookup(AddressType.PERMANENT.getID(), providerSystem.getCodeSystem().getText()));
    }

    LOG.debug("VoMapper renderAddressVoToXAD: exit (" + xad.toString() + ")");
}
项目:AvoinApotti    文件:VoMapper.java   
protected final void renderMaximsIdentifier(Integer ID,PID pid,ProviderSystemVo providerSystem)throws Exception
{
    if(null==ID||null==pid||null==providerSystem)
        return;
    int identiferCount=pid.getPatientIdentifierList().length;
    CX maximsID=pid.getPatientIdentifierList(identiferCount);
    maximsID.getID().setValue(ID.toString());
    if (providerSystem.getIdtypeComponent().intValue() == 4)
        maximsID.getAssigningAuthority().getNamespaceID().setValue("MAXIMS");
    else
        maximsID.getIdentifierTypeCode().setValue("MAXIMS");
}
项目:AvoinApotti    文件:VoMapper.java   
protected final void renderMemberOfStaffShortVoToXCN(MemberOfStaffShortVo mos, XCN xcn,ProviderSystemVo providerSystem) throws DataTypeException
{
    LOG.debug("VoMapper renderMemberOfStaffShortVoToXCN: entry");

    xcn.getGivenName().setValue(mos.getName().getForename());
    xcn.getFamilyName().getSurname().setValue(mos.getName().getSurname());
    TaxonomyMap mapping = mos.getExternalCode(providerSystem.getCodeSystem());
    if (mapping != null)
    {
        xcn.getIDNumber().setValue(mapping.getTaxonomyCode());          
    }
    LOG.debug("VoMapper renderMemberOfStaffShortVoToXCN: exit");

}
项目:AvoinApotti    文件:Logic.java   
private void populateInstanceControl(ProviderSystemVo voProviderSystem)
{
    clearInstanceControls();

    if (voProviderSystem != null)
    {
        populateIpAddressesInstanceControls(voProviderSystem);
        form.cmbIdComponent().setValue(voProviderSystem.getIdtypeComponent());
        super.populateScreenFromData(voProviderSystem);

        populateConfigurationItemsControl(voProviderSystem);
    }

}
项目:AvoinApotti    文件:VoMapper.java   
protected void populateMSH(ProviderSystemVo proVo, MSH msh, String messageControlID,
        String messageType, String triggerEvent) throws DataTypeException, Exception {
    LOG.debug("VoMapper populateMSH: entry");
    renderDateTimeVoToTS(new DateTime(), msh.getDateTimeOfMessage());

    String receivingFacility=null;
    ConfigPropertyVo prop = proVo.getConfigurationProperty(ConfigItems.Hl7Facility);
    if (prop != null)
    {
        receivingFacility = prop.getPropertyValue();
    }
    if (receivingFacility == null)
        receivingFacility = cfg.getReceivingFacility();

    String processingId=null;
    ConfigPropertyVo hl7Prop = proVo.getConfigurationProperty(ConfigItems.ProcessingID);
    if (hl7Prop != null)
    {
        processingId=hl7Prop.getPropertyValue();
    }
    if (processingId == null)
        processingId = cfg.getProcessingId();

    msh.getSendingApplication().getNamespaceID().setValue(cfg.getSendApplication());    
    msh.getSendingFacility().getNamespaceID().setValue(cfg.getSendFacility()); 
    msh.getFieldSeparator().setValue("|");  
    msh.getEncodingCharacters().setValue("^~\\&");
    msh.getReceivingFacility().getNamespaceID().setValue(receivingFacility);
    msh.getReceivingApplication().getNamespaceID().setValue(proVo.getHl7Application());
    msh.getVersionID().getVersionID().setValue("2.4");
    msh.getMessageType().getMessageType().setValue(messageType);
    msh.getMessageType().getTriggerEvent().setValue(triggerEvent);
    msh.getProcessingID().getProcessingID().setValue(processingId);  // Debug / Production / Training
    msh.getMessageControlID().setValue(messageControlID);
    //      order.getMSH().getMessageControlID().setValue(new String() + new java.util.Date().getTime());
    LOG.debug("VoMapper populateMSH: exit");

}
项目:AvoinApotti    文件:A12VoMapper.java   
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
    a02mapper = (A02VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A02);
    if (a02mapper == null)
    {
        throw new HL7Exception("A12 mapper requires A02 mapper. A02 mapper not found in list of registerd mappers.");           
    }
    return(a02mapper.processPatientTransfer(msg, providerSystem));
}
项目:AvoinApotti    文件:A21VoMapper.java   
protected Message processPatientLeave(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
    try
    {

        PatientShort patVo = (PatientShort)getPrimaryIdFromPid(msg, providerSystem);

        if (patVo != null)
        {
            patVo = getDemog().getPatient(patVo);

            if (patVo == null)
                return HL7Utils.buildRejAck(msg.get("MSH"), "This patient has not been registered within the system", HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));

            String eventCode = HL7Utils.getEventCode(msg);
            if (eventCode.equals("A21") || eventCode.equals("A53"))  // A21 set's patient on leave, A53 cancels the cancelled Patient Leave i.e. sets them on leave again
                adt.recordInpatientLeave(patVo);
            else if (eventCode.equals("A22") || eventCode.equals("A52"))  // Cancel Patient's Leave
            {
                PV1 pv1 = (PV1) msg.get("PV1");
                LocShortVo loc = null;
                loc = orgLoc.getLocationByTaxonomyType(pv1.getAssignedPatientLocation().getPointOfCare().getValue(), TaxonomyType.PAS);
                patVo.setWard(loc);
                adt.cancelInpatientLeave(patVo);  // A22
            }
        }
    }
    catch (StaleObjectException ex)
    {
        return HL7Utils.buildRejAck( msg.get("MSH"), "StaleObjectException occured recording Inpatient Leave - " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
    }

    Message ack = HL7Utils.buildPosAck( msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems()));
    return ack;
}
项目:AvoinApotti    文件:A40VoMapper.java   
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
    a34mapper = (A34VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A34);
    if (a34mapper == null)
    {
        throw new HL7Exception("A40 mapper requires A34 mapper. A34 mapper not found in list of registerd mappers.");           
    }

    return(a34mapper.processPatientMerge(msg, providerSystem));

}
项目:AvoinApotti    文件:A40VoMapper.java   
private final void renderPatidCollectionToMrg(PatientIdCollection coll, MRG mrg, ProviderSystemVo providerSystem) throws Exception
{
    if (coll == null)
        return;
    LOG.debug("VoMapper renderPatidCollectionToMrg: entry");
    int posInMsg=0;
    for (int i = 0; i < coll.size(); i++)
    {
        PatientId patId = coll.get(i);

        //http://jira/browse/WDEV-10022
        if(ConfigFlag.HL7.SEND_ONLY_VERIFIED_NHSN.getValue()==true 
                &&patId.getTypeIsNotNull()&&patId.getType().equals(PatIdType.NHSN)
                &&(!patId.getVerifiedIsNotNull()||patId.getVerified()==false))
        {

            continue;
        }
        String patIdType = svc.getRemoteLookup(patId.getType().getID(), providerSystem.getCodeSystem().getText());
        if (patIdType == null)
        {
            continue;
        }
        CX id1 = mrg.getPriorPatientIdentifierList(posInMsg);
        posInMsg++;
        renderPatientIdtoCX( patId,id1, providerSystem);
        if(patId.getType().equals(providerSystem.getPrimaryPatientId()))
        {
            CX accNum = mrg.getPriorPatientAccountNumber();
            renderPatientIdtoCX( patId,accNum, providerSystem);
        }
    }
    LOG.debug("VoMapper renderPatidCollectionToMrg: exit");
}
项目:AvoinApotti    文件:A40VoMapper.java   
private final void renderPatientIdtoCX(PatientId patId,CX cx,ProviderSystemVo providerSystem) throws Exception
{
    if (null==patId.getType())
        return;
    String patIdType = svc.getRemoteLookup(patId.getType().getID(), providerSystem.getCodeSystem().getText());
    if (patIdType == null)
        return;

    if (patId.getType().equals(PatIdType.NHSN))
        cx.getID().setValue((patId.getValue()!=null)?patId.getValue().replace(" ", ""):null);

    else
        cx.getID().setValue(patId.getValue());

    if (providerSystem.getIdtypeComponent().intValue() == 4)
        cx.getAssigningAuthority().getNamespaceID().setValue(patIdType);
    else
        cx.getIdentifierTypeCode().setValue(patIdType);

    if (patId.getType().equals(PatIdType.NHSN))
    {
        if(patId.getVerifiedIsNotNull()&&patId.getVerified())
        {
            cx.getCheckDigit().setValue("V");
            cx.getCodeIdentifyingTheCheckDigitSchemeEmployed().setValue("MAXIMS");
        }
    }
}
项目:AvoinApotti    文件:HL7EngineOutbound.java   
private String generateA47Message(PatientRefVo patient, String hl7Application, ProviderSystemVo providerSystem) throws HL7Exception
{
    Message msg;
    a47mapper.processedCount++;
    try
    {
        msg = a47mapper.populateMessage(patient, hl7Application, providerSystem);
        if (msg != null)
        {
            String ret = parser.encode(msg);
            a47mapper.successCount++;
            a47mapper.lastSuccessDateTime = new DateTime();
            a47mapper.lastSuccessMessage = ret;
            return ret;
        }
    }
    catch (Exception e)
    {
        a47mapper.errorCount++;
        a47mapper.lastFailedDateTime = new DateTime();
        throw new HL7Exception("Exception occurred generating ADT Message for HL7App - " + hl7Application + " - " + e.getMessage(), e);
    }

    a47mapper.errorCount++;
    a47mapper.lastFailedDateTime = new DateTime();
    throw new HL7Exception("generateA47Message: A null message cannot be parsed!");
}
项目:AvoinApotti    文件:A60VoMapper.java   
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{       
    try {
        processPatientAllergy(msg, providerSystem);
    }
    catch (Exception ex)
    {
        return HL7Utils.buildRejAck(msg.get("MSH"), ex.getClass().getName() + " occurred. " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
    }

    Message ack = HL7Utils.buildPosAck(msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems()));
    return ack; 

}
项目:AvoinApotti    文件:R01VoMapper.java   
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
    try
    {
        processResult(msg,providerSystem);
    }
    catch (StaleObjectException soe)
    {
        try
        {
            System.out.println("Handeling SOE");
            Thread.sleep(10000);
            processResult(msg,providerSystem);
        }
        catch(Exception ie)
        {
            this.errorCount++;
            ie.printStackTrace();
            return HL7Utils.buildRejAck(msg.get("MSH"), "Exception. " + ie.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
        }
    }
    catch (Exception ex)
    {
        this.errorCount++;
        ex.printStackTrace();
        return HL7Utils.buildRejAck(msg.get("MSH"), "Exception. " + ex.getMessage(), HL7Errors.APP_INT_ERROR, toConfigItemArray(providerSystem.getConfigItems()));
    }

    Message ack = HL7Utils.buildPosAck(msg.get("MSH"), toConfigItemArray(providerSystem.getConfigItems()));
    return ack;
}
项目:AvoinApotti    文件:R01VoMapper.java   
/**
 * wdev-2367
 * updateOrderLevelValues
 * This method will update the Patient Location and Responsible Clinician if they are specified with a result message. 
 * @param ormMsg
 * @param obr 
 * @param orc 
 * @param voOrder
 * @param providerSystem
 * @return 
 * @return
 * @throws HL7Exception 
 * @throws StaleObjectException 
 */
private IfOcsOrderVo updateOrderLevelValues(Message ormMsg, ORC orc, OBR obr, IfOcsOrderVo voOrder, ProviderSystemVo providerSystem) throws HL7Exception, StaleObjectException
{
    PV1 pv1=null;
    if (ormMsg instanceof ORM_O01)
    {
        pv1=((ORM_O01)ormMsg).getORM_O01_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getORM_O01_PV1PV2().getPV1();
    }
    else if (ormMsg instanceof OMG_O19)
    {
        pv1=((OMG_O19)ormMsg).getOMG_O19_PIDPD1NTEPV1PV2IN1IN2IN3GT1AL1().getOMG_O19_PV1PV2().getPV1();
    }
    else if (ormMsg instanceof ORU_R01)
    {
        pv1=((ORU_R01)ormMsg).getORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTECTDOBXNTEFT1CTI().getORU_R01_PIDPD1NK1NTEPV1PV2().getORU_R01_PV1PV2().getPV1();
    }

    if (pv1 != null)
    {
        populateLocationVoFromPL(pv1.getAssignedPatientLocation(), voOrder, providerSystem);            
    }

    // ORC-12   Ordering provider
    populateWithOrderingProvider(voOrder, orc, obr, providerSystem);

    // wdev-3054 - Removed code that appends value to Additional Clinical Info as now only populated
    // on un-solicited results

    String errors[] = voOrder.validate();
    if (errors != null)
        throw new HL7Exception("Validation errors found for order - " + VoMapper.toDisplayString(errors));
    voOrder = ocsIfInbound.saveOrderLevelItems(voOrder);
    return voOrder;
}
项目:AvoinApotti    文件:R01VoMapper.java   
private IfOrderInvestigationVo populateRADInvestigationVoFromOBR(OBR obr, String sendingApplication, ProviderSystemVo providerSystem) throws Exception
{
    IfOrderInvestigationVo orderInvVo = new IfOrderInvestigationVo();

    String providerInvCode = obr.getUniversalServiceIdentifier().getIdentifier().getValue();

    // wdev-2397 specimen source is now part of the search criteria to get the investigation
    SPS sps = obr.getSpecimenSource();

    IfProviderInvSearchVo search = new IfProviderInvSearchVo();
    search.setProviderInvCode(providerInvCode);
    search.setProvider(providerSystem);
    search.setHl7App(sendingApplication);
    search.setSpecimenSource(sps.getSpecimenSourceNameOrCode().getIdentifier().getValue());
    IfInvestigationLiteVo invVo = ocsIfInbound.getInvestigationByHl7AppInvAndService(search);
    if (invVo == null)
        throw new HL7Exception("Investigation not found for provider system and providerInvCode = " + providerInvCode);


    fillRADInvestigationFromOBR(orderInvVo, obr, invVo,providerSystem);

        // OBR-27   Quantity/timing
    // wdev-2746 - If obr-27 is not populated, we can check obr-5
    String priority = obr.getQuantityTiming(0).getPriority().getValue();
    if (priority == null)
        priority = obr.getPriority().getValue();
    if (priority != null)
    {
        orderInvVo.setOrderPriority((OrderPriority) svc.getLocalLookup(OrderPriority.class, OrderPriority.TYPE_ID, providerSystem.getCodeSystem().getText(), priority));
    }

    orderInvVo.setWasOrdered(Boolean.FALSE);
    return orderInvVo;
}
项目:AvoinApotti    文件:A28VoMapper.java   
protected void renderPatientMedicalInsuranceToIN1(PatientMedicalInsuranceVo medicalInsurance,IN1 in1,ProviderSystemVo providerSystem) throws HL7Exception
{
    if(medicalInsurance==null||in1==null||providerSystem==null)
    {
        return;
    }
    //IN1-3
    if(medicalInsurance.getCompanyIsNotNull()&&medicalInsurance.getCompany().getCodeMappingsIsNotNull())
    {
        String companyName  = medicalInsurance.getCompany().getCodeMappings().getMappingValue(providerSystem.getCodeSystem());
        in1.getInsuranceCompanyID(0).getID().setValue(companyName);
    }
    //IN1-36
    if(medicalInsurance.getPolicyNumberIsNotNull())
    {
        in1.getPolicyNumber().setValue(medicalInsurance.getPolicyNumber());
    }
    //IN1-2
    if(medicalInsurance.getPolicyTypeIsNotNull())
    {
        in1.getInsurancePlanID().getIdentifier().setValue(svc.getRemoteLookup(medicalInsurance.getPolicyType().getID(), providerSystem.getCodeSystem().getText()));
    }
    //IN1-13
    if(medicalInsurance.getExpiryDateIsNotNull())
    {
        in1.getPlanExpirationDate().setValue(medicalInsurance.getExpiryDate().toString(DateFormat.ISO));
    }

}
项目:AvoinApotti    文件:A28VoMapper.java   
protected void renderInsuranceToIN1(InsuranceVo insurance,IN1 in1,ProviderSystemVo providerSystem) throws HL7Exception
{
    if(insurance!=null||in1==null||providerSystem==null)
    {
    // Medical Card / Insurance 

    //IN1-28
        in1.getSetIDIN1().setValue("1");
        if(insurance.getHealthActCategoryIsNotNull())
        {
            in1.getPreAdmitCert().setValue(svc.getRemoteLookup(insurance.getHealthActCategory().getID(), providerSystem.getCodeSystem().getText()));
        }
    //IN1-35
    //IN1-31
        if(insurance.getMedicalCardProvedIsNotNull())
        {
            in1.getBillingStatus().setValue(svc.getRemoteLookup(insurance.getMedicalCardProved().getID(), providerSystem.getCodeSystem().getText()));
        }
    //IN1-14-3
        if(insurance.getEligibilityProofIsNotNull())
        {
            in1.getAuthorizationInformation().getSource().setValue(insurance.getEligibilityProof());
        }
    //IN1-29
        if(insurance.getMedicalCardNoIsNotNull())
        {
            in1.getCompanyPlanCode().setValue(insurance.getMedicalCardNo());
        }
    }

}
项目:AvoinApotti    文件:A28VoMapper.java   
protected void renderEHICToIN1(InsuranceVo insurance, IN1 in1,ProviderSystemVo providerSystem) throws HL7Exception {
    if (insurance != null || in1 == null || providerSystem == null)
    {
        in1.getSetIDIN1().setValue("2");
        // IN1-2
        in1.getInsurancePlanID().getIdentifier().setValue("EHIC");
        // IN1-3
        in1.getInsuranceCompanyID(0).getID().setValue("EHIC");
        // IN1-36
        if (insurance.getEHICNumberIsNotNull())
        {
            in1.getPolicyNumber().setValue(insurance.getEHICNumber());
        }
        // IN1-13
        if (insurance.getEHICExpiryDateIsNotNull())
        {
            in1.getPlanExpirationDate().setValue(
                    insurance.getEHICExpiryDate().toString(DateFormat.ISO));
        }
        // IN1-5-6
        if (insurance.getEHICCountryIsNotNull())
        {
            in1.getInsuranceCompanyAddress(0).getCountry().setValue(svc.getRemoteLookup(insurance.getEHICCountry().getID(),providerSystem.getCodeSystem().getText()));
        }
        // IN1-4
        if (insurance.getEHICInstitutionIsNotNull())
        {
            in1.getInsuranceCompanyName(0).getOrganizationName().setValue(insurance.getEHICInstitution());
        }
    }
}
项目:AvoinApotti    文件:A28VoMapper.java   
private void populateMSH(ADT_A05 msg, ProviderSystemVo providerSystem) throws DataTypeException, Exception
{
    LOG.debug("A28VoMapper populateMSH: entry");
    String receivingFacility=null;
    ConfigPropertyVo prop = providerSystem.getConfigurationProperty(ConfigItems.Hl7Facility);
    if (prop != null)
    {
        receivingFacility = prop.getPropertyValue();
    }
    if (receivingFacility == null)
        receivingFacility = cfg.getReceivingFacility();
    String processingId=null;
    ConfigPropertyVo hl7Prop = providerSystem.getConfigurationProperty(ConfigItems.ProcessingID);
    if (hl7Prop != null)
    {
        processingId=hl7Prop.getPropertyValue();
    }
    if (processingId == null)
        processingId = cfg.getProcessingId();
    DateTime msgDateTime = new DateTime();
    renderDateTimeVoToTS(msgDateTime, msg.getMSH().getDateTimeOfMessage());
    msg.getMSH().getSendingApplication().getNamespaceID().setValue(cfg.getSendApplication());
    msg.getMSH().getSendingFacility().getNamespaceID().setValue(cfg.getSendFacility()); 

    msg.getMSH().getFieldSeparator().setValue("|");  
    msg.getMSH().getEncodingCharacters().setValue("^~\\&");
    msg.getMSH().getReceivingApplication().getNamespaceID().setValue(providerSystem.getHl7Application());
    msg.getMSH().getReceivingFacility().getNamespaceID().setValue(receivingFacility);
    msg.getMSH().getVersionID().getVersionID().setValue("2.4");
    msg.getMSH().getMessageType().getMessageType().setValue("ADT");
    msg.getMSH().getMessageType().getTriggerEvent().setValue("A28");
    msg.getMSH().getProcessingID().getProcessingID().setValue(processingId);  // Debug / Production / Training
    msg.getMSH().getMessageControlID().setValue(new String() + new java.util.Date().getTime());
    LOG.debug("A28VoMapper populateMSH: exit");

}
项目:AvoinApotti    文件:Logic.java   
private void newInstance()
{
    // initalise the screen for a new record
    form.getLocalContext().setSelectedRecord(new ProviderSystemVo());
    clearInstanceControls();
    // set the form mode
    form.setMode(FormMode.EDIT);
    updateIPAndHostControlsState();

}
项目:AvoinApotti    文件:A01VoMapper.java   
public Message processEvent(Message msg, ProviderSystemVo providerSystem) throws HL7Exception
{
    a28mapper = (A28VoMapper) HL7EngineApplication.getVoMapper(EvnCodes.A28);
    if (a28mapper == null)
    {
        throw new HL7Exception("A01 mapper requires A28 mapper. A28 mapper not found in list of registerd mappers.");           
    }

    Message ack = processPatientAdmission(msg, providerSystem);
    return ack;
}
项目:AvoinApotti    文件:HL7EngineOutbound.java   
private String generateA31Message(PatientRefVo patient, String hl7Application, ProviderSystemVo providerSystem) throws HL7Exception
{
    Message msg;
    a31mapper.processedCount++;
    try
    {
        msg = a31mapper.populateMessage(patient, hl7Application, providerSystem);
        if (msg != null)
        {
            String ret = parser.encode(msg);
            a31mapper.successCount++;
            a31mapper.lastSuccessDateTime = new DateTime();
            a31mapper.lastSuccessMessage = ret;
            return ret;
        }
    }
    catch (Exception e)
    {
        a31mapper.errorCount++;
        a31mapper.lastFailedDateTime = new DateTime();
        throw new HL7Exception("Exception occurred generating ADT Message for HL7App - " + hl7Application + " - " + e.getMessage(), e);
    }

    a31mapper.errorCount++;
    a31mapper.lastFailedDateTime = new DateTime();
    throw new HL7Exception("generateA31Message: A null message cannot be parsed!");
}