主程序

This commit is contained in:
tangw 2025-10-17 16:27:37 +08:00
parent f20bf79bd9
commit d127803152
11 changed files with 262 additions and 51 deletions

View File

@ -44,4 +44,7 @@ public class LabResult extends BaseEntity {
private String ygzq;
private Integer xsws;
private Integer changeflag;
private Integer cp_modify;
private String cp_compa;
private String cp_lastflag;
}

View File

@ -1,6 +1,7 @@
package com.czlis.interfaceCommon.mapper;
import com.czlis.common.core.domain.entity.lis.LabReqmain;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
@ -10,5 +11,5 @@ public interface LabReqmainMapper {
int updateLabReqmainAll(LabReqmain labReqmain);
int deleteLabReqmain(String sqh);
void insertLabReqmain(LabReqmain labReqmain);
int updateLabReqmainZT(Map<String,Object> map);
int zxLabReqmain(@Param("sqh")String sqh,@Param("userId")String userId);
}

View File

@ -1,10 +1,13 @@
package com.czlis.interfaceCommon.mapper;
import com.czlis.common.core.domain.entity.lis.LabResultlog;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface LabResultlogMapper {
int insertLabResultlog(@Param("jyrq") Date jyrq, @Param("yq")String yq, @Param("ybh") String ybh, @Param("xgrq")Date xgrq, @Param("xgyhdh")String xgyhdh, @Param("ip")String ip);
List<LabResultlog> getLabResultlog(@Param("jyrq") Date jyrq, @Param("yq")String yq, @Param("ybh") String ybh);
List<LabResultlog> getLabResultlogxmdh(@Param("jyrq") Date jyrq, @Param("yq")String yq, @Param("ybh") String ybh,@Param("xmdh") String xmdh);
}

View File

@ -195,19 +195,22 @@ public class CommonUtil {
public LabReqmain getLabReqmainOne(String sqh) {
return labReqmainMapper.getLabReqmainOne(sqh);
}
@Transactional(rollbackFor = Exception.class)
public int updateLabReqmain(LabReqmain labReqmain) {
return labReqmainMapper.updateLabReqmain(labReqmain);
}
@Transactional(rollbackFor = Exception.class)
public int deleteLabReqmain(String sqh) {
return labReqmainMapper.deleteLabReqmain(sqh);
}
@Transactional(rollbackFor = Exception.class)
public void insertLabReqmain(LabReqmain labReqmain) {
labReqmainMapper.insertLabReqmain(labReqmain);
}
@Transactional(rollbackFor = Exception.class)
public void zxLabReqmain(String sqh,String userId){
labReqmainMapper.zxLabReqmain(sqh,userId);
}
public List<LabReqsteplog> getLabReqsteplog(String sqh) {
return labReqsteplogMapper.getLabReqsteplog(sqh);
}
@ -291,6 +294,13 @@ public class CommonUtil {
public void insertLabResultlog(Date jyrq, String yq, String ybh,Date xgrq,String xgyhdh,String ip) {
labResultlogMapper.insertLabResultlog(jyrq, yq, ybh,xgrq,xgyhdh,ip);
}
public List<LabResultlog> getLabResultlog(Date jyrq, String yq, String ybh){
return labResultlogMapper.getLabResultlog(jyrq, yq, ybh);
}
public List<LabResultlog> getLabResultlogxmdh(Date jyrq, String yq, String ybh, String xmdh) {
return labResultlogMapper.getLabResultlogxmdh(jyrq, yq, ybh,xmdh);
}
@Transactional(rollbackFor = Exception.class)
public void insertLabPatlog(Date jyrq, String yq, String ybh,Date xgrq,String xgyhdh,String ip) {
labPatlogMapper.insertLabPatlog(jyrq, yq, ybh,xgrq,xgyhdh,ip);

View File

@ -147,7 +147,7 @@ public class LisWorkUtils {
String alarmflag = labPat.getAlarmflag();
if (("1".equals(alarmflag) && !wjz)) {
labPat.setAlarmflag("");
} else if (("".equals(alarmflag.trim()) || alarmflag == null) && wjz) {
} else if (("".equals(alarmflag)||" ".equals(alarmflag)|| alarmflag == null) && wjz) {
labPat.setAlarmflag("1");
}
commonUtil.updateLabPat(labPat);
@ -494,12 +494,21 @@ public class LisWorkUtils {
for (int i = 0; i < parameters.length; i++) {
String itemcode = parameters[i];
if ("SEX".equals(itemcode)) {
String sex = labPat.getBrxb().trim();
String sex = labPat.getBrxb();
if(sex==null||"".equals(sex)||" ".equals(sex)){
setjgsg = false;
break;
}
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())){
setjgsg = false;
break;
}
double age = AgeUtils.getDecimalAge(AgeUtils.getBirthDateByAge(labPat.getNl(), labPat.getNldw()));
variables.put("AGE", String.valueOf(age));
lb_jsx = true;
@ -1609,10 +1618,12 @@ public class LisWorkUtils {
LabPat labPat = commonUtil.getLabPatOne(jyrq, yq, ybh);
boolean nowjz = checknowjz(labPat);
labResultList = calcsample(labPat, labResultList, xmCalcList);
List<LabResult> labResultList1 = labResultList.stream().filter(labR -> labR.getChangeflag() == 1).collect(Collectors.toList());
if (labResultList1.size() > 0) {
for (LabResult labResult0 : labResultList1) {
changeresultf(labPat, labResult0, nowjz);
if(labResultList.size()>0) {
List<LabResult> labResultList1 = labResultList.stream().filter(labR -> labR.getChangeflag() != null && labR.getChangeflag() == 1).collect(Collectors.toList());
if (labResultList1.size() > 0) {
for (LabResult labResult0 : labResultList1) {
changeresultf(labPat, labResult0, nowjz);
}
}
}
}
@ -1755,7 +1766,7 @@ public class LisWorkUtils {
String userId = labPat.getYhdh();
Date sjsj=commonUtil.getCurrentTime();
//修改状态和时间
updateLabReqmainZT(userId, sqh);
commonUtil.zxLabReqmain(sqh,userId);
//保存lab_pat表信息
labPat.setYblx(commonUtil.getComDictIdByName("BT", labReqmain.getYblx()));
labPat.setKsdh(commonUtil.getComDictIdByName("DP", labReqmain.getKsdh()));
@ -1764,6 +1775,10 @@ public class LisWorkUtils {
labPat.setBrxm(labReqmain.getBrxm());
labPat.setBrxb(labReqmain.getBrxb());
labPat.setBrly(labReqmain.getBrly());
labPat.setSjys(labReqmain.getSqys());
String brxb=labReqmain.getBrxb();
if(brxb!=null)brxb=brxb.trim();
labPat.setBrxb(brxb);
labPat.setCh(labReqmain.getCh());
Map<String, Object> ageFromBirthDay = AgeUtils.getAgeByBirthDate(labReqmain.getBrsr());
String age = ageFromBirthDay.get("nl").toString();
@ -1784,8 +1799,9 @@ public class LisWorkUtils {
labPat.setPhone(labReqmain.getPhone());
labPat.setAddr(labReqmain.getAddr());
labPat.setLstd(labReqmain.getLstd());
labPat.setCjbw(labReqmain.getCjbw());
String brxm0 = labPat.getBrxm();
if(!"".equals(brxm0)) {
if(!"".equals(brxm0)&&brxm0!=null) {
String pinyin = PinyinUtil.getFirstLetter(brxm0, ""); //拼音首字母
if (pinyin.length() >= 9) {
pinyin = pinyin.substring(0, 9);
@ -1879,7 +1895,7 @@ public class LisWorkUtils {
}
labPat = loaddefault(labPat);
String brxm0 = labPat.getBrxm();
if(!"".equals(brxm0)) {
if(!"".equals(brxm0)&&brxm0!=null) {
String pinyin = PinyinUtil.getFirstLetter(brxm0, ""); //拼音首字母
if (pinyin.length() >= 9) {
pinyin = pinyin.substring(0, 9);
@ -1962,14 +1978,6 @@ public class LisWorkUtils {
return new Result("0", "");
}
public void updateLabReqmainZT(String userId, String sqh) {
Map<String, Object> map = new HashMap<>();
map.put("userId", userId);
map.put("sqh", sqh);
labReqmainMapper.updateLabReqmainZT(map);
}
public LabPat loaddefault(LabPat labPat) {
Date jyrq = labPat.getJyrq();
String yq = labPat.getYq();
@ -1993,6 +2001,7 @@ public class LisWorkUtils {
for (LabInputcol labInputcol : labInputcolList0) {
if (!"!".equals(labInputcol)) {
String zdmc = labInputcol.getZdmc();
switch (zdmc) {
case "dysj":
case "cyrq":
@ -2000,34 +2009,43 @@ public class LisWorkUtils {
case "nl":
break;
case "yhdh":
mrz = labInputcol.getMrz();
if (mrz != null && "".equals(mrz)) {
String sybh = loginConfigParam.getCurrent_yhdh_sybh();
String eybh = loginConfigParam.getCurrent_yhdh_eybh();
if ("".equals(sybh) && "".equals(eybh) && sybh != null && eybh != null) {
if (LisUtil.isStringBetween(ybh, sybh, eybh)) {
String yhdh0=labPat.getYhdh();
if (yhdh0 == null ||"".equals(yhdh0)) {
mrz = labInputcol.getMrz();
if (mrz != null && "".equals(mrz)) {
String sybh = loginConfigParam.getCurrent_yhdh_sybh();
String eybh = loginConfigParam.getCurrent_yhdh_eybh();
if ("".equals(sybh) && "".equals(eybh) && sybh != null && eybh != null) {
if (LisUtil.isStringBetween(ybh, sybh, eybh)) {
labPat.setYhdh(mrz);
}
} else {
labPat.setYhdh(mrz);
}
} else {
labPat.setYhdh(mrz);
}
}
break;
case "hdys":
String sybh = loginConfigParam.getCurrent_hdys_sybh();
String eybh = loginConfigParam.getCurrent_hdys_eybh();
if ("".equals(sybh) && "".equals(eybh) && sybh != null && eybh != null) {
if (LisUtil.isStringBetween(ybh, sybh, eybh)) {
String hdys0=labPat.getYhdh();
if (hdys0 == null ||"".equals(hdys0)) {
String sybh = loginConfigParam.getCurrent_hdys_sybh();
String eybh = loginConfigParam.getCurrent_hdys_eybh();
if ("".equals(sybh) && "".equals(eybh) && sybh != null && eybh != null) {
if (LisUtil.isStringBetween(ybh, sybh, eybh)) {
labPat.setHdys(mrz);
}
} else {
labPat.setHdys(mrz);
}
} else {
labPat.setHdys(mrz);
}
break;
default:
mrz = labInputcol.getMrz();
if (mrz != null && !"".equals(mrz)) {
EntityUtils.setItem(labPat, zdmc, mrz);
String value=(String)EntityUtils.getItem(labPat,zdmc);
if (value == null ||"".equals(value)) {
mrz = labInputcol.getMrz();
if (mrz != null && !"".equals(mrz)) {
EntityUtils.setItem(labPat, zdmc, mrz);
}
}
}
}

View File

@ -18,6 +18,7 @@
<if test="yq != null and yq !=''">and yq = #{yq}</if>
<if test="jyrq != null">and jyrq = #{jyrq}</if>
</where>
order by yq,jyrq,right(space(20) + ybh,20)
</select>
<select id="getSampleListday" resultType="com.czlis.common.core.domain.entity.lis.LabPat">
<include refid="selectLabPatVo"></include>
@ -25,6 +26,7 @@
<if test="days != null and days != 0">and jyrq >=CONVERT(varchar(10),getdate() - ${days},120)</if>
<if test="yq != null and yq !=''">and yq = #{yq}</if>
</where>
order by yq,jyrq,right(space(20) + ybh,20)
</select>
<select id="getCountByKey" resultType="int">
select count(1) from lab_pat where yq = #{yq} and jyrq = #{jyrq} and ybh = #{ybh}

View File

@ -6,14 +6,11 @@
select * from lab_reqmain where sqh = #{sqh}
</select>
<update id="updateLabReqmainZT">
<![CDATA[
UPDATE lab_reqmain SET zt = '2', jsys = #{userId}, jssj =getdate() WHERE sqh = #{sqh} AND (zt < '2' or zt='8' or jssj<zxsj)
]]>
<update id="zxLabReqmain">
UPDATE lab_reqmain SET zt = '2', jsys = #{userId}, jssj =getdate() WHERE sqh = #{sqh} AND ('2'> zt or zt='8' or zxsj>jssj)
</update>
<delete id="deleteLabReqmain" parameterType="String">
delete from lab_reqmain
where sqh = #{sqh}
delete from lab_reqmain where sqh = #{sqh}
</delete>
<insert id="insertLabReqmain" parameterType="com.czlis.common.core.domain.entity.lis.LabReqmain">
insert into lab_reqmain (sqh, ksdh, sqys,

View File

@ -9,4 +9,10 @@
cutoff, jgbz, bz1, bz2, yhdh, #{xgrq}, #{xgyhdh}
From lab_result WHERE jyrq = #{jyrq} and yq = #{yq} and ybh = #{ybh}
</insert>
<select id="getLabResultlog" resultType="com.czlis.common.core.domain.entity.lis.LabResultlog" >
SELECT * from lab_resultlog WHERE jyrq = #{jyrq} and yq = #{yq} and ybh = #{ybh}
</select>
<select id="getLabResultlogxmdh" resultType="com.czlis.common.core.domain.entity.lis.LabResultlog" >
SELECT * from lab_resultlog WHERE jyrq = #{jyrq} and yq = #{yq} and ybh = #{ybh} and xmdh = #{xmdh}
</select>
</mapper>

View File

@ -144,8 +144,8 @@ public class LisWorkController extends BaseController {
Date jyrq = labResult.getJyrq();
String yq = labResult.getYq();
String ybh = labResult.getYbh();
log.info("jyrq,{}", jyrq.toString());
return labResultService.getresultinfo(jyrq, yq, ybh);
// log.info("jyrq,{}", jyrq.toString());
return lisWorkService.getresultinfo(jyrq, yq, ybh);
}
@Log(title = "主界面",businessType = BusinessType.DELETE_DETAIL)

View File

@ -14,7 +14,7 @@ public interface LisWorkService {
Result getGroupInstrdList(Long userId,String groupId);
Result getInstrdConfig(String yq);
List<LabPat> getSampleList(Date jyrq, String yq, Long days);
Result getresultinfo(Date jyrq, String yq, String ybh);
Result getLabPat(Date jyrq, String yq, String ybh);
Result sampleMedInfo(Date jyrq, String yq, String ybh);
Result checkUser(String yhdh, String mm);

View File

@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
@ -99,7 +100,7 @@ public class LisWorkServiceImpl implements LisWorkService {
}
@Override
public Result getInstrdConfig(String yq) {
List<ComOpt> comOptlist = lisWorkMapper.getInstrdConfig(yq);
// List<ComOpt> comOptlist = lisWorkMapper.getInstrdConfig(yq);
List<LabInputcol> labInputcolList = commonUtil.getLabInputcol(yq);
for(LabInputcol labInputcol:labInputcolList){
String zdmc=labInputcol.getZdmc();
@ -166,11 +167,181 @@ public class LisWorkServiceImpl implements LisWorkService {
}
}
Map<String,Object> instrdConfig=new HashMap<String,Object>();
instrdConfig.put("comOptlist",comOptlist);
instrdConfig.put("ResultConfig",getInstrdResultConfig(yq));
instrdConfig.put("labInputcolList",labInputcolList);
return new Result("0","获取仪器参数成功!",instrdConfig);
}
private List<LabInputcol> getInstrdResultConfig(String yq){
String showod= commonUtil.getComOptValue(yq,"SHOWOD");
if(showod==null||"".equals(showod))showod="0";
String showodflag="0";
String showcutoffflag="0";
String showrefsflag="1";
char firstChar = showod.charAt(0);
switch (firstChar){
case '1':
showodflag="1";
showcutoffflag="1";
showrefsflag="0";
break;
case '2':
showodflag="1";
showcutoffflag="1";
showrefsflag="1";
break;
case '3':
showodflag="1";
showcutoffflag="0";
showrefsflag="1";
break;
}
String result_label= commonUtil.getComOptValue(yq,"RESULT_LABEL");
if(result_label==null||"".equals(result_label))result_label="结果";
String od_label= commonUtil.getComOptValue(yq,"OD_LABEL");
if(od_label==null||"".equals(od_label))od_label="OD";
String cutoff_label= commonUtil.getComOptValue(yq,"CUTOFF_LABEL");
if(cutoff_label==null||"".equals(cutoff_label))cutoff_label="CUTOFF";
List<LabInputcol> ResultConfig=new ArrayList<>();
LabInputcol labInputcol=new LabInputcol();
labInputcol.setXh(0);
labInputcol.setYq(yq);
labInputcol.setZdmc("index");
labInputcol.setKj("1");
labInputcol.setKybj("0");
labInputcol.setZdts("");
labInputcol.setMrz("45");
ResultConfig.add(0,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(1);
labInputcol.setYq(yq);
labInputcol.setZdmc("redo_flag");
labInputcol.setKj("1");
labInputcol.setKybj("0");
labInputcol.setZdts("复");
labInputcol.setMrz("45");
ResultConfig.add(1,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(2);
labInputcol.setYq(yq);
labInputcol.setZdmc("xmdh");
labInputcol.setKj("1");
labInputcol.setKybj("0");
labInputcol.setZdts("项目");
labInputcol.setDict("xmdh");
labInputcol.setMrz("90");
ResultConfig.add(2,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(3);
labInputcol.setYq(yq);
labInputcol.setZdmc("xmmc");
labInputcol.setKj("1");
labInputcol.setKybj("0");
labInputcol.setZdts("名称");
labInputcol.setMrz("120");
ResultConfig.add(3,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(4);
labInputcol.setYq(yq);
labInputcol.setZdmc("csjg");
labInputcol.setKj("1");
labInputcol.setKybj("1");
labInputcol.setZdts(result_label);
labInputcol.setDict("xmval");
labInputcol.setMrz("100");
ResultConfig.add(4,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(5);
labInputcol.setYq(yq);
labInputcol.setZdmc("cp_compa");
labInputcol.setKj("1");
labInputcol.setKybj("0");
labInputcol.setZdts("上次结果");
labInputcol.setMrz("100");
ResultConfig.add(5,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(6);
labInputcol.setYq(yq);
labInputcol.setZdmc("od");
labInputcol.setKj(showodflag);
labInputcol.setKybj("1");
labInputcol.setZdts(od_label);
labInputcol.setMrz("100");
ResultConfig.add(6,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(7);
labInputcol.setYq(yq);
labInputcol.setZdmc("cutoff");
labInputcol.setKj(showcutoffflag);
labInputcol.setKybj("1");
labInputcol.setZdts(cutoff_label);
labInputcol.setMrz("100");
ResultConfig.add(7,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(8);
labInputcol.setYq(yq);
labInputcol.setZdmc("refs");
labInputcol.setKj(showrefsflag);
labInputcol.setKybj("0");
labInputcol.setZdts("参考值");
labInputcol.setMrz("120");
ResultConfig.add(8,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(9);
labInputcol.setYq(yq);
labInputcol.setZdmc("dw");
labInputcol.setKj(showrefsflag);
labInputcol.setKybj("0");
labInputcol.setZdts("单位");
labInputcol.setMrz("80");
ResultConfig.add(9,labInputcol);
labInputcol=new LabInputcol();
labInputcol.setXh(10);
labInputcol.setYq(yq);
labInputcol.setZdmc("bz1");
labInputcol.setKj("1");
labInputcol.setKybj("0");
labInputcol.setZdts("子模块");
labInputcol.setMrz("80");
ResultConfig.add(10,labInputcol);
return ResultConfig;
}
@Override
public Result getresultinfo(Date jyrq, String yq, String ybh){
List<LabResult> labResultList=commonUtil.getresultinfo(jyrq,yq,ybh);
List<LabResultlog> labResultlog=commonUtil.getLabResultlog(jyrq,yq,ybh);
if(labResultList.size()>0 && labResultlog.size()>0) {
for (LabResult labResult : labResultList) {
String xmdh=labResult.getXmdh();
String csjg=labResult.getCsjg();
if(csjg==null)csjg="";
if(xmdh!=null&&"".equals(xmdh)) {
List<LabResultlog> labResultlog0 = labResultlog.stream().filter(rlog -> xmdh.equals(rlog.getXmdh())).collect(Collectors.toList());
if(labResultlog0.size()>0) {
String csjg0=labResultlog0.get(0).getCsjg();
if(csjg0==null)csjg0="";
if(!csjg.equals(csjg0)) {
labResult.setCp_modify(1);
}
}
}
}
}
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);
return labResultList;
}
@Override
public List<LabPat> getSampleList(Date jyrq, String yq, Long days) {
if(days>1) {