jrt不同于主流Spring+mybats框架宣传的多数据支持。引入mybats之后多数据库支持基本就是无稽之谈,一堆Mapper写SQL语句,多数据库支持从最开始就变成只能连多种数据库,而不是业务程序可以跑在多种数据库上面不用改动。一个框架如果不能解决常规业务查询需求和级联取数据,那么必然就要暴露SQL执行的api,暴露SQL之后业务程序跨库就无从谈起,只能是镜花水月。
jrt所宣传的多数据库支持是指真实的业务程序不用修改就能轻松换数据库运行,要满足这个就必然要加强数据访问层,满足业务查询述求,才能让业务摆脱写SQL。
jrt提供系列api解决业务查询述求,就以一些质控物维护的业务场景来说:
按某列的值查询列表,来满足用外键查询子数据
按某列值删除数据来满足业务快速删子数据
DolerGet来满足多维取数据,主要是一级级取参照的数据,这样就不用写复杂的关联查询
事务注解来满足申明式事务
拷贝属性方法满足页面实现数据拷贝功能
传入排序和分页来满足分页查询需求
提供按条件CheckHas检测是否有数据,方便业务判断指定数据是否存在,后台使用top 1来提高性能
支持实体表的子表查询数据,这样就可以得到一个表的数据,然后再DolerGet爬行周边数据,核心就是支持子类查询配合DolerGet用
经过一系列操作数据的api提供,jrt写业务可以不用写SQL就可以高效优雅的完成,从而确保jrt多数据库支持的真实可靠性。
质控物维护后台主代码,虽然涉及10几个表的多级关系,但是还是优雅的用jrt的api实现了
import JRT.Core.CustomAttributes.Trans;
import JRT.Core.Dto.OutValue;
import JRT.Core.Util.ReflectUtil;
import JRTBLLBase.BaseHttpHandler;
import JRTBLLBase.Helper;
import JRT.Core.Dto.HashParam;
import JRT.Core.Dto.ParamDto;
import JRT.Core.Dto.OutParam;
import JRT.Model.Entity.*;
import JRT.Core.Util.Convert;
import JRT.Core.MultiPlatform.JRTContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
*由代码生成器生成的后台代码
*/
public class ashBTQCMaterial extends BaseHttpHandler {
/**
* 得到仪器树
* @return
*/
public String GetMachineTree() throws Exception
{
List<MachineTreeDto> retList=new ArrayList<>();
//得到用户可以访问的工作组
List<SYSUserRole> roleList=EntityManager().FindByColVal(SYSUserRole.class,"UserDR",Convert.ToInt32(UserLogin().UserID));
if(roleList!=null&&roleList.size()>0)
{
HashMap hasOutWG=new HashMap();
for(SYSUserRole role:roleList)
{
//每个工作组只输出一次
if(hasOutWG.containsKey(role.WorkGroupDR))
{
continue;
}
hasOutWG.put(role.WorkGroupDR,true);
//工作组树节点
MachineTreeDto wgTree=new MachineTreeDto();
wgTree.RowID=role.WorkGroupDR;
wgTree.id="WG-"+role.WorkGroupDR;
BTWorkGroup wgDto=EntityManager().DolerGet(BTWorkGroup.class,role.WorkGroupDR);
wgTree.text=wgDto.CName;
wgTree.children=new ArrayList<>();
wgTree.Type="WG";
retList.add(wgTree);
//查询所有工作小组
List<BTWorkGroupMachine> wgmList=EntityManager().FindByColVal(BTWorkGroupMachine.class,"WorkGroupDR",role.WorkGroupDR);
if(wgmList!=null&&wgmList.size()>0)
{
for(BTWorkGroupMachine wgm:wgmList)
{
//工作小组树节点
MachineTreeDto wgmTree=new MachineTreeDto();
wgmTree.RowID=wgm.RowID;
wgmTree.id="WGM-"+wgm.RowID;
wgmTree.text=wgm.CName;
wgmTree.children=new ArrayList<>();
wgmTree.Type="WGM";
wgTree.children.add(wgmTree);
//查询工作小组下的所有仪器
List<BTMIMachineParameter> machList=EntityManager().FindByColVal(BTMIMachineParameter.class,"WorkGroupMachineDR",wgm.RowID);
if(machList!=null&&machList.size()>0)
{
for(BTMIMachineParameter mi:machList)
{
//仪器树节点
MachineTreeDto miTree=new MachineTreeDto();
miTree.RowID=mi.RowID;
miTree.id="MI-"+mi.RowID;
miTree.text=mi.CName;
miTree.Type="MI";
wgmTree.children.add(miTree);
}
}
}
}
}
}
//删除没有仪器的节点
DealNoMachineTree(retList);
return Helper.Object2Json(retList);
}
/**
* 保存数据,前台按表的属性名提交
* @return 字符串
*/
@Trans
public String SaveBTQCMaterial() throws Exception
{
BTQCMaterial dto=new BTQCMaterial();
//主键
dto.RowID=Helper.ValidParam(JRTContext.GetRequest(Request, "RowID"), dto.RowID);
//代码
dto.Code=Helper.ValidParam(JRTContext.GetRequest(Request, "Code"), dto.Code);
//名称
dto.CName=Helper.ValidParam(JRTContext.GetRequest(Request, "CName"), dto.CName);
//仪器
dto.MachineDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MachineDR"), dto.MachineDR);
//浓度数
dto.Levels=Helper.ValidParam(JRTContext.GetRequest(Request, "Levels"), dto.Levels);
//波长
dto.WaveLength=Helper.ValidParam(JRTContext.GetRequest(Request, "WaveLength"), dto.WaveLength);
//是否自动入库 {1:true,0:false}
dto.AutoSave=Helper.ValidParam(JRTContext.GetRequest(Request, "AutoSave"), dto.AutoSave);
//说明
dto.Remark=Helper.ValidParam(JRTContext.GetRequest(Request, "Remark"), dto.Remark);
//序号
dto.Sequence=Helper.ValidParam(JRTContext.GetRequest(Request, "Sequence"), dto.Sequence);
//激活 {1:true,0:false}
dto.Active=Helper.ValidParam(JRTContext.GetRequest(Request, "Active"), dto.Active);
//是否覆盖数据 {1:true,0:false}
dto.IsOverWriteData=Helper.ValidParam(JRTContext.GetRequest(Request, "IsOverWriteData"), dto.IsOverWriteData);
//不允许日间质控 {1:true,0:false}
dto.NotAllowDay=Helper.ValidParam(JRTContext.GetRequest(Request, "NotAllowDay"), dto.NotAllowDay);
//日间质控没做不显示 {1:true,0:false}
dto.NotShowNullDay=Helper.ValidParam(JRTContext.GetRequest(Request, "NotShowNullDay"), dto.NotShowNullDay);
OutValue key=new OutValue();
int ret=0;
//更新
if(dto.RowID>0)
{
ret=EntityManager().Update(dto,null, ErrRet(), null, null, null);
}
//插入数据
else
{
ret=EntityManager().Save(dto,key,ErrRet());
if(ret==1) {
for (int i = 0; i < dto.Levels; i++) {
BTQCMaterialLevel levDto = new BTQCMaterialLevel();
levDto.CName = "浓度" + (i + 1);
levDto.Color = "";
levDto.LevelNo = i + 1;
levDto.MaterialDR = dto.RowID;
EntityManager().Save(levDto,key,ErrRet());
}
}
else
{
throw new Exception(Err.GetString());
}
}
if(ret==1)
{
return Helper.Success();
}
else
{
return Helper.Error();
}
}
/**
* 删除数据,多个RowID以上尖号分割
* @return 字符串
*/
@Trans
public String DeleteBTQCMaterial() throws Exception
{
String RowIDS=Helper.ValidParam(JRTContext.GetRequest(Request, "RowIDS"), "");
if(RowIDS.isEmpty())
{
return Helper.Error("请传入要删除数据的RowID,多个以^分割!");
}
//分割主键
String [] arr=RowIDS.split("^");
//out参数
OutParam out=new OutParam();
//循环删除数据
for(int i=0;i<arr.length;i++)
{
int id = Convert.ToInt32(arr[i]);
//质控结果数量
int resCount=EntityManager().GetCoutNum(QCTestResult.class,"MaterialDR",id);
if(resCount>100)
{
throw new Exception("质控结果数量大于100了,不允许删除!");
}
//删除批次公共信息
EntityManager().RemoveByColVal(BTQCMaterialLot.class, "MaterialDR", id);
//删除质控浓度
EntityManager().RemoveByColVal(BTQCMaterialLevel.class, "MaterialDR", id);
//删除质控标识
EntityManager().RemoveByColVal(BTQCMachineQC.class, "MaterialDR", id);
//删除质控规则
EntityManager().RemoveByColVal(BTQCMaterialRules.class, "MaterialDR", id);
//删除质控项目批次
EntityManager().RemoveByColVal(BTQCMaterialTestCode.class, "MaterialDR", id);
//删除质控项目规则
EntityManager().RemoveByColVal(BTQCMaterialTCRules.class, "MaterialDR", id);
//删除定性质控显示信息
EntityManager().RemoveByColVal(BTQCQualitativeShow.class, "MaterialDR", id);
//删除质控项目批次的业务数据
EntityManager().RemoveByColVal(QCResMaterialTestCode.class, "MaterialDR", id);
int ret=EntityManager().RemoveById(BTQCMaterial.class,id,out);
if(ret!=1)
{
return Helper.Error(out);
}
}
return Helper.Success();
}
/**
* 查询选择树的仪器
* @return 字符串
*/
public String QrySelectMachine() throws Exception {
List<BTMIMachineParameter> retist = new ArrayList<>();
//工作组
String WorkGroupDR = Helper.ValidParam(JRTContext.GetRequest(Request, "WorkGroupDR"), "");
//工作小组
String WorkGroupMachineDR = Helper.ValidParam(JRTContext.GetRequest(Request, "WorkGroupMachineDR"), "");
//仪器
String MachineDR = Helper.ValidParam(JRTContext.GetRequest(Request, "MachineDR"), "");
//选择工作组
if(!WorkGroupDR.isEmpty()) {
//查工作小组
List<BTWorkGroupMachine> wgmList=EntityManager().FindByColVal(BTWorkGroupMachine.class,"WorkGroupDR",Integer.valueOf(WorkGroupDR));
if(wgmList!=null&&wgmList.size()>0)
{
for(BTWorkGroupMachine wgm:wgmList)
{
//查仪器
List<BTMIMachineParameter> miList=EntityManager().FindByColVal(BTMIMachineParameter.class,"WorkGroupMachineDR",wgm.RowID);
retist.addAll(miList);
}
}
}
//选择工作小组
else if(!WorkGroupMachineDR.isEmpty()) {
//查仪器
List<BTMIMachineParameter> miList=EntityManager().FindByColVal(BTMIMachineParameter.class,"WorkGroupMachineDR",Integer.valueOf(WorkGroupMachineDR));
retist.addAll(miList);
}
//选择仪器
else if(!MachineDR.isEmpty()) {
BTMIMachineParameter mi=EntityManager().DolerGet(BTMIMachineParameter.class,Integer.valueOf(MachineDR));
retist.add(mi);
}
return Helper.Object2Json(retist);
}
/**
* 查询数据,前台按表的属性名提交
* @return 字符串
*/
public String QryBTQCMaterial() throws Exception
{
List<BTQCMaterialDto> retlist=new ArrayList<>();
//工作组
String WorkGroupDR=Helper.ValidParam(JRTContext.GetRequest(Request, "WorkGroupDR"), "");
//工作小组
String WorkGroupMachineDR=Helper.ValidParam(JRTContext.GetRequest(Request, "WorkGroupMachineDR"), "");
//仪器
String MachineDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MachineDR"), "");
//存仪器
List<BTMIMachineParameter> machList=new ArrayList<>();
//选择工作组
if(!WorkGroupDR.isEmpty()) {
//查工作小组
List<BTWorkGroupMachine> wgmList=EntityManager().FindByColVal(BTWorkGroupMachine.class,"WorkGroupDR",Integer.valueOf(WorkGroupDR));
if(wgmList!=null&&wgmList.size()>0)
{
for(BTWorkGroupMachine wgm:wgmList)
{
//查仪器
List<BTMIMachineParameter> miList=EntityManager().FindByColVal(BTMIMachineParameter.class,"WorkGroupMachineDR",wgm.RowID);
machList.addAll(miList);
}
}
}
//选择工作小组
else if(!WorkGroupMachineDR.isEmpty()) {
//查仪器
List<BTMIMachineParameter> miList=EntityManager().FindByColVal(BTMIMachineParameter.class,"WorkGroupMachineDR",Integer.valueOf(WorkGroupMachineDR));
machList.addAll(miList);
}
//选择仪器
else if(!MachineDR.isEmpty()) {
BTMIMachineParameter mi=EntityManager().DolerGet(BTMIMachineParameter.class,Integer.valueOf(MachineDR));
machList.add(mi);
}
if(machList.size()>0)
{
for(BTMIMachineParameter mi:machList)
{
List<BTQCMaterialDto> miMats=EntityManager().FindByColVal(BTQCMaterialDto.class,"MachineDR",mi.RowID);
if(miMats!=null&&miMats.size()>0) {
for(BTQCMaterialDto one:miMats)
{
one.WorkGroupMachineDR=mi.WorkGroupMachineDR;
BTWorkGroupMachine wgm=EntityManager().DolerGet(BTWorkGroupMachine.class,mi.WorkGroupMachineDR);
one.WorkGroupMachineName=wgm.CName;
one.WorkGroupDR=wgm.WorkGroupDR;
BTWorkGroup wg=EntityManager().DolerGet(BTWorkGroup.class,wgm.WorkGroupDR);
one.WorkGroupName=wg.CName;
one.MachineName=mi.CName;
}
retlist.addAll(miMats);
}
}
}
return Helper.Object2Json(retlist);
}
/**
* 保存数据,前台按表的属性名提交
* @return 字符串
*/
public String SaveBTQCMaterialTestCode() throws Exception
{
BTQCMaterialTestCode dto=new BTQCMaterialTestCode();
//主键
dto.RowID=Helper.ValidParam(JRTContext.GetRequest(Request, "RowID"), dto.RowID);
//质控物
dto.MaterialDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MaterialDR"), dto.MaterialDR);
//项目
dto.TestCodeDR=Helper.ValidParam(JRTContext.GetRequest(Request, "TestCodeDR"), dto.TestCodeDR);
//浓度
dto.LevelNo=Helper.ValidParam(JRTContext.GetRequest(Request, "LevelNo"), dto.LevelNo);
//开始日期
dto.StartDate=Helper.ValidParam(JRTContext.GetRequest(Request, "StartDate"), dto.StartDate);
//靶子
dto.Mean=Helper.ValidParam(JRTContext.GetRequest(Request, "Mean"), dto.Mean);
//标准差
dto.SD=Helper.ValidParam(JRTContext.GetRequest(Request, "SD"), dto.SD);
//设置CV
dto.SetCV=Helper.ValidParam(JRTContext.GetRequest(Request, "SetCV"), dto.SetCV);
//目标CV
dto.TargetCV=Helper.ValidParam(JRTContext.GetRequest(Request, "TargetCV"), dto.TargetCV);
//质控品批号
dto.LotNo=Helper.ValidParam(JRTContext.GetRequest(Request, "LotNo"), dto.LotNo);
//质控物厂家
dto.MatManufacturer=Helper.ValidParam(JRTContext.GetRequest(Request, "MatManufacturer"), dto.MatManufacturer);
//厂家均值
dto.ManufacturerMean=Helper.ValidParam(JRTContext.GetRequest(Request, "ManufacturerMean"), dto.ManufacturerMean);
//厂家标准差
dto.ManufacturerSD=Helper.ValidParam(JRTContext.GetRequest(Request, "ManufacturerSD"), dto.ManufacturerSD);
//试剂批号
dto.RgLot=Helper.ValidParam(JRTContext.GetRequest(Request, "RgLot"), dto.RgLot);
//试剂厂家
dto.RgManufacturer=Helper.ValidParam(JRTContext.GetRequest(Request, "RgManufacturer"), dto.RgManufacturer);
//测试方法
dto.TestMethod=Helper.ValidParam(JRTContext.GetRequest(Request, "TestMethod"), dto.TestMethod);
//计算类型
dto.CalcType=Helper.ValidParam(JRTContext.GetRequest(Request, "CalcType"), dto.CalcType);
//精度
dto.Precision=Helper.ValidParam(JRTContext.GetRequest(Request, "Precision"), dto.Precision);
//稀释倍数
dto.Dilutions=Helper.ValidParam(JRTContext.GetRequest(Request, "Dilutions"), dto.Dilutions);
//说明
dto.Remark=Helper.ValidParam(JRTContext.GetRequest(Request, "Remark"), dto.Remark);
//浓度单位
dto.LevelUnit=Helper.ValidParam(JRTContext.GetRequest(Request, "LevelUnit"), dto.LevelUnit);
//CV来源
dto.CVSource=Helper.ValidParam(JRTContext.GetRequest(Request, "CVSource"), dto.CVSource);
//生产日期
dto.ProductDate=Helper.ValidParam(JRTContext.GetRequest(Request, "ProductDate"), dto.ProductDate);
//有效日期
dto.ExpiryDate=Helper.ValidParam(JRTContext.GetRequest(Request, "ExpiryDate"), dto.ExpiryDate);
//关闭日期
dto.ClosingDate=Helper.ValidParam(JRTContext.GetRequest(Request, "ClosingDate"), dto.ClosingDate);
//校正液批次
dto.AmendLiquidLot=Helper.ValidParam(JRTContext.GetRequest(Request, "AmendLiquidLot"), dto.AmendLiquidLot);
//主波长
dto.WaveLengthMian=Helper.ValidParam(JRTContext.GetRequest(Request, "WaveLengthMian"), dto.WaveLengthMian);
//波长
dto.WaveLength=Helper.ValidParam(JRTContext.GetRequest(Request, "WaveLength"), dto.WaveLength);
//生效日期
dto.RgEffectiveDate=Helper.ValidParam(JRTContext.GetRequest(Request, "RgEffectiveDate"), dto.RgEffectiveDate);
//校准液有效期
dto.AmendLiquidDate=Helper.ValidParam(JRTContext.GetRequest(Request, "AmendLiquidDate"), dto.AmendLiquidDate);
//校准液
dto.AmendLiquid=Helper.ValidParam(JRTContext.GetRequest(Request, "AmendLiquid"), dto.AmendLiquid);
//偏离图SD
dto.DeviationRatioSD=Helper.ValidParam(JRTContext.GetRequest(Request, "DeviationRatioSD"), dto.DeviationRatioSD);
//规则说明
dto.RuleRemark=Helper.ValidParam(JRTContext.GetRequest(Request, "RuleRemark"), dto.RuleRemark);
//序号
dto.Sequence=Helper.ValidParam(JRTContext.GetRequest(Request, "Sequence"), dto.Sequence);
//激活 {1:true,0:false}
dto.Active=Helper.ValidParam(JRTContext.GetRequest(Request, "Active"), dto.Active);
//计算靶值
dto.FloatMean=Helper.ValidParam(JRTContext.GetRequest(Request, "FloatMean"), dto.FloatMean);
//计算标准差
dto.FloatSD=Helper.ValidParam(JRTContext.GetRequest(Request, "FloatSD"), dto.FloatSD);
//累计总数
dto.AccSum=Helper.ValidParam(JRTContext.GetRequest(Request, "AccSum"), dto.AccSum);
//累计均值
dto.AccMean=Helper.ValidParam(JRTContext.GetRequest(Request, "AccMean"), dto.AccMean);
//累计标准差
dto.AccSD=Helper.ValidParam(JRTContext.GetRequest(Request, "AccSD"), dto.AccSD);
//在控个数
dto.InControlNum=Helper.ValidParam(JRTContext.GetRequest(Request, "InControlNum"), dto.InControlNum);
//在控均值
dto.InControlMean=Helper.ValidParam(JRTContext.GetRequest(Request, "InControlMean"), dto.InControlMean);
//在控标准差
dto.InControlSD=Helper.ValidParam(JRTContext.GetRequest(Request, "InControlSD"), dto.InControlSD);
OutParam out=new OutParam();
int ret=0;
//更新
if(dto.RowID>0)
{
ret=EntityManager().Update(dto,null, out, null, null, null);
}
//插入数据
else
{
ret=EntityManager().Save(dto,out);
}
if(ret==1)
{
return Helper.Success();
}
else
{
return Helper.Error(out);
}
}
/**
* 复制质控物
* @return
*/
@Trans
public String CopyBTQCMaterial() throws Exception
{
//要复制的质控物
int RowID=Helper.ValidParam(JRTContext.GetRequest(Request, "RowID"), 0);
//新质控物信息
int NewMachDR=Helper.ValidParam(JRTContext.GetRequest(Request, "NewMachDR"), 0);
String NewCode=Helper.ValidParam(JRTContext.GetRequest(Request, "NewCode"), "");
String NewName=Helper.ValidParam(JRTContext.GetRequest(Request, "NewName"), "");
BTQCMaterial matOld=EntityManager().DolerGet(BTQCMaterial.class,RowID);
BTQCMaterial matNew=new BTQCMaterial();
//拷贝属性
Helper.CopyProperties(matOld,matNew);
matNew.Code=NewCode;
matNew.CName=NewName;
matNew.MachineDR=NewMachDR;
OutValue key=new OutValue();
int ret=EntityManager().Save(matNew,key,ErrRet());
if(ret==1)
{
//拷贝浓度
List<BTQCMaterialLevel> levList=EntityManager().FindByColVal(BTQCMaterialLevel.class,"MaterialDR",RowID);
if(levList!=null&&levList.size()>0)
{
for(BTQCMaterialLevel lev:levList)
{
BTQCMaterialLevel newLev=new BTQCMaterialLevel();
Helper.CopyProperties(lev,newLev);
newLev.MaterialDR=key.GetInerger();
int ret1=EntityManager().Save(newLev,ErrRet());
if(ret1!=1)
{
throw new Exception("拷贝质控浓度失败:"+Err.GetString());
}
}
}
//拷贝标识
List<BTQCMachineQC> machQCList=EntityManager().FindByColVal(BTQCMachineQC.class,"MaterialDR",RowID);
if(machQCList!=null&&machQCList.size()>0)
{
for(BTQCMachineQC machQC:machQCList)
{
BTQCMachineQC newMachQC=new BTQCMachineQC();
Helper.CopyProperties(machQC,newMachQC);
newMachQC.MaterialDR=key.GetInerger();
int ret1=EntityManager().Save(newMachQC,ErrRet());
if(ret1!=1)
{
throw new Exception("拷贝质控标识失败:"+Err.GetString());
}
}
}
//拷贝项目批次
List<BTQCMaterialTestCode> matTSList=EntityManager().FindByColVal(BTQCMaterialTestCode.class,"MaterialDR",RowID);
if(matTSList!=null&&matTSList.size()>0)
{
for(BTQCMaterialTestCode matTS:matTSList)
{
BTQCMaterialTestCode newMatTS=new BTQCMaterialTestCode();
Helper.CopyProperties(matTS,newMatTS);
newMatTS.MaterialDR=key.GetInerger();
int ret1=EntityManager().Save(newMatTS,ErrRet());
if(ret1!=1)
{
throw new Exception("拷贝质控项目批次失败:"+Err.GetString());
}
}
}
//拷贝批次公共信息
List<BTQCMaterialLot> matLotList=EntityManager().FindByColVal(BTQCMaterialLot.class,"MaterialDR",RowID);
if(matLotList!=null&&matLotList.size()>0)
{
for(BTQCMaterialLot matLot:matLotList)
{
BTQCMaterialLot newMatLot=new BTQCMaterialLot();
Helper.CopyProperties(matLot,newMatLot);
newMatLot.MaterialDR=key.GetInerger();
int ret1=EntityManager().Save(newMatLot,ErrRet());
if(ret1!=1)
{
throw new Exception("拷贝质控批次公共信息失败:"+Err.GetString());
}
}
}
//拷贝质控规则
List<BTQCMaterialRules> matRuleList=EntityManager().FindByColVal(BTQCMaterialRules.class,"MaterialDR",RowID);
if(matRuleList!=null&&matRuleList.size()>0)
{
for(BTQCMaterialRules matRule:matRuleList)
{
BTQCMaterialRules newMatRule=new BTQCMaterialRules();
Helper.CopyProperties(matRule,newMatRule);
newMatRule.MaterialDR=key.GetInerger();
int ret1=EntityManager().Save(newMatRule,ErrRet());
if(ret1!=1)
{
throw new Exception("拷贝质控规则失败:"+Err.GetString());
}
}
}
//拷贝项目质控规则
List<BTQCMaterialTCRules> matTCRuleList=EntityManager().FindByColVal(BTQCMaterialTCRules.class,"MaterialDR",RowID);
if(matTCRuleList!=null&&matTCRuleList.size()>0)
{
for(BTQCMaterialTCRules matTCRule:matTCRuleList)
{
BTQCMaterialTCRules newMatTCRule=new BTQCMaterialTCRules();
Helper.CopyProperties(matTCRule,newMatTCRule);
newMatTCRule.MaterialDR=key.GetInerger();
int ret1=EntityManager().Save(newMatTCRule,ErrRet());
if(ret1!=1)
{
throw new Exception("拷贝项目质控规则失败:"+Err.GetString());
}
}
}
//拷贝定性显示
List<BTQCQualitativeShow> qlitiList=EntityManager().FindByColVal(BTQCQualitativeShow.class,"MaterialDR",RowID);
if(qlitiList!=null&&qlitiList.size()>0)
{
for(BTQCQualitativeShow qliti:qlitiList)
{
BTQCQualitativeShow newQliti=new BTQCQualitativeShow();
Helper.CopyProperties(qliti,newQliti);
newQliti.MaterialDR=key.GetInerger();
int ret1=EntityManager().Save(newQliti,ErrRet());
if(ret1!=1)
{
throw new Exception("拷贝定性显示失败:"+Err.GetString());
}
}
}
}
return Helper.Success();
}
/**
* 批量修改批次项目属性
* @return 字符串
*/
@Trans
public String UpdateLotBTQCMaterialTestCode() throws Exception
{
String RowIDS=Helper.ValidParam(JRTContext.GetRequest(Request, "RowIDS"), "");
List<String> upCol=new ArrayList<>();
String StartDate=Helper.ValidParam(JRTContext.GetRequest(Request, "StartDate"), "");
if(!StartDate.isEmpty())
{
upCol.add("StartDate");
}
String LotNo=Helper.ValidParam(JRTContext.GetRequest(Request, "LotNo"), "");
if(!LotNo.isEmpty())
{
upCol.add("LotNo");
}
String MatManufacturer=Helper.ValidParam(JRTContext.GetRequest(Request, "MatManufacturer"), "");
if(!MatManufacturer.isEmpty())
{
upCol.add("MatManufacturer");
}
String RgLot=Helper.ValidParam(JRTContext.GetRequest(Request, "RgLot"), "");
if(!RgLot.isEmpty())
{
upCol.add("RgLot");
}
String RgManufacturer=Helper.ValidParam(JRTContext.GetRequest(Request, "RgManufacturer"), "");
if(!RgManufacturer.isEmpty())
{
upCol.add("RgManufacturer");
}
String RgEffectiveDate=Helper.ValidParam(JRTContext.GetRequest(Request, "RgEffectiveDate"), "");
if(!RgEffectiveDate.isEmpty())
{
upCol.add("RgEffectiveDate");
}
String TestMethod=Helper.ValidParam(JRTContext.GetRequest(Request, "TestMethod"), "");
if(!TestMethod.isEmpty())
{
upCol.add("TestMethod");
}
String CalcType=Helper.ValidParam(JRTContext.GetRequest(Request, "CalcType"), "");
if(!CalcType.isEmpty())
{
upCol.add("CalcType");
}
String Precision=Helper.ValidParam(JRTContext.GetRequest(Request, "Precision"), "");
if(!Precision.isEmpty())
{
upCol.add("Precision");
}
String Dilutions=Helper.ValidParam(JRTContext.GetRequest(Request, "Dilutions"), "");
if(!Dilutions.isEmpty())
{
upCol.add("Dilutions");
}
String Remark=Helper.ValidParam(JRTContext.GetRequest(Request, "Remark"), "");
if(!Remark.isEmpty())
{
upCol.add("Remark");
}
String LevelUnit=Helper.ValidParam(JRTContext.GetRequest(Request, "LevelUnit"), "");
if(!LevelUnit.isEmpty())
{
upCol.add("LevelUnit");
}
String TargetCV=Helper.ValidParam(JRTContext.GetRequest(Request, "TargetCV"), "");
if(!TargetCV.isEmpty())
{
upCol.add("TargetCV");
}
String CVSource=Helper.ValidParam(JRTContext.GetRequest(Request, "CVSource"), "");
if(!CVSource.isEmpty())
{
upCol.add("CVSource");
}
String Sequence=Helper.ValidParam(JRTContext.GetRequest(Request, "Sequence"), "");
if(!Sequence.isEmpty())
{
upCol.add("Sequence");
}
String ProductDate=Helper.ValidParam(JRTContext.GetRequest(Request, "ProductDate"), "");
if(!ProductDate.isEmpty())
{
upCol.add("ProductDate");
}
String ExpiryDate=Helper.ValidParam(JRTContext.GetRequest(Request, "ExpiryDate"), "");
if(!ExpiryDate.isEmpty())
{
upCol.add("ExpiryDate");
}
String ClosingDate=Helper.ValidParam(JRTContext.GetRequest(Request, "ClosingDate"), "");
if(!ClosingDate.isEmpty())
{
upCol.add("ClosingDate");
}
String WaveLengthMian=Helper.ValidParam(JRTContext.GetRequest(Request, "WaveLengthMian"), "");
if(!WaveLengthMian.isEmpty())
{
upCol.add("WaveLengthMian");
}
String WaveLength=Helper.ValidParam(JRTContext.GetRequest(Request, "WaveLength"), "");
if(!WaveLength.isEmpty())
{
upCol.add("WaveLength");
}
String Active=Helper.ValidParam(JRTContext.GetRequest(Request, "Active"), "");
if(!Active.isEmpty())
{
upCol.add("Active");
}
String AmendLiquidLot=Helper.ValidParam(JRTContext.GetRequest(Request, "AmendLiquidLot"), "");
if(!AmendLiquidLot.isEmpty())
{
upCol.add("AmendLiquidLot");
}
String AmendLiquidDate=Helper.ValidParam(JRTContext.GetRequest(Request, "AmendLiquidDate"), "");
if(!AmendLiquidDate.isEmpty())
{
upCol.add("AmendLiquidDate");
}
String AmendLiquid=Helper.ValidParam(JRTContext.GetRequest(Request, "AmendLiquid"), "");
if(!AmendLiquid.isEmpty())
{
upCol.add("AmendLiquid");
}
String RuleRemark=Helper.ValidParam(JRTContext.GetRequest(Request, "RuleRemark"), "");
if(!RuleRemark.isEmpty())
{
upCol.add("RuleRemark");
}
String [] arr=RowIDS.split("\\^");
for(int i=0;i<arr.length;i++)
{
int RowID=Convert.ToInt32(arr[i]);
BTQCMaterialTestCode dto=EntityManager().DolerGet(BTQCMaterialTestCode.class,RowID);
if(!StartDate.isEmpty())
{
dto.StartDate=Helper.DateToInt(StartDate);
}
if(!LotNo.isEmpty())
{
dto.LotNo=LotNo;
}
if(!MatManufacturer.isEmpty())
{
dto.MatManufacturer=MatManufacturer;
}
if(!RgLot.isEmpty())
{
dto.RgLot=RgLot;
}
if(!RgManufacturer.isEmpty())
{
dto.RgManufacturer=RgManufacturer;
}
if(!RgEffectiveDate.isEmpty())
{
dto.RgEffectiveDate=Helper.DateToInt(RgEffectiveDate);
}
if(!TestMethod.isEmpty())
{
dto.TestMethod=TestMethod;
}
if(!CalcType.isEmpty())
{
dto.CalcType=CalcType;
}
if(!Precision.isEmpty())
{
dto.Precision=Convert.ToInt32(Precision);
}
if(!Dilutions.isEmpty())
{
dto.Dilutions=Dilutions;
}
if(!Remark.isEmpty())
{
dto.Remark=Remark;
}
if(!LevelUnit.isEmpty())
{
dto.LevelUnit=LevelUnit;
}
if(!TargetCV.isEmpty())
{
dto.TargetCV=TargetCV;
}
if(!CVSource.isEmpty())
{
dto.CVSource=CVSource;
}
if(!Sequence.isEmpty())
{
dto.Sequence=Convert.ToInt32(Sequence);
}
if(!ProductDate.isEmpty())
{
dto.ProductDate=Helper.DateToInt(ProductDate);
}
if(!ExpiryDate.isEmpty())
{
dto.ExpiryDate=Helper.DateToInt(ExpiryDate);
}
if(!ClosingDate.isEmpty())
{
dto.ClosingDate=Helper.DateToInt(ClosingDate);
}
if(!WaveLengthMian.isEmpty())
{
dto.WaveLengthMian=WaveLengthMian;
}
if(!WaveLength.isEmpty())
{
dto.WaveLength=WaveLength;
}
if(!Active.isEmpty())
{
dto.Active=Helper.ValidParam(Active,true);
}
if(!AmendLiquidLot.isEmpty())
{
dto.AmendLiquidLot=AmendLiquidLot;
}
if(!AmendLiquidDate.isEmpty())
{
dto.AmendLiquidDate=Helper.DateToInt(AmendLiquidDate);
}
if(!AmendLiquid.isEmpty())
{
dto.AmendLiquid=AmendLiquid;
}
if(!RuleRemark.isEmpty())
{
dto.RuleRemark=RuleRemark;
}
int ret=EntityManager().Update(dto,ErrRet(),upCol);
if(ret!=1)
{
throw new Exception("更新项目批次失败:"+Err.GetString());
}
}
return Helper.Success();
}
/**
* 删除数据,多个RowID以上尖号分割
* @return 字符串
*/
public String DeleteBTQCMaterialTestCode() throws Exception
{
String RowIDS=Helper.ValidParam(JRTContext.GetRequest(Request, "RowIDS"), "");
if(RowIDS.isEmpty())
{
return Helper.Error("请传入要删除数据的RowID,多个以^分割!");
}
//分割主键
String [] arr=RowIDS.split("\\^");
//out参数
OutParam out=new OutParam();
//循环删除数据
for(int i=0;i<arr.length;i++)
{
int ret=EntityManager().RemoveById(BTQCMaterialTestCode.class,Convert.ToInt32(arr[i]),out);
if(ret!=1)
{
return Helper.Error(out);
}
}
return Helper.Success();
}
/**
* 查询数据,前台按表的属性名提交
* @return 字符串
*/
public String QryBTQCMaterialTestCode() throws Exception
{
//分页
int pageSize = Helper.ValidParam(JRT.Core.MultiPlatform.JRTContext.GetRequest(Request, "rows"), -1);
int pageIndex = Helper.ValidParam(JRT.Core.MultiPlatform.JRTContext.GetRequest(Request, "page"), -1);
//质控物
int MaterialDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MaterialDR"), 0);
//按项目和浓度筛选
String TestCodeDR=Helper.ValidParam(JRTContext.GetRequest(Request, "TestCodeDR"), "");
String LevelNo=Helper.ValidParam(JRTContext.GetRequest(Request, "LevelNo"), "");
//筛选
String Filter=Helper.ValidParam(JRTContext.GetRequest(Request, "Filter"), "");
//质控浓度数据
List<BTQCMaterialLevel> levList=EntityManager().FindByColVal(BTQCMaterialLevel.class,"MaterialDR",MaterialDR);
HashParam hs=new HashParam();
hs.Add("MaterialDR",MaterialDR);
if(!TestCodeDR.isEmpty())
{
hs.Add("TestCodeDR",Convert.ToInt32(TestCodeDR));
}
if(!LevelNo.isEmpty())
{
hs.Add("LevelNo",Convert.ToInt32(LevelNo));
}
OutValue totalNum=new OutValue();
//分页查询
List<BTQCMaterialTestCodeDto> dataList=EntityManager().FindAll(BTQCMaterialTestCodeDto.class,hs,"StartDate desc",pageSize,pageIndex,"",null,null,totalNum);
List<BTQCMaterialTestCodeDto> retList=new ArrayList<>();
//标识最后的批次项目
HashMap lastMap=new HashMap();
if(dataList!=null&&dataList.size()>0)
{
for(BTQCMaterialTestCodeDto one:dataList)
{
//打上标识
if(!lastMap.containsKey(one.TestCodeDR+"-"+one.LevelNo))
{
one.IsLast=true;
lastMap.put(one.TestCodeDR+"-"+one.LevelNo,true);
}
else
{
one.IsLast=false;
}
one.LevelNoName="";
for(BTQCMaterialLevel lev:levList)
{
if(lev.LevelNo==one.LevelNo)
{
one.LevelNoName=lev.CName;
}
}
//项目数据
BTTestCode tsDto=EntityManager().DolerGet(BTTestCode.class,one.TestCodeDR);
one.TestCodeCode=tsDto.Code;
one.TestCodeDR=tsDto.RowID;
one.TestCodeSynonym=tsDto.Synonym;
one.TestCodeName=tsDto.CName;
boolean isPerData=false;
if(!Filter.isEmpty()&&one.LevelNoName.contains(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.TestCodeName.contains(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.TestCodeCode.equals(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.LotNo.equals(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.RgLot.equals(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.Remark.contains(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.MatManufacturer.equals(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.RgManufacturer.equals(Filter))
{
isPerData=true;
}
if(Filter.isEmpty()||isPerData==true)
{
retList.add(one);
}
}
}
return Helper.MakeTotalJson(retList,totalNum);
}
/**
* 查询能够开通的项目或者已经开通的项目
* @return
*/
public String QueryOpenTestCode() throws Exception
{
//查是否有开通项目
boolean HasOpen=Helper.ValidParam(JRTContext.GetRequest(Request, "HasOpen"), false);
//质控物主键
int MaterialDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MaterialDR"), 0);
//得到质控物的数据
BTQCMaterial matDto=EntityManager().DolerGet(BTQCMaterial.class,MaterialDR);
//仪器数据
BTMIMachineParameter machDto=EntityManager().DolerGet(BTMIMachineParameter.class,matDto.MachineDR);
//查询仪器项目
List<BTMIMachineTestCode> machTsList=EntityManager().FindByColVal(BTMIMachineTestCode.class,"MachineParameterDR",matDto.MachineDR);
//质控浓度数据
List<BTQCMaterialLevel> levList=EntityManager().FindByColVal(BTQCMaterialLevel.class,"MaterialDR",MaterialDR);
//返回列表
List<BTMIMachineTestCodeDto> retList=new ArrayList<>();
if(machTsList!=null&&machTsList.size()>0)
{
for(int i=0;i<machTsList.size();i++)
{
//没激活的不要
if(machTsList.get(i).Active!=null&&machTsList.get(i).Active==false)
{
continue;
}
//没维护通道的不算质控
if(machTsList.get(i).ResultChannel==null||machTsList.get(i).ResultChannel.isEmpty())
{
continue;
}
for(int j=1;j<=matDto.Levels;j++)
{
HashParam hs=new HashParam();
hs.Add("MaterialDR",matDto.RowID);
hs.Add("TestCodeDR",machTsList.get(i).TestCodeDR);
hs.Add("LevelNo",j);
//按条件检查是否有数据
boolean hasOpen=EntityManager().CheckHasData(BTQCMaterialTestCode.class,hs,null,null);
//根据开通决定输出
if(hasOpen==HasOpen)
{
BTMIMachineTestCodeDto one=new BTMIMachineTestCodeDto();
one.MaterialDR=matDto.RowID;
one.MachineDR=machDto.RowID;
one.LevelNo=j;
one.LevelNoName="";
for(BTQCMaterialLevel lev:levList)
{
if(lev.LevelNo==j)
{
one.LevelNoName=lev.CName;
}
}
//项目数据
BTTestCode tsDto=EntityManager().DolerGet(BTTestCode.class,machTsList.get(i).TestCodeDR);
one.TestCodeCode=tsDto.Code;
one.TestCodeDR=tsDto.RowID;
one.TestCodeSynonym=tsDto.Synonym;
one.TestCodeName=tsDto.CName;
retList.add(one);
}
}
}
}
return Helper.Object2Json(retList);
}
/**
* 开通质控项目
* @return
*/
@Trans
public String OpenBTQCMaterialTestCode() throws Exception
{
int MaterialDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MaterialDR"), 0);
int MaterialLotDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MaterialLotDR"), 0);
String OpenTsLev=Helper.ValidParam(JRTContext.GetRequest(Request, "OpenTsLev"), "");
String [] arr=OpenTsLev.split("\\^");
//公共信息
BTQCMaterialLot lotDto=EntityManager().DolerGet(BTQCMaterialLot.class,MaterialLotDR);
OutValue key=new OutValue();
for(String one:arr)
{
String [] tsLev=one.split("-");
int TestCodeDR=Convert.ToInt32(tsLev[0]);
int LevelNo=Convert.ToInt32(tsLev[1]);
BTQCMaterialTestCode dto=new BTQCMaterialTestCode();
//拷贝相同的属性值
ReflectUtil.CopyProperties(lotDto,dto);
dto.MaterialDR=MaterialDR;
dto.TestCodeDR=TestCodeDR;
dto.LevelNo=LevelNo;
dto.Active=true;
dto.Sequence=1;
int ret=EntityManager().Save(dto,key,ErrRet());
if(ret!=1)
{
throw new Exception(Err.GetString());
}
}
return Helper.Success();
}
/**
* 更换项目批次
* @return
*/
@Trans
public String ChangeBTQCMaterialTestCode() throws Exception
{
int MaterialDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MaterialDR"), 0);
int MaterialLotDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MaterialLotDR"), 0);
String RowIDS=Helper.ValidParam(JRTContext.GetRequest(Request, "RowIDS"), "");
String [] arr=RowIDS.split("\\^");
//公共信息
BTQCMaterialLot lotDto=EntityManager().DolerGet(BTQCMaterialLot.class,MaterialLotDR);
OutValue key=new OutValue();
List<String> upCol=new ArrayList<>();
upCol.add("Active");
for(String one:arr)
{
int MatTestCodeDR=Convert.ToInt32(one);
BTQCMaterialTestCode dto=EntityManager().DolerGet(BTQCMaterialTestCode.class,MatTestCodeDR);
int TestCodeDR=dto.TestCodeDR;
int LevelNo=dto.LevelNo;
dto.Active=false;
//之前的数据设置不激活
EntityManager().Update(dto,upCol);
dto.Sequence=dto.Sequence+1;
//拷贝相同的属性值,null和空串的不拷贝
ReflectUtil.CopyProperties(lotDto,dto,true);
dto.MaterialDR=MaterialDR;
dto.TestCodeDR=TestCodeDR;
dto.LevelNo=LevelNo;
dto.Active=true;
dto.Sequence=1;
int ret=EntityManager().Save(dto,key,ErrRet());
if(ret!=1)
{
throw new Exception(Err.GetString());
}
}
return Helper.Success();
}
/**
* 查询能更换批次的项目
* @return
*/
public String QueryChangeTestCode() throws Exception
{
//质控物主键
int MaterialDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MaterialDR"), 0);
//得到质控物的数据
BTQCMaterial matDto=EntityManager().DolerGet(BTQCMaterial.class,MaterialDR);
//仪器数据
BTMIMachineParameter machDto=EntityManager().DolerGet(BTMIMachineParameter.class,matDto.MachineDR);
//查询仪器项目
List<BTMIMachineTestCode> machTsList=EntityManager().FindByColVal(BTMIMachineTestCode.class,"MachineParameterDR",matDto.MachineDR);
//质控浓度数据
List<BTQCMaterialLevel> levList=EntityManager().FindByColVal(BTQCMaterialLevel.class,"MaterialDR",MaterialDR);
//返回列表
List<BTQCMaterialTestCodeDto> retList=new ArrayList<>();
if(machTsList!=null&&machTsList.size()>0)
{
for(int i=0;i<machTsList.size();i++)
{
//没激活的不要
if(machTsList.get(i).Active!=null&&machTsList.get(i).Active==false)
{
continue;
}
for(int j=1;j<=matDto.Levels;j++)
{
HashParam hs=new HashParam();
hs.Add("MaterialDR",matDto.RowID);
hs.Add("TestCodeDR",machTsList.get(i).TestCodeDR);
hs.Add("LevelNo",j);
//按条件检查是否有数据
boolean hasOpen=EntityManager().CheckHasData(BTQCMaterialTestCode.class,hs,null,null);
//根据开通决定输出
if(hasOpen==true)
{
List<BTQCMaterialTestCodeDto> oneList=EntityManager().FindAllSimple(BTQCMaterialTestCodeDto.class,hs,"StartDate desc",1,null,null);
BTQCMaterialTestCodeDto one=oneList.get(0);
one.LevelNoName="";
for(BTQCMaterialLevel lev:levList)
{
if(lev.LevelNo==one.LevelNo)
{
one.LevelNoName=lev.CName;
}
}
//项目数据
BTTestCode tsDto=EntityManager().DolerGet(BTTestCode.class,one.TestCodeDR);
one.TestCodeCode=tsDto.Code;
one.TestCodeDR=tsDto.RowID;
one.TestCodeSynonym=tsDto.Synonym;
one.TestCodeName=tsDto.CName;
retList.add(one);
}
}
}
}
return Helper.Object2Json(retList);
}
/**
* 查询数据,前台按表的属性名提交
* @return 字符串
*/
public String QryQCResMaterialTestCode() throws Exception
{
//分页
int pageSize = Helper.ValidParam(JRT.Core.MultiPlatform.JRTContext.GetRequest(Request, "rows"), -1);
int pageIndex = Helper.ValidParam(JRT.Core.MultiPlatform.JRTContext.GetRequest(Request, "page"), -1);
//质控物
int MaterialDR=Helper.ValidParam(JRTContext.GetRequest(Request, "MaterialDR"), 0);
//按项目和浓度筛选
String TestCodeDR=Helper.ValidParam(JRTContext.GetRequest(Request, "TestCodeDR"), "");
String LevelNo=Helper.ValidParam(JRTContext.GetRequest(Request, "LevelNo"), "");
//筛选
String Filter=Helper.ValidParam(JRTContext.GetRequest(Request, "Filter"), "");
//质控浓度数据
List<BTQCMaterialLevel> levList=EntityManager().FindByColVal(BTQCMaterialLevel.class,"MaterialDR",MaterialDR);
HashParam hs=new HashParam();
hs.Add("MaterialDR",MaterialDR);
if(!TestCodeDR.isEmpty())
{
hs.Add("TestCodeDR",Convert.ToInt32(TestCodeDR));
}
if(!LevelNo.isEmpty())
{
hs.Add("LevelNo",Convert.ToInt32(LevelNo));
}
OutValue totalNum=new OutValue();
//分页查询
List<QCResMaterialTestCodeDto> dataList=EntityManager().FindAll(QCResMaterialTestCodeDto.class,hs,"TestDate desc",pageSize,pageIndex,"",null,null,totalNum);
List<QCResMaterialTestCodeDto> retList=new ArrayList<>();
if(dataList!=null&&dataList.size()>0)
{
for(QCResMaterialTestCodeDto one:dataList)
{
one.LevelNoName="";
for(BTQCMaterialLevel lev:levList)
{
if(lev.LevelNo==one.LevelNo)
{
one.LevelNoName=lev.CName;
}
}
//项目数据
BTTestCode tsDto=EntityManager().DolerGet(BTTestCode.class,one.TestCodeDR);
one.TestCodeCode=tsDto.Code;
one.TestCodeDR=tsDto.RowID;
one.TestCodeSynonym=tsDto.Synonym;
one.TestCodeName=tsDto.CName;
boolean isPerData=false;
if(!Filter.isEmpty()&&one.LevelNoName.contains(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.TestCodeName.contains(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.TestCodeCode.equals(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.LotNo.equals(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.RgLot.equals(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.Remark.contains(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.MatManufacturer.equals(Filter))
{
isPerData=true;
}
if(!Filter.isEmpty()&&one.RgManufacturer.equals(Filter))
{
isPerData=true;
}
if(Filter.isEmpty()||isPerData==true)
{
retList.add(one);
}
}
}
return Helper.MakeTotalJson(retList,totalNum);
}
/**
* 去除没有仪器的树节点
* @param retList 树节点集合
*/
private void DealNoMachineTree(List<MachineTreeDto> retList) throws Exception
{
if(retList!=null&&retList.size()>0)
{
for(int i=0;i<retList.size();i++)
{
//没有工作小组的工作组删掉
if(retList.get(i).children.size()==0)
{
retList.remove(i);
i--;
}
else
{
//检查每个工作小组
for(int j=0;j<retList.get(i).children.size();j++)
{
//工作小组下没有仪器
if(retList.get(i).children.get(j).children.size()==0)
{
retList.get(i).children.remove(j);
j--;
}
}
//没有小组就把工作组节点也删了
if(retList.get(i).children.size()==0)
{
retList.remove(i);
i--;
}
}
}
}
}
/**
* 质控业务数据的批次项目信息
*/
public static class QCResMaterialTestCodeDto extends QCResMaterialTestCode
{
/**
* 浓度名称
*/
public String LevelNoName;
/**
* 项目代码
*/
public String TestCodeCode;
/**
* 项目名称
*/
public String TestCodeName;
/**
* 项目缩写
*/
public String TestCodeSynonym;
}
/**
* 返回仪器项目的数据
*/
public static class BTMIMachineTestCodeDto
{
/**
* 质控物主键
*/
public int MaterialDR;
/**
* 仪器主键
*/
public int MachineDR;
/**
* 项目主键
*/
public int TestCodeDR;
/**
* 浓度
*/
public int LevelNo;
/**
* 浓度名称
*/
public String LevelNoName;
/**
* 项目代码
*/
public String TestCodeCode;
/**
* 项目名称
*/
public String TestCodeName;
/**
* 项目缩写
*/
public String TestCodeSynonym;
}
/**
* 质控仪器树实体
*/
public static class MachineTreeDto {
/**
* 数据唯一键
*/
public int RowID;
/**
* 树id
*/
public String id;
/**
* 树文本
*/
public String text;
/**
* 是否选择
*/
public String checked;
/**
* 子节点
*/
public List<MachineTreeDto> children;
/**
* 节点类型
*/
public String Type;
}
/**
* 质控物实体
*/
public static class BTQCMaterialDto extends BTQCMaterial
{
/**
* 工作组主键
*/
public int WorkGroupDR;
/**
* 工作组名称
*/
public String WorkGroupName;
/**
* 工作小组主键
*/
public int WorkGroupMachineDR;
/**
* 工作小组名称
*/
public String WorkGroupMachineName;
/**
* 仪器名称
*/
public String MachineName;
}
/**
* 质控项目的返回实体
*/
public static class BTQCMaterialTestCodeDto extends BTQCMaterialTestCode
{
/**
* 浓度名称
*/
public String LevelNoName;
/**
* 项目代码
*/
public String TestCodeCode;
/**
* 项目名称
*/
public String TestCodeName;
/**
* 项目缩写
*/
public String TestCodeSynonym;
/**
* 是否最后的批次项目
*/
public boolean IsLast;
}
}