主业务添加代码
This commit is contained in:
parent
a2855b373a
commit
0a59ac9ffe
@ -0,0 +1,23 @@
|
|||||||
|
package com.czlis.common.core.domain.entity.lis;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class LabCheckrules {
|
||||||
|
|
||||||
|
private Integer ruleid;
|
||||||
|
private String rptunitid;
|
||||||
|
private String checkrules;
|
||||||
|
private String checktype;
|
||||||
|
private String logflag;
|
||||||
|
private String logcontent;
|
||||||
|
private String ruledisplay;
|
||||||
|
private String actions;
|
||||||
|
private String autocheck;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.czlis.interfaceCommon.mapper;
|
||||||
|
|
||||||
|
import com.czlis.common.core.domain.entity.lis.LabCheckrules;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface LabCheckrulesMapper {
|
||||||
|
/**
|
||||||
|
* 高级审核条件
|
||||||
|
* @param yq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<LabCheckrules> getLabCheckrules(String yq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动审核条件
|
||||||
|
* @param yq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<LabCheckrules> getLabCheckrulesAutocheck(String yq);
|
||||||
|
}
|
||||||
@ -58,24 +58,10 @@ public class CalcUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static boolean getBooleanFromCalc(String CalcExpression, Map<String, String> variableMap) {
|
public static boolean getBooleanFromCalc(String CalcExpression, Map<String, String> variableMap) {
|
||||||
ExpressionParser parser = new SpelExpressionParser();
|
String resultcondition = "if((" + CalcExpression + ") ,1,0)";
|
||||||
StandardEvaluationContext context = new StandardEvaluationContext();
|
String result1 = getValueFromCalc(resultcondition, variableMap);
|
||||||
// 统一变量处理:数字转Double,否则保留String
|
if ("1".equals(result1)) return true;
|
||||||
for (Map.Entry<String, String> entry : variableMap.entrySet()) {
|
return false;
|
||||||
String str = entry.getValue();
|
|
||||||
if (isNumber(str)) {
|
|
||||||
context.setVariable(entry.getKey(), Double.parseDouble(str));
|
|
||||||
} else {
|
|
||||||
context.setVariable(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String expression = getCalc(CalcExpression);
|
|
||||||
Expression exp = parser.parseExpression(expression);
|
|
||||||
try {
|
|
||||||
return exp.getValue(context, Boolean.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("布尔表达式计算失败: " + expression, e); // 增强异常信息
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.czlis.interfaceCommon.utils;
|
|||||||
import com.czlis.common.core.domain.Result;
|
import com.czlis.common.core.domain.Result;
|
||||||
import com.czlis.common.core.domain.entity.lis.*;
|
import com.czlis.common.core.domain.entity.lis.*;
|
||||||
import com.czlis.interfaceCommon.mapper.CheckResultMapper;
|
import com.czlis.interfaceCommon.mapper.CheckResultMapper;
|
||||||
|
import com.czlis.interfaceCommon.mapper.LabCheckrulesMapper;
|
||||||
import com.czlis.interfaceCommon.mapper.XmInfoMapper;
|
import com.czlis.interfaceCommon.mapper.XmInfoMapper;
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -20,7 +21,8 @@ public class CheckResultUtils {
|
|||||||
XmInfoMapper xmInfoMapper;
|
XmInfoMapper xmInfoMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
CheckResultMapper checkResultMapper;
|
CheckResultMapper checkResultMapper;
|
||||||
|
@Autowired
|
||||||
|
LabCheckrulesMapper labCheckrulesMapper;
|
||||||
public String chksample(LabPat labPat, List<LabResult> labResultList) {
|
public String chksample(LabPat labPat, List<LabResult> labResultList) {
|
||||||
String errmsg = "";
|
String errmsg = "";
|
||||||
String brdh = labPat.getBrdh();
|
String brdh = labPat.getBrdh();
|
||||||
@ -126,8 +128,125 @@ public class CheckResultUtils {
|
|||||||
if(!"".equals(errmsg))errmsg= errmsg +LisUtil.LINE_SEPARATOR+ "请咨询该仪器组长或专业检验师 !";
|
if(!"".equals(errmsg))errmsg= errmsg +LisUtil.LINE_SEPARATOR+ "请咨询该仪器组长或专业检验师 !";
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}
|
}
|
||||||
public Result chksamplenew(LabPat labPat, List<LabResult> labResultList){
|
|
||||||
|
|
||||||
return new Result("0", "");
|
/**
|
||||||
|
* 自动审核时,询问默认失败,填备注默认每次都填
|
||||||
|
* @param labPat
|
||||||
|
* @param labResultList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, Object> autochksamplenew(LabPat labPat, List<LabResult> labResultList) {
|
||||||
|
|
||||||
|
Map<String, Object> params=chksamplenew(labPat, labResultList,0);
|
||||||
|
String code=(String)params.get("code");
|
||||||
|
if ("3".equals(code))params.put("code","0");
|
||||||
|
if ("5".equals(code))params.put("code","-1");
|
||||||
|
if ("1".equals(code))params.put("code","-1");
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高级审核,对于重复询问通过xh递归询问
|
||||||
|
* @param labPat
|
||||||
|
* @param labResultList
|
||||||
|
* @param xh
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, Object> chksamplenew(LabPat labPat, List<LabResult> labResultList,int xh){
|
||||||
|
String yq = labPat.getYq();
|
||||||
|
Date jyrq = labPat.getJyrq();
|
||||||
|
String ybh = labPat.getYbh();
|
||||||
|
String bz= labPat.getBz();
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("code", "0");
|
||||||
|
params.put("msg","");
|
||||||
|
params.put("bz",bz);
|
||||||
|
params.put("setbz",false);
|
||||||
|
params.put("xh",xh);
|
||||||
|
List<LabCheckrules> labCheckruleslist=labCheckrulesMapper.getLabCheckrules(yq);
|
||||||
|
if(labCheckruleslist.size()==0)return params;
|
||||||
|
if(xh>=labCheckruleslist.size())return params;
|
||||||
|
for (int i = xh; i < labCheckruleslist.size(); i++){
|
||||||
|
LabCheckrules labCheckrules=labCheckruleslist.get(i);
|
||||||
|
String checkrules=labCheckrules.getCheckrules();
|
||||||
|
String checktype=labCheckrules.getChecktype();
|
||||||
|
String logcontent=labCheckrules.getLogcontent();
|
||||||
|
String ruledisplay=labCheckrules.getRuledisplay();
|
||||||
|
String errmsg=checkcondition(labPat,labResultList,checkrules,ruledisplay);
|
||||||
|
if(!"".equals(errmsg)) {
|
||||||
|
if("0".equals(checktype)) {
|
||||||
|
errmsg="审核未通过,你是否要强行通过?"+ruledisplay+LisUtil.LINE_SEPARATOR+"审核未通过,你是否要强行通过?"+LisUtil.LINE_SEPARATOR+errmsg;
|
||||||
|
params.put("code", "5");
|
||||||
|
params.put("msg",errmsg);
|
||||||
|
int ruleid0=labCheckrules.getRuleid();
|
||||||
|
params.put("xh",i);
|
||||||
|
return params;
|
||||||
|
}else if("3".equals(checktype)) {
|
||||||
|
errmsg="审核未通过"+LisUtil.LINE_SEPARATOR+"设置的组合审核条件:"+errmsg+LisUtil.LINE_SEPARATOR+"审核未通过,不允许审核!";
|
||||||
|
params.put("code", "1");
|
||||||
|
params.put("msg",errmsg);
|
||||||
|
return params;
|
||||||
|
}else if("4".equals(checktype)) {
|
||||||
|
bz=replacebz(labPat,labResultList,logcontent);
|
||||||
|
labPat.setBz(bz);
|
||||||
|
params.put("setbz", true);
|
||||||
|
errmsg="此次审核将产生一个备注信息"+LisUtil.LINE_SEPARATOR+bz;
|
||||||
|
params.put("code", "3");
|
||||||
|
params.put("msg",errmsg);
|
||||||
|
params.put("bz",bz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String checkcondition(LabPat labPat, List<LabResult> labResultList,String checkrules,String ruledisplay){
|
||||||
|
String errmsg="";
|
||||||
|
if(checkrules.contains("ANY_")){
|
||||||
|
Map<String, String> variables = new HashMap<>();
|
||||||
|
String[] parameters=CalcUtils.getParameters(checkrules);
|
||||||
|
for (int i = 0; i < parameters.length; i++) {
|
||||||
|
String itemcode = parameters[i];
|
||||||
|
switch (itemcode) {
|
||||||
|
case "SEX":
|
||||||
|
String sex = labPat.getBrxb().trim();
|
||||||
|
if ("1".equals(sex)) sex = "男";
|
||||||
|
if ("2".equals(sex)) sex = "女";
|
||||||
|
variables.put("SEX", sex);
|
||||||
|
break;
|
||||||
|
case "AGE":
|
||||||
|
double age = AgeUtils.getDecimalAge(AgeUtils.getBirthDateByAge(labPat.getNl(), labPat.getNldw()));
|
||||||
|
variables.put("AGE", String.valueOf(age));
|
||||||
|
break;
|
||||||
|
case "":
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean flag=CalcUtils.getBooleanFromCalc(checkrules, variables);
|
||||||
|
errmsg = "审核条件: " + ruledisplay + " 未通过!" ;
|
||||||
|
}
|
||||||
|
return errmsg;
|
||||||
|
}
|
||||||
|
private String replacebz(LabPat labPat, List<LabResult> labResultList,String logcontent){
|
||||||
|
String errmsg=logcontent;
|
||||||
|
String[] parameters=CalcUtils.getParameters(logcontent);
|
||||||
|
for (int i = 0; i < parameters.length; i++) {
|
||||||
|
String itemcode = parameters[i];
|
||||||
|
switch (itemcode) {
|
||||||
|
case "SEX":
|
||||||
|
String sex = labPat.getBrxb().trim();
|
||||||
|
if ("1".equals(sex)) sex = "男";
|
||||||
|
if ("2".equals(sex)) sex = "女";
|
||||||
|
errmsg.replace("[SEX]",sex);
|
||||||
|
break;
|
||||||
|
case "AGE":
|
||||||
|
double age = AgeUtils.getDecimalAge(AgeUtils.getBirthDateByAge(labPat.getNl(), labPat.getNldw()));
|
||||||
|
errmsg.replace("[AGE]",String.valueOf(age));
|
||||||
|
break;
|
||||||
|
case "":
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="com.czlis.interfaceCommon.mapper.LabCheckrulesMapper">
|
||||||
|
<select id="getLabCheckrules">
|
||||||
|
SELECT ruleid,rptunitid,checkrules,checktype,logflag,logcontent,ruledisplay,actions
|
||||||
|
FROM lab_checkrules where logflag = '1' and rptunitid = #{yq}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getLabCheckrulesAutocheck">
|
||||||
|
SELECT ruleid,rptunitid,checkrules,checktype,logflag,logcontent,ruledisplay,actions
|
||||||
|
FROM lab_checkrules where (isnull(autocheck,'') = '1') and rptunitid = #{yq}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -231,6 +231,15 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
} else if (("".equals(alarmflag) || alarmflag == null) && wjz == 1) {
|
} else if (("".equals(alarmflag) || alarmflag == null) && wjz == 1) {
|
||||||
labPat.setAlarmflag("");
|
labPat.setAlarmflag("");
|
||||||
}
|
}
|
||||||
|
//医学审核条件判断
|
||||||
|
if(problemId<4)problemId=4;
|
||||||
|
result=chksample(labPat,problemId);
|
||||||
|
if ("99".equals(result.getCode())) {
|
||||||
|
labPat.setBz(result.getMsg());
|
||||||
|
result.setCode("0");
|
||||||
|
}
|
||||||
|
if (!"0".equals(result.getCode())) return result;
|
||||||
|
if(problemId<99)problemId=99;
|
||||||
//4:CA请求业务的处理
|
//4:CA请求业务的处理
|
||||||
//Result result=addCA(jyrq, yq, ybh, hdys);
|
//Result result=addCA(jyrq, yq, ybh, hdys);
|
||||||
//if("0".equals(result.getCode()))return result;
|
//if("0".equals(result.getCode()))return result;
|
||||||
@ -351,21 +360,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
if (Userid == null || "".equals(Userid)) {
|
if (Userid == null || "".equals(Userid)) {
|
||||||
Userid = SecurityUtils.getLoginUser().getUsername();
|
Userid = SecurityUtils.getLoginUser().getUsername();
|
||||||
}
|
}
|
||||||
//医学审核条件判断
|
|
||||||
if(problemId<3) {
|
|
||||||
String checkvalue = checkResultUtils.chksample(labPat, labResultList);
|
|
||||||
if (checkvalue != null && !"".equals(checkvalue)) {
|
|
||||||
return new Result("5", checkvalue, 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//医学审核条件判断(新规则)
|
|
||||||
if(problemId<4) {
|
|
||||||
Result chksamplenewvalue = checkResultUtils.chksamplenew(labPat, labResultList);
|
|
||||||
if (chksamplenewvalue.getCode().equals("5")) {
|
|
||||||
return new Result("5", chksamplenewvalue.getMsg(), 4);
|
|
||||||
}
|
|
||||||
if (!chksamplenewvalue.getCode().equals("0")) return chksamplenewvalue;
|
|
||||||
}
|
|
||||||
//调用his报告接口,检查外部接口对审核前的定制需求
|
//调用his报告接口,检查外部接口对审核前的定制需求
|
||||||
SetReport setReport = new SetReport();
|
SetReport setReport = new SetReport();
|
||||||
setReport.setIp(IpUtils.getIpAddr());
|
setReport.setIp(IpUtils.getIpAddr());
|
||||||
@ -409,6 +404,49 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
return new Result("0", "保存成功!");
|
return new Result("0", "保存成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医学审核条件判断
|
||||||
|
* @param labPat
|
||||||
|
* @param problemId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Result chksample(LabPat labPat,Integer problemId) {
|
||||||
|
List<LabResult> labResultList = commonUtil.getLabResultList(labPat.getJyrq(),labPat.getYq(),labPat.getYbh());
|
||||||
|
//医学审核条件判断
|
||||||
|
if(problemId<3) {
|
||||||
|
String checkvalue = checkResultUtils.chksample(labPat, labResultList);
|
||||||
|
if (checkvalue != null && !"".equals(checkvalue)) {
|
||||||
|
return new Result("5", checkvalue, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Boolean setbz=false;
|
||||||
|
String bz=labPat.getBz();
|
||||||
|
//医学审核条件判断(新规则),预留99个递归ID
|
||||||
|
if(problemId<99) {
|
||||||
|
int xh=0;
|
||||||
|
if(problemId>4)xh=problemId - 4;
|
||||||
|
Map<String, Object> chksamplenewvalue = checkResultUtils.chksamplenew(labPat, labResultList,xh);
|
||||||
|
String chkCode=(String)chksamplenewvalue.get("code");
|
||||||
|
String chkMsg=(String)chksamplenewvalue.get("code");
|
||||||
|
bz=(String)chksamplenewvalue.get("bz");
|
||||||
|
labPat.setBz(bz);
|
||||||
|
xh=(Integer) chksamplenewvalue.get("xh");
|
||||||
|
setbz=(Boolean) chksamplenewvalue.get("setbz");
|
||||||
|
problemId=4+xh;
|
||||||
|
if ("5".equals(chkCode)) {
|
||||||
|
if (setbz){
|
||||||
|
commonUtil.updateLabPat(labPat);
|
||||||
|
}
|
||||||
|
return new Result("5", chkMsg, problemId);
|
||||||
|
}
|
||||||
|
if (!"0".equals(chkCode)) return new Result(chkCode, chkMsg, problemId);
|
||||||
|
}
|
||||||
|
if (setbz){
|
||||||
|
commonUtil.updateLabPat(labPat);
|
||||||
|
return new Result("99", bz);
|
||||||
|
}
|
||||||
|
return new Result("0", "保存成功!");
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 审核后步骤,在审核过程中,必须完成审核前校验通过,结果计算值填充,参考值结果标志危急值标志填写完成,最后使用此方法修改状态
|
* 审核后步骤,在审核过程中,必须完成审核前校验通过,结果计算值填充,参考值结果标志危急值标志填写完成,最后使用此方法修改状态
|
||||||
*
|
*
|
||||||
@ -476,8 +514,8 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
setReport.setStatus(LisinterfaceNameConstants.REPORTEND);
|
setReport.setStatus(LisinterfaceNameConstants.REPORTEND);
|
||||||
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport);
|
Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport);
|
||||||
if (result.getCode().equals("5")) {
|
if (result.getCode().equals("5")) {
|
||||||
if (problemId < 4) {
|
if (problemId < 100) {
|
||||||
return new Result(result.getCode(), result.getMsg(), 4);
|
return new Result(result.getCode(), result.getMsg(), 100);
|
||||||
}
|
}
|
||||||
return new Result("0", "保存成功!");
|
return new Result("0", "保存成功!");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user