主程序

This commit is contained in:
tangw 2025-10-20 15:49:07 +08:00
parent 96d67c84ad
commit 4c6012bfec
7 changed files with 155 additions and 16 deletions

View File

@ -47,4 +47,5 @@ public class LabResult extends BaseEntity {
private Integer cp_modify;
private String cp_compa;
private String cp_lastflag;
private Date cp_lastjyrq;
}

View File

@ -1,6 +1,7 @@
package com.czlis.interfaceCommon.mapper;
import com.czlis.common.core.domain.entity.lis.LabPat;
import com.czlis.interfaceCommon.pojo.entity.LastLabPatParam;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
@ -22,5 +23,5 @@ public interface LabPatMapper {
int getCountByKey(@Param("jyrq") Date jyrq, @Param("yq") String yq,@Param("ybh") String ybh) ;
//根据编号查sqh
String getSqhByKey(@Param("jyrq")Date jyrq,@Param("yq") String yq,@Param("ybh") String ybh);
List<LabPat> getlastLabPat(LastLabPatParam lastLabPatParam);
}

View File

@ -0,0 +1,20 @@
package com.czlis.interfaceCommon.pojo.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LastLabPatParam {
private Date startda;
private Date endda;
private String brdh;
private String brxm;
private String mzh;
private String sfzh;
private String instrlist;
private String yq;
}

View File

@ -5,6 +5,7 @@ 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;
@ -175,7 +176,9 @@ public class CommonUtil {
public String getLabPatJgbz(Date jyrq, String yq, String ybh){
return labPatMapper.getLabPatJgbz(jyrq, yq, ybh);
}
public List<LabPat> getlastLabPat(LastLabPatParam lastLabPatParam){
return labPatMapper.getlastLabPat(lastLabPatParam);
}
public String getSqhByKey(Date jyrq, String yq, String ybh) {
return labPatMapper.getSqhByKey(jyrq, yq, ybh);
}

View File

@ -678,21 +678,21 @@ public class LisWorkUtils {
}
private boolean checknowjz(LabPat labPat) {
boolean nowjz = false;
//危急值标识去除原则 nowjz = true 不能算做危急值
String brxm = labPat.getBrxm();
if (brxm != null) {
if (brxm.contains("质控") || brxm.contains("复查") || brxm.contains("QC") || brxm.contains("qc") || brxm.contains("软化水") || brxm.contains("锅炉水")) {
nowjz = true;
return true;
}
}
String brly = labPat.getBrly();
if (brly != null) brly = commonUtil.getComDictNameById("PT", brly);
if (brly != null) if (brly.contains("质控")) nowjz = true;
if (brly != null) if (brly.contains("质控")) return true;
if (brly != null) if (brly.contains("复查")) return true;
String ksdh = labPat.getKsdh();
if (ksdh != null) ksdh = commonUtil.getComDictNameById("DP", ksdh);
if (ksdh != null) if (ksdh.contains("检验科")) nowjz = true;
return nowjz;
if (ksdh != null) if (ksdh.contains("检验科")) return true;
return false;
}
/**

View File

@ -37,6 +37,23 @@
<select id="getLabPatJgbz" resultType="String">
select jgbz from lab_pat where yq = #{yq} and jyrq = #{jyrq} and ybh = #{ybh}
</select>
<select id="getlastLabPat" resultType="com.czlis.common.core.domain.entity.lis.LabPat" parameterType="com.czlis.interfaceCommon.pojo.entity.LastLabPatParam">
SELECT top 10 lab_pat.jyrq,lab_pat.yq,lab_pat.ybh
FROM lab_pat
<where>
<if test="startda != null">and jyrq >= #{startda}</if>
<if test="endda != null">and #{endda} >= jyrq </if>
<if test="brdh != null and brdh !=''">and brdh = #{brdh}</if>
<if test="brxm != null and brxm !=''">and brxm = #{brxm}</if>
<if test="mzh != null and mzh !=''">and mzh = #{mzh}</if>
<if test="sfzh != null and sfzh !=''">and sfzh = #{sfzh}</if>
<if test="instrlist != null and instrlist !=''">and yq in ${instrlist} </if>
<if test="yq != null and yq !=''">and yq = #{yq}</if>
</where>
ORDER BY lab_pat.jyrq DESC,right(replicate(' ',20) + lab_pat.ybh,20) DESC
</select>
<insert id="insertLabPat" parameterType="com.czlis.common.core.domain.entity.lis.LabPat">
insert into lab_pat (jyrq, yq, ybh,
wyh, yblx, fb, ksdh,

View File

@ -10,10 +10,8 @@ import com.czlis.common.utils.SecurityUtils;
import com.czlis.common.utils.StringUtils;
import com.czlis.interfaceCommon.constants.ComLogConstants;
import com.czlis.interfaceCommon.constants.LabReqmainConstants;
import com.czlis.interfaceCommon.utils.CommonUtil;
import com.czlis.interfaceCommon.utils.LisWorkUtils;
import com.czlis.interfaceCommon.utils.LoginConfigParamUtil;
import com.czlis.interfaceCommon.utils.ReportUtil;
import com.czlis.interfaceCommon.pojo.entity.LastLabPatParam;
import com.czlis.interfaceCommon.utils.*;
import com.czlis.liswork.mapper.LisWorkMapper;
@ -330,18 +328,117 @@ public class LisWorkServiceImpl implements LisWorkService {
}
}
}
LabPat labPat =commonUtil.getLabPatOne(jyrq,yq,ybh);
List<LabResult> labResultList0=getlastresult(labPat,labResultList);
if(labResultList0.size()>0) {
for (LabResult labResult : labResultList) {
labResult.setCp_lastjyrq(labResultList0.get(0).getJyrq());
String xmdh=labResult.getXmdh();
String csjg=labResult.getCsjg();
if(csjg==null)csjg="";
if(xmdh!=null&&!"".equals(xmdh)) {
List<LabResult> labResult0 = labResultList0.stream().filter(rlog -> xmdh.equals(rlog.getXmdh())).collect(Collectors.toList());
if(labResult0.size()>0) {
String csjg0 =labResult0.get(0).getCsjg();
String result_flag=labResult0.get(0).getResult_flag();
if("未做".equals(csjg0)||csjg0==null){
csjg0="";
result_flag="";
}
labResult.setCp_compa(csjg0);
labResult.setCp_lastflag(result_flag);
}
}
}
}
return new Result("0","成功!",labResultList);
}
/**
* 获取当前结果的上一次结果
* @param jyrq
* @param yq
* @param ybh
* @return
*/
private List<LabResult> getlastresult(Date jyrq, String yq, String ybh){
List<LabResult> labResultList=commonUtil.getresultinfo(jyrq,yq,ybh);
private List<LabResult> getlastresult(LabPat labPat,List<LabResult> labResultall){
Date jyrq=labPat.getJyrq();
String yq=labPat.getYq();
String ybh=labPat.getYbh();
LastLabPatParam lastLabPatParam=new LastLabPatParam();
String comparecol = commonUtil.getComOptValue(yq,"COMPARECOL");
String brdh=labPat.getBrdh();
String mzh=labPat.getMzh();
String sfzh=labPat.getSfzh();
String brxm=labPat.getBrxm();
List<LabResult> labResultList=new ArrayList<>();
switch (comparecol){
case "住院号":
if("".equals(brdh)||brdh==null){
return labResultList;
}
lastLabPatParam.setBrdh(brdh);
break;
case "卡号":
if("".equals(mzh)||mzh==null){
return labResultList;
}
lastLabPatParam.setMzh(mzh);
break;
case "身份证":
if("".equals(sfzh)||sfzh==null){
return labResultList;
}
lastLabPatParam.setSfzh(sfzh);
break;
case "姓名":
if("".equals(brxm)||brxm==null){
return labResultList;
}
lastLabPatParam.setBrxm(brxm);
break;
default:
if("".equals(brdh)||brdh==null){
return labResultList;
}
if("".equals(brxm)||brxm==null){
return labResultList;
}
lastLabPatParam.setBrdh(brdh);
lastLabPatParam.setBrxm(brxm);
}
String interval = commonUtil.getComOptValue(yq,"COMPAREDA");
if(interval==null||"".equals(interval))interval="60";
int getday=-Integer.parseInt(interval);
lastLabPatParam.setEndda(jyrq);
lastLabPatParam.setStartda(LisUtil.relativeDate(jyrq,getday));
String compother= commonUtil.getComOptValue(yq,"COMPOTHERINSTR");
if(compother!=null&&!"".equals(compother)) {
String instrlist = commonUtil.getComOptValue(yq, "COMPOTHERINSTRLIST");
//'CAL800','XS500I','33','40'
if("".equals(instrlist)||instrlist==null){lastLabPatParam.setYq(yq);}
else {
instrlist="("+instrlist+",'"+yq+"')";
lastLabPatParam.setInstrlist(instrlist);
}
}
List<LabPat> labPatList =commonUtil.getlastLabPat(lastLabPatParam);
if(labPatList.size()>0) {
for(LabPat labPat0:labPatList) {
Date jyrq0 = labPat0.getJyrq();
String yq0 = labPat0.getYq();
String ybh0 = labPat0.getYbh();
if (jyrq0 == jyrq && yq0.equals(yq) && ybh0.equals(ybh)) {
}else {
List<LabResult> labResultList0 = commonUtil.getLabResultList(jyrq0, yq0, ybh0);
for(LabResult labResult:labResultList0) {
String xmdh=labResult.getXmdh();
List<LabResult> labResult0 = labResultall.stream().filter(rlog -> xmdh.equals(rlog.getXmdh())).collect(Collectors.toList());
if(labResult0.size()>0){
return labResultList0;
}
}
}
}
}
return labResultList;
}