From 82141d9cf881b0eca2ea9c646d4355254dc2d6c4 Mon Sep 17 00:00:00 2001 From: tangw Date: Fri, 22 Aug 2025 19:59:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E4=B8=9A=E5=8A=A1=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/domain/entity/lis/LabPat.java | 4 +- .../core/domain/entity/lis/LabReqmain.java | 50 +++-- .../core/domain/entity/lis/LabResult.java | 7 +- .../mapper/LabReqmainMapper.java | 7 +- .../interfaceCommon/utils/CalcUtils.java | 146 ++++++++----- .../interfaceCommon/utils/CommonUtil.java | 29 ++- .../main/resources/mapper/LabPatMapper.xml | 30 --- .../resources/mapper/LabReqmainMapper.xml | 199 +++++++++++++++++- .../work/LisWorkOperController.java | 2 +- .../liswork/mapper/LisWorkOperMapper.java | 2 +- .../service/impl/LisWorkOperServiceImpl.java | 156 ++++++++------ 11 files changed, 462 insertions(+), 170 deletions(-) diff --git a/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabPat.java b/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabPat.java index 7e5d590..c090cfd 100644 --- a/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabPat.java +++ b/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabPat.java @@ -55,8 +55,6 @@ public class LabPat extends BaseEntity { private String instrid; private String jzbz; private String sbbr; - // private String qrr; - // private Date qrsj; private String alarmflag; private String alarmconfirm; private Date alarmconfirmdt; @@ -80,4 +78,6 @@ public class LabPat extends BaseEntity { private String fault; private String faults; private Date faultdt; + private String sn_tss; + private String sn_result; } diff --git a/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabReqmain.java b/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabReqmain.java index 524de64..6d9f920 100644 --- a/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabReqmain.java +++ b/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabReqmain.java @@ -42,6 +42,29 @@ public class LabReqmain extends BaseEntity { private String zd; private Date cysj; private Date cksj; + private String ckzj; + private String ckyh; + private String djry; + private String inputman; + private String powerman; + private String contactman; + private String refsqh; + private String cyr; + private String bbsjr; + private Date bbsjsj; + private String performby; + private String sbbr; + private String inzt; + private String libpos; + private Date inlibtime; + private String inlibman; + private Date outlibtime; + private String outlibman; + private String refused; + private Date confirmtime; + private String confirmer; + private String cybl; + private String bbsjbl; private String yljg; private String kh; private String klx; @@ -50,22 +73,15 @@ public class LabReqmain extends BaseEntity { private String sfzh; private String phone; private String phone1; - private Date confirmtime; - private String confirmer; - private String cyr; - private String addr; - private String fb; - private String bbsjr; - private Date bbsjsj; - private String czid; - private String czmc; - private String jzjlid; - private String hzdh; - private String zxks; - private String hosid; - private String lstd; - private String jcptbz; - private String slzq; - private Date sjsj; private String yqdh; + private Date sjsj; + private String addr; + private String lstd; + private String ssrq; + private String slzq; + private Date cyblsj; + private Date bbsjblsj; + private String ybrl; + private String qsyljg; + private String cjbw; } diff --git a/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabResult.java b/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabResult.java index 17fbef9..de75658 100644 --- a/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabResult.java +++ b/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/LabResult.java @@ -18,6 +18,7 @@ public class LabResult extends BaseEntity { private String yq; private String ybh; private String xmdh; + private String wyh; private String csjg; private String od; private String cutoff; @@ -25,8 +26,7 @@ public class LabResult extends BaseEntity { private String bz1; private String bz2; private String yhdh; - private String textresult; - private String instrid; + private Integer instrid; private Date operdt; private String operna; private String refs; @@ -36,6 +36,9 @@ public class LabResult extends BaseEntity { private String alarmFlag; private String redoFlag; private String sqxmdh; + private String redoText; + private String bz3; + private String textresult; private String xmmc; private String ygzd; private String ygzq; diff --git a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/mapper/LabReqmainMapper.java b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/mapper/LabReqmainMapper.java index 45f47ce..e388994 100644 --- a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/mapper/LabReqmainMapper.java +++ b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/mapper/LabReqmainMapper.java @@ -6,6 +6,9 @@ import java.util.Map; public interface LabReqmainMapper { LabReqmain getLabReqmainOne(String sqh); - void updateLabReqmain(LabReqmain labReqmain); - void updateLabReqmainZT(Map map); + int updateLabReqmain(LabReqmain labReqmain); + int updateLabReqmainAll(LabReqmain labReqmain); + int deleteLabReqmain(String sqh); + void insertLabReqmain(LabReqmain labReqmain); + int updateLabReqmainZT(Map map); } diff --git a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/CalcUtils.java b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/CalcUtils.java index 25d909b..2bbcd3b 100644 --- a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/CalcUtils.java +++ b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/CalcUtils.java @@ -17,45 +17,65 @@ public class CalcUtils { * @param variableMap 入参MAP * @return */ - public static String getValueFromCalc(String CalcExpression,Map variableMap){ - // 创建SpEL解析器 + public static String getValueFromCalc(String CalcExpression, Map variableMap) { ExpressionParser parser = new SpelExpressionParser(); - // 创建评估上下文 StandardEvaluationContext context = new StandardEvaluationContext(); - // 循环遍历Map,将键值对添加到上下文 for (Map.Entry entry : variableMap.entrySet()) { - // 键作为变量名,值作为变量值 String str = entry.getValue(); - if(isNumber(str)){ + if (isNumber(str)) { context.setVariable(entry.getKey(), Double.parseDouble(str)); - }else { + } else { context.setVariable(entry.getKey(), entry.getValue()); } } - // 测试表达式:使用多个变量进行判断"#score >= 60 ? #name + '的' + #subject + '成绩及格' : #name + '的' + #subject + '成绩不及格'" String expression = getCalc(CalcExpression); Expression exp = parser.parseExpression(expression); - // 执行表达式(传入上下文) try { - String result = exp.getValue(context, String.class); - //System.out.println(result); // 输出:张三的数学成绩及格 - return result; - } catch (Exception e) { - // 意外错误时返回null - return null; - } + // 先获取原始结果(可能是Number、Boolean、String等) + Object result = exp.getValue(context); + // 安全转换为String + if (result == null) { + return ""; // 空值返回空字符串(或根据业务返回null) + } + + // 特殊处理数字类型,避免科学计数法(如1000000.0 → "1000000") + if (result instanceof Number) { + Number num = (Number) result; + // 判断是否为整数(无小数部分) + if (num.doubleValue() == Math.floor(num.doubleValue())) { + return String.valueOf(num.longValue()); + } else { + return String.valueOf(num.doubleValue()); + } + } + + // 其他类型直接调用toString() + return result.toString(); + + } catch (Exception e) { + throw new RuntimeException("表达式计算失败: " + expression, e); + } } - public static boolean getBooleanFromCalc(String CalcExpression,Map variableMap){ + public static boolean getBooleanFromCalc(String CalcExpression, Map variableMap) { ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext context = new StandardEvaluationContext(); + // 统一变量处理:数字转Double,否则保留String for (Map.Entry entry : variableMap.entrySet()) { - context.setVariable(entry.getKey(), entry.getValue()); + 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); - boolean result = exp.getValue(context, Boolean.class); - return result; + try { + return exp.getValue(context, Boolean.class); + } catch (Exception e) { + throw new RuntimeException("布尔表达式计算失败: " + expression, e); // 增强异常信息 + } } /** @@ -64,6 +84,7 @@ public class CalcUtils { * @return */ public static String getCalc(String CalcExpression){ + // 1. 替换逻辑运算符:and→&&,or→|| String processed = CalcExpression.replaceAll("\\band|AND\\b", "&&").replaceAll("\\bor|OR\\b", "||"); // 2. 替换变量格式:[a] → #a @@ -72,9 +93,47 @@ public class CalcUtils { processed = replaceLenFunction(processed); //4.like '%aa'或者 like 'aa%'或者 like '%aa%' processed = replaceLikeExpressions(processed); + // 1. 先将所有比较用的=替换为==(关键修复) + processed = processed.replaceAll("(\\w+)\\s*=\\s*('.*?'|\\w+)", "$1 == $2"); //5. 递归处理if结构:if(cond, trueExpr, falseExpr) → cond?trueExpr:falseExpr return processIf(processed); } + + /** + * 取出公式中所有[参数]返回数组,供调用传值引用 + * @param input + * @return + */ + public static String[] getParameters(String input) { + // 正则表达式匹配 [] 中的内容 + Pattern pattern = Pattern.compile("\\[(.*?)\\]"); + Matcher matcher = pattern.matcher(input); + + // 第一步:统计匹配数量,确定数组长度 + int count = 0; + // 临时存储匹配结果的数组(初始长度设为10,可根据实际场景调整) + String[] tempArray = new String[10]; + + // 循环查找所有匹配项 + while (matcher.find()) { + // 存储当前匹配的内容([]中的字符串) + tempArray[count] = matcher.group(1); + count++; + + // 若临时数组容量不足,扩容(每次翻倍) + if (count == tempArray.length) { + String[] newArray = new String[tempArray.length * 2]; + System.arraycopy(tempArray, 0, newArray, 0, tempArray.length); + tempArray = newArray; + } + } + + // 第二步:创建与实际数量匹配的结果数组 + String[] result = new String[count]; + System.arraycopy(tempArray, 0, result, 0, count); + + return result; + } /** * 递归解析并替换if表达式 */ @@ -162,29 +221,29 @@ public class CalcUtils { for (int i = 0; i < 3; i++) { parts[i] = new StringBuilder(); } + boolean inQuotes = false; // 标记是否在字符串中(单引号内) for (char c : inner.toCharArray()) { - if (c == ',' && stack.isEmpty()) { + // 处理单引号包裹的字符串(忽略内部逗号) + if (c == '\'') { + inQuotes = !inQuotes; + parts[partIndex].append(c); + continue; + } + // 仅当不在字符串中且栈为空时,才用逗号分割参数 + if (c == ',' && !inQuotes && stack.isEmpty()) { partIndex++; - if (partIndex >= 3) { - break; - } + if (partIndex >= 3) break; } else { - if (c == '(') { - stack.push('('); - } else if (c == ')') { - if (!stack.isEmpty()) { - stack.pop(); - } - } + if (c == '(') stack.push('('); + else if (c == ')') if (!stack.isEmpty()) stack.pop(); parts[partIndex].append(c); } } - return new String[]{ - parts[0].toString(), - parts[1].toString(), - parts[2].toString() + parts[0].toString().trim(), + parts[1].toString().trim(), + parts[2].toString().trim() }; } /** @@ -215,24 +274,18 @@ public class CalcUtils { * 支持: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); + // 修正正则:左侧表达式允许包含#、字母、数字、下划线(#[a-zA-Z0-9_]+) + 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 leftExpr = matcher.group(1); // 支持#变量(如#RESULT) + String patternStr = matcher.group(2); String replacement = generateLikeReplacement(leftExpr, patternStr); matcher.appendReplacement(result, replacement); } matcher.appendTail(result); - return result.toString(); } /** @@ -270,9 +323,8 @@ public class CalcUtils { */ public static boolean isNumber(String str) { if (str == null || str.trim().isEmpty()) { - return false; + return false; // 空值不视为数字 } - // 正则表达式:匹配正负整数、正负小数 String regex = "^[+-]?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)$"; return str.matches(regex); } diff --git a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/CommonUtil.java b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/CommonUtil.java index 6c1c180..d2c2836 100644 --- a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/CommonUtil.java +++ b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/CommonUtil.java @@ -50,6 +50,7 @@ public class CommonUtil { LabReqreportPdffileMapper labReqreportPdffileMapper; @Autowired LabReqsteplogMapper labReqsteplogMapper; + //====检验主表操作方法集合=== public LabPat getLabPatOne(Date jyrq, String yq, String ybh) { return labPatMapper.getLabPatOne(jyrq, yq, ybh); @@ -90,6 +91,19 @@ public class CommonUtil { public LabReqmain getLabReqmainOne(String sqh) { return labReqmainMapper.getLabReqmainOne(sqh); } + + public int updateLabReqmain(LabReqmain labReqmain) { + return labReqmainMapper.updateLabReqmain(labReqmain); + } + + public int deleteLabReqmain(String sqh) { + return labReqmainMapper.deleteLabReqmain(sqh); + } + + public void insertLabReqmain(LabReqmain labReqmain) { + labReqmainMapper.insertLabReqmain(labReqmain); + } + public List getLabReqsteplog(String sqh) { return labReqsteplogMapper.getLabReqsteplog(sqh); } @@ -105,8 +119,8 @@ public class CommonUtil { } @Transactional(rollbackFor = Exception.class) - public int insertLabResult(LabResult labResult) { - return labResultMapper.insertLabResult(labResult); + public void insertLabResult(LabResult labResult) { + labResultMapper.insertLabResult(labResult); } public List getresultinfo(Date jyrq, String yq, String ybh) { @@ -270,8 +284,11 @@ public class CommonUtil { } else { //没有获取到缓存,则先从数据库中查询数据,然后再进行缓存 ComOpt comOpt1 = comOptMapper.getComOptOne(yq, xxdh); - ComOptionUtils.setOptCache(yq, xxdh, comOpt1); - return comOpt1.getXxqz(); + if (comOpt1 != null) { + ComOptionUtils.setOptCache(yq, xxdh, comOpt1); + return comOpt1.getXxqz(); + } + return null; } } @@ -310,7 +327,7 @@ public class CommonUtil { return labReqreportPdffileMapper.getLabReqreportPdffileList(sqh); } - public LabReqreportPdffile getLabReqreportPdffileOne(Date jyrq,String yq,String ybh) { - return labReqreportPdffileMapper.getLabReqreportPdffileOne(jyrq,yq,ybh); + public LabReqreportPdffile getLabReqreportPdffileOne(Date jyrq, String yq, String ybh) { + return labReqreportPdffileMapper.getLabReqreportPdffileOne(jyrq, yq, ybh); } } diff --git a/lis-interfaceCommon/src/main/resources/mapper/LabPatMapper.xml b/lis-interfaceCommon/src/main/resources/mapper/LabPatMapper.xml index cb08207..1aab89c 100644 --- a/lis-interfaceCommon/src/main/resources/mapper/LabPatMapper.xml +++ b/lis-interfaceCommon/src/main/resources/mapper/LabPatMapper.xml @@ -76,8 +76,6 @@ instrid, jzbz, sbbr, - qrr, - qrsj, alarmflag, alarmconfirm, alarmconfirmdt, @@ -99,15 +97,8 @@ lstd, zjlx, slzq, - uploaddate, - lastupdatetime, - ylfw, - upload, checker, - lisptsc, autojgbz, - crbsj, - testName, jyrq,yq,ybh ) values( @@ -151,8 +142,6 @@ #{instrid}, #{jzbz}, #{sbbr}, - #{qrr}, - #{qrsj}, #{alarmflag}, #{alarmconfirm}, #{alarmconfirmdt}, @@ -174,15 +163,8 @@ #{lstd}, #{zjlx}, #{slzq}, - #{uploaddate}, - #{lastupdatetime}, - #{ylfw}, - #{upload}, #{checker}, - #{lisptsc}, #{autojgbz}, - #{crbsj}, - #{testName}, #{jyrq},#{yq},#{ybh} ) @@ -309,12 +291,6 @@ sbbr = #{sbbr,jdbcType=VARCHAR}, - - qrr = #{qrr,jdbcType=VARCHAR}, - - - qrsj = #{qrsj,jdbcType=TIMESTAMP}, - alarmflag = #{alarmflag,jdbcType=CHAR}, @@ -375,12 +351,6 @@ slzq = #{slzq,jdbcType=VARCHAR}, - - uploaddate = #{uploaddate,jdbcType=TIMESTAMP}, - - - whonetupdate = #{whonetupdate,jdbcType=TIMESTAMP}, - checker = #{checker,jdbcType=VARCHAR}, diff --git a/lis-interfaceCommon/src/main/resources/mapper/LabReqmainMapper.xml b/lis-interfaceCommon/src/main/resources/mapper/LabReqmainMapper.xml index 336670e..60815da 100644 --- a/lis-interfaceCommon/src/main/resources/mapper/LabReqmainMapper.xml +++ b/lis-interfaceCommon/src/main/resources/mapper/LabReqmainMapper.xml @@ -11,8 +11,201 @@ UPDATE lab_reqmain SET zt = '2', jsys = #{userId}, jssj =getdate() WHERE sqh = #{sqh} AND (zt < '2' or zt='8' or jssj - - - + + delete from lab_reqmain + where sqh = #{sqh} + + + insert into lab_reqmain (sqh, ksdh, sqys, + sqsj, jsys, jssj, + zt, jjzt, brly, brdh, + brxm, brxb, brsr, bz1, + bz2, bz3, jzbz, txm, + ch, yblx, zxys, zxsj, + bgddh, costs, nl, nldw, + zd, cysj, cksj, + ckzj, ckyh, djry, inputman, + powerman, contactman, refsqh, + cyr, bbsjr, bbsjsj, + performby, sbbr, inzt, + libpos, inlibtime, inlibman, + outlibtime, outlibman, refused, + confirmtime, confirmer, cybl, + bbsjbl, yljg, kh, klx, + jzsj, jymd, sfzh, + phone, phone1, yqdh, sjsj, + addr, lstd, ssrq, + slzq, cyblsj, bbsjblsj, + ybrl,qsyljg,cjbw) + values (#{sqh}, #{ksdh}, #{sqys}, + #{sqsj}, #{jsys}, #{jssj}, + #{zt}, #{jjzt}, #{brly}, #{brdh}, + #{brxm}, #{brxb}, #{brsr}, #{bz1}, + #{bz2}, #{bz3}, #{jzbz}, #{txm}, + #{ch}, #{yblx}, #{zxys}, #{zxsj}, + #{bgddh}, #{costs}, #{nl}, #{nldw}, + #{zd}, #{cysj}, #{cksj}, + #{ckzj}, #{ckyh}, #{djry}, #{inputman}, + #{powerman}, #{contactman}, #{refsqh}, + #{cyr}, #{bbsjr}, #{bbsjsj}, + #{performby}, #{sbbr}, #{inzt}, + #{libpos}, #{inlibtime}, #{inlibman}, + #{outlibtime}, #{outlibman}, #{refused}, + #{confirmtime}, #{confirmer}, #{cybl}, + #{bbsjbl}, #{yljg}, #{kh}, #{klx}, + #{jzsj}, #{jymd}, #{sfzh}, + #{phone}, #{phone1}, #{yqdh}, #{sjsj}, + #{addr}, #{lstd}, #{ssrq}, + #{slzq}, #{cyblsj}, #{bbsjblsj}, + #{ybrl},#{qsyljg},#{cjbw}) + + + update lab_reqmain + + ksdh = #{ksdh}, + sqys = #{sqys}, + sqsj = #{sqsj}, + jsys = #{jsys}, + jssj = #{jssj}, + zt = #{zt}, + jjzt = #{jjzt}, + brly = #{brly}, + brdh = #{brdh}, + brxm = #{brxm}, + brxb = #{brxb}, + brsr = #{brsr}, + bz1 = #{bz1}, + bz2 = #{bz2}, + bz3 = #{bz3}, + jzbz = #{jzbz}, + txm = #{txm}, + ch = #{ch}, + yblx = #{yblx}, + zxys = #{zxys}, + zxsj = #{zxsj}, + bgddh = #{bgddh}, + costs = #{costs}, + nl = #{nl}, + nldw = #{nldw}, + zd = #{zd}, + cysj = #{cysj}, + cksj = #{cksj}, + ckzj = #{ckzj}, + ckyh = #{ckyh}, + djry = #{djry}, + inputman = #{inputman}, + powerman = #{powerman}, + contactman = #{contactman}, + refsqh = #{refsqh}, + cyr = #{cyr}, + bbsjr = #{bbsjr}, + bbsjsj = #{bbsjsj}, + performby = #{performby}, + sbbr = #{sbbr}, + inzt = #{inzt}, + libpos = #{libpos}, + inlibtime = #{inlibtime}, + inlibman = #{inlibman}, + outlibtime = #{outlibtime}, + outlibman = #{outlibman}, + refused = #{refused}, + confirmtime = #{confirmtime}, + confirmer = #{confirmer}, + cybl = #{cybl}, + bbsjbl = #{bbsjbl}, + yljg = #{yljg}, + kh = #{kh}, + klx = #{klx}, + jzsj = #{jzsj}, + jymd = #{jymd}, + sfzh = #{sfzh}, + phone = #{phone}, + phone1 = #{phone1}, + yqdh = #{yqdh}, + sjsj = #{sjsj}, + addr = #{addr}, + lstd = #{lstd}, + ssrq = #{ssrq}, + slzq = #{slzq}, + cyblsj = #{cyblsj}, + bbsjblsj = #{bbsjblsj}, + ybrl = #{ybrl}, + qsyljg = #{qsyljg}, + + where sqh = #{sqh} + + + update lab_reqmain + set ksdh = #{ksdh}, + sqys = #{sqys}, + sqsj = #{sqsj}, + jsys = #{jsys}, + jssj = #{jssj}, + zt = #{zt}, + jjzt = #{jjzt}, + brly = #{brly}, + brdh = #{brdh}, + brxm = #{brxm}, + brxb = #{brxb}, + brsr = #{brsr}, + bz1 = #{bz1}, + bz2 = #{bz2}, + bz3 = #{bz3}, + jzbz = #{jzbz}, + txm = #{txm}, + ch = #{ch}, + yblx = #{yblx}, + zxys = #{zxys}, + zxsj = #{zxsj}, + bgddh = #{bgddh}, + costs = #{costs}, + nl = #{nl}, + nldw = #{nldw}, + zd = #{zd}, + cysj = #{cysj}, + cksj = #{cksj}, + ckzj = #{ckzj}, + ckyh = #{ckyh}, + djry = #{djry}, + inputman = #{inputman}, + powerman = #{powerman}, + contactman = #{contactman}, + refsqh = #{refsqh}, + cyr = #{cyr}, + bbsjr = #{bbsjr}, + bbsjsj = #{bbsjsj}, + performby = #{performby}, + sbbr = #{sbbr}, + inzt = #{inzt}, + libpos = #{libpos}, + inlibtime = #{inlibtime}, + inlibman = #{inlibman}, + outlibtime = #{outlibtime}, + outlibman = #{outlibman}, + refused = #{refused}, + confirmtime = #{confirmtime}, + confirmer = #{confirmer}, + cybl = #{cybl}, + bbsjbl = #{bbsjbl}, + yljg = #{yljg}, + kh = #{kh}, + klx = #{klx}, + jzsj = #{jzsj}, + jymd = #{jymd}, + sfzh = #{sfzh}, + phone = #{phone}, + phone1 = #{phone1}, + yqdh = #{yqdh}, + sjsj = #{sjsj}, + addr = #{addr}, + lstd = #{lstd}, + ssrq = #{ssrq}, + slzq = #{slzq}, + cyblsj = #{cyblsj}, + bbsjblsj = #{bbsjblsj}, + ybrl = #{ybrl}, + qsyljg = #{qsyljg} + where sqh = #{sqh} + diff --git a/liswork/src/main/java/com/czlis/liswork/controller/work/LisWorkOperController.java b/liswork/src/main/java/com/czlis/liswork/controller/work/LisWorkOperController.java index 8b84623..5579bf9 100644 --- a/liswork/src/main/java/com/czlis/liswork/controller/work/LisWorkOperController.java +++ b/liswork/src/main/java/com/czlis/liswork/controller/work/LisWorkOperController.java @@ -50,7 +50,7 @@ public class LisWorkOperController extends BaseController { */ @ApiOperation("审核报告") @GetMapping("/check2") - public Result check21( Date jyrq, String yq, String ybh, String hdys){ + public Result check2( Date jyrq, String yq, String ybh, String hdys){ log.info("yq:{}", yq); hdys="lis"; diff --git a/liswork/src/main/java/com/czlis/liswork/mapper/LisWorkOperMapper.java b/liswork/src/main/java/com/czlis/liswork/mapper/LisWorkOperMapper.java index 98f3669..9ebc0e6 100644 --- a/liswork/src/main/java/com/czlis/liswork/mapper/LisWorkOperMapper.java +++ b/liswork/src/main/java/com/czlis/liswork/mapper/LisWorkOperMapper.java @@ -10,7 +10,7 @@ import java.util.Map; public interface LisWorkOperMapper { Long checkReqClass(@Param("sqh") String sqh,@Param("yq") String yq); String selectSqxmdh(String sqh); - void sp_setrefs(Map map); + void spSetrefs(Map map); 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 getResultCalc(@Param("jyrq") Date jyrq, @Param("yq") String yq, @Param("ybh") String ybh); diff --git a/liswork/src/main/java/com/czlis/liswork/service/impl/LisWorkOperServiceImpl.java b/liswork/src/main/java/com/czlis/liswork/service/impl/LisWorkOperServiceImpl.java index fe4ba15..b4b1bb7 100644 --- a/liswork/src/main/java/com/czlis/liswork/service/impl/LisWorkOperServiceImpl.java +++ b/liswork/src/main/java/com/czlis/liswork/service/impl/LisWorkOperServiceImpl.java @@ -323,7 +323,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService { if (wxh > 0) return new Result("-1", "有结果为****禁止审核!"); } String sqh = labPat.getSqh(); - if (sqh == null || "".equals(sqh)) { + if (sqh != null && !"".equals(sqh)) { if (!"质控".equals(brlyname)) { if ("1".equals(commonUtil.getHISOPT("sp_dublereport"))) { LabPat labPat0 = lisWorkOperMapper.checkdublereport(sqh, ybh); @@ -413,9 +413,50 @@ public class LisWorkOperServiceImpl implements LisWorkOperService { if (labReqmain != null) { String zt = labReqmain.getZt(); if (SampleStatusConstants.CANCAL.equals(zt)) return new Result("-1", "申请单已作废禁止审核!"); + labReqmain.setYqdh(yq); + labReqmain.setSjsj(jysj); labReqmain.setConfirmer(hdys); - Date confirmtime = dysj; - labReqmain.setConfirmtime(confirmtime); + labReqmain.setConfirmtime(Confirmdt); + labReqmain = checklabReqmainTAT(labReqmain); + if (!SampleStatusConstants.CANCAL.equals(zt)) labReqmain.setZt(SampleStatusConstants.CONFIRM); + commonUtil.updateLabReqmain(labReqmain); + Date cysj = labReqmain.getCysj(); + if (cysj != null) labPat.setCyrq(cysj); + } + + //调用his报告接口,完成报告同时调用外部接口任务 + SetReport setReport = new SetReport(); + setReport.setIp(IpUtils.getIpAddr()); + setReport.setJyrq(DateFormatUtils.format(jyrq, "yyyy-MM-dd")); + setReport.setYq(yq.trim()); + setReport.setYbh(ybh); + setReport.setUserid(hdys); + setReport.setStatus(LisinterfaceNameConstants.REPORTEND); + Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport); + if (result.getCode().equals("5")) { + if (problemId < 4) { + return new Result(result.getCode(), result.getMsg(), 4); + } + return new Result("0", "保存成功!"); + } + if (!result.getCode().equals("0")) return result; + //最后完成 + labPat.setJgbz(ReportStatusConstants.CONFIRM); + commonUtil.updateLabPat(labPat); + return new Result("0", "保存成功!"); + } + + /** + * 申请单表校验TAT时间顺序,恢复时间倒置的时间轴 + * + * @param labReqmain + * @return + */ + private LabReqmain checklabReqmainTAT(LabReqmain labReqmain) { + if (labReqmain != null) { + Date confirmtime = labReqmain.getConfirmtime(); + Date jysj = labReqmain.getSjsj(); + String sqh = labReqmain.getSqh(); Date zxsj = labReqmain.getZxsj(); Date cysj = labReqmain.getCysj(); Date bbsjsj = labReqmain.getBbsjsj(); @@ -491,31 +532,8 @@ public class LisWorkOperServiceImpl implements LisWorkOperService { labReqmain.setZxsj(zxsj); } labReqmain.setSjsj(sjsj); - labReqmain.setYqdh(yq); - if (!SampleStatusConstants.CANCAL.equals(zt)) labReqmain.setZt(SampleStatusConstants.CONFIRM); - if (cysj != null) labPat.setCyrq(cysj); - // commonUtil.updateLabReqmain(labReqmain); } - //调用his报告接口,完成报告同时调用外部接口任务 - SetReport setReport = new SetReport(); - setReport.setIp(IpUtils.getIpAddr()); - setReport.setJyrq(DateFormatUtils.format(jyrq, "yyyy-MM-dd")); - setReport.setYq(yq.trim()); - setReport.setYbh(ybh); - setReport.setUserid(hdys); - setReport.setStatus(LisinterfaceNameConstants.REPORTEND); - Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREPORT, setReport); - if (result.getCode().equals("5")) { - if (problemId < 4) { - return new Result(result.getCode(), result.getMsg(), 4); - } - return new Result("0", "保存成功!"); - } - if (!result.getCode().equals("0")) return result; - //最后完成 - labPat.setJgbz(ReportStatusConstants.CONFIRM); - commonUtil.updateLabPat(labPat); - return new Result("0", "保存成功!"); + return labReqmain; } /** @@ -555,7 +573,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService { //保存最新参考值结果标志 int wjz = saverefs(labPat); //补写结果表申请单项目编号 - String sqh = labPat.getYbh(); + String sqh = labPat.getSqh(); if (sqh != null && !"".equals(sqh)) setItemSqxmdh(jyrq, yq, ybh, sqh); return wjz; } @@ -577,8 +595,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService { //内部使用 private void setItemSqxmdh(Date jyrq, String yq, String ybh, String sqh) { - if (sqh == null || "".equals(sqh)) { - } else { + if (sqh != null && !"".equals(sqh)) { int sl = labReqdetailMapper.getCountByKey(sqh); if (sl == 1) { String sqxmdh = lisWorkOperMapper.selectSqxmdh(sqh); @@ -614,28 +631,45 @@ public class LisWorkOperServiceImpl implements LisWorkOperService { String xmdh = resultCalc.getJsxm(); if (!xmdhold.equals(xmdh)) { xmdhold = xmdh; - String sex = labPat.getBrxb().trim(); - if ("1".equals(sex)) sex = "男"; - if ("2".equals(sex)) sex = "女"; - double age = AgeUtils.getDecimalAge(AgeUtils.getBirthDateByAge(labPat.getNl(), labPat.getNldw())); + boolean setjgsg=true; Map variables = new HashMap<>(); - variables.put("SEX", sex); // 示例值 - variables.put("AGE", String.valueOf(age)); - String result = CalcUtils.getValueFromCalc(jsgs, variables); - if (result != null && !result.trim().isEmpty()) { - //插入结果值 - LabResult labResult = commonUtil.getLabResult(jyrq, yq, ybh, xmdh); - if (labResult == null) { - labResult = new LabResult(); - labResult.setJyrq(jyrq); - labResult.setYq(yq); - labResult.setYbh(ybh); - labResult.setXmdh(xmdh); - labResult.setCsjg(result); - commonUtil.insertLabResult(labResult); - } else { - labResult.setCsjg(result); - commonUtil.updateLabResult(labResult); + String[] parameters =CalcUtils.getParameters(jsgs); + for (int i = 0; i < parameters.length; i++) { + String itemcode=parameters[i]; + if("SEX".equals(itemcode)){ + String sex = labPat.getBrxb().trim(); + if ("1".equals(sex)) sex = "男"; + if ("2".equals(sex)) sex = "女"; + variables.put("SEX", sex); + }else if("AGE".equals(itemcode)){ + double age = AgeUtils.getDecimalAge(AgeUtils.getBirthDateByAge(labPat.getNl(), labPat.getNldw())); + variables.put("AGE", String.valueOf(age)); + }else{ + List collect = resultCalcDTO.stream().filter(result -> result.getXmdh().equals(itemcode)).collect(Collectors.toList()); + if (collect.size() > 0) { + variables.put(itemcode, collect.get(0).getCsjg()); + }else{ + setjgsg=false; + } + } + } + if(setjgsg) { + String result = CalcUtils.getValueFromCalc(jsgs, variables); + if (result != null && !result.trim().isEmpty()) { + //插入结果值 + LabResult labResult = commonUtil.getLabResult(jyrq, yq, ybh, xmdh); + if (labResult == null) { + labResult = new LabResult(); + labResult.setJyrq(jyrq); + labResult.setYq(yq); + labResult.setYbh(ybh); + labResult.setXmdh(xmdh); + labResult.setCsjg(result); + commonUtil.insertLabResult(labResult); + } else { + labResult.setCsjg(result); + commonUtil.updateLabResult(labResult); + } } } } @@ -685,7 +719,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService { map.put("settype", "1"); map.put("retcode", ""); map.put("retmsg", ""); - lisWorkOperMapper.sp_setrefs(map); + lisWorkOperMapper.spSetrefs(map); String retCode = String.valueOf(map.get("retcode")); String retMsg = String.valueOf(map.get("retmsg")); log.info("调用存储过程{}返回值:{},{}", "sp_setrefs", retCode, retMsg); @@ -835,10 +869,10 @@ public class LisWorkOperServiceImpl implements LisWorkOperService { lmtflag = "P"; resultflag = lmtflag; if ("J".equals(lmtflag)) wjzflag = "H"; + int wjzf = alarmcondition(labPat, labResult); + if (wjzf == 1) wjzflag = "H";//满足特定危机值条件 + if (wjzf == 0) wjzflag = "";//存在特定危机值条件,但不满足不提示 } - int wjzf = alarmcondition(labPat, labResult); - if (wjzf == 1) wjzflag = "H";//满足特定危机值条件 - if (wjzf == 0) wjzflag = "";//存在特定危机值条件,但不满足不提示 //小数保留位数计算 Integer xsws = xmInfo.getXsws(); if (xsws >= 0) csjg = LisUtil.round(csjg, xsws); @@ -873,11 +907,15 @@ public class LisWorkOperServiceImpl implements LisWorkOperService { String brxm = ""; String brdh = ""; String ksdh = labPat.getKsdh(); - String ksdh1 = commonUtil.getComDictIdByName("BT", ksdh); - if (ksdh1 != null && !ksdh1.trim().isEmpty()) ksdh = ksdh1; + if(ksdh !=null &&!ksdh.trim().isEmpty()) { + String ksdh1 = commonUtil.getComDictIdByName("DP", 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; + if(ybzt !=null &&!ybzt.trim().isEmpty()){ + String ybzt1 = commonUtil.getComDictIdByName("ST", ybzt); + if (ybzt1 != null && !ybzt1.trim().isEmpty()) ybzt = ybzt1; + } String zd = labPat.getZd(); for (XmAlarmdetail xmAlarmdetail : getXmAlarmdetail) { String samplecondition = xmAlarmdetail.getSamplecondition();