diff --git a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/mapper/LabInstrMapper.java b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/mapper/LabInstrMapper.java index 753e81c..4036b5a 100644 --- a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/mapper/LabInstrMapper.java +++ b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/mapper/LabInstrMapper.java @@ -14,4 +14,8 @@ public interface LabInstrMapper { String getYqdl(@Param("yq")String yq); String getBgdh(@Param("yq")String yq); String getLisgroup(@Param("yq")String yq); + List getInstrdList(@Param("lisgroup") String lisgroup, @Param("yljg") String yljg, @Param("useflag") String useflag, @Param("userno") String userno, @Param("powerbit") String powerbit); + List querybylisgroup(@Param("lisgroup") String lisgroup, @Param("yljg") String yljg, @Param("useflag") String useflag); + + } 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 9a6b711..ec34acc 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 @@ -1,14 +1,11 @@ package com.czlis.interfaceCommon.utils; -import com.czlis.common.core.domain.Result; import com.czlis.common.core.domain.entity.lis.*; import com.czlis.common.utils.ComDictUtils; import com.czlis.common.utils.ComOptionUtils; import com.czlis.interfaceCommon.mapper.*; import com.czlis.interfaceCommon.pojo.entity.LastLabPatParam; -import com.sun.org.apache.bcel.internal.generic.RETURN; 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; @@ -417,7 +414,12 @@ public class CommonUtil { public LabInstr getLabInstr(String yq) { return labInstrMapper.getLabInstr(yq); } - + public List getInstrdList(String lisgroup,String yljg,String useflag,String userno,String powerbit){ + return labInstrMapper.getInstrdList(lisgroup, yljg, useflag, userno, powerbit); + } + public List querybylisgroup(String lisgroup,String yljg,String useflag){ + return labInstrMapper.querybylisgroup(lisgroup, yljg, useflag); + } public List getLabInstrList(LabInstr labInstr) { return labInstrMapper.getLabInstrList(labInstr); } @@ -456,9 +458,9 @@ public class CommonUtil { //字典查询单位名称 public String getCompany(String yljg) { - if (yljg == null || yljg.equals("")) return getCompany(); + if (yljg == null || yljg.isEmpty()) return getCompany(); String zdmc = getComDictNameById("HOS", yljg); - if (zdmc == null || zdmc.equals("")) { + if (zdmc == null || zdmc.isEmpty()) { return yljg; } else { return zdmc; @@ -467,7 +469,7 @@ public class CommonUtil { public String getCompany() { String zdmc = getComDictNameById("99", "COMPANY"); - if (zdmc == null || zdmc.equals("")) { + if (zdmc == null || zdmc.isEmpty()) { return ""; } else { return zdmc; @@ -481,11 +483,11 @@ public class CommonUtil { List comDictList = getDictCache(zdlb); if (comDictList != null) { List collect = comDictList.stream().filter(comDict -> comDict.getZddh().equals(zddh)).collect(Collectors.toList()); - if (collect.size() > 0) { + if (!collect.isEmpty()) { return collect.get(0).getZdmc(); }else{ List collect0 = comDictList.stream().filter(comDict -> comDict.getZdmc().equals(zddh)).collect(Collectors.toList()); - if (collect0.size() > 0) { + if (!collect0.isEmpty()) { return collect0.get(0).getZdmc(); } } @@ -499,11 +501,11 @@ public class CommonUtil { List comDictList = getDictCache(zdlb); if (comDictList != null) { List collect = comDictList.stream().filter(comDict -> comDict.getZdmc().equals(zdmc)).collect(Collectors.toList()); - if (collect.size() > 0) { + if (!collect.isEmpty()) { return collect.get(0).getZddh(); }else{ List collect0 = comDictList.stream().filter(comDict -> comDict.getZddh().equals(zdmc)).collect(Collectors.toList()); - if (collect0.size() > 0) { + if (!collect0.isEmpty()) { return collect0.get(0).getZddh(); } } @@ -586,8 +588,7 @@ public class CommonUtil { if ("S".equals(yhjs)) return true; String userPower = comUsrpowerMapper.getUserPower(yq, yhdh); if (userPower == null) return false; - if ("Y".equals(userPower.substring(powerIdx - 1, 1))) return true; - return false; + return "Y".equals(userPower.substring(powerIdx - 1, 1)); } public byte[] getComUsrdzqm(String yhdh) { return comUsrMapper.getComUsrdzqm(yhdh); diff --git a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/LisWorkUtils.java b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/LisWorkUtils.java index 7b8f6af..618bf23 100644 --- a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/LisWorkUtils.java +++ b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/LisWorkUtils.java @@ -51,6 +51,7 @@ public class LisWorkUtils { CommonUtil commonUtil; @Autowired LisWorkUtils lisWorkUtils; + /** * 初步审核 * @@ -61,7 +62,7 @@ public class LisWorkUtils { * @return */ public Result confirm1(Date jyrq, String yq, String ybh, String hdys, int problemId) { - if (hdys == null || "".equals(hdys)) return new Result("-1", "审核者为空,无法审核!"); + if (hdys == null || hdys.isEmpty()) return new Result("-1", "审核者为空,无法审核!"); LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh); labPat.setHdys(hdys); List labResultList = commonUtil.getLabResultList(jyrq, yq, ybh); @@ -123,7 +124,7 @@ public class LisWorkUtils { public Result saveallresult(Date jyrq, String yq, String ybh) { int finsh = 1; List labResultList = commonUtil.getLabResultList(jyrq, yq, ybh); - if (labResultList == null || labResultList.size() == 0) return new Result("-1", "结果为空!"); + if (labResultList == null || labResultList.isEmpty()) return new Result("-1", "结果为空!"); for (LabResult labResult : labResultList) { String csjg = labResult.getCsjg(); if ("未做".equals(csjg)) { @@ -147,7 +148,7 @@ public class LisWorkUtils { String alarmflag = labPat.getAlarmflag(); if (("1".equals(alarmflag) && !wjz)) { labPat.setAlarmflag(""); - } else if (("".equals(alarmflag)||" ".equals(alarmflag)|| alarmflag == null) && wjz) { + } else if (("".equals(alarmflag) || " ".equals(alarmflag) || alarmflag == null) && wjz) { labPat.setAlarmflag("1"); } commonUtil.updateLabPat(labPat); @@ -164,7 +165,7 @@ public class LisWorkUtils { * @return */ public Result confirm(Date jyrq, String yq, String ybh, String hdys, int problemId) { - if (hdys == null || "".equals(hdys)) return new Result("-1", "审核者为空,无法审核!"); + if (hdys == null || hdys.isEmpty()) return new Result("-1", "审核者为空,无法审核!"); LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh); labPat.setHdys(hdys); List labResultList = commonUtil.getLabResultList(jyrq, yq, ybh); @@ -236,10 +237,10 @@ public class LisWorkUtils { * @return */ private Result beforeconfirm(LabPat labPat, List labResultList, Integer checktype, Integer problemId) { + if (labPat == null) return new Result("-1", "病人信息为空禁止审核!"); Date jyrq = labPat.getJyrq(); String yq = labPat.getYq(); String ybh = labPat.getYbh(); - if (labPat == null) return new Result("-1", "病人信息为空禁止审核!"); String jgbz = labPat.getJgbz(); if ("2".equals(jgbz)) return new Result("1", "报告已审核!"); if ("5".equals(jgbz)) return new Result("-1", "已锁定报告禁止审核!"); @@ -252,33 +253,33 @@ public class LisWorkUtils { } String limit_brly = commonUtil.getHISOPT("limit_brly"); String brly = labPat.getBrly(); - if ("1".equals(limit_brly) && (brly == null || "".equals(brly))) + if ("1".equals(limit_brly) && (brly == null || brly.isEmpty())) return new Result("-1", "病人类型为空,禁止审核!"); String limit_yblx = commonUtil.getHISOPT("limit_yblx"); String yblx = labPat.getYblx(); - if ("1".equals(limit_yblx) && (yblx == null || "".equals(yblx))) + if ("1".equals(limit_yblx) && (yblx == null || yblx.isEmpty())) return new Result("-1", "样本类型为空,禁止审核!"); String limit_brxm = commonUtil.getHISOPT("limit_brxm"); String brxm = labPat.getBrxm(); - if ("1".equals(limit_brxm) && (brxm == null || "".equals(brxm))) + if ("1".equals(limit_brxm) && (brxm == null || brxm.isEmpty())) return new Result("-1", "病人姓名为空,禁止审核!"); - if ((brxm == null || "".equals(brxm)) && problemId < 1) new Result("5", "姓名为空,你确定要审核吗?", 1); + if ((brxm == null || brxm.isEmpty()) && problemId < 1) new Result("5", "姓名为空,你确定要审核吗?", 1); String limit_ksdh = commonUtil.getHISOPT("limit_ksdh"); String ksdh = labPat.getKsdh(); - if ("1".equals(limit_ksdh) && (ksdh == null || "".equals(ksdh))) + if ("1".equals(limit_ksdh) && (ksdh == null || ksdh.isEmpty())) return new Result("-1", "科室单位为空,禁止审核!"); String limit_patno = commonUtil.getHISOPT("limit_patno"); String brdh = labPat.getBrdh(); String brlyname = commonUtil.getComDictNameById("PT", brly); - if ("1".equals(limit_patno) && (brdh == null || "".equals(brdh))) { + if ("1".equals(limit_patno) && (brdh == null || brdh.isEmpty())) { if (!"质控".equals(brlyname)) return new Result("-1", "病历号不能为空,禁止审核!"); } String limit_brpatno = commonUtil.getHISOPT("limit_brpatno"); - if ("1".equals(limit_brpatno) && (brdh == null || "".equals(brdh))) { + if ("1".equals(limit_brpatno) && (brdh == null || brdh.isEmpty())) { if ("1".equals(brly) || "3".equals(brly)) return new Result("-1", "门诊住院的病历号不能为空,禁止审核!"); } String yqdl = commonUtil.getYqdl(yq); - if (labResultList == null || labResultList.size() == 0) return new Result("-1", "结果为空禁止审核!"); + if (labResultList == null || labResultList.isEmpty()) return new Result("-1", "结果为空禁止审核!"); for (LabResult labResult : labResultList) { String csjg = labResult.getCsjg(); if ("未做".equals(csjg)) { @@ -307,7 +308,7 @@ public class LisWorkUtils { if (wxh > 0) return new Result("-1", "有结果为****禁止审核!"); } String sqh = labPat.getSqh(); - if (sqh != null && !"".equals(sqh)) { + if (sqh != null && !sqh.isEmpty()) { if (!"质控".equals(brlyname)) { if ("1".equals(commonUtil.getHISOPT("sp_dublereport"))) { LabPat labPat0 = lisWorkUtilsMapper.checkdublereport(sqh, ybh); @@ -329,7 +330,7 @@ public class LisWorkUtils { } String Userid = labPat.getHdys(); - if (Userid == null || "".equals(Userid)) { + if (Userid == null || Userid.isEmpty()) { Userid = SecurityUtils.getLoginUser().getUsername(); } //初审不需要调用接口 @@ -345,7 +346,7 @@ public class LisWorkUtils { if (!"细菌仪".equals(yqdl)) { if (!"1".equals(commonUtil.getHISOPT("wswcbbgbl"))) { String ls_cbbgyq = commonUtil.getComOptValue(yq, "cbbgyq"); - if (ls_cbbgyq != null && !"".equals(ls_cbbgyq)) { + if (ls_cbbgyq != null && !ls_cbbgyq.isEmpty()) { String ls_ejbgyq = "EJBG" + ls_cbbgyq; ls_cbbgyq = "CBBG" + ls_cbbgyq; int count = commonUtil.getCountByKey(jyrq, ls_cbbgyq, ybh); @@ -398,9 +399,9 @@ public class LisWorkUtils { Date currenttime = DateUtils.getNowDate(); int weekDay = DateUtils.getWeekDay(currenttime); //周末不算 - if (weekDay == 6 && weekDay == 7) return 0; + if (weekDay == 6 || weekDay == 7) return 0; int lt_now = Integer.parseInt(DateUtils.time(currenttime, "HH:mm").replace(":", "")); - if ((sb1 == null || sb1.isEmpty()) && (sb2 == null || sb2.isEmpty())) { + if ((sb1 != null && !sb1.isEmpty()) && (sb2 != null && !sb2.isEmpty())) { sb1 = sb1.replace(":", ""); sb2 = sb2.replace(":", ""); @@ -409,6 +410,10 @@ public class LisWorkUtils { int nsb2 = Integer.parseInt(sb2); if (lt_now > nsb1 && lt_now < nsb2) return 1; } + } + if ((sb3 != null && !sb3.isEmpty()) && (sb4 != null && !sb4.isEmpty())) { + sb3 = sb3.replace(":", ""); + sb4 = sb4.replace(":", ""); if (LisUtil.isTureNumber(sb3) && LisUtil.isTureNumber(sb4)) { int nsb3 = Integer.parseInt(sb3); int nsb4 = Integer.parseInt(sb4); @@ -436,12 +441,12 @@ public class LisWorkUtils { } //计算项目更新 List xmCalcList = commonUtil.getXmCalcList(yq); - if (xmCalcList.size() > 0) { + if (!xmCalcList.isEmpty()) { labResultList = calcsample(labPat, labResultList, xmCalcList); } //补写结果表申请单项目编号 String sqh = labPat.getSqh(); - if (sqh != null && !"".equals(sqh)) setItemSqxmdh(jyrq, yq, ybh, sqh); + if (sqh != null && !sqh.isEmpty()) setItemSqxmdh(jyrq, yq, ybh, sqh); //保存最新参考值结果标志 labResultList = saverefs(labPat); return labResultList; @@ -449,14 +454,13 @@ public class LisWorkUtils { public void setItemSqxmdh(Date jyrq, String yq, String ybh) { String sqh = commonUtil.getSqhByKey(jyrq, yq, ybh); - if (sqh == null || "".equals(sqh)) { - } else { + if (sqh != null && !sqh.isEmpty()) { setItemSqxmdh(jyrq, yq, ybh, sqh); } } private void setItemSqxmdh(Date jyrq, String yq, String ybh, String sqh) { - if (sqh != null && !"".equals(sqh)) { + if (sqh != null && !sqh.isEmpty()) { int sl = labReqdetailMapper.getCountByKey(sqh); if (sl == 1) { String sqxmdh = lisWorkUtilsMapper.selectSqxmdh(sqh); @@ -471,7 +475,7 @@ public class LisWorkUtils { LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh); List labResultList = commonUtil.getLabResultList(jyrq, yq, ybh); List xmCalcList = commonUtil.getXmCalcList(yq); - if (xmCalcList.size() > 0) { + if (!xmCalcList.isEmpty()) { calcsample(labPat, labResultList, xmCalcList); } return new Result("0", "保存成功!"); @@ -491,21 +495,20 @@ public class LisWorkUtils { boolean lb_jsx = false; Map variables = new HashMap<>(); String[] parameters = CalcUtils.getParameters(jsgs); - for (int i = 0; i < parameters.length; i++) { - String itemcode = parameters[i]; + for (String itemcode : parameters) { if ("SEX".equals(itemcode)) { String sex = labPat.getBrxb(); - if(sex==null||"".equals(sex)||" ".equals(sex)){ + if (sex == null || sex.isEmpty() || " ".equals(sex)) { setjgsg = false; break; } - sex=sex.trim(); + sex = sex.trim(); if ("男".equals(sex)) sex = "1"; if ("女".equals(sex)) sex = "2"; variables.put("SEX", sex); lb_jsx = true; } else if ("AGE".equals(itemcode)) { - if(labPat.getNl()==null||labPat.getNldw()==null||"".equals(labPat.getNldw())||" ".equals(labPat.getNldw())){ + if (labPat.getNl() == null || labPat.getNldw() == null || labPat.getNldw().isEmpty() || " ".equals(labPat.getNldw())) { setjgsg = false; break; } @@ -514,7 +517,7 @@ public class LisWorkUtils { lb_jsx = true; } else { List collect = labResultList.stream().filter(result -> result.getXmdh().equals(itemcode)).collect(Collectors.toList()); - if (collect.size() > 0) { + if (!collect.isEmpty()) { variables.put(itemcode, collect.get(0).getCsjg()); } else { setjgsg = false; @@ -613,7 +616,7 @@ public class LisWorkUtils { String retCode = String.valueOf(map.get("retcode")); String retMsg = String.valueOf(map.get("retmsg")); log.info("调用存储过程{}返回值:{},{}", "sp_setrefs", retCode, retMsg); - if (retCode == null || "".equals(retCode) || "-1".equals(retCode)) lb_setbj = false; + if (retCode == null || retCode.isEmpty() || "-1".equals(retCode)) lb_setbj = false; labResultList = commonUtil.getLabResultList(jyrq, yq, ybh); log.info("labResultList.size:{}", labResultList.size()); List xmInfoList = commonUtil.getXmInfoList(yq); @@ -629,8 +632,10 @@ public class LisWorkUtils { //当结果为数值并且与周期诊断无关,计算存储过程保存成功后,只进行危急值判断 if (lb_nummode && lb_setbj && !"Y".equals(ygzd) && !"Y".equals(ygzq)) { if (nowjz) { - String resultalarmflag1 = labResult.getAlarm_flag().trim(); - if (!"".equals(resultalarmflag1) && resultalarmflag1 != null) { + String resultalarmflag1 = labResult.getAlarm_flag(); + if(resultalarmflag1 != null)resultalarmflag1=resultalarmflag1.trim(); + else resultalarmflag1=""; + if (!resultalarmflag1.isEmpty()) { labResult.setAlarm_flag(""); commonUtil.updateLabResult(labResult); } @@ -659,7 +664,7 @@ public class LisWorkUtils { } else { String xmdh = labResult.getXmdh(); List xmInfo0 = xmInfoList.stream().filter(xm -> xm.getXmdh().equals(xmdh)).collect(Collectors.toList()); - if (xmInfo0.size() > 0) { + if (!xmInfo0.isEmpty()) { XmInfo xmInfo = xmInfo0.get(0); List getXmAlarmdetail = xmAlarmdetailList.stream().filter(detail -> detail.getXmdh().equals(xmdh)).collect(Collectors.toList()); LabResult labResult0 = setxmdhrefs(labPat, labResult, xmInfo, getXmAlarmdetail, nowjz); @@ -704,7 +709,7 @@ public class LisWorkUtils { */ private int alarmcondition(LabPat labPat, LabResult labResult, List getXmAlarmdetail) { if (getXmAlarmdetail == null) return -1; - boolean lb_fcb = false, lb_hasval = false; + boolean lb_fcb, lb_hasval = false; String csjg = labResult.getCsjg(); if (csjg == null || csjg.trim().isEmpty()) return -1; String yq = labPat.getYq(); @@ -842,7 +847,7 @@ public class LisWorkUtils { if (altersx != null) hlimit = altersx; } //数值型结果判断 - Double csjgnum = Double.valueOf(csjgnew); + double csjgnum = Double.parseDouble(csjgnew); if (ckxx != null) if (csjgnum < ckxx) resultflag = "L"; if (cksx != null) if (csjgnum > cksx) resultflag = "H"; if (!nowjz) { @@ -858,7 +863,7 @@ public class LisWorkUtils { //文字型结果判断 String jgbzold = labResult.getJgbz(); String lmtflag = getitemlmtflag(yq, xmdh, csjg); - if ("P".equals(jgbzold) && (csjg.indexOf("阳") >= 0 || csjg.indexOf("+") >= 0 || csjg.indexOf(":") >= 0) && (lmtflag == null || lmtflag.trim().isEmpty())) + if ("P".equals(jgbzold) && (csjg.contains("阳") || csjg.contains("+") || csjg.contains(":")) && (lmtflag == null || lmtflag.trim().isEmpty())) lmtflag = "P"; resultflag = lmtflag; if (!nowjz) { @@ -890,7 +895,7 @@ public class LisWorkUtils { } public String getitemlmtflag(String yq, String xmdh, String csjg) { - String jgbz = ""; + String jgbz; if (csjg == null || csjg.isEmpty()) { return ""; } @@ -920,7 +925,7 @@ public class LisWorkUtils { //医学审核条件判断 if (problemId < 6) { String checkvalue = checkResultUtils.chksample(labPat, labResultList); - if (checkvalue != null && !"".equals(checkvalue)) { + if (checkvalue != null && !checkvalue.isEmpty()) { return new Result("5", checkvalue, 6); } } @@ -1093,22 +1098,22 @@ public class LisWorkUtils { Date bbsjsj = labReqmain.getBbsjsj(); Date jssj = labReqmain.getJssj(); Date sjsj = labReqmain.getSjsj(); - if (sjsj == null) sjsj = jysj; - if (sjsj.after(confirmtime)) sjsj = jysj; - if (jssj == null) jssj = sjsj; - if (jssj.after(confirmtime)) jssj = sjsj; + if (sjsj == null&&jysj !=null) sjsj =new Date(jysj.getTime()); + if (sjsj !=null&&sjsj.after(confirmtime)&&jysj !=null) sjsj =new Date(jysj.getTime()); + if (jssj == null&&sjsj !=null) jssj =new Date(sjsj.getTime()); + if (jssj !=null&&jssj.after(confirmtime)&&sjsj !=null) jssj = new Date(sjsj.getTime()); if (bbsjsj != null) { - if (bbsjsj.after(jssj) && jysj.after(bbsjsj)) jssj = jysj; + if (jysj !=null&&bbsjsj.after(jssj) && jysj.after(bbsjsj)) jssj = new Date(jysj.getTime()); } - if (cysj != null) { - if (cysj.after(jssj) && jysj.after(cysj)) jssj = jysj; + if (cysj != null&&jysj !=null) { + if (cysj.after(jssj) && jysj.after(cysj)) jssj =new Date(jysj.getTime()); } - if (jssj.after(sjsj)) sjsj = jysj; + if (jysj !=null&&jssj.after(sjsj)) sjsj =new Date(jysj.getTime()); List labReqsteplog = commonUtil.getLabReqsteplog(sqh); - if (bbsjsj != null && bbsjsj.after(jssj)) { - Date sj = jssj; - Date finalSj = sj; + if (jssj !=null&&bbsjsj != null && bbsjsj.after(jssj)) { + Date sj = new Date(jssj.getTime()); + Date finalSj = new Date(jssj.getTime()); Optional maxTimeEntity = labReqsteplog.stream() .filter(entity -> "13".equals(entity.getZt())) .filter(entity -> entity.getChangedate().before(finalSj)) @@ -1116,13 +1121,13 @@ public class LisWorkUtils { if (maxTimeEntity.isPresent()) { sj = maxTimeEntity.get().getChangedate(); } - bbsjsj = sj; + bbsjsj = new Date(sj.getTime()); labReqmain.setBbsjsj(bbsjsj); } else { - bbsjsj = jssj; + if(jssj !=null) bbsjsj = new Date(jssj.getTime()); } - if (cysj != null && cysj.after(bbsjsj)) { - Date sj = bbsjsj; + if (bbsjsj != null && cysj != null && cysj.after(bbsjsj)) { + Date sj = new Date(bbsjsj.getTime()); Date finalSj = sj; Optional maxTimeEntity = labReqsteplog.stream() .filter(entity -> "12".equals(entity.getZt())) @@ -1131,25 +1136,25 @@ public class LisWorkUtils { if (maxTimeEntity.isPresent()) { sj = maxTimeEntity.get().getChangedate(); } - cysj = sj; + cysj =new Date(sj.getTime()); labReqmain.setCysj(cysj); } - if (cysj != null && zxsj.after(cysj) && bbsjsj.after(zxsj)) { - Date sj = bbsjsj; - Date finalSj = sj; + if (bbsjsj != null && cysj != null && zxsj.after(cysj) && bbsjsj.after(zxsj)) { + + Date finalSj = new Date(bbsjsj.getTime()); Optional maxTimeEntity = labReqsteplog.stream() .filter(entity -> "12".equals(entity.getZt())) .filter(entity -> entity.getChangedate().before(finalSj)) .max(Comparator.comparing(LabReqsteplog::getChangedate)); if (maxTimeEntity.isPresent()) { cysj = maxTimeEntity.get().getChangedate(); - } else cysj = zxsj; + } else cysj = new Date(zxsj.getTime()); labReqmain.setCysj(cysj); } else { - cysj = bbsjsj; + if(bbsjsj != null ) cysj =new Date(bbsjsj.getTime()); } - if (zxsj != null && zxsj.after(cysj)) { - Date sj = cysj; + if (cysj != null && zxsj != null && zxsj.after(cysj)) { + Date sj = new Date(cysj.getTime()); Date finalSj = sj; Optional maxTimeEntity = labReqsteplog.stream() .filter(entity -> "11".equals(entity.getZt())) @@ -1159,10 +1164,10 @@ public class LisWorkUtils { sj = maxTimeEntity.get().getChangedate(); } - zxsj = sj; + zxsj = new Date(sj.getTime()); labReqmain.setZxsj(zxsj); } - labReqmain.setSjsj(sjsj); + if (sjsj != null)labReqmain.setSjsj(sjsj); } return labReqmain; } @@ -1195,7 +1200,7 @@ public class LisWorkUtils { labRefused.setSqh(ls_sqh); labRefused.setRefusetext(ls_xpywrdh); List labRefusedList = commonUtil.getLabRefusedList(labRefused); - if (labRefusedList.size() == 0) { + if (labRefusedList.isEmpty()) { labRefused.setRefusedtime(new Date()); labRefused.setKsdh(labPat.getKsdh()); labRefused.setBz("0"); @@ -1215,8 +1220,8 @@ public class LisWorkUtils { */ private boolean getAlarmFlag(List labResultList) { boolean wjz = false; - List labResultList0 = labResultList.stream().filter(xm -> !"".equals(xm.getAlarm_flag().trim()) && xm.getAlarm_flag() != null).collect(Collectors.toList()); - if (labResultList0.size() > 0) { + List labResultList0 = labResultList.stream().filter(xm ->xm.getAlarm_flag() != null).filter(xm -> !xm.getAlarm_flag().trim().isEmpty()).collect(Collectors.toList()); + if (!labResultList0.isEmpty()) { wjz = true; } return wjz; @@ -1229,9 +1234,9 @@ public class LisWorkUtils { * @return */ private String getAlarmMsg(List labResultList) { - String wjzmsg = ""; - List labResultList0 = labResultList.stream().filter(xm -> !"".equals(xm.getAlarm_flag().trim()) && xm.getAlarm_flag() != null).collect(Collectors.toList()); - if (labResultList0.size() > 0) { + StringBuilder wjzmsg = new StringBuilder(); + List labResultList0 = labResultList.stream().filter(xm ->xm.getAlarm_flag() != null).filter(xm -> !xm.getAlarm_flag().trim().isEmpty()).collect(Collectors.toList()); + if (!labResultList0.isEmpty()) { for (LabResult labResult : labResultList0) { String xmmc = labResult.getXmmc(); String cjsg = labResult.getCsjg(); @@ -1241,10 +1246,10 @@ public class LisWorkUtils { cjsg = ""; } - wjzmsg = wjzmsg + "项目:" + xmmc + cjsg + LisUtil.LINE_SEPARATOR; + wjzmsg.append("项目:").append(xmmc).append(cjsg).append(LisUtil.LINE_SEPARATOR); } } - return wjzmsg; + return wjzmsg.toString(); } /** @@ -1343,11 +1348,11 @@ public class LisWorkUtils { yhdh = sysUser.getNickName(); } else { String yhxm = commonUtil.getComUsrName(yhdh); - if (yhxm != null && "".equals(yhxm)) yhdh = yhxm; + if (yhxm != null && yhxm.isEmpty()) yhdh = yhxm; } String sjys = labPat.getSjys(); String sjysname = commonUtil.getComDictNameById("SRD", sjys); - if (sjysname == null || "".equals(sjysname)) { + if (sjysname == null || sjysname.isEmpty()) { sjysname = sjys; } if ("".equals(qrr) || qrr == null) { @@ -1369,8 +1374,8 @@ public class LisWorkUtils { } commonUtil.insertLabPatwarning(labPatwarning); String ls_bz = ""; - List labResultList0 = labResultList.stream().filter(xm -> !"".equals(xm.getAlarm_flag().trim()) && xm.getAlarm_flag() != null).collect(Collectors.toList()); - if (labResultList0.size() > 0) { + List labResultList0 = labResultList.stream().filter(xm -> xm.getAlarm_flag() != null).filter(xm -> !xm.getAlarm_flag().trim().isEmpty()).collect(Collectors.toList()); + if (!labResultList0.isEmpty()) { for (LabResult labResult : labResultList0) { LabResultwarning labResultwarning = new LabResultwarning(); labResultwarning.setJyrq(jyrq); @@ -1457,7 +1462,7 @@ public class LisWorkUtils { * @return */ public Result unconfirm(Date jyrq, String yq, String ybh, String yhdh) { - if (yhdh == null || "".equals(yhdh)) return new Result("1", "操作者为空,无法解除审核!"); + if (yhdh == null || yhdh.isEmpty()) return new Result("1", "操作者为空,无法解除审核!"); int problemId = ServletUtils.getParameterToInt("problemId", 0); LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh); if (problemId < 3) { @@ -1549,7 +1554,7 @@ public class LisWorkUtils { } public Result unconfirm1(Date jyrq, String yq, String ybh, String yhdh) { - if (yhdh == null || "".equals(yhdh)) return new Result("1", "操作者为空,无法解除审核!"); + if (yhdh == null || yhdh.isEmpty()) return new Result("1", "操作者为空,无法解除审核!"); int problemId = ServletUtils.getParameterToInt("problemId", 0); LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh); if (problemId < 3) { @@ -1600,17 +1605,17 @@ public class LisWorkUtils { loginConfigParam.setCurrent_labInputcol(labInputcolList); } } - Boolean setcalc = false; + boolean setcalc = false; List xmCalcList = null; switch (column) { case "brxb": xmCalcList = commonUtil.getXmCalcbyxmdh(yq, "SEX"); - if (xmCalcList.size() > 0) setcalc = true; + if (!xmCalcList.isEmpty()) setcalc = true; break; case "nl": case "nldw": xmCalcList = commonUtil.getXmCalcbyxmdh(yq, "AGE"); - if (xmCalcList.size() > 0) setcalc = true; + if (!xmCalcList.isEmpty()) setcalc = true; break; } if (setcalc) { @@ -1618,9 +1623,9 @@ public class LisWorkUtils { LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh); boolean nowjz = checknowjz(labPat); labResultList = calcsample(labPat, labResultList, xmCalcList); - if(labResultList.size()>0) { + if (!labResultList.isEmpty()) { List labResultList1 = labResultList.stream().filter(labR -> labR.getChangeflag() != null && labR.getChangeflag() == 1).collect(Collectors.toList()); - if (labResultList1.size() > 0) { + if (!labResultList1.isEmpty()) { for (LabResult labResult0 : labResultList1) { changeresultf(labPat, labResult0, nowjz); } @@ -1645,34 +1650,35 @@ public class LisWorkUtils { String jgbz = commonUtil.getLabPatJgbz(jyrq, yq, ybh); if ("2".equals(jgbz)) return new Result("-1", "结果已审核禁止删除!"); if ("5".equals(jgbz)) return new Result("-1", "结果已锁定禁止删除!"); - // if ("1".equals(jgbz)) return new Result("-1", "结果已初审禁止删除!"); - //IF MessageBox("删除","你确定删除当前 " + ls_ybh + " 号标本?",question!,YesNo!,2) = 2 THEN RETURN 1 交给前端 - String yqdl=commonUtil.getYqdl(yq); - if("细菌仪".equals(yqdl)) { - String cbbgyq=commonUtil.getComOptValue(yq,"cbbgyq"); - if(cbbgyq!=null&&!"".equals(cbbgyq)) { - String is_instr_cbbg="CBBG"+cbbgyq; - String is_instr_ejbg="EJBG"+cbbgyq; + // if ("1".equals(jgbz)) return new Result("-1", "结果已初审禁止删除!"); + //IF MessageBox("删除","你确定删除当前 " + ls_ybh + " 号标本?",question!,YesNo!,2) = 2 THEN RETURN 1 交给前端 + String yqdl = commonUtil.getYqdl(yq); + if ("细菌仪".equals(yqdl)) { + String cbbgyq = commonUtil.getComOptValue(yq, "cbbgyq"); + if (cbbgyq != null && !cbbgyq.isEmpty()) { + String is_instr_cbbg = "CBBG" + cbbgyq; + String is_instr_ejbg = "EJBG" + cbbgyq; String jgbz0 = commonUtil.getLabPatJgbz(jyrq, is_instr_cbbg, ybh); - if(jgbz0!=null) { - if("2".equals(jgbz0)||"3".equals(jgbz0)){ + if (jgbz0 != null) { + if ("2".equals(jgbz0) || "3".equals(jgbz0)) { return new Result("1", "初步报告已经被审核,撤回前无法删除!"); } } String jgbz1 = commonUtil.getLabPatJgbz(jyrq, is_instr_ejbg, ybh); - if(jgbz1!=null) { - if("2".equals(jgbz1)||"4".equals(jgbz1)){ + if (jgbz1 != null) { + if ("2".equals(jgbz1) || "4".equals(jgbz1)) { return new Result("1", "二级报告已经被审核,撤回前无法删除!"); } } - if(jgbz0!=null) delsample(jyrq, is_instr_cbbg, ybh); - if(jgbz1!=null) delsample(jyrq, is_instr_ejbg, ybh); + if (jgbz0 != null) delsample(jyrq, is_instr_cbbg, ybh); + if (jgbz1 != null) delsample(jyrq, is_instr_ejbg, ybh); } } delsample(jyrq, yq, ybh); - setComLog(jyrq, yq, ybh,yhdh,ComLogConstants.LG_M,"删除整个样本"); + setComLog(jyrq, yq, ybh, yhdh, ComLogConstants.LG_M, "删除整个样本"); return new Result("0", "保存成功"); } + private void delsample(Date jyrq, String yq, String ybh) { commonUtil.delLabResultMedAll(jyrq, yq, ybh); commonUtil.delLabResultAll(jyrq, yq, ybh); @@ -1699,11 +1705,11 @@ public class LisWorkUtils { labResult = setxmdhrefs(labPat, labResult, xmInfo, getXmAlarmdetail, nowjz); commonUtil.insertLabResult(labResult); List xmCalcList = commonUtil.getXmCalcbyxmdh(yq, xmdh); - if (xmCalcList.size() > 0) { + if (!xmCalcList.isEmpty()) { List labResultList = commonUtil.getLabResultList(jyrq, yq, ybh); labResultList = calcsample(labPat, labResultList, xmCalcList); List labResultList1 = labResultList.stream().filter(labR -> labR.getChangeflag() != null).filter(labR -> labR.getChangeflag() == 1).collect(Collectors.toList()); - if (labResultList1.size() > 0) { + if (!labResultList1.isEmpty()) { for (LabResult labResult0 : labResultList1) { changeresultf(labPat, labResult0, nowjz); } @@ -1743,11 +1749,11 @@ public class LisWorkUtils { labResult = setxmdhrefs(labPat, labResult, xmInfo, getXmAlarmdetail, nowjz); commonUtil.updateLabResult(labResult); List xmCalcList = commonUtil.getXmCalcbyxmdh(yq, xmdh); - if (xmCalcList.size() > 0) { + if (!xmCalcList.isEmpty()) { List labResultList = commonUtil.getLabResultList(jyrq, yq, ybh); labResultList = calcsample(labPat, labResultList, xmCalcList); List labResultList1 = labResultList.stream().filter(labR -> labR.getChangeflag() != null).filter(labR -> labR.getChangeflag() == 1).collect(Collectors.toList()); - if (labResultList1.size() > 0) { + if (!labResultList1.isEmpty()) { for (LabResult labResult0 : labResultList1) { changeresultf(labPat, labResult0, nowjz); } @@ -1780,11 +1786,11 @@ public class LisWorkUtils { LabInstrvsreqclass labInstrvsreqclass = new LabInstrvsreqclass(); labInstrvsreqclass.setYq(yq); List labInstrvsreqclassList = labInstrvsreqclassMapper.getLabInstrvsreqclassList(labInstrvsreqclass); - if (labInstrvsreqclassList.size() > 0) { + if (!labInstrvsreqclassList.isEmpty()) { List collect = labInstrvsreqclassList.stream().filter(labInstrvsreqclass1 -> labInstrvsreqclass1.getBgddh().equals(bgddh)).collect(Collectors.toList()); List collect1 = labInstrvsreqclassList.stream().filter(labInstrvsreqclass1 -> labInstrvsreqclass1.getBgddh().equals("MZ_" + bgddh)).collect(Collectors.toList()); - if (collect.size() > 0) return new Result("0", ""); - if (collect1.size() > 0) return new Result("0", ""); + if (!collect.isEmpty()) return new Result("0", ""); + if (!collect1.isEmpty()) return new Result("0", ""); } Long count = lisWorkUtilsMapper.checkReqClass(sqh, yq); if (count > 0) { @@ -1800,9 +1806,9 @@ public class LisWorkUtils { String yq = labPat.getYq(); String ybh = labPat.getYbh(); String userId = labPat.getYhdh(); - Date sjsj=commonUtil.getCurrentTime(); + Date sjsj = commonUtil.getCurrentTime(); //修改状态和时间 - commonUtil.zxLabReqmain(sqh,userId); + commonUtil.zxLabReqmain(sqh, userId); //保存lab_pat表信息 labPat.setYblx(commonUtil.getComDictIdByName("BT", labReqmain.getYblx())); labPat.setKsdh(commonUtil.getComDictIdByName("DP", labReqmain.getKsdh())); @@ -1812,8 +1818,8 @@ public class LisWorkUtils { labPat.setBrxb(labReqmain.getBrxb()); labPat.setBrly(labReqmain.getBrly()); labPat.setSjys(labReqmain.getSqys()); - String brxb=labReqmain.getBrxb(); - if(brxb!=null)brxb=brxb.trim(); + String brxb = labReqmain.getBrxb(); + if (brxb != null) brxb = brxb.trim(); labPat.setBrxb(brxb); labPat.setCh(labReqmain.getCh()); Map ageFromBirthDay = AgeUtils.getAgeByBirthDate(labReqmain.getBrsr()); @@ -1837,7 +1843,7 @@ public class LisWorkUtils { labPat.setLstd(labReqmain.getLstd()); labPat.setCjbw(labReqmain.getCjbw()); String brxm0 = labPat.getBrxm(); - if(!"".equals(brxm0)&&brxm0!=null) { + if (!"".equals(brxm0) && brxm0 != null) { String pinyin = PinyinUtil.getFirstLetter(brxm0, ""); //拼音首字母 if (pinyin.length() >= 9) { pinyin = pinyin.substring(0, 9); @@ -1848,9 +1854,10 @@ public class LisWorkUtils { else commonUtil.updateLabPat(labPat); return new Result("0", "保存成功!", labPat); } - public Result newPat(Date jyrq, String ybh, String yq, String brdh,String brly,String yljg,int problemId) { - if(brly==null)brly=""; - if(yljg==null||"".equals(yljg))yljg=commonUtil.getLabInstr(yq).getYljg(); + + public Result newPat(Date jyrq, String ybh, String yq, String brdh, String brly, String yljg, int problemId) { + if (brly == null) brly = ""; + if (yljg == null || yljg.isEmpty()) yljg = commonUtil.getLabInstr(yq).getYljg(); LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh); boolean newpatinfo = true; if (labPat != null) { @@ -1863,7 +1870,7 @@ public class LisWorkUtils { String sqh0 = labPat.getSqh(); String brxm = labPat.getBrxm(); if (problemId < 1) { - if ((brdh0 != null && !"".equals(brdh0)) || (sqh0 != null && !"".equals(sqh0)) || (brxm != null && !"".equals(brxm))) { + if ((brdh0 != null && !brdh0.isEmpty()) || (sqh0 != null && !sqh0.isEmpty()) || (brxm != null && !brxm.isEmpty())) { return new Result("5", "当前样本已有病人信息是否替换!", 1); } } @@ -1875,63 +1882,63 @@ public class LisWorkUtils { labPat.setYq(yq); labPat.setYbh(ybh); labPat.setBrdh(brdh); - if(!"".equals(brdh)){ - //4.获取病人信息 - DayMessage dayMessage = new DayMessage(); - dayMessage.setIp(""); - dayMessage.setYljg("1"); - dayMessage.setUserid(yhdh); - dayMessage.setMsgid(LisinterfaceNameConstants.DAYMESSAGE_GETPATIENT); - String val =brdh + "|"+brly+"|"+yljg; //这里有个医疗机构的,没有传,要考虑 - dayMessage.setMsg(val); - Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.DAYMESSAGE, dayMessage); - String msg=result.getMsg(); - String[] msgret = msg.split("\\|"); + if (!"".equals(brdh)) { + //4.获取病人信息 + DayMessage dayMessage = new DayMessage(); + dayMessage.setIp(""); + dayMessage.setYljg("1"); + dayMessage.setUserid(yhdh); + dayMessage.setMsgid(LisinterfaceNameConstants.DAYMESSAGE_GETPATIENT); + String val = brdh + "|" + brly + "|" + yljg; //这里有个医疗机构的,没有传,要考虑 + dayMessage.setMsg(val); + Result result = lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.DAYMESSAGE, dayMessage); + String msg = result.getMsg(); + String[] msgret = msg.split("\\|"); - if(msgret.length>8) { - labPat.setBrxm(msgret[0]); - labPat.setBrxb(msgret[1]); - String brsr=msgret[2]; - if(!"".equals(brsr)&&brsr!=null) { - Map ageFromBirthDay = AgeUtils.getAgeByBirthDate(brsr); - String age = ageFromBirthDay.get("nl").toString(); - String unit = ageFromBirthDay.get("nldw").toString(); - labPat.setNl(Integer.parseInt(age)); - labPat.setNldw(unit); + if (msgret.length > 8) { + labPat.setBrxm(msgret[0]); + labPat.setBrxb(msgret[1]); + String brsr = msgret[2]; + if (!"".equals(brsr) && brsr != null) { + Map ageFromBirthDay = AgeUtils.getAgeByBirthDate(brsr); + String age = ageFromBirthDay.get("nl").toString(); + String unit = ageFromBirthDay.get("nldw").toString(); + labPat.setNl(Integer.parseInt(age)); + labPat.setNldw(unit); + } + labPat.setBrdh(msgret[3]); + labPat.setFb(msgret[4]); + labPat.setBrly(msgret[5]); + labPat.setCh(msgret[6]); + labPat.setKsdh(msgret[7]); + labPat.setZd(msgret[8]); + } else { + List comPatList = commonUtil.getComPat(brdh, yljg); + if (!comPatList.isEmpty()) { + ComPat comPat = comPatList.get(0); + labPat.setBrxm(comPat.getBrxm()); + labPat.setCh(comPat.getCh()); + labPat.setBrxm(comPat.getXb()); + labPat.setBrly(comPat.getBrly()); + labPat.setFb(comPat.getFb()); + labPat.setKsdh(comPat.getKsdh()); + labPat.setZd(comPat.getZd()); + labPat.setMzh(comPat.getMzh()); + labPat.setSjys(comPat.getSjys()); + Date sr = comPat.getSr(); + if (sr != null) { + Map ageFromBirthDay = AgeUtils.getAgeByBirthDate(sr); + String age = ageFromBirthDay.get("nl").toString(); + String unit = ageFromBirthDay.get("nldw").toString(); + labPat.setNl(Integer.parseInt(age)); + labPat.setNldw(unit); + } + } } - labPat.setBrdh(msgret[3]); - labPat.setFb(msgret[4]); - labPat.setBrly(msgret[5]); - labPat.setCh(msgret[6]); - labPat.setKsdh(msgret[7]); - labPat.setZd(msgret[8]); - }else{ - List comPatList= commonUtil.getComPat(brdh,yljg); - if(comPatList.size()>0) { - ComPat comPat=comPatList.get(0); - labPat.setBrxm(comPat.getBrxm()); - labPat.setCh(comPat.getCh()); - labPat.setBrxm(comPat.getXb()); - labPat.setBrly(comPat.getBrly()); - labPat.setFb(comPat.getFb()); - labPat.setKsdh(comPat.getKsdh()); - labPat.setZd(comPat.getZd()); - labPat.setMzh(comPat.getMzh()); - labPat.setSjys(comPat.getSjys()); - Date sr=comPat.getSr(); - if(sr!=null) { - Map ageFromBirthDay = AgeUtils.getAgeByBirthDate(sr); - String age = ageFromBirthDay.get("nl").toString(); - String unit = ageFromBirthDay.get("nldw").toString(); - labPat.setNl(Integer.parseInt(age)); - labPat.setNldw(unit); - } - } - } } labPat = loaddefault(labPat); String brxm0 = labPat.getBrxm(); - if(!"".equals(brxm0)&&brxm0!=null) { + if (!"".equals(brxm0) && brxm0 != null) { String pinyin = PinyinUtil.getFirstLetter(brxm0, ""); //拼音首字母 if (pinyin.length() >= 9) { pinyin = pinyin.substring(0, 9); @@ -1943,6 +1950,7 @@ public class LisWorkUtils { else commonUtil.updateLabPat(labPat); return new Result("0", "保存成功!", labPat); } + public Result newPatInfo(Date jyrq, String ybh, String sqh, String yq, int problemId) { LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh); @@ -1957,7 +1965,7 @@ public class LisWorkUtils { String sqh0 = labPat.getSqh(); String brxm = labPat.getBrxm(); if (problemId < 1) { - if ((brdh != null && !"".equals(brdh)) || (sqh0 != null && !"".equals(sqh0)) || (brxm != null && !"".equals(brxm))) { + if ((brdh != null && !brdh.isEmpty()) || (sqh0 != null && !sqh0.isEmpty()) || (brxm != null && !brxm.isEmpty())) { return new Result("5", "当前样本已有病人信息是否替换!", 1); } } @@ -2009,11 +2017,12 @@ public class LisWorkUtils { if (!result3.getCode().equals("0")) return result3; //6.写日志 - lisWorkUtils.setComLog(jyrq,yq,ybh,yhdh,ComLogConstants.LG_SJ,sqh); - if(sqh!=null||"".equals(sqh))lisWorkUtils.setlabReqsteplog(sqh,LabReqmainConstants.START,yhdh); + lisWorkUtils.setComLog(jyrq, yq, ybh, yhdh, ComLogConstants.LG_SJ, sqh); + if (sqh != null && !sqh.isEmpty()) lisWorkUtils.setlabReqsteplog(sqh, LabReqmainConstants.START, yhdh); - return new Result("0", "",labPat); + return new Result("0", "", labPat); } + public LabPat loaddefault(LabPat labPat) { Date jyrq = labPat.getJyrq(); String yq = labPat.getYq(); @@ -2024,7 +2033,7 @@ public class LisWorkUtils { SysLoginParam loginConfigParam = loginConfigParamUtil.getLoginConfigParam(); String Current_instrid = loginConfigParam.getCurrent_instrid(); List labInputcolList = loginConfigParam.getCurrent_labInputcol(); - if (Current_instrid == null || !yq.equals(Current_instrid)) { + if (!yq.equals(Current_instrid)) { loginConfigParam.setCurrent_yhdh_sybh(""); loginConfigParam.setCurrent_yhdh_eybh(""); loginConfigParam.setCurrent_hdys_sybh(""); @@ -2032,10 +2041,10 @@ public class LisWorkUtils { labInputcolList = commonUtil.getLabInputcol(yq); loginConfigParam.setCurrent_labInputcol(labInputcolList); } - List labInputcolList0 = labInputcolList.stream().filter(labInputcol0 -> labInputcol0.getMrz() != null && !"".equals(labInputcol0.getMrz())).collect(Collectors.toList()); + List labInputcolList0 = labInputcolList.stream().filter(labInputcol0 -> labInputcol0.getMrz() != null && !labInputcol0.getMrz().isEmpty()).collect(Collectors.toList()); String mrz = null; for (LabInputcol labInputcol : labInputcolList0) { - if (!"!".equals(labInputcol)) { + if (!"!".equals(labInputcol.getZdmc())) { String zdmc = labInputcol.getZdmc(); switch (zdmc) { @@ -2045,13 +2054,13 @@ public class LisWorkUtils { case "nl": break; case "yhdh": - String yhdh0=labPat.getYhdh(); - if (yhdh0 == null ||"".equals(yhdh0)) { + String yhdh0 = labPat.getYhdh(); + if (yhdh0 == null || yhdh0.isEmpty()) { mrz = labInputcol.getMrz(); - if (mrz != null && "".equals(mrz)) { + if (mrz != null && !mrz.isEmpty()) { String sybh = loginConfigParam.getCurrent_yhdh_sybh(); String eybh = loginConfigParam.getCurrent_yhdh_eybh(); - if ("".equals(sybh) && "".equals(eybh) && sybh != null && eybh != null) { + if (!"".equals(sybh) && !"".equals(eybh) && sybh != null && eybh != null) { if (LisUtil.isStringBetween(ybh, sybh, eybh)) { labPat.setYhdh(mrz); } @@ -2062,11 +2071,11 @@ public class LisWorkUtils { } break; case "hdys": - String hdys0=labPat.getYhdh(); - if (hdys0 == null ||"".equals(hdys0)) { + String hdys0 = labPat.getYhdh(); + if (hdys0 == null || hdys0.isEmpty()) { String sybh = loginConfigParam.getCurrent_hdys_sybh(); String eybh = loginConfigParam.getCurrent_hdys_eybh(); - if ("".equals(sybh) && "".equals(eybh) && sybh != null && eybh != null) { + if (!"".equals(sybh) && !"".equals(eybh)) { if (LisUtil.isStringBetween(ybh, sybh, eybh)) { labPat.setHdys(mrz); } @@ -2076,10 +2085,10 @@ public class LisWorkUtils { } break; default: - String value=(String)EntityUtils.getItem(labPat,zdmc); - if (value == null ||"".equals(value)) { + String value = (String) EntityUtils.getItem(labPat, zdmc); + if (value == null || value.isEmpty()) { mrz = labInputcol.getMrz(); - if (mrz != null && !"".equals(mrz)) { + if (mrz != null && !mrz.isEmpty()) { EntityUtils.setItem(labPat, zdmc, mrz); } } @@ -2087,12 +2096,12 @@ public class LisWorkUtils { } } String yhdh = SecurityUtils.getLoginUser().getUsername(); - if (labPat.getYhdh() == null || "".equals(labPat.getYhdh())) + if (labPat.getYhdh() == null || labPat.getYhdh().isEmpty()) labPat.setYhdh(SecurityUtils.getLoginUser().getUsername()); labPat.setLastuser(yhdh); labPat.setLastdt(ldt_now); - Integer shcs=labPat.getShcs(); - if(shcs==null)labPat.setShcs(0); + Integer shcs = labPat.getShcs(); + if (shcs == null) labPat.setShcs(0); if (labPat.getJgbz() == null) labPat.setJgbz(LabPatConstants.DEFAULT); return labPat; } diff --git a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/ReportUtil.java b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/ReportUtil.java index dfd7a82..7034609 100644 --- a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/ReportUtil.java +++ b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/ReportUtil.java @@ -54,15 +54,15 @@ public class ReportUtil { public void printBarCode(BarCodeParam mzBarCodeParam) { + Map parameters=new HashMap<>(); + parameters.put("barcode", mzBarCodeParam.getSqh()); + parameters.put("line1", mzBarCodeParam.getBrxm() + " " + mzBarCodeParam.getBrxb() + " " + mzBarCodeParam.getNl()); + parameters.put("line2", mzBarCodeParam.getSfxmmc()); try { //构造数据 - Map parameters = new HashMap(); - parameters.put("barcode", mzBarCodeParam.getSqh()); - parameters.put("line1", mzBarCodeParam.getBrxm() + " " + mzBarCodeParam.getBrxb() + " " + mzBarCodeParam.getNl()); - parameters.put("line2", mzBarCodeParam.getSfxmmc()); JasperReportUtil.print(RuoYiConfig.getMzPrintName(), "barcode", parameters); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(); log.error("打印条码报错,条码号:{}", mzBarCodeParam.getSqh(), e); } } @@ -71,7 +71,6 @@ public class ReportUtil { public void printBackpaper(List sqhs) { String sqh = sqhs.get(0); BackPaperParam backPaperParam = backPaperMapper.selectReqmian(sqh); - // ObjectMapper objectMapper = new ObjectMapper(); Map parameters = BeanUtil.beanToMap(backPaperParam); parameters.put("company", commonUtil.getCompany(backPaperParam.getYljg())); parameters.put("age", AgeUtils.getAge(backPaperParam.getBrsr())); @@ -85,13 +84,13 @@ public class ReportUtil { String bglqsm = ""; if (bglqdh1 != null) { List labRptgetruledetail = backPaperMapper.getLabRptgetruledetail(bglqdh1); - if (labRptgetruledetail.size() > 0) { + if (!labRptgetruledetail.isEmpty()) { bglqsm = labRptgetruledetail.get(0).getBglqsm(); } } - if (bglqdh2 != null && bglqsm != null && !bglqsm.trim().equals("")) { + if (bglqdh2 != null && bglqsm != null && !bglqsm.trim().isEmpty()) { List labRptgetruledetail = backPaperMapper.getLabRptgetruledetail(bglqdh2); - if (labRptgetruledetail.size() > 0) { + if (!labRptgetruledetail.isEmpty()) { bglqsm = labRptgetruledetail.get(0).getBglqsm(); } } @@ -101,7 +100,7 @@ public class ReportUtil { try { //构造数据 - System.out.println("入参参数:" + parameters.toString()); + System.out.println("入参参数:" + parameters); JasperReportUtil.print(RuoYiConfig.getMzPrintName(), "backpaper", parameters, detailList); } catch (Exception e) { e.printStackTrace(); @@ -116,7 +115,7 @@ public class ReportUtil { public Result printToPdf(String templatename, BarCodeParam barCodeParam, String pdfName, boolean base64) { String staticpath=ImageUtils.getStaticPath()+ File.separator; - String outputPath = staticpath+ File.separator + "printPDF"+ File.separator + UUID.randomUUID().toString() + ".pdf"; // PDF输出路径(多级目录会自动创建) + String outputPath = staticpath+ File.separator + "printPDF"+ File.separator + UUID.randomUUID() + ".pdf"; // PDF输出路径(多级目录会自动创建) Map stringObjectMap = BeanUtil.beanToMap(barCodeParam); try { Connection connection = dataSource.getConnection(); @@ -130,9 +129,9 @@ public class ReportUtil { if (base64) { //删除图片文件 String[] pic = barCodeParam.getPic(); - if(pic != null && pic.length > 0){ - for (int i = 0; i < pic.length; i++) { - String picFilePath =staticpath+ File.separator +"graphs"+File.separator + StrUtil.splitToArray(pic[i], "graphs/")[1]; + if(pic != null){ + for (String s : pic) { + String picFilePath = staticpath + File.separator + "graphs" + File.separator + StrUtil.splitToArray(s, "graphs/")[1]; FileUtils.deleteFile(picFilePath); } } @@ -154,8 +153,8 @@ public class ReportUtil { return getHttpURL("printPDF")+"/"+pdfName+".pdf"; } public String getHttpURL(String pathChild) { - String httpPath = ""; - if (printURL == null || printURL.equals("")) { + String httpPath; + if (printURL == null || printURL.isEmpty()) { httpPath = "http://" + IpUtils.getHostIp() + ":" + port + "/" + pathChild; } else { httpPath = "http://" + printURL + ":" + port + "/" + pathChild; @@ -166,10 +165,10 @@ public class ReportUtil { /** * 判断当前报告单是否使用A4报告单 * - * @param jyrq - * @param yq - * @param ybh - * @return + * @param jyrq 检验日期 + * @param yq 仪器 + * @param ybh 样本号 + * @return 返回纸张格式 */ public String getReportPaperSize(Date jyrq, String yq, String ybh) { //是否分A4,A5报告单 @@ -237,9 +236,9 @@ public class ReportUtil { */ public void mergePdfsHorizontally(String Base64input1, String Base64input2, String output) throws IOException { //把base64数据生成pdf文件 - String path1 = RuoYiConfig.getProfile() + "/config/static/printPDF/" + UUID.randomUUID().toString() + ".pdf"; + String path1 = RuoYiConfig.getProfile() + "/config/static/printPDF/" + UUID.randomUUID() + ".pdf"; Base64.decodeToFile(Base64input1, new File(path1)); - String path2 = RuoYiConfig.getProfile() + "/config/static/printPDF/" + UUID.randomUUID().toString() + ".pdf"; + String path2 = RuoYiConfig.getProfile() + "/config/static/printPDF/" + UUID.randomUUID() + ".pdf"; Base64.decodeToFile(Base64input2, new File(path2)); try (PdfWriter writer = new PdfWriter(output); PdfDocument pdfDoc = new PdfDocument(writer); @@ -360,10 +359,10 @@ public class ReportUtil { String[] filename = new String[labGraphList.size()]; String httpPath = getHttpURL(filepath); int filecount = 0; - if (labGraphList.size() > 0) { + if (!labGraphList.isEmpty()) { for (LabGraph labGraph : labGraphList) { String txlb = labGraph.getTxlb(); - String txlbmc = UUID.randomUUID().toString() + "." + txlb.toLowerCase(); + String txlbmc = UUID.randomUUID() + "." + txlb.toLowerCase(); byte[] txnr = labGraph.getTxnr(); try { ImageUtils.generateToStaticDir(txnr, filepath, txlbmc); @@ -379,11 +378,11 @@ public class ReportUtil { /** * 获取电子签名 - * @param yhdh - * @return + * @param yhdh 用户代号 + * @return 签名地址 */ public String getSignName(String yhdh) { - if(yhdh==null||"".equals(yhdh))return ""; + if(yhdh==null|| yhdh.isEmpty())return ""; //SELECT zplx INTO :ls_pictype FROM off_staff WHERE rydh = :as_userno ; String pictype="jpg";//暂时写死是jpg,8.0新版本后期可以考虑用户表增加字段指定类型 String dirpath="signname"; diff --git a/lis-interfaceCommon/src/main/resources/mapper/LabInstrMapper.xml b/lis-interfaceCommon/src/main/resources/mapper/LabInstrMapper.xml index 3f9d9eb..50ac14b 100644 --- a/lis-interfaceCommon/src/main/resources/mapper/LabInstrMapper.xml +++ b/lis-interfaceCommon/src/main/resources/mapper/LabInstrMapper.xml @@ -21,6 +21,25 @@ + +