主业务添加代码
This commit is contained in:
parent
dfc791c3ab
commit
3f0498eb9d
@ -8,11 +8,13 @@ import lombok.NoArgsConstructor;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class XmVal {
|
||||
private Integer xmid;
|
||||
private String xmdh;
|
||||
private String qz;
|
||||
private String srm;
|
||||
private Integer xh;
|
||||
private String jgbz;
|
||||
|
||||
private String yq;
|
||||
private String xmdh;
|
||||
private String qz;
|
||||
private String srm;
|
||||
private Integer xh;
|
||||
private String jgbz;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.czlis.interfaceCommon.mapper;
|
||||
|
||||
import com.czlis.common.core.domain.entity.lis.XmAlarmdetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface XmAlarmdetailMapper {
|
||||
List<XmAlarmdetail> getXmAlarmdetailList(String yq);
|
||||
List<XmAlarmdetail> getXmAlarmdetail(@Param("yq")String yq, @Param("xmdh")String xmdh);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.czlis.interfaceCommon.mapper;
|
||||
|
||||
import com.czlis.common.core.domain.entity.lis.XmRef;
|
||||
import com.czlis.common.core.domain.entity.lis.XmVal;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface XmValMapper {
|
||||
List<XmVal> getXmValList(String yq);
|
||||
XmVal getXmVal(@Param("yq")String yq, @Param("xmdh")String xmdh);
|
||||
XmVal getXmValValue(@Param("yq")String yq, @Param("xmdh")String xmdh,@Param("csjg")String csjg);
|
||||
String getXmValJgbz(@Param("yq")String yq, @Param("xmdh")String xmdh,@Param("csjg")String csjg,@Param("csjg1")String csjg1,@Param("csjg2")String csjg2);
|
||||
}
|
||||
@ -65,14 +65,14 @@ public class CalcUtils {
|
||||
*/
|
||||
public static String getCalc(String CalcExpression){
|
||||
// 1. 替换逻辑运算符:and→&&,or→||
|
||||
String processed = CalcExpression.replaceAll("\\band\\b", "&&").replaceAll("\\bor\\b", "||");
|
||||
processed = processed.replaceAll("\\bAND\\b", "&&").replaceAll("\\bOR\\b", "||");
|
||||
String processed = CalcExpression.replaceAll("\\band|AND\\b", "&&").replaceAll("\\bor|OR\\b", "||");
|
||||
// 2. 替换变量格式:[a] → #a
|
||||
processed = processed.replaceAll("\\[(\\w+)\\]", "#$1");
|
||||
// 3. 替换len()函数为length()方法:len(xxx) → xxx.length()
|
||||
processed = replaceLenFunction(processed);
|
||||
//5.case表达式暂时不处理,后期看需要扩展
|
||||
//4. 递归处理if结构:if(cond, trueExpr, falseExpr) → cond?trueExpr:falseExpr
|
||||
//4.like '%aa'或者 like 'aa%'或者 like '%aa%'
|
||||
processed = replaceLikeExpressions(processed);
|
||||
//5. 递归处理if结构:if(cond, trueExpr, falseExpr) → cond?trueExpr:falseExpr
|
||||
return processIf(processed);
|
||||
}
|
||||
/**
|
||||
@ -210,6 +210,60 @@ public class CalcUtils {
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
/**
|
||||
* 处理like表达式转换
|
||||
* 支持:like '%xxx'、like 'xxx%'、like '%xxx%'、like 'xxx'(精确匹配)
|
||||
*/
|
||||
private static String replaceLikeExpressions(String expression) {
|
||||
// 正则匹配 like 表达式(支持空格变化和引号)
|
||||
// 分组说明:
|
||||
// group1: 左侧表达式(如字段或变量)
|
||||
// group2: 匹配模式(如'%aa%'、'aa%'等)
|
||||
Pattern pattern = Pattern.compile("(\\w+)\\s+like\\s+'([^']+)'", Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(expression);
|
||||
|
||||
StringBuffer result = new StringBuffer();
|
||||
while (matcher.find()) {
|
||||
String leftExpr = matcher.group(1); // 左侧表达式(如 field1)
|
||||
String patternStr = matcher.group(2); // 匹配模式(如 %aa%)
|
||||
|
||||
// 根据模式生成对应的SpEL方法调用
|
||||
String replacement = generateLikeReplacement(leftExpr, patternStr);
|
||||
matcher.appendReplacement(result, replacement);
|
||||
}
|
||||
matcher.appendTail(result);
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
/**
|
||||
* 根据like模式生成对应的SpEL方法调用
|
||||
*/
|
||||
private static String generateLikeReplacement(String leftExpr, String patternStr) {
|
||||
boolean startsWithWildcard = patternStr.startsWith("%");
|
||||
boolean endsWithWildcard = patternStr.endsWith("%");
|
||||
String content = patternStr.replace("%", ""); // 提取实际匹配内容
|
||||
|
||||
// 处理三种like场景
|
||||
if (startsWithWildcard && endsWithWildcard) {
|
||||
// like '%xxx%' → 包含:xxx.contains('content')
|
||||
return String.format("%s.contains('%s')", leftExpr, escapeQuotes(content));
|
||||
} else if (startsWithWildcard) {
|
||||
// like '%xxx' → 以...结尾:xxx.endsWith('content')
|
||||
return String.format("%s.endsWith('%s')", leftExpr, escapeQuotes(content));
|
||||
} else if (endsWithWildcard) {
|
||||
// like 'xxx%' → 以...开头:xxx.startsWith('content')
|
||||
return String.format("%s.startsWith('%s')", leftExpr, escapeQuotes(content));
|
||||
} else {
|
||||
// like 'xxx' → 精确匹配:xxx.equals('content')
|
||||
return String.format("%s.equals('%s')", leftExpr, escapeQuotes(content));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 转义字符串中的单引号,避免SpEL语法错误
|
||||
*/
|
||||
private static String escapeQuotes(String str) {
|
||||
return str.replace("'", "\\'");
|
||||
}
|
||||
/**
|
||||
* 使用正则表达式判断字符串是否为数字
|
||||
* 支持:整数(123)、小数(123.45)、正负号(-123、+45.6)
|
||||
@ -226,9 +280,10 @@ public class CalcUtils {
|
||||
// 测试
|
||||
public static void main(String[] args) {
|
||||
Map<String, String> variables = new HashMap<>();
|
||||
variables.put("ALB", "4.0"); // 示例值
|
||||
variables.put("RESULT", "4.0"); // 示例值
|
||||
// variables.put("TP", "6.0");
|
||||
String testCalc = "[ALB] /( [TP] - [ALB] )";
|
||||
String testCalc = "if(([结果]>7.12) ,1,0)";
|
||||
testCalc=testCalc.replace("[结果]", "[RESULT]");
|
||||
//System.out.println(getCalc(testCalc));
|
||||
System.out.println(getValueFromCalc(testCalc,variables));
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import com.czlis.common.utils.ComDictUtils;
|
||||
import com.czlis.common.utils.ComOptionUtils;
|
||||
import com.czlis.interfaceCommon.mapper.*;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -38,8 +39,11 @@ public class CommonUtil {
|
||||
XmInfoMapper xmInfoMapper;
|
||||
@Autowired
|
||||
XmRefMapper xmRefMapper;
|
||||
|
||||
//====检验主表操作方法集合===
|
||||
@Autowired
|
||||
XmValMapper xmValMapper;
|
||||
@Autowired
|
||||
XmAlarmdetailMapper xmAlarmdetailMapper;
|
||||
//====检验主表操作方法集合===
|
||||
public LabPat getLabPatOne(Date jyrq, String yq, String ybh){
|
||||
return labPatMapper.getLabPatOne(jyrq, yq, ybh);
|
||||
}
|
||||
@ -75,6 +79,10 @@ public class CommonUtil {
|
||||
public List<XmRef> getXmRefList(String yq) {return xmRefMapper.getXmRefList(yq);}
|
||||
public XmRef getXmRef(String yq,String xmdh) {return xmRefMapper.getXmRef(yq,xmdh);}
|
||||
public XmRef getXmRefValue(Map<String,Object> map) {return xmRefMapper.getXmRefValue(map);}
|
||||
public String getXmRefJgbz(String yq,String xmdh,String csjg,String csjg1,String csjg2) {return xmValMapper.getXmValJgbz(yq,xmdh,csjg,csjg1,csjg2);}
|
||||
public List<XmAlarmdetail> getXmAlarmdetail(String yq,String xmdh){return xmAlarmdetailMapper.getXmAlarmdetail(yq,xmdh);};
|
||||
|
||||
|
||||
//服务器时间方法
|
||||
public Date getCurrentTime(){return commonMapper.getCurrentTime();}
|
||||
public String getCurrentDate(){return DateFormatUtils.format(commonMapper.getCurrentTime(), "yyyy-MM-dd");}
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
<?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.XmAlarmdetailMapper">
|
||||
|
||||
<select id="getXmAlarmdetailList" resultType="com.czlis.common.core.domain.entity.lis.XmAlarmdetail">
|
||||
select * from xm_alarmdetail where yq=#{yq}
|
||||
</select>
|
||||
<select id="getXmAlarmdetail" resultType="com.czlis.common.core.domain.entity.lis.XmAlarmdetail">
|
||||
select * from xm_alarmdetail where yq = #{yq} and xmdh = #{xmdh}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,50 @@
|
||||
<?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.XmValMapper">
|
||||
|
||||
<select id="getXmValList" resultType="com.czlis.common.core.domain.entity.lis.XmVal">
|
||||
select * from xm_val where yq=#{yq}
|
||||
</select>
|
||||
<select id="getXmVal" resultType="com.czlis.common.core.domain.entity.lis.XmVal">
|
||||
select * from xm_val where yq = #{yq} and xmdh = #{xmdh}
|
||||
</select>
|
||||
|
||||
<select id="getXmValValue" resultType="com.czlis.common.core.domain.entity.lis.XmVal">
|
||||
select TOP 1 * from xm_val
|
||||
<where>
|
||||
<if test="yq != null and yq != ''">
|
||||
and yq = #{yq}
|
||||
</if>
|
||||
<if test="xmdh != null and xmdh != ''">
|
||||
and xmdh = #{xmdh}
|
||||
</if>
|
||||
<if test="csjg != null and csjg != ''">
|
||||
and qz = #{csjg}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getXmValJgbz" resultType="com.czlis.common.core.domain.entity.lis.XmVal">
|
||||
select TOP 1 jgbz from xm_val
|
||||
<where>
|
||||
<if test="yq != null and yq != ''">
|
||||
and yq = #{yq}
|
||||
</if>
|
||||
<if test="xmdh != null and xmdh != ''">
|
||||
and xmdh = #{xmdh}
|
||||
</if>
|
||||
<!-- 动态 OR 条件块:多条件时用 OR 连接,单条件时自动转为 AND -->
|
||||
<trim prefix="AND (" suffix=")" prefixOverrides="OR">
|
||||
<if test="csjg != null and csjg != ''">
|
||||
OR qz = #{csjg}
|
||||
</if>
|
||||
<if test="csjg1 != null and csjg1 != ''">
|
||||
OR qz = #{csjg1}
|
||||
</if>
|
||||
<if test="csjg2 != null and csjg2 != ''">
|
||||
OR qz = #{csjg2}
|
||||
</if>
|
||||
</trim>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -14,4 +14,5 @@ public interface LisWorkOperMapper {
|
||||
void updatelabresultsqxmdhall(@Param("jyrq") Date jyrq,@Param("yq") String yq,@Param("ybh") String ybh,@Param("sqxmdh") String sqxmdh);
|
||||
void updatelabresultsqxmdh(@Param("jyrq") Date jyrq,@Param("yq") String yq,@Param("ybh") String ybh,@Param("sqh") String sqh);
|
||||
List<ResultCalcDTO> getResultCalc(@Param("jyrq") Date jyrq, @Param("yq") String yq, @Param("ybh") String ybh);
|
||||
Integer getLimitCount(Map<String,Object> map);
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.czlis.liswork.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
||||
import com.czlis.common.core.domain.entity.lis.*;
|
||||
import com.czlis.common.utils.StringUtils;
|
||||
import com.czlis.interfaceCommon.constants.LisinterfaceNameConstants;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.interfaceCommon.constants.SampleStatusConstants;
|
||||
@ -16,13 +16,12 @@ import com.czlis.liswork.mapper.LisWorkOperMapper;
|
||||
import com.czlis.liswork.mapper.dict.LabInstrvsreqclassMapper;
|
||||
import com.czlis.liswork.pojo.DTO.ResultCalcDTO;
|
||||
import com.czlis.liswork.service.LisWorkOperService;
|
||||
import com.czlis.liswork.utils.LisWorkUtil;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -264,7 +263,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
}
|
||||
LabPat labPat=commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
//计算项目更新
|
||||
calcsample(jyrq, yq, ybh, labPat);
|
||||
calcsample(labPat);
|
||||
String yqdl=lisWorkOperMapper.selectYqdl(yq);
|
||||
if(!"细菌仪".equals(yqdl)) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@ -279,7 +278,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
String retMsg = String.valueOf(map.get("retmsg"));
|
||||
log.info("调用存储过程{}返回值:{},{}", "sp_setrefs", retCode, retMsg);
|
||||
if (retCode == null || "".equals(retCode) || "-1".equals(retCode)) return new Result("-1", "保存常规参考值失败!");
|
||||
int wjz=saverefs(jyrq, yq, ybh, labPat);
|
||||
int wjz=saverefs(labPat);
|
||||
if(wjz==1){
|
||||
//危急值处理过程
|
||||
}
|
||||
@ -321,11 +320,14 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
*/
|
||||
public Result calcsample(Date jyrq, String yq, String ybh){
|
||||
LabPat labPat=commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
calcsample(jyrq, yq, ybh, labPat);
|
||||
calcsample(labPat);
|
||||
return new Result("0","保存成功!");
|
||||
}
|
||||
//内部使用
|
||||
private void calcsample(Date jyrq, String yq, String ybh,LabPat labPat){
|
||||
private void calcsample(LabPat labPat){
|
||||
Date jyrq=labPat.getJyrq();
|
||||
String yq=labPat.getYq();
|
||||
String ybh=labPat.getYbh();
|
||||
List<ResultCalcDTO> resultCalcDTO=lisWorkOperMapper.getResultCalc(jyrq,yq,ybh);
|
||||
String xmdhold="";
|
||||
for (ResultCalcDTO resultCalc : resultCalcDTO) {
|
||||
@ -368,19 +370,19 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
*/
|
||||
public Result saverefs(Date jyrq, String yq, String ybh){
|
||||
LabPat labPat=commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||
saverefs(jyrq, yq, ybh, labPat);
|
||||
saverefs(labPat);
|
||||
return new Result("0","保存成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算项目参考值结果异常标志(内部使用)
|
||||
* @param jyrq
|
||||
* @param yq
|
||||
* @param ybh
|
||||
* @param labPat
|
||||
* @return 返回值0正常,1有危急值明细存在
|
||||
*/
|
||||
private int saverefs(Date jyrq, String yq, String ybh,LabPat labPat){
|
||||
private int saverefs(LabPat labPat){
|
||||
Date jyrq=labPat.getJyrq();
|
||||
String yq=labPat.getYq();
|
||||
String ybh=labPat.getYbh();
|
||||
String yqdl=lisWorkOperMapper.selectYqdl(yq);
|
||||
boolean lb_setbj=true,lb_wjz=false;
|
||||
if(!"细菌仪".equals(yqdl)) {
|
||||
@ -404,10 +406,10 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
String ygzd = labResult.getYgzd();
|
||||
//当结果为数值并且与周期诊断无关,计算存储过程保存成功后,只进行危急值判断
|
||||
if(lb_nummode && lb_setbj && !"Y".equals(ygzd) && !"Y".equals(ygzq)){
|
||||
int wjz=alarmcondition(jyrq, yq, ybh, labPat,labResult);
|
||||
int wjz=alarmcondition(labPat,labResult);
|
||||
if(wjz==1)lb_wjz=true;
|
||||
}else {
|
||||
int wjz = setrefs(jyrq, yq, ybh, labPat, labResult);
|
||||
int wjz = setrefs( labPat, labResult);
|
||||
if (wjz == 1) lb_wjz = true;
|
||||
}
|
||||
}
|
||||
@ -421,14 +423,12 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
|
||||
/**
|
||||
* 明细结果计算参考值异常标志危急值标志并更新
|
||||
* @param jyrq
|
||||
* @param yq
|
||||
* @param ybh
|
||||
* @param labPat
|
||||
* @param labResult
|
||||
* @return
|
||||
*/
|
||||
private int setrefs(Date jyrq, String yq, String ybh,LabPat labPat,LabResult labResult){
|
||||
private int setrefs(LabPat labPat,LabResult labResult){
|
||||
String yq=labPat.getYq();
|
||||
String resultflag="M",wjzflag="";
|
||||
int wjz=0;
|
||||
String xmdh=labResult.getXmdh();
|
||||
@ -503,7 +503,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
Double csjgnum = Double.valueOf(csjgnew);
|
||||
if(ckxx != null)if(csjgnum<ckxx)resultflag="L";
|
||||
if(cksx != null)if(csjgnum>cksx)resultflag="H";
|
||||
int wjzf=alarmcondition(jyrq, yq, ybh, labPat,labResult);
|
||||
int wjzf=alarmcondition(labPat,labResult);
|
||||
if(wjzf==-1) {
|
||||
if(llimit != null)if(csjgnum<llimit)wjzflag="L";
|
||||
if(hlimit != null)if(csjgnum>hlimit)wjzflag="H";
|
||||
@ -514,14 +514,13 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
}else{
|
||||
//文字型结果判断
|
||||
String jgbzold=labResult.getJgbz();
|
||||
String lmtflag ="";//commonUtil.getitemlmtflag(yq,xmdh,csjg);
|
||||
String lmtflag =getitemlmtflag(yq,xmdh,csjg);
|
||||
if("P".equals(jgbzold) && (csjg.indexOf("阳")>=0 || csjg.indexOf("+")>=0 || csjg.indexOf(":")>=0 ) && (lmtflag == null || lmtflag.trim().isEmpty())) lmtflag="P";
|
||||
resultflag=lmtflag;
|
||||
if("J".equals(lmtflag))wjzflag="H";
|
||||
int wjzf=alarmcondition(jyrq, yq, ybh, labPat,labResult);
|
||||
if(wjzf==1) {
|
||||
wjzflag="H";
|
||||
}
|
||||
if("J".equals(lmtflag))wjzflag = "H";
|
||||
int wjzf=alarmcondition(labPat,labResult);
|
||||
if(wjzf==1) wjzflag="H";
|
||||
|
||||
}
|
||||
//小数保留位数计算
|
||||
Integer xsws= xmInfo.getXsws();
|
||||
@ -535,18 +534,103 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
||||
|
||||
commonUtil.updateLabResult(labResult);
|
||||
}
|
||||
if(!"".equals(wjzflag))wjz=1;
|
||||
return wjz;
|
||||
}
|
||||
/**
|
||||
*特定条件危急值判断
|
||||
* @param jyrq
|
||||
* @param yq
|
||||
* @param ybh
|
||||
* @param labPat
|
||||
* @param labResult
|
||||
* @return
|
||||
*/
|
||||
private int alarmcondition(Date jyrq, String yq, String ybh,LabPat labPat,LabResult labResult){
|
||||
return 0;
|
||||
private int alarmcondition(LabPat labPat,LabResult labResult){
|
||||
boolean lb_fcb=false,lb_hasval=false;
|
||||
String csjg=labResult.getCsjg();
|
||||
if (csjg == null || csjg.trim().isEmpty()) return 0;
|
||||
String yq=labPat.getYq();
|
||||
String xmdh=labResult.getXmdh();
|
||||
String brxm="";
|
||||
String brdh="";
|
||||
String ksdh=labPat.getKsdh();
|
||||
String ksdh1=commonUtil.getComDictIdByName("BT",ksdh);
|
||||
if (ksdh1 != null && !ksdh1.trim().isEmpty()) ksdh=ksdh1;
|
||||
String ybzt=labPat.getYbzt();
|
||||
String ybzt1=commonUtil.getComDictIdByName("ST",ybzt);
|
||||
if (ybzt1 != null && !ybzt1.trim().isEmpty()) ybzt=ybzt1;
|
||||
String zd=labPat.getZd();
|
||||
|
||||
List<XmAlarmdetail> getXmAlarmdetail=commonUtil.getXmAlarmdetail(yq,xmdh);
|
||||
if(getXmAlarmdetail==null)return 0;
|
||||
for(XmAlarmdetail xmAlarmdetail :getXmAlarmdetail){
|
||||
String samplecondition=xmAlarmdetail.getSamplecondition();
|
||||
lb_fcb=false;
|
||||
if (samplecondition.toLowerCase().contains("[初报]")) {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("xmdh", xmdh);
|
||||
map.put("jyrq", labPat.getJyrq());
|
||||
if (samplecondition.toLowerCase().contains("brxm"))brxm=labPat.getBrxm();
|
||||
if (samplecondition.toLowerCase().contains("brdh"))brdh=labPat.getBrdh();
|
||||
map.put("brxm", brxm);
|
||||
map.put("brdh", brdh);
|
||||
int limitcount=lisWorkOperMapper.getLimitCount(map);
|
||||
if(limitcount>0)lb_fcb=true;
|
||||
samplecondition = samplecondition.replace("'brxm'", "1");
|
||||
samplecondition = samplecondition.replace("'brdh'", "1");
|
||||
samplecondition = samplecondition.replace("[初报]", "[CB]");
|
||||
}
|
||||
|
||||
labPat.setYblx(commonUtil.getComDictIdByName("BT",labPat.getYblx()));
|
||||
labPat.setKsdh(commonUtil.getComDictIdByName("DP",labPat.getKsdh()));
|
||||
samplecondition=samplecondition.replace("[科室]", "[DEPT]");
|
||||
samplecondition=samplecondition.replace("[诊断]", "[DIAG]");
|
||||
samplecondition=samplecondition.replace("[样本状态]", "[YBZT]");
|
||||
Map<String, String> variables = new HashMap<>();
|
||||
variables.put("ZB", "1");
|
||||
variables.put("DEPT", ksdh);
|
||||
variables.put("DIAG", zd);
|
||||
variables.put("YBZT", ybzt);
|
||||
samplecondition="if((" + samplecondition + ") ,1,0)";
|
||||
String result=CalcUtils.getValueFromCalc(samplecondition,variables);
|
||||
if("1".equals( result)){
|
||||
if(lb_fcb)return 0;
|
||||
lb_hasval=true;
|
||||
String resultcondition = xmAlarmdetail.getResultcondition();
|
||||
resultcondition=resultcondition.replace("[结果]", "[RESULT]");
|
||||
Map<String, String> variables1 = new HashMap<>();
|
||||
variables1.put("RESULT", csjg);
|
||||
resultcondition="if((" + resultcondition + ") ,1,0)";
|
||||
String result1=CalcUtils.getValueFromCalc(resultcondition,variables1);
|
||||
if("1".equals( result1))return 1;
|
||||
}
|
||||
}
|
||||
if( lb_hasval)return 0;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取常用取值结果标志
|
||||
* @param yq
|
||||
* @param xmdh
|
||||
* @param csjg
|
||||
* @return
|
||||
*/
|
||||
public String getitemlmtflag(String yq,String xmdh,String csjg){
|
||||
String jgbz="";
|
||||
if (csjg == null || csjg.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String csjg1="",csjg2="";
|
||||
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("\\((.*?)\\)");
|
||||
java.util.regex.Matcher matcher = pattern.matcher(csjg);
|
||||
if (matcher.find()) {
|
||||
csjg1=matcher.group(1);
|
||||
}
|
||||
int index = csjg.indexOf(",");
|
||||
if(index == -1)csjg2= StringUtils.substring(csjg,index+1);
|
||||
jgbz=commonUtil.getXmRefJgbz(yq,xmdh,csjg,csjg1,csjg2);
|
||||
if (jgbz == null) {
|
||||
return "";
|
||||
}
|
||||
return jgbz;
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,4 +40,22 @@
|
||||
( lab_result.yq =#{yq}) And
|
||||
( lab_result.ybh = #{ybh}) )
|
||||
</select>
|
||||
<select id="getLimitCount" resultType="Integer">
|
||||
select COUNT(1) from lab_resultwarning,lab_pat where lab_resultwarning.jyrq=lab_pat.jyrq
|
||||
and lab_resultwarning.yq=lab_pat.yq and lab_resultwarning.ybh=lab_pat.ybh and
|
||||
<where>
|
||||
<if test="xmdh != null and xmdh != ''">lab_resultwarning.xmdh = #{xmdh}</if>
|
||||
</where>
|
||||
<where>
|
||||
<if test="jyrq != null ">and lab_pat.jyrq = #{jyrq}</if>
|
||||
</where>
|
||||
<where>
|
||||
<if test="brdh != null and brdh != ''">and lab_pat.brdh = #{brdh}</if>
|
||||
</where>
|
||||
<where>
|
||||
<if test="brxm != null and brxm != ''">and lab_pat.brdh = #{brxm}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user