From 41866475ffaceac4711fd9105abbf27c56f3bbb1 Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Fri, 21 Feb 2025 15:43:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8E=A6=E9=97=A8=E4=B8=AD=E5=8C=BB?= =?UTF-8?q?=E9=99=A2=E8=81=94=E4=BC=97=E4=BA=BA=E5=B7=A5=E5=A4=84=E7=90=86?= =?UTF-8?q?,=E5=A4=9A=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jiashi/controller/WebController.java | 163 +++++++++++++++++- .../jiashi/dao/CardInfoPathRepository.java | 5 + src/main/java/com/jiashi/dao/DataQuery.java | 105 ++++++++++- src/main/resources/templates/index.html | 4 +- src/main/resources/templates/index2.html | 94 ++++++++++ src/main/resources/templates/index3.html | 94 ++++++++++ src/main/resources/templates/index4.html | 94 ++++++++++ 7 files changed, 554 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/templates/index2.html create mode 100644 src/main/resources/templates/index3.html create mode 100644 src/main/resources/templates/index4.html diff --git a/src/main/java/com/jiashi/controller/WebController.java b/src/main/java/com/jiashi/controller/WebController.java index e87f3c3..00fa861 100644 --- a/src/main/java/com/jiashi/controller/WebController.java +++ b/src/main/java/com/jiashi/controller/WebController.java @@ -22,6 +22,7 @@ import java.awt.image.BufferedImage; import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -31,13 +32,22 @@ import java.util.stream.Collectors; */ @Controller public class WebController { + /* + index 处理状态 2 未找到文件夹,匹配路径 falg +(病案号 or 住院号),不能处理状态改为 6 + index2 处理状态 6 ,匹配路径 (病案号 or 住院号),不能处理状态改为 7 + index3 处理状态 7 ,匹配路径 (like 病案号),不能处理状态改为 8 + index4 处理状态 8 ,匹配路径 (not in 已完成的路径),不能处理状态改为 9 + 其他状态2 改为 index条件重复操作,状态 9 需要人工联众去下载上传 + */ + + @Autowired private DataQuery dataQuery; @RequestMapping("/index") public String index(Model model) { ArrayList list = new ArrayList<>(); - List cardInfos = dataQuery.queryNotFoundDirCardInfo(); + List cardInfos = dataQuery.queryFailedL1CardInfo(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); for (CardInfo cardInfo : cardInfos) { String flag = cardInfo.getPat_path().substring(0, 2); @@ -72,6 +82,130 @@ public class WebController { return "index"; } + + @RequestMapping("/index2") + public String index2(Model model) { + List list = new ArrayList<>(); + List cardInfos = dataQuery.queryFailedL2CardInfo(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + for (CardInfo cardInfo : cardInfos) { + List cardInfoPaths = dataQuery.queryPath(cardInfo.getPatno(), cardInfo.getGestno()); + if (CollectionUtils.isEmpty(cardInfoPaths)) { + dataQuery.updateBatchState(cardInfo, 7); + continue; + } + + List firstPageFilePaths = new ArrayList<>(); + List firstPageFileNames = findFirstPageFileName(cardInfo); + for (CardInfoPath cardInfoPath : cardInfoPaths) { + for (String firstPageFileName : firstPageFileNames) { + String firstPageFilePath = cardInfoPath.getPath() + File.separator + firstPageFileName; + if (new File(firstPageFilePath).exists()) { + firstPageFilePaths.add(firstPageFilePath); + } + } + + } + + XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm(); + hospConfirm.setId(cardInfo.getId()); + hospConfirm.setPatname(cardInfo.getPatname()); + hospConfirm.setPatno(cardInfo.getPatno()); + hospConfirm.setGestno(cardInfo.getGestno()); + hospConfirm.setOutdate(sdf.format(cardInfo.getOutdate())); + hospConfirm.setPaths(firstPageFilePaths); + list.add(hospConfirm); + } + if (!list.isEmpty()) { + list= Collections.singletonList(list.get(0)); + } + model.addAttribute("confirms", list); + return "index2"; + } + + @RequestMapping("/index3") + public String index3(Model model) { + List list = new ArrayList<>(); + List cardInfos = dataQuery.queryFailedL3CardInfo(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + for (CardInfo cardInfo : cardInfos) { + String flag = cardInfo.getPat_path().substring(0, 2); + List cardInfoPaths = dataQuery.queryPath(flag, cardInfo.getPatno(), cardInfo.getGestno()); + if (CollectionUtils.isEmpty(cardInfoPaths)) { + dataQuery.updateBatchState(cardInfo, 8); + continue; + } + + List firstPageFilePaths = new ArrayList<>(); + List firstPageFileNames = findFirstPageFileName(cardInfo); + for (CardInfoPath cardInfoPath : cardInfoPaths) { + for (String firstPageFileName : firstPageFileNames) { + String firstPageFilePath = cardInfoPath.getPath() + File.separator + firstPageFileName; + if (new File(firstPageFilePath).exists()) { + firstPageFilePaths.add(firstPageFilePath); + } + } + + } + + XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm(); + hospConfirm.setId(cardInfo.getId()); + hospConfirm.setPatname(cardInfo.getPatname()); + hospConfirm.setPatno(cardInfo.getPatno()); + hospConfirm.setGestno(cardInfo.getGestno()); + hospConfirm.setOutdate(sdf.format(cardInfo.getOutdate())); + hospConfirm.setPaths(firstPageFilePaths); + list.add(hospConfirm); + } + if (!list.isEmpty()) { + list= Collections.singletonList(list.get(0)); + } + model.addAttribute("confirms", list); + return "index3"; + } + + @RequestMapping("/index4") + public String index4(Model model) { + List list = new ArrayList<>(); + List cardInfos = dataQuery.queryFailedL4CardInfo(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + for (CardInfo cardInfo : cardInfos) { + List cardInfoPaths = dataQuery.queryNotUsedPath(); + if (CollectionUtils.isEmpty(cardInfoPaths)) { + dataQuery.updateBatchState(cardInfo, 9); + continue; + } + + List firstPageFilePaths = new ArrayList<>(); + List firstPageFileNames = findFirstPageFileName(cardInfo); + for (CardInfoPath cardInfoPath : cardInfoPaths) { + for (String firstPageFileName : firstPageFileNames) { + String firstPageFilePath = cardInfoPath.getPath() + File.separator + firstPageFileName; + if (new File(firstPageFilePath).exists()) { + firstPageFilePaths.add(firstPageFilePath); + } + } + + } + + XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm(); + hospConfirm.setId(cardInfo.getId()); + hospConfirm.setPatname(cardInfo.getPatname()); + hospConfirm.setPatno(cardInfo.getPatno()); + hospConfirm.setGestno(cardInfo.getGestno()); + hospConfirm.setOutdate(sdf.format(cardInfo.getOutdate())); + hospConfirm.setPaths(firstPageFilePaths); + list.add(hospConfirm); + } + if (!list.isEmpty()) { + list= Collections.singletonList(list.get(0)); + } + model.addAttribute("confirms", list); + return "index4"; + } + + + private List findFirstPageFileName(CardInfo cardInfo) { List pictures = dataQuery.getPictures(cardInfo.getId()); List firstPageFiles = pictures.stream() @@ -127,4 +261,31 @@ public class WebController { dataQuery.updateBatchState(cardInfo, 6); return "success"; } + + @GetMapping("/notconfirmPath2") + @ResponseBody + public String notconfirmPath2(@RequestParam("id") String id) { + CardInfo cardInfo = new CardInfo(); + cardInfo.setId(id); + dataQuery.updateBatchState(cardInfo, 7); + return "success"; + } + + @GetMapping("/notconfirmPath3") + @ResponseBody + public String notconfirmPath3(@RequestParam("id") String id) { + CardInfo cardInfo = new CardInfo(); + cardInfo.setId(id); + dataQuery.updateBatchState(cardInfo, 8); + return "success"; + } + + @GetMapping("/notconfirmPath4") + @ResponseBody + public String notconfirmPath4(@RequestParam("id") String id) { + CardInfo cardInfo = new CardInfo(); + cardInfo.setId(id); + dataQuery.updateBatchState(cardInfo, 9); + return "success"; + } } diff --git a/src/main/java/com/jiashi/dao/CardInfoPathRepository.java b/src/main/java/com/jiashi/dao/CardInfoPathRepository.java index 7ef94d2..64f1a87 100644 --- a/src/main/java/com/jiashi/dao/CardInfoPathRepository.java +++ b/src/main/java/com/jiashi/dao/CardInfoPathRepository.java @@ -3,11 +3,16 @@ package com.jiashi.dao; import com.jiashi.service.CardInfoPath; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface CardInfoPathRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "select * from t_card_info_upload_path where path not in (select findpicpath from t_card_info_upload where state in (2,3,4) )",nativeQuery = true) + List queryNotUsedPath(); } diff --git a/src/main/java/com/jiashi/dao/DataQuery.java b/src/main/java/com/jiashi/dao/DataQuery.java index 9ebe5e9..9b8b0f6 100644 --- a/src/main/java/com/jiashi/dao/DataQuery.java +++ b/src/main/java/com/jiashi/dao/DataQuery.java @@ -87,8 +87,10 @@ public class DataQuery { } } - - public List queryNotFoundDirCardInfo() { + /** + * 失败1级,状态为 2,原因为 未找到联众数据文件夹! + */ + public List queryFailedL1CardInfo() { cardInfoTableLock.lock(); try { Specification specification = (root, query, cb) -> { @@ -109,6 +111,77 @@ public class DataQuery { } } + /** + * 失败2级,状态为 6 + */ + public List queryFailedL2CardInfo() { + cardInfoTableLock.lock(); + try { + Specification specification = (root, query, cb) -> { + List predicates = new ArrayList<>(); + predicates.add(cb.equal(root.get("state"), 6)); + return cb.and(predicates.toArray(new Predicate[predicates.size()])); + }; + Sort.Order sortCreateTime = Sort.Order.asc("outdate"); + Sort sort = Sort.by(sortCreateTime); + Pageable pageable = PageRequest.of(0, 20, sort); + + Page all = cardInfoRepository.findAll(specification,pageable); + return all.toList(); + } finally { + cardInfoTableLock.unlock(); + + } + } + + /** + * 失败3级,状态为 7 + */ + public List queryFailedL3CardInfo() { + cardInfoTableLock.lock(); + try { + Specification specification = (root, query, cb) -> { + List predicates = new ArrayList<>(); + predicates.add(cb.equal(root.get("state"), 7)); + return cb.and(predicates.toArray(new Predicate[predicates.size()])); + }; + Sort.Order sortCreateTime = Sort.Order.asc("outdate"); + Sort sort = Sort.by(sortCreateTime); + Pageable pageable = PageRequest.of(0, 20, sort); + + Page all = cardInfoRepository.findAll(specification,pageable); + return all.toList(); + } finally { + cardInfoTableLock.unlock(); + + } + } + + + /** + * 失败四级,状态为 8 + */ + public List queryFailedL4CardInfo() { + cardInfoTableLock.lock(); + try { + Specification specification = (root, query, cb) -> { + List predicates = new ArrayList<>(); + predicates.add(cb.equal(root.get("state"), 8)); + return cb.and(predicates.toArray(new Predicate[predicates.size()])); + }; + Sort.Order sortCreateTime = Sort.Order.asc("outdate"); + Sort sort = Sort.by(sortCreateTime); + Pageable pageable = PageRequest.of(0, 20, sort); + + Page all = cardInfoRepository.findAll(specification,pageable); + return all.toList(); + } finally { + cardInfoTableLock.unlock(); + + } + } + + public List dateQueryByInpNo(String inpNo) { cardInfoTableLock.lock(); @@ -227,4 +300,32 @@ public class DataQuery { List all = cardInfoPathRepository.findAll(specification); return all; } + + public List queryPath(String patno, String gestno) { + Specification specification = (root, query, cb) -> { + Predicate or1 = cb.equal(root.get("patnopart"), patno); + Predicate or2 = cb.equal(root.get("patnopart"), gestno); + + List predicates = new ArrayList<>(); + predicates.add(cb.or(or1,or2)); + return cb.and(predicates.toArray(new Predicate[predicates.size()])); + }; + List all = cardInfoPathRepository.findAll(specification); + return all; + } + + public List queryPathLike(String patno) { + Specification specification = (root, query, cb) -> { + Predicate like = cb.like(root.get("patnopart"), patno); + List predicates = new ArrayList<>(); + predicates.add(like); + return cb.and(predicates.toArray(new Predicate[predicates.size()])); + }; + List all = cardInfoPathRepository.findAll(specification); + return all; + } + + public List queryNotUsedPath() { + return cardInfoPathRepository.queryNotUsedPath(); + } } diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 2e8408e..18dc0c2 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -38,7 +38,7 @@ } -

厦门中医院嘉时根据首页确认联众患者图片存储目录重新采集

+

处理状态2+不确定目录,路径标识+病案号部分

已处理 - 不能处理 + 上级处理

diff --git a/src/main/resources/templates/index2.html b/src/main/resources/templates/index2.html new file mode 100644 index 0000000..6602a4e --- /dev/null +++ b/src/main/resources/templates/index2.html @@ -0,0 +1,94 @@ + + + + + + 患者信息列表 + + + +

处理状态6,匹配病案号部分

+
+
+

+

+ + 上级处理 +

+
+ + 确认 +
+
+
+ + +
+ Zoomed Image +
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/index3.html b/src/main/resources/templates/index3.html new file mode 100644 index 0000000..3ab04ad --- /dev/null +++ b/src/main/resources/templates/index3.html @@ -0,0 +1,94 @@ + + + + + + 患者信息列表 + + + +

处理状态7,病案号相似的路径

+
+
+

+

+ + 上级处理 +

+
+ + 确认 +
+
+
+ + +
+ Zoomed Image +
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/index4.html b/src/main/resources/templates/index4.html new file mode 100644 index 0000000..d369320 --- /dev/null +++ b/src/main/resources/templates/index4.html @@ -0,0 +1,94 @@ + + + + + + 患者信息列表 + + + +

处理状态8,未匹配的路径

+
+
+

+

+ + 上级处理 +

+
+ + 确认 +
+
+
+ + +
+ Zoomed Image +
+ + + + + + \ No newline at end of file