历史结果

This commit is contained in:
jiangs 2025-10-23 16:15:33 +08:00
parent 426be1babc
commit 3e2d003548
6 changed files with 94 additions and 18 deletions

View File

@ -1,5 +1,6 @@
package com.czlis.liswork.controller.work; package com.czlis.liswork.controller.work;
import com.czlis.common.annotation.Anonymous;
import com.czlis.common.core.controller.BaseController; import com.czlis.common.core.controller.BaseController;
import com.czlis.common.core.domain.Result; import com.czlis.common.core.domain.Result;
import com.czlis.liswork.service.LisWorkPageInfoService; import com.czlis.liswork.service.LisWorkPageInfoService;
@ -32,6 +33,7 @@ public class LisWorkPageInfoController extends BaseController {
return lisWorkPageInfoService.getRedo(jyrq,yq,ybh); return lisWorkPageInfoService.getRedo(jyrq,yq,ybh);
} }
@Anonymous
@ApiOperation("获取历史结果") @ApiOperation("获取历史结果")
@GetMapping("/history") @GetMapping("/history")
public Result getHistory(Date jyrq,String yq,String ybh){ public Result getHistory(Date jyrq,String yq,String ybh){

View File

@ -0,0 +1,23 @@
package com.czlis.liswork.pojo.DTO;
import com.czlis.liswork.pojo.HistoryResult;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class HistoryResultDTO {
private List<HistoryResult> one;
private List<HistoryResult> two;
private List<HistoryResult> three;
private List<HistoryResult> four;
private List<HistoryResult> five;
private List<HistoryResult> six;
private List<HistoryResult> seven;
private List<HistoryResult> eight;
private List<HistoryResult> nine;
}

View File

@ -20,5 +20,9 @@ public class HistoryResult {
private String nl; private String nl;
private String yqdl; private String yqdl;
private String brdh; private String brdh;
private String brxm;
private String result_flag;
private String yljg;
} }

View File

@ -10,6 +10,7 @@ import com.czlis.common.utils.file.FileUtils;
import com.czlis.common.utils.file.ImageUtils; import com.czlis.common.utils.file.ImageUtils;
import com.czlis.interfaceCommon.utils.ReportUtil; import com.czlis.interfaceCommon.utils.ReportUtil;
import com.czlis.liswork.mapper.LisWorkPageInfoMapper; import com.czlis.liswork.mapper.LisWorkPageInfoMapper;
import com.czlis.liswork.pojo.DTO.HistoryResultDTO;
import com.czlis.liswork.pojo.HistoryResult; import com.czlis.liswork.pojo.HistoryResult;
import com.czlis.liswork.service.LisWorkPageInfoService; import com.czlis.liswork.service.LisWorkPageInfoService;
import com.czlis.interfaceCommon.utils.CommonUtil; import com.czlis.interfaceCommon.utils.CommonUtil;
@ -69,28 +70,74 @@ public class LisWorkPageInfoServiceImpl implements LisWorkPageInfoService {
map.put("yqdl", hisResultThisList.get(0).getYqdl()); map.put("yqdl", hisResultThisList.get(0).getYqdl());
map.put("brdh",hisResultThisList.get(0).getBrdh()); map.put("brdh",hisResultThisList.get(0).getBrdh());
List<HistoryResult> hisResultList = lisWorkPageInfoMapper.getHisResult(map); List<HistoryResult> hisResultList = lisWorkPageInfoMapper.getHisResult(map);
for (HistoryResult historyResult : hisResultThisList) { // for (HistoryResult historyResult : hisResultThisList) {
List<HistoryResult> collect = hisResultList.stream().filter(historyResult1 -> // List<HistoryResult> collect = hisResultList.stream().filter(historyResult1 ->
historyResult1.getXmdh().equals(historyResult.getXmdh()) && !historyResult1.getJyrq().equals(historyResult.getJyrq())).collect(Collectors.toList()); // historyResult1.getXmdh().equals(historyResult.getXmdh()) && !historyResult1.getJyrq().equals(historyResult.getJyrq())).collect(Collectors.toList());
if(!collect.isEmpty()) hisResultThisList.addAll(collect); // if(!collect.isEmpty()) hisResultThisList.addAll(collect);
} // }
//排序 //排序,先按时间排序,再按项目代号排序
hisResultThisList.sort(new Comparator<HistoryResult>() { hisResultList.sort(new Comparator<HistoryResult>() {
@Override @Override
public int compare(HistoryResult o1, HistoryResult o2) { public int compare(HistoryResult o1, HistoryResult o2) {
String xmdh = o1.getXmdh();
String xmdh2 = o2.getXmdh();
int i = xmdh.compareTo(xmdh2);
if(i == 0) {
Date jyrq1 = o1.getJyrq(); Date jyrq1 = o1.getJyrq();
Date jyrq2 = o2.getJyrq(); Date jyrq2 = o2.getJyrq();
return jyrq1.compareTo(jyrq2); int i1 = jyrq2.compareTo(jyrq1);
if(i1 == 0){
String xmdh = o1.getXmdh();
String xmdh2 = o2.getXmdh();
return xmdh.compareTo(xmdh2);
}else{ }else{
return i; return i1;
} }
} }
}); });
return new Result("0","获取成功!",hisResultThisList); Date jyrqTemp = null;
int i = 0;
HistoryResultDTO historyResultDTO = new HistoryResultDTO();
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);
}
jyrqTemp = jyrq1;
}
for (Date jyrqDate : jyrqList) {
i++;
List<HistoryResult> historySingleResultList = hisResultList.stream().filter(historyResult -> historyResult.getJyrq().equals(jyrqDate)).collect(Collectors.toList());
switch (i){
case 1:
historyResultDTO.setOne(historySingleResultList);
break;
case 2:
historyResultDTO.setTwo(historySingleResultList);
break;
case 3:
historyResultDTO.setThree(historySingleResultList);
break;
case 4:
historyResultDTO.setFour(historySingleResultList);
break;
case 5:
historyResultDTO.setFive(historySingleResultList);
break;
case 6:
historyResultDTO.setSix(historySingleResultList);
break;
case 7:
historyResultDTO.setSeven(historySingleResultList);
break;
case 8:
historyResultDTO.setEight(historySingleResultList);
break;
case 9:
historyResultDTO.setNine(historySingleResultList);
break;
}
}
return new Result("0","获取成功!",historyResultDTO);
} }
/** /**

View File

@ -364,7 +364,7 @@ public class LisWorkServiceImpl implements LisWorkService {
* @return 上一次结果 * @return 上一次结果
*/ */
private List<LabResult> getlastresult(LabPat labPat,List<LabResult> labResultall){ public List<LabResult> getlastresult(LabPat labPat,List<LabResult> labResultall){
Date jyrq=labPat.getJyrq(); Date jyrq=labPat.getJyrq();
String yq=labPat.getYq(); String yq=labPat.getYq();
String ybh=labPat.getYbh(); String ybh=labPat.getYbh();

View File

@ -84,7 +84,7 @@
<select id="getHisResult" resultType="com.czlis.liswork.pojo.HistoryResult"> <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,a.brdh,
(case a.brxb when '1' then '男' when '2' then '女' end) as brxb , (case a.brxb when '1' then '男' when '2' then '女' end) as brxb ,
a.nl+a.nldw as nl a.nl+a.nldw 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 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' 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 and a.jyrq > getdate() - 360