Java 类ims.ocrr.vo.lookups.ResultUnitOfMeasure 实例源码

项目:AvoinApotti    文件:OcsIfInboundImpl.java   
public IfAnalyteVo getAnalyte(String extCode, String extTxt, IfProviderInvSearchVo search, ResultUnitOfMeasure unitOfMeasure) throws DomainInterfaceException,StaleObjectException 
{
    if (search == null)
        return null;
    DomainFactory factory = getDomainFactory();
    String hql = " from Analyte a where a.analyteExtCode = '" + extCode + "'";

    LocSvcProviderSys locSvcProv = getDomLocProviderSystem(search);
    if (locSvcProv == null)
        throw new DomainInterfaceException("Location Service Provider not found for hl7App " + search.getHl7App());

    LocationService locSvc = locSvcProv.getLocationService();
    if (locSvc == null)
        throw new DomainInterfaceException("Location Service not found for Provider " + locSvcProv.getProviderSystem().getSystemName());

    ProviderSystem providerSystem = locSvcProv.getProviderSystem();     

    //query depends on config flag setting:
    //TODO test flags for non-BHRT application
    String datasetName = extTxt;
    if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue().equals("SVC"))
    {
         hql += " and a.service = " + locSvc.getService().getId();
         datasetName += " (" + search.getService().getServiceName() + " - " + extCode + ")";
    }
    else if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue() == "LOC_SVC")
    {
        hql += " and a.locationService = " + locSvc.getId();
        datasetName += " (" + locSvc.getLocation().getName() + " - " + search.getService().getServiceName() + " - " + extCode + ")";
    }
    else if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue() == "PROV_SYS") 
    {
        hql += " and a.providerSystem =  " + providerSystem.getId();
        datasetName += " (" + providerSystem.getSystemName() + " - " + extCode + ")";
    }
    List l = factory.find(hql);
    if (l != null && l.size() != 0)
    {
        if (l.size() > 1 ) //error?
            return null;
        else 
        {
            Analyte analyte = (Analyte) l.get(0);
            if(analyte.getAnalyteExtText()!=null
                    &&extTxt!=null
                    &&!analyte.getAnalyteExtText().trim().toUpperCase().equals(extTxt.trim().toUpperCase()))
            {
                throw new DomainInterfaceException("Analyte description does not match learned value for: "+extCode);
            }
            return IfAnalyteVoAssembler.create(analyte);
        }
    }

    //Doesn't exist - Create 
    Analyte analyteBo = new Analyte();
    analyteBo.setAnalyteExtCode(extCode);
    analyteBo.setAnalyteExtText(extTxt);
    analyteBo.setService(locSvc.getService());
    analyteBo.setProviderSystem(providerSystem);
    analyteBo.setLocationService(locSvc);               
    DatasetType dst = new DatasetType();
    dst.setName(datasetName);
    dst.setCategory(this.getDomLookup(DataSetCategory.PATHOLOGYRESULT));
    dst.setDefaultLineType(this.getDomLookup(LineType.SOLID));
    dst.setDefLineColPtIcon(this.getDomLookup(LineColourPointIcon.RED_SQUARE));
    dst.setIsActive(Boolean.TRUE);
    dst.setUnitOfMeasure(getDomLookup(unitOfMeasure));
    analyteBo.setDatasetType(dst);
    factory.save(analyteBo);
    return IfAnalyteVoAssembler.create(analyteBo);

}
项目:openMAXIMS    文件:OcsIfInboundImpl.java   
public IfAnalyteVo getAnalyte(String extCode, String extTxt, IfProviderInvSearchVo search, ResultUnitOfMeasure unitOfMeasure, Boolean doAnalyteCheck) throws DomainInterfaceException,StaleObjectException //http://jira/browse/WDEV-21674
{
    if (search == null)
        return null;
    DomainFactory factory = getDomainFactory();
    String hql = " from Analyte a where a.analyteExtCode = '" + extCode + "'";

    LocSvcProviderSys locSvcProv = getDomLocProviderSystem(search);
    if (locSvcProv == null)
        throw new DomainInterfaceException("Location Service Provider not found for hl7App " + search.getHl7App());

    LocationService locSvc = locSvcProv.getLocationService();
    if (locSvc == null)
        throw new DomainInterfaceException("Location Service not found for Provider " + locSvcProv.getProviderSystem().getSystemName());

    ProviderSystem providerSystem = locSvcProv.getProviderSystem();     

    //query depends on config flag setting:
    //TODO test flags for non-BHRT application
    String datasetName = extTxt;
    if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue().equals("SVC"))
    {
         hql += " and a.service = " + locSvc.getService().getId();
         datasetName += " (" + search.getService().getServiceName() + " - " + extCode + ")";
    }
    else if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue() == "LOC_SVC")
    {
        hql += " and a.locationService = " + locSvc.getId();
        datasetName += " (" + locSvc.getLocation().getName() + " - " + search.getService().getServiceName() + " - " + extCode + ")";
    }
    else if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue() == "PROV_SYS") 
    {
        hql += " and a.providerSystem =  " + providerSystem.getId();
        datasetName += " (" + providerSystem.getSystemName() + " - " + extCode + ")";
    }
    List l = factory.find(hql);
    if (l != null && l.size() != 0)
    {
        if (l.size() > 1 ) //error?
            return null;
        else 
        {
            Analyte analyte = (Analyte) l.get(0);
            if((doAnalyteCheck!=null&&Boolean.TRUE.equals(doAnalyteCheck)) //WDEV-21674 MAXIMS 10.1.2
                    &&analyte.getAnalyteExtText()!=null
                    &&extTxt!=null
                    &&!analyte.getAnalyteExtText().trim().toUpperCase().equals(extTxt.trim().toUpperCase()))
            {
                throw new DomainInterfaceException("Analyte description does not match learned value for: "+extCode);
            }
            return IfAnalyteVoAssembler.create(analyte);
        }
    }

    //Doesn't exist - Create 
    Analyte analyteBo = new Analyte();
    analyteBo.setAnalyteExtCode(extCode);
    analyteBo.setAnalyteExtText(extTxt);
    analyteBo.setService(locSvc.getService());
    analyteBo.setProviderSystem(providerSystem);
    analyteBo.setLocationService(locSvc);               
    DatasetType dst = new DatasetType();
    dst.setName(datasetName);
    dst.setCategory(this.getDomLookup(DataSetCategory.PATHOLOGYRESULT));
    dst.setDefaultLineType(this.getDomLookup(LineType.SOLID));
    dst.setDefLineColPtIcon(this.getDomLookup(LineColourPointIcon.RED_SQUARE));
    dst.setIsActive(Boolean.TRUE);
    dst.setUnitOfMeasure(getDomLookup(unitOfMeasure));
    analyteBo.setDatasetType(dst);
    factory.save(analyteBo);
    return IfAnalyteVoAssembler.create(analyteBo);

}
项目:openMAXIMS    文件:OcsIfInboundImpl.java   
public IfAnalyteVo getAnalyte(String extCode, String extTxt, IfProviderInvSearchVo search, ResultUnitOfMeasure unitOfMeasure) throws DomainInterfaceException,StaleObjectException 
{
    if (search == null)
        return null;
    DomainFactory factory = getDomainFactory();
    String hql = " from Analyte a where a.analyteExtCode = '" + extCode + "'";

    LocSvcProviderSys locSvcProv = getDomLocProviderSystem(search);
    if (locSvcProv == null)
        throw new DomainInterfaceException("Location Service Provider not found for hl7App " + search.getHl7App());

    LocationService locSvc = locSvcProv.getLocationService();
    if (locSvc == null)
        throw new DomainInterfaceException("Location Service not found for Provider " + locSvcProv.getProviderSystem().getSystemName());

    ProviderSystem providerSystem = locSvcProv.getProviderSystem();     

    //query depends on config flag setting:
    //TODO test flags for non-BHRT application
    String datasetName = extTxt;
    if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue().equals("SVC"))
    {
         hql += " and a.service = " + locSvc.getService().getId();
         datasetName += " (" + search.getService().getServiceName() + " - " + extCode + ")";
    }
    else if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue() == "LOC_SVC")
    {
        hql += " and a.locationService = " + locSvc.getId();
        datasetName += " (" + locSvc.getLocation().getName() + " - " + search.getService().getServiceName() + " - " + extCode + ")";
    }
    else if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue() == "PROV_SYS") 
    {
        hql += " and a.providerSystem =  " + providerSystem.getId();
        datasetName += " (" + providerSystem.getSystemName() + " - " + extCode + ")";
    }
    List l = factory.find(hql);
    if (l != null && l.size() != 0)
    {
        if (l.size() > 1 ) //error?
            return null;
        else 
        {
            Analyte analyte = (Analyte) l.get(0);
            if(analyte.getAnalyteExtText()!=null
                    &&extTxt!=null
                    &&!analyte.getAnalyteExtText().trim().toUpperCase().equals(extTxt.trim().toUpperCase()))
            {
                throw new DomainInterfaceException("Analyte description does not match learned value for: "+extCode);
            }
            return IfAnalyteVoAssembler.create(analyte);
        }
    }

    //Doesn't exist - Create 
    Analyte analyteBo = new Analyte();
    analyteBo.setAnalyteExtCode(extCode);
    analyteBo.setAnalyteExtText(extTxt);
    analyteBo.setService(locSvc.getService());
    analyteBo.setProviderSystem(providerSystem);
    analyteBo.setLocationService(locSvc);               
    DatasetType dst = new DatasetType();
    dst.setName(datasetName);
    dst.setCategory(this.getDomLookup(DataSetCategory.PATHOLOGYRESULT));
    dst.setDefaultLineType(this.getDomLookup(LineType.SOLID));
    dst.setDefLineColPtIcon(this.getDomLookup(LineColourPointIcon.RED_SQUARE));
    dst.setIsActive(Boolean.TRUE);
    dst.setUnitOfMeasure(getDomLookup(unitOfMeasure));
    analyteBo.setDatasetType(dst);
    factory.save(analyteBo);
    return IfAnalyteVoAssembler.create(analyteBo);

}
项目:openmaxims-linux    文件:OcsIfInboundImpl.java   
public IfAnalyteVo getAnalyte(String extCode, String extTxt, IfProviderInvSearchVo search, ResultUnitOfMeasure unitOfMeasure) throws DomainInterfaceException,StaleObjectException 
{
    if (search == null)
        return null;
    DomainFactory factory = getDomainFactory();
    String hql = " from Analyte a where a.analyteExtCode = '" + extCode + "'";

    LocSvcProviderSys locSvcProv = getDomLocProviderSystem(search);
    if (locSvcProv == null)
        throw new DomainInterfaceException("Location Service Provider not found for hl7App " + search.getHl7App());

    LocationService locSvc = locSvcProv.getLocationService();
    if (locSvc == null)
        throw new DomainInterfaceException("Location Service not found for Provider " + locSvcProv.getProviderSystem().getSystemName());

    ProviderSystem providerSystem = locSvcProv.getProviderSystem();     

    //query depends on config flag setting:
    //TODO test flags for non-BHRT application
    String datasetName = extTxt;
    if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue().equals("SVC"))
    {
         hql += " and a.service = " + locSvc.getService().getId();
         datasetName += " (" + search.getService().getServiceName() + " - " + extCode + ")";
    }
    else if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue() == "LOC_SVC")
    {
        hql += " and a.locationService = " + locSvc.getId();
        datasetName += " (" + locSvc.getLocation().getName() + " - " + search.getService().getServiceName() + " - " + extCode + ")";
    }
    else if (ConfigFlag.DOM.ANALYTE_UNIQUENESS.getValue() == "PROV_SYS") 
    {
        hql += " and a.providerSystem =  " + providerSystem.getId();
        datasetName += " (" + providerSystem.getSystemName() + " - " + extCode + ")";
    }
    List l = factory.find(hql);
    if (l != null && l.size() != 0)
    {
        if (l.size() > 1 ) //error?
            return null;
        else 
        {
            Analyte analyte = (Analyte) l.get(0);
            if(analyte.getAnalyteExtText()!=null
                    &&extTxt!=null
                    &&!analyte.getAnalyteExtText().trim().toUpperCase().equals(extTxt.trim().toUpperCase()))
            {
                throw new DomainInterfaceException("Analyte description does not match learned value for: "+extCode);
            }
            return IfAnalyteVoAssembler.create(analyte);
        }
    }

    //Doesn't exist - Create 
    Analyte analyteBo = new Analyte();
    analyteBo.setAnalyteExtCode(extCode);
    analyteBo.setAnalyteExtText(extTxt);
    analyteBo.setService(locSvc.getService());
    analyteBo.setProviderSystem(providerSystem);
    analyteBo.setLocationService(locSvc);               
    DatasetType dst = new DatasetType();
    dst.setName(datasetName);
    dst.setCategory(this.getDomLookup(DataSetCategory.PATHOLOGYRESULT));
    dst.setDefaultLineType(this.getDomLookup(LineType.SOLID));
    dst.setDefLineColPtIcon(this.getDomLookup(LineColourPointIcon.RED_SQUARE));
    dst.setIsActive(Boolean.TRUE);
    dst.setUnitOfMeasure(getDomLookup(unitOfMeasure));
    analyteBo.setDatasetType(dst);
    factory.save(analyteBo);
    return IfAnalyteVoAssembler.create(analyteBo);

}