Java 类ims.core.vo.lookups.LineColourPointIcon 实例源码

项目:AvoinApotti    文件:Logic.java   
private void createVariableCells(DynamicGridRow row, boolean bDefault)
{
    clearVariableCells(row);

    DynamicGridCell cell = row.getCells().newCell(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_LINETYPE), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineType.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(false);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefaultLineType());
        cell.setReadOnly(true);
    }

    cell = row.getCells().newCell(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_COLOR_ICON), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineColourPointIcon.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(false);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefLineColPtIcon());
        cell.setReadOnly(true);
    }
}
项目:AvoinApotti    文件:Logic.java   
private void createVariableCells(DynamicGridRow row, boolean bDefault)
{
    clearVariableCells(row);

    DynamicGridCell cell = row.getCells().newCell(form.dyngrdChart().getColumns().getByIdentifier(COL_LINETYPE), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineType.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(true);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefaultLineType());
    }

    cell = row.getCells().newCell(form.dyngrdChart().getColumns().getByIdentifier(COL_COLOR_ICON), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineColourPointIcon.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(true);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefLineColPtIcon());
    }
}
项目:openMAXIMS    文件:Logic.java   
private void createVariableCells(DynamicGridRow row, boolean bDefault)
{
    clearVariableCells(row);

    DynamicGridCell cell = row.getCells().newCell(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_LINETYPE), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineType.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(false);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefaultLineType());
        cell.setReadOnly(true);
    }

    cell = row.getCells().newCell(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_COLOR_ICON), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineColourPointIcon.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(false);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefLineColPtIcon());
        cell.setReadOnly(true);
    }
}
项目:openMAXIMS    文件:Logic.java   
private void createVariableCells(DynamicGridRow row, boolean bDefault)
{
    clearVariableCells(row);

    DynamicGridCell cell = row.getCells().newCell(form.dyngrdChart().getColumns().getByIdentifier(COL_LINETYPE), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineType.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(true);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefaultLineType());
    }

    cell = row.getCells().newCell(form.dyngrdChart().getColumns().getByIdentifier(COL_COLOR_ICON), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineColourPointIcon.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(true);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefLineColPtIcon());
    }
}
项目:openMAXIMS    文件:Logic.java   
private void createVariableCells(DynamicGridRow row, boolean bDefault)
{
    clearVariableCells(row);

    DynamicGridCell cell = row.getCells().newCell(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_LINETYPE), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineType.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(false);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefaultLineType());
        cell.setReadOnly(true);
    }

    cell = row.getCells().newCell(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_COLOR_ICON), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineColourPointIcon.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(false);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefLineColPtIcon());
        cell.setReadOnly(true);
    }
}
项目:openMAXIMS    文件:Logic.java   
private void createVariableCells(DynamicGridRow row, boolean bDefault)
{
    clearVariableCells(row);

    DynamicGridCell cell = row.getCells().newCell(form.dyngrdChart().getColumns().getByIdentifier(COL_LINETYPE), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineType.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(true);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefaultLineType());
    }

    cell = row.getCells().newCell(form.dyngrdChart().getColumns().getByIdentifier(COL_COLOR_ICON), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineColourPointIcon.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(true);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefLineColPtIcon());
    }
}
项目:openmaxims-linux    文件:Logic.java   
private void createVariableCells(DynamicGridRow row, boolean bDefault)
{
    clearVariableCells(row);

    DynamicGridCell cell = row.getCells().newCell(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_LINETYPE), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineType.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(false);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefaultLineType());
        cell.setReadOnly(true);
    }

    cell = row.getCells().newCell(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_COLOR_ICON), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineColourPointIcon.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(false);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefLineColPtIcon());
        cell.setReadOnly(true);
    }
}
项目:openmaxims-linux    文件:Logic.java   
private void createVariableCells(DynamicGridRow row, boolean bDefault)
{
    clearVariableCells(row);

    DynamicGridCell cell = row.getCells().newCell(form.dyngrdChart().getColumns().getByIdentifier(COL_LINETYPE), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineType.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(true);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefaultLineType());
    }

    cell = row.getCells().newCell(form.dyngrdChart().getColumns().getByIdentifier(COL_COLOR_ICON), DynamicCellType.ENUMERATION);
    engine.populate(cell, LineColourPointIcon.getNegativeInstancesAsIItemCollection());
    cell.setReadOnly(true);
    if(bDefault)
    {
        cell.setValue(((DataSetTypeVo)row.getValue()).getDefLineColPtIcon());
    }
}
项目:AvoinApotti    文件:Logic.java   
private ChartTypeVo populateDataFromScreenLocal()
{
    ChartTypeVo record = populateDataFromScreen(form.getLocalContext().getCurrentRecord());

    record.setNormalBandColour(form.cmbNormalColour().getValue());

    if(record.getDatasetTypes() == null)
        record.setDatasetTypes(new ChartTypeDatasetVoCollection());
    else
        record.getDatasetTypes().clear();

    int order = 1;  //WDEV-12548

    for (int i = 0; i < form.dyngrdLinkedDataSets().getRows().size(); i++)
    {
        DynamicGridRow row = form.dyngrdLinkedDataSets().getRows().get(i);

        ChartTypeDatasetVo item = new ChartTypeDatasetVo();
        item.setDatasetType((DataSetTypeVo)row.getValue());

        if(row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_ANSWERBOX)).getValue().equals(LineTypeStatus.CUSTOM))
        {
            item.setLineType((LineType) row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_LINETYPE)).getValue());
            item.setLineColourPointIcon((LineColourPointIcon) row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_COLOR_ICON)).getValue());
        }

        item.setSortOrder(Integer.valueOf(order++)); //WDEV-12548

        record.getDatasetTypes().add(item);
    }

    return record;
}
项目:openMAXIMS    文件:Logic.java   
private ChartTypeVo populateDataFromScreenLocal()
{
    ChartTypeVo record = populateDataFromScreen(form.getLocalContext().getCurrentRecord());

    record.setNormalBandColour(form.cmbNormalColour().getValue());

    if(record.getDatasetTypes() == null)
        record.setDatasetTypes(new ChartTypeDatasetVoCollection());
    else
        record.getDatasetTypes().clear();

    int order = 1;  //WDEV-12548

    for (int i = 0; i < form.dyngrdLinkedDataSets().getRows().size(); i++)
    {
        DynamicGridRow row = form.dyngrdLinkedDataSets().getRows().get(i);

        ChartTypeDatasetVo item = new ChartTypeDatasetVo();
        item.setDatasetType((DataSetTypeVo)row.getValue());

        if(row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_ANSWERBOX)).getValue().equals(LineTypeStatus.CUSTOM))
        {
            item.setLineType((LineType) row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_LINETYPE)).getValue());
            item.setLineColourPointIcon((LineColourPointIcon) row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_COLOR_ICON)).getValue());
        }

        item.setSortOrder(Integer.valueOf(order++)); //WDEV-12548

        record.getDatasetTypes().add(item);
    }

    return record;
}
项目:openMAXIMS    文件:Logic.java   
private ChartTypeVo populateDataFromScreenLocal()
{
    ChartTypeVo record = populateDataFromScreen(form.getLocalContext().getCurrentRecord());

    record.setNormalBandColour(form.cmbNormalColour().getValue());

    if(record.getDatasetTypes() == null)
        record.setDatasetTypes(new ChartTypeDatasetVoCollection());
    else
        record.getDatasetTypes().clear();

    int order = 1;  //WDEV-12548

    for (int i = 0; i < form.dyngrdLinkedDataSets().getRows().size(); i++)
    {
        DynamicGridRow row = form.dyngrdLinkedDataSets().getRows().get(i);

        ChartTypeDatasetVo item = new ChartTypeDatasetVo();
        item.setDatasetType((DataSetTypeVo)row.getValue());

        if(row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_ANSWERBOX)).getValue().equals(LineTypeStatus.CUSTOM))
        {
            item.setLineType((LineType) row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_LINETYPE)).getValue());
            item.setLineColourPointIcon((LineColourPointIcon) row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_COLOR_ICON)).getValue());
        }

        item.setSortOrder(Integer.valueOf(order++)); //WDEV-12548

        record.getDatasetTypes().add(item);
    }

    return record;
}
项目:openmaxims-linux    文件:Logic.java   
private ChartTypeVo populateDataFromScreenLocal()
{
    ChartTypeVo record = populateDataFromScreen(form.getLocalContext().getCurrentRecord());

    record.setNormalBandColour(form.cmbNormalColour().getValue());

    if(record.getDatasetTypes() == null)
        record.setDatasetTypes(new ChartTypeDatasetVoCollection());
    else
        record.getDatasetTypes().clear();

    int order = 1;  //WDEV-12548

    for (int i = 0; i < form.dyngrdLinkedDataSets().getRows().size(); i++)
    {
        DynamicGridRow row = form.dyngrdLinkedDataSets().getRows().get(i);

        ChartTypeDatasetVo item = new ChartTypeDatasetVo();
        item.setDatasetType((DataSetTypeVo)row.getValue());

        if(row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_ANSWERBOX)).getValue().equals(LineTypeStatus.CUSTOM))
        {
            item.setLineType((LineType) row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_LINETYPE)).getValue());
            item.setLineColourPointIcon((LineColourPointIcon) row.getCells().get(form.dyngrdLinkedDataSets().getColumns().getByIdentifier(COL_COLOR_ICON)).getValue());
        }

        item.setSortOrder(Integer.valueOf(order++)); //WDEV-12548

        record.getDatasetTypes().add(item);
    }

    return record;
}
项目: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);

}