主程序
This commit is contained in:
parent
295ad9342a
commit
da1806ebfa
@ -17,4 +17,7 @@ public class LastLabPatParam {
|
||||
private String sfzh;
|
||||
private String instrlist;
|
||||
private String yq;
|
||||
private Date jyrq;
|
||||
private String ybh;
|
||||
private String yqdl;
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import com.czlis.common.core.domain.entity.lis.*;
|
||||
import com.czlis.common.utils.*;
|
||||
import com.czlis.common.utils.ip.IpUtils;
|
||||
import com.czlis.interfaceCommon.constants.LabPatConstants;
|
||||
import com.czlis.interfaceCommon.pojo.entity.LastLabPatParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -395,4 +396,5 @@ public class LisWorkBase {
|
||||
}
|
||||
return falg;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,13 +1,21 @@
|
||||
package com.czlis.interfaceCommon.utils;
|
||||
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.LabPat;
|
||||
import com.czlis.common.core.domain.entity.lis.LabResult;
|
||||
import com.czlis.common.utils.SecurityUtils;
|
||||
import com.czlis.common.utils.ip.IpUtils;
|
||||
import com.czlis.interfaceCommon.constants.LisinterfaceNameConstants;
|
||||
import com.czlis.interfaceCommon.pojo.entity.LastLabPatParam;
|
||||
import com.czlis.interfaceCommon.pojo.inter.DayMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class LisWorkUtils extends LisWorkconfirm{
|
||||
@ -27,4 +35,84 @@ public class LisWorkUtils extends LisWorkconfirm{
|
||||
dayMessage.setMsg(content);
|
||||
return lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.DAYMESSAGE, dayMessage);
|
||||
}
|
||||
public List<LabPat> getHistroypat(LabPat labPat) {
|
||||
List<LabPat> nullret=new ArrayList<>();
|
||||
if(labPat==null){return nullret;}
|
||||
Date jyrq = labPat.getJyrq();
|
||||
String yq = labPat.getYq();
|
||||
String ybh = labPat.getYbh();
|
||||
LastLabPatParam lastLabPatParam=getLastLabPatParam(labPat);
|
||||
if(lastLabPatParam==null){return nullret;}
|
||||
List<LabPat> labPatList = commonUtil.getlastLabPat(lastLabPatParam);
|
||||
if(!labPatList.isEmpty()){
|
||||
List<LabPat> labPatList0=labPatList.stream().filter(st->!jyrq.equals(st.getJyrq())&&!yq.equals(st.getYq())&&!ybh.equals(st.getYbh())).collect(Collectors.toList());
|
||||
return labPatList0;
|
||||
}
|
||||
return labPatList;
|
||||
}
|
||||
public LastLabPatParam getLastLabPatParam(LabPat labPat){
|
||||
LastLabPatParam nullret=new LastLabPatParam();
|
||||
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 nullret;
|
||||
}
|
||||
lastLabPatParam.setBrdh(brdh);
|
||||
break;
|
||||
case "卡号":
|
||||
if ("".equals(mzh) || mzh == null) {
|
||||
return nullret;
|
||||
}
|
||||
lastLabPatParam.setMzh(mzh);
|
||||
break;
|
||||
case "身份证":
|
||||
if ("".equals(sfzh) || sfzh == null) {
|
||||
return nullret;
|
||||
}
|
||||
lastLabPatParam.setSfzh(sfzh);
|
||||
break;
|
||||
case "姓名":
|
||||
if ("".equals(brxm) || brxm == null) {
|
||||
return nullret;
|
||||
}
|
||||
lastLabPatParam.setBrxm(brxm);
|
||||
break;
|
||||
default:
|
||||
if ("".equals(brdh) || brdh == null) {
|
||||
return nullret;
|
||||
}
|
||||
if ("".equals(brxm) || brxm == null) {
|
||||
return nullret;
|
||||
}
|
||||
lastLabPatParam.setBrdh(brdh);
|
||||
lastLabPatParam.setBrxm(brxm);
|
||||
}
|
||||
String interval = commonUtil.getComOptValue(yq, "COMPAREDA");
|
||||
if (interval == null || interval.isEmpty()) 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 && !compother.isEmpty()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
return lastLabPatParam;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
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
|
||||
SELECT top 20 lab_pat.jyrq,lab_pat.yq,lab_pat.ybh
|
||||
FROM lab_pat
|
||||
<where>
|
||||
<if test="startda != null">and jyrq >= #{startda}</if>
|
||||
|
||||
@ -25,6 +25,7 @@ public class HistoryResult {
|
||||
private String yljg;
|
||||
private String cksx;
|
||||
private String ckxx;
|
||||
private String yqmc;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
package com.czlis.liswork.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.*;
|
||||
import com.czlis.interfaceCommon.pojo.entity.LastLabPatParam;
|
||||
import com.czlis.interfaceCommon.utils.LisWorkUtils;
|
||||
import com.czlis.interfaceCommon.utils.ReportUtil;
|
||||
import com.czlis.liswork.mapper.LisWorkPageInfoMapper;
|
||||
@ -111,18 +113,11 @@ public Result deleteRedo(LabResultRe labResultRe){
|
||||
}
|
||||
@Override
|
||||
public Result getHistory(Date jyrq, String yq, String ybh) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("jyrq",jyrq);
|
||||
map.put("yq",yq);
|
||||
map.put("ybh",ybh);
|
||||
//本次结果
|
||||
List<HistoryResult> hisResultThisList = lisWorkPageInfoMapper.getHisResult(map);
|
||||
if(hisResultThisList.size()<=0) return new Result("-1","没有找到对应的结果信息!");
|
||||
//其他结果
|
||||
map.clear();
|
||||
map.put("yqdl", hisResultThisList.get(0).getYqdl());
|
||||
map.put("brdh",hisResultThisList.get(0).getBrdh());
|
||||
Result historyResult = getHistoryResult(hisResultThisList, map);
|
||||
LabPat labPat=commonUtil.getLabPatOne(jyrq,yq,ybh);
|
||||
LastLabPatParam lastLabPatParam=lisWorkUtils.getLastLabPatParam(labPat);
|
||||
if(lastLabPatParam==null){return new Result("-1","缺少查询条件!");}
|
||||
Map<String,Object> map=BeanUtil.beanToMap(lastLabPatParam);
|
||||
Result historyResult = getHistoryResult(jyrq,yq,ybh,map);
|
||||
return new Result("0","获取成功!",historyResult.getData());
|
||||
}
|
||||
|
||||
@ -175,7 +170,7 @@ public Result deleteRedo(LabResultRe labResultRe){
|
||||
map.clear();
|
||||
map.put("yqdl", hisResultThisList.get(0).getYqdl());
|
||||
map.put("brdh",hisResultThisList.get(0).getBrdh());
|
||||
Result historyResult = getHistoryResult(hisResultThisList, map);
|
||||
Result historyResult = getHistoryResult(jyrq,yq,ybh, map);
|
||||
return new Result("0","获取成功!",historyResult.getData());
|
||||
}
|
||||
|
||||
@ -198,42 +193,53 @@ public Result deleteRedo(LabResultRe labResultRe){
|
||||
}
|
||||
|
||||
|
||||
public Result getHistoryResult(List<HistoryResult> hisResultThisList,Map<String,Object> map){
|
||||
List<HistoryResult> hisResultList = lisWorkPageInfoMapper.getHisResult(map);
|
||||
public Result getHistoryResult(Date jyrq, String yq, String ybh,Map<String,Object> map){
|
||||
List<HistoryResult> hisResultList0 = lisWorkPageInfoMapper.getHisResult(map);
|
||||
if(hisResultList0.isEmpty()){return new Result("-1","无历史数据!");}
|
||||
List<HistoryResult> hisResultThisList=hisResultList0.stream().filter(st->jyrq.equals(st.getJyrq())&&yq.equals(st.getYq().trim())&&ybh.equals(st.getYbh())).collect(Collectors.toList());
|
||||
List<HistoryResult> hisResultList=hisResultList0.stream().filter(st->!(jyrq.equals(st.getJyrq())&&yq.equals(st.getYq().trim())&&ybh.equals(st.getYbh()))).collect(Collectors.toList());
|
||||
if(hisResultList.isEmpty()){return new Result("-1","无历史数据!");}
|
||||
|
||||
//排序,先按时间排序,再按项目代号排序
|
||||
hisResultList.sort(new Comparator<HistoryResult>() {
|
||||
@Override
|
||||
public int compare(HistoryResult o1, HistoryResult o2) {
|
||||
Date jyrq1 = o1.getJyrq();
|
||||
Date jyrq2 = o2.getJyrq();
|
||||
int i1 = jyrq2.compareTo(jyrq1);
|
||||
if(i1 == 0){
|
||||
String xmdh = o1.getXmdh();
|
||||
String xmdh2 = o2.getXmdh();
|
||||
return xmdh.compareTo(xmdh2);
|
||||
}else{
|
||||
return i1;
|
||||
}
|
||||
}
|
||||
});
|
||||
Date jyrqTemp = null;
|
||||
// 依据 jyrq,yq,ybh 去重(自定义去重字段)
|
||||
List<HistoryResult> distinctList = hisResultList.stream()
|
||||
// 利用 LinkedHashSet 去重并保留顺序,键为 "jyrq,yq,ybh" 的组合
|
||||
.collect(Collectors.toMap(
|
||||
// 生成唯一键:将所选字段拼接为字符串(确保唯一)
|
||||
item -> item.getJyrq() + "_" + item.getYq().trim()+"_"+item.getYbh(),
|
||||
// 值为对象本身
|
||||
item -> item,
|
||||
// 若键重复,保留第一个出现的对象
|
||||
(existing, replacement) -> existing
|
||||
))
|
||||
// 转换为 List
|
||||
.values().stream().collect(Collectors.toList());
|
||||
List<HistoryResult> sortedList = distinctList.stream()
|
||||
// 第一步:按 date 降序排序(最新时间在前)
|
||||
.sorted(Comparator.comparing(HistoryResult::getJyrq)
|
||||
.thenComparing(HistoryResult::getYq)
|
||||
.thenComparing(HistoryResult::getYbh).reversed())
|
||||
.collect(Collectors.toList());
|
||||
int i = 0;
|
||||
HistoryResultDTO historyResultDTO = new HistoryResultDTO();
|
||||
//本次结果
|
||||
historyResultDTO.setFirst(hisResultThisList);
|
||||
List<Date> jyrqList = new ArrayList<>();
|
||||
for (HistoryResult historyResult : hisResultList) {
|
||||
Date jyrq1 = historyResult.getJyrq();
|
||||
int compare = DateUtil.compare(jyrq1, jyrqTemp);
|
||||
if(compare != 0){
|
||||
jyrqList.add(jyrq1);
|
||||
for (HistoryResult HistoryResult0 : sortedList) {
|
||||
Date jyrq0=HistoryResult0.getJyrq();
|
||||
String yq0=HistoryResult0.getYq();
|
||||
String ybh0=HistoryResult0.getYbh();
|
||||
|
||||
List<HistoryResult> historySingleResultList=hisResultList.stream().filter(st->jyrq0.equals(st.getJyrq())&&yq0.equals(st.getYq())&&ybh0.equals(st.getYbh())).collect(Collectors.toList());
|
||||
boolean havexmdh=false;
|
||||
for (HistoryResult labResult : hisResultThisList) {
|
||||
String xmdh = labResult.getXmdh();
|
||||
List<HistoryResult> labResult0 = historySingleResultList.stream().filter(rlog -> xmdh.equals(rlog.getXmdh())).collect(Collectors.toList());
|
||||
if (!labResult0.isEmpty()) {
|
||||
havexmdh=true;
|
||||
break;
|
||||
}
|
||||
jyrqTemp = jyrq1;
|
||||
}
|
||||
for (Date jyrqDate : jyrqList) {
|
||||
if (havexmdh) {
|
||||
i++;
|
||||
List<HistoryResult> historySingleResultList = hisResultList.stream().filter(historyResult -> historyResult.getJyrq().equals(jyrqDate)).collect(Collectors.toList());
|
||||
switch (i){
|
||||
case 1:
|
||||
historyResultDTO.setOne(historySingleResultList);
|
||||
@ -264,6 +270,7 @@ public Result deleteRedo(LabResultRe labResultRe){
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return new Result("0","获取成功!",historyResultDTO);
|
||||
}
|
||||
|
||||
@ -153,32 +153,41 @@
|
||||
</select>
|
||||
|
||||
<select id="getHisResult" resultType="com.czlis.liswork.pojo.HistoryResult">
|
||||
select b.jyrq,c.xmdh, c.xmmc,b.csjg,b.ybh,b.yq,d.yqdl,a.brdh,
|
||||
select b.jyrq,c.xmdh, c.xmmc,b.csjg,b.ybh,b.yq,d.yqdl,d.yqmc,a.brdh,
|
||||
(case a.brxb when '1' then '男' when '2' then '女' end) as brxb ,
|
||||
c.cksx,c.ckxx,
|
||||
convert(varchar(100),a.nl)+(case a.nldw when '1' then '岁' when '2' then '月' when '3' then '天' end) as nl,
|
||||
a.brxm as brxm,b.result_flag,(select top 1 zdmc from com_dict where zdlb = 'HOS' and zddh = a.yljg) as yljg
|
||||
from lab_pat a, lab_result b,xm_info c,lab_instr d
|
||||
where a.jyrq = b.jyrq and a.yq = b.yq and a.ybh = b.ybh and a.jgbz = '2'
|
||||
and c.yq = b.yq and c.xmdh = b.xmdh and d.yq = a.yq and a.jyrq > getdate() - 360
|
||||
and c.yq = b.yq and c.xmdh = b.xmdh and d.yq = a.yq
|
||||
<if test="startda != null">and a.jyrq >= #{startda}</if>
|
||||
<if test="endda != null">and #{endda} >= a.jyrq </if>
|
||||
<if test="yqdl != null and yqdl != ''"> and d.yqdl = #{yqdl}</if>
|
||||
<if test="brdh != null and brdh != ''"> and a.brdh = #{brdh}</if>
|
||||
<if test="brxm != null and brxm !=''">and a.brxm = #{brxm}</if>
|
||||
<if test="mzh != null and mzh !=''">and a.mzh = #{mzh}</if>
|
||||
<if test="sfzh != null and sfzh !=''">and a.sfzh = #{sfzh}</if>
|
||||
<if test="instrlist != null and instrlist !=''">and a.yq in ${instrlist} </if>
|
||||
<if test="jyrq != null "> and a.jyrq = #{jyrq}</if>
|
||||
<if test="yq != null and yq != ''"> and a.yq = #{yq}</if>
|
||||
<if test="ybh != null and ybh != ''"> and a.ybh = #{ybh}</if>
|
||||
order by c.dyxh asc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getbgxm" resultType="map">
|
||||
<![CDATA[
|
||||
SELECT distinct xm_reqitem_vs_reportitem.sqxmdh,
|
||||
xm_reqitem_vs_reportitem.yq,
|
||||
xm_reqitem_vs_reportitem.xmdh,
|
||||
xm_reqitem_vs_reportitem.tdh,
|
||||
xm_reqitem_vs_reportitem.mrz,xm_info.dyxh,xm_info.xmmc
|
||||
FROM xm_reqitem_vs_reportitem,xm_info
|
||||
WHERE ( xm_reqitem_vs_reportitem.sqxmdh = #{sqxmdh} ) AND (isnull(xm_reqitem_vs_reportitem.def,'')<>'1') and
|
||||
WHERE ( xm_reqitem_vs_reportitem.sqxmdh = #{sqxmdh} ) AND (isnull(xm_reqitem_vs_reportitem.def,'')!='1') and
|
||||
( xm_reqitem_vs_reportitem.yq = #{yq} ) and xm_reqitem_vs_reportitem.yq=xm_info.yq and xm_reqitem_vs_reportitem.xmdh=xm_info.xmdh
|
||||
]]>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getInputmdl">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user