主业务添加代码
This commit is contained in:
parent
4764a89ccb
commit
e65f138de0
@ -5,6 +5,7 @@ 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.LabCheckrulesMapper;
|
||||||
import com.czlis.interfaceCommon.mapper.XmInfoMapper;
|
import com.czlis.interfaceCommon.mapper.XmInfoMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -32,10 +33,12 @@ public class CheckResultUtils {
|
|||||||
Date jyrq = labPat.getJyrq();
|
Date jyrq = labPat.getJyrq();
|
||||||
String ybh = labPat.getYbh();
|
String ybh = labPat.getYbh();
|
||||||
List<XmInfo> xmInfoList0 = commonUtil.getXmInfoList(yq);
|
List<XmInfo> xmInfoList0 = commonUtil.getXmInfoList(yq);
|
||||||
|
if(xmInfoList0.size()==0) return errmsg;
|
||||||
List<XmInfo> xmInfoList = xmInfoList0.stream().filter(xmInfo -> xmInfo.getXjx()!=null||xmInfo.getSjx()!=null||xmInfo.getJgjg()!=null||xmInfo.getJgz()!=null||xmInfo.getJgbz()!=null).collect(Collectors.toList());
|
List<XmInfo> xmInfoList = xmInfoList0.stream().filter(xmInfo -> xmInfo.getXjx()!=null||xmInfo.getSjx()!=null||xmInfo.getJgjg()!=null||xmInfo.getJgz()!=null||xmInfo.getJgbz()!=null).collect(Collectors.toList());
|
||||||
if(xmInfoList.size()>0) {
|
if(xmInfoList.size()>0) {
|
||||||
for (LabResult labResult : labResultList) {
|
for (LabResult labResult : labResultList) {
|
||||||
String xmdh = labResult.getXmdh();
|
String xmdh = labResult.getXmdh();
|
||||||
|
|
||||||
List<XmInfo> collect = xmInfoList.stream().filter(xmInfo -> xmInfo.getXmdh().equals(xmdh)).collect(Collectors.toList());
|
List<XmInfo> collect = xmInfoList.stream().filter(xmInfo -> xmInfo.getXmdh().equals(xmdh)).collect(Collectors.toList());
|
||||||
if (collect.size() > 0) {
|
if (collect.size() > 0) {
|
||||||
XmInfo xmInfo = collect.get(0);
|
XmInfo xmInfo = collect.get(0);
|
||||||
@ -73,12 +76,13 @@ public class CheckResultUtils {
|
|||||||
lde_low = csjgnum - jgz;
|
lde_low = csjgnum - jgz;
|
||||||
}
|
}
|
||||||
List<LabResult> chkval = checkResultMapper.getChkvaList(brdh, ldt_startda, jyrq, yq, xmdh);
|
List<LabResult> chkval = checkResultMapper.getChkvaList(brdh, ldt_startda, jyrq, yq, xmdh);
|
||||||
|
if (chkval != null && chkval.size() > 0) {
|
||||||
List<LabResult> collect0 = chkval.stream().filter(LabResult0 -> LisUtil.isNumber(LabResult0.getCsjg())).collect(Collectors.toList());
|
List<LabResult> collect0 = chkval.stream().filter(LabResult0 -> LisUtil.isNumber(LabResult0.getCsjg())).collect(Collectors.toList());
|
||||||
if (collect0.size() > 0) {
|
if (collect0.size() > 0) {
|
||||||
Double finalLde_up = lde_up;
|
Double finalLde_up = lde_up;
|
||||||
Double finalLde_low = lde_low;
|
Double finalLde_low = lde_low;
|
||||||
List<LabResult> collect1 = collect0.stream().filter(LabResult1 -> Double.parseDouble(LabResult1.getCsjg()) > finalLde_up && Double.parseDouble(LabResult1.getCsjg()) < finalLde_low).collect(Collectors.toList());
|
List<LabResult> collect1 = collect0.stream().filter(LabResult1 -> Double.parseDouble(LabResult1.getCsjg()) > finalLde_up && Double.parseDouble(LabResult1.getCsjg()) < finalLde_low).collect(Collectors.toList());
|
||||||
if (collect0.size() > 0) {
|
if (collect1.size() > 0) {
|
||||||
errmsg = errmsg + LisUtil.LINE_SEPARATOR + xmdh + " 结果 (" + labResult.getCsjg() + ") 和 " +
|
errmsg = errmsg + LisUtil.LINE_SEPARATOR + xmdh + " 结果 (" + labResult.getCsjg() + ") 和 " +
|
||||||
DateFormatUtils.format(collect1.get(0).getJyrq(), "yyyy-MM-dd") + "日" +
|
DateFormatUtils.format(collect1.get(0).getJyrq(), "yyyy-MM-dd") + "日" +
|
||||||
collect1.get(0).getYbh() + " 号标本的结果 (" + collect1.get(0).getCsjg() + ") 相比超标";
|
collect1.get(0).getYbh() + " 号标本的结果 (" + collect1.get(0).getCsjg() + ") 相比超标";
|
||||||
@ -87,12 +91,14 @@ public class CheckResultUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<LabChk> labChkList = checkResultMapper.getLabChkList(yq);
|
List<LabChk> labChkList = checkResultMapper.getLabChkList(yq);
|
||||||
|
if(labChkList.size()==0) return errmsg;
|
||||||
for (LabChk labChk : labChkList) {
|
for (LabChk labChk : labChkList) {
|
||||||
String jsgs = labChk.getHdnr();
|
String jsgs = labChk.getHdnr();
|
||||||
boolean setjgsg = true;
|
boolean setjgsg = true;
|
||||||
@ -177,14 +183,14 @@ public class CheckResultUtils {
|
|||||||
String errmsg = checkcondition(labPat, labResultList, checkrules, ruledisplay);
|
String errmsg = checkcondition(labPat, labResultList, checkrules, ruledisplay);
|
||||||
if (!"".equals(errmsg)) {
|
if (!"".equals(errmsg)) {
|
||||||
if ("0".equals(checktype)) {
|
if ("0".equals(checktype)) {
|
||||||
errmsg = "审核规则触发,未通过审核!,你是否要强行通过?" + ruledisplay + LisUtil.LINE_SEPARATOR + "审核规则触发,未通过审核!,你是否要强行通过?" + LisUtil.LINE_SEPARATOR + errmsg;
|
errmsg = errmsg+ LisUtil.LINE_SEPARATOR + "你是否要强行通过?" ;
|
||||||
params.put("code", "5");
|
params.put("code", "5");
|
||||||
params.put("msg", errmsg);
|
params.put("msg", errmsg);
|
||||||
int ruleid0 = labCheckrules.getRuleid();
|
int ruleid0 = labCheckrules.getRuleid();
|
||||||
params.put("xh", i+1);
|
params.put("xh", i+1);
|
||||||
return params;
|
return params;
|
||||||
} else if ("3".equals(checktype)) {
|
} else if ("3".equals(checktype)) {
|
||||||
errmsg = "审核规则触发,未通过审核!" + LisUtil.LINE_SEPARATOR + "设置的组合审核条件:" + errmsg + LisUtil.LINE_SEPARATOR + "审核规则触发,未通过审核!,不允许审核!";
|
errmsg = errmsg + LisUtil.LINE_SEPARATOR + "不允许审核!";
|
||||||
params.put("code", "1");
|
params.put("code", "1");
|
||||||
params.put("msg", errmsg);
|
params.put("msg", errmsg);
|
||||||
params.put("xh", i+1);
|
params.put("xh", i+1);
|
||||||
@ -281,7 +287,7 @@ public class CheckResultUtils {
|
|||||||
errmsg.replace("[" + itemcode + "]", csjg);
|
errmsg.replace("[" + itemcode + "]", csjg);
|
||||||
|
|
||||||
}
|
}
|
||||||
List<LabResult> labResultList0 = commonUtil.labResultMapper.getLabResultWithSql(labPat.getJyrq(), labPat.getYq(), labPat.getYbh(), errmsg);
|
List<LabResult> labResultList0 = commonUtil.getLabResultWithSql(labPat.getJyrq(), labPat.getYq(), labPat.getYbh(), errmsg);
|
||||||
if (labResultList0.size() > 0) flag = true;
|
if (labResultList0.size() > 0) flag = true;
|
||||||
}
|
}
|
||||||
if (flag = true) errmsg = "审核条件: " + ruledisplay + " 规则触发,未通过审核!";
|
if (flag = true) errmsg = "审核条件: " + ruledisplay + " 规则触发,未通过审核!";
|
||||||
|
|||||||
@ -55,6 +55,7 @@ public class CommonUtil {
|
|||||||
ComLogMapper comLogMapper;
|
ComLogMapper comLogMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
LabRefusedMapper labRefusedMapper;
|
LabRefusedMapper labRefusedMapper;
|
||||||
|
|
||||||
//====检验主表操作方法集合===
|
//====检验主表操作方法集合===
|
||||||
public LabPat getLabPatOne(Date jyrq, String yq, String ybh) {
|
public LabPat getLabPatOne(Date jyrq, String yq, String ybh) {
|
||||||
return labPatMapper.getLabPatOne(jyrq, yq, ybh);
|
return labPatMapper.getLabPatOne(jyrq, yq, ybh);
|
||||||
@ -111,9 +112,11 @@ public class CommonUtil {
|
|||||||
public List<LabReqsteplog> getLabReqsteplog(String sqh) {
|
public List<LabReqsteplog> getLabReqsteplog(String sqh) {
|
||||||
return labReqsteplogMapper.getLabReqsteplog(sqh);
|
return labReqsteplogMapper.getLabReqsteplog(sqh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LabRefused> getLabRefusedList(LabRefused labRefused) {
|
public List<LabRefused> getLabRefusedList(LabRefused labRefused) {
|
||||||
return labRefusedMapper.getLabRefusedList(labRefused);
|
return labRefusedMapper.getLabRefusedList(labRefused);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int insertLabRefused(LabRefused labRefused) {
|
public int insertLabRefused(LabRefused labRefused) {
|
||||||
return labRefusedMapper.insertLabRefused(labRefused);
|
return labRefusedMapper.insertLabRefused(labRefused);
|
||||||
}
|
}
|
||||||
@ -148,6 +151,10 @@ public class CommonUtil {
|
|||||||
return labResultMapper.delNullLabResult(jyrq, yq, ybh);
|
return labResultMapper.delNullLabResult(jyrq, yq, ybh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LabResult> getLabResultWithSql(Date jyrq, String yq, String ybh, String errmsg) {
|
||||||
|
return labResultMapper.getLabResultWithSql(jyrq, yq, ybh, errmsg);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateLabResult(LabResult labResult) {
|
public int updateLabResult(LabResult labResult) {
|
||||||
return labResultMapper.updateLabResult(labResult);
|
return labResultMapper.updateLabResult(labResult);
|
||||||
@ -173,6 +180,7 @@ public class CommonUtil {
|
|||||||
public XmRef getXmRefValue(Map<String, Object> map) {
|
public XmRef getXmRefValue(Map<String, Object> map) {
|
||||||
return xmRefMapper.getXmRefValue(map);
|
return xmRefMapper.getXmRefValue(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmRef getXmRefValue(String yq, String xmdh, String bbtype, String sex, Double age, String zd, String slzq) {
|
public XmRef getXmRefValue(String yq, String xmdh, String bbtype, String sex, Double age, String zd, String slzq) {
|
||||||
return xmRefMapper.getXmRefValue(yq, xmdh, bbtype, sex, age, zd, slzq);
|
return xmRefMapper.getXmRefValue(yq, xmdh, bbtype, sex, age, zd, slzq);
|
||||||
}
|
}
|
||||||
@ -184,7 +192,10 @@ public class CommonUtil {
|
|||||||
public List<XmAlarmdetail> getXmAlarmdetail(String yq, String xmdh) {
|
public List<XmAlarmdetail> getXmAlarmdetail(String yq, String xmdh) {
|
||||||
return xmAlarmdetailMapper.getXmAlarmdetail(yq, xmdh);
|
return xmAlarmdetailMapper.getXmAlarmdetail(yq, xmdh);
|
||||||
}
|
}
|
||||||
public Integer insertComLog(ComLog comLog) {return comLogMapper.insertComLog(comLog);}
|
|
||||||
|
public Integer insertComLog(ComLog comLog) {
|
||||||
|
return comLogMapper.insertComLog(comLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getYqmc(String yq) {
|
public String getYqmc(String yq) {
|
||||||
@ -251,6 +262,11 @@ public class CommonUtil {
|
|||||||
List<ComDict> collect = comDictList.stream().filter(comDict -> comDict.getZddh().equals(zddh)).collect(Collectors.toList());
|
List<ComDict> collect = comDictList.stream().filter(comDict -> comDict.getZddh().equals(zddh)).collect(Collectors.toList());
|
||||||
if (collect.size() > 0) {
|
if (collect.size() > 0) {
|
||||||
return collect.get(0).getZdmc();
|
return collect.get(0).getZdmc();
|
||||||
|
}else{
|
||||||
|
List<ComDict> collect0 = comDictList.stream().filter(comDict -> comDict.getZdmc().equals(zddh)).collect(Collectors.toList());
|
||||||
|
if (collect0.size() > 0) {
|
||||||
|
return collect0.get(0).getZdmc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果redis当中没有查到数据,则先在设置redis值,
|
//如果redis当中没有查到数据,则先在设置redis值,
|
||||||
@ -263,7 +279,12 @@ public class CommonUtil {
|
|||||||
if (comDictList != null) {
|
if (comDictList != null) {
|
||||||
List<ComDict> collect = comDictList.stream().filter(comDict -> comDict.getZdmc().equals(zdmc)).collect(Collectors.toList());
|
List<ComDict> collect = comDictList.stream().filter(comDict -> comDict.getZdmc().equals(zdmc)).collect(Collectors.toList());
|
||||||
if (collect.size() > 0) {
|
if (collect.size() > 0) {
|
||||||
return collect.get(0).getZdmc();
|
return collect.get(0).getZddh();
|
||||||
|
}else{
|
||||||
|
List<ComDict> collect0 = comDictList.stream().filter(comDict -> comDict.getZddh().equals(zdmc)).collect(Collectors.toList());
|
||||||
|
if (collect0.size() > 0) {
|
||||||
|
return collect0.get(0).getZddh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果redis当中没有查到数据,则先在设置redis值,
|
//如果redis当中没有查到数据,则先在设置redis值,
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.czlis.interfaceCommon.utils;
|
package com.czlis.interfaceCommon.utils;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -149,57 +151,39 @@ public class LisUtil {
|
|||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保留指定小数位数
|
保留指定小数位数(四舍五入)
|
||||||
* 支持比较符号(<=、>=、<、>)和负号(-)同时存在的情况
|
支持比较符号 (<=、>=、<、>) 和负号 (-) 同时存在的情况
|
||||||
* @param input 输入字符串,如"123.1234"、">123.252"、"<=123.252"、"-45.67"、">=-89.01"
|
@param input 输入字符串,如 "123.1234"、">123.252"、"<=123.252"、"-45.67"、">=-89.01"
|
||||||
* @param decimalPlaces 要保留的小数位数,需为非负整数
|
@param decimalPlaces 要保留的小数位数,需为非负整数
|
||||||
* @return 格式化后的字符串,无法处理时返回原值
|
@return 格式化后的字符串,无法处理时返回原值
|
||||||
*/
|
*/
|
||||||
public static String round (String input, int decimalPlaces) {
|
public static String round (String input, int decimalPlaces) {
|
||||||
// 处理空输入或无效小数位数
|
// 处理空输入或无效小数位数
|
||||||
if (input == null || input.trim ().isEmpty () || decimalPlaces < 0) {
|
if (input == null || input.trim ().isEmpty () || decimalPlaces < 0) {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义比较运算符前缀(按长度排序,确保正确识别)
|
// 定义比较运算符前缀(按长度排序,确保正确识别)
|
||||||
String [] comparisonPrefixes = {"<=", ">=", "<", ">"};
|
String [] comparisonPrefixes = {"<=", ">=", "<", ">"};
|
||||||
String comparisonPrefix = "";
|
String comparisonPrefix = "";
|
||||||
String remainingPart = input;
|
String remainingPart = input.trim (); // 去除首尾空格
|
||||||
|
|
||||||
// 提取比较运算符前缀
|
// 提取比较运算符前缀
|
||||||
for (String prefix : comparisonPrefixes) {
|
for (String prefix : comparisonPrefixes) {
|
||||||
if (remainingPart.startsWith (prefix)) {
|
if (remainingPart.startsWith (prefix)) {
|
||||||
comparisonPrefix = prefix;
|
comparisonPrefix = prefix;
|
||||||
remainingPart = remainingPart.substring(prefix.length());
|
remainingPart = remainingPart.substring (prefix.length ()).trim (); // 去除前缀后的空格
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 尝试解析剩余部分为数字(使用 BigDecimal 避免精度问题)
|
||||||
// 尝试解析剩余部分为数字
|
|
||||||
try {
|
try {
|
||||||
// 解析数字(包含可能的负号)
|
// 解析为 BigDecimal(支持正负号和小数)
|
||||||
double number = Double.parseDouble(remainingPart);
|
BigDecimal number = new BigDecimal (remainingPart);
|
||||||
|
// 设置四舍五入模式并保留指定小数位数
|
||||||
// 创建格式化模式(整数部分至少1位,小数部分固定位数)
|
BigDecimal rounded = number.setScale (decimalPlaces, RoundingMode.HALF_UP);
|
||||||
StringBuilder formatPattern = new StringBuilder();
|
// 拼接比较前缀和格式化后的数字
|
||||||
formatPattern.append("0");
|
return comparisonPrefix + rounded.toPlainString (); //toPlainString 避免科学计数法
|
||||||
if (decimalPlaces > 0) {
|
|
||||||
formatPattern.append(".");
|
|
||||||
// 循环添加指定数量的0
|
|
||||||
for (int i = 0; i < decimalPlaces; i++) {
|
|
||||||
formatPattern.append("0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 格式化数字并拼接比较前缀
|
|
||||||
String formattedNumber = String.format(
|
|
||||||
"%s%s",
|
|
||||||
comparisonPrefix,
|
|
||||||
String.format(formatPattern.toString(), number)
|
|
||||||
);
|
|
||||||
|
|
||||||
return formattedNumber;
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
// 数字部分无法解析时返回原值
|
// 数字部分无法解析时返回原值
|
||||||
return input;
|
return input;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user