diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistPageReqVO.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistPageReqVO.java index 9ae23a176..9c7e7cfcb 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistPageReqVO.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistPageReqVO.java @@ -104,5 +104,8 @@ public class PatientexamlistPageReqVO extends PageParam { @Schema(description = "开单科室") private String billDoctorDepartment; + private String StudyInsta; + + } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistRespVO.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistRespVO.java index 7514c6fb2..9f27443f9 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistRespVO.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistRespVO.java @@ -125,4 +125,7 @@ public class PatientexamlistRespVO { @Schema(description = "开单科室") private String billDoctorDepartment; + private String StudyInsta; + + } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistSaveReqVO.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistSaveReqVO.java index c3955b59a..b49dfbbd6 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistSaveReqVO.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/vo/PatientexamlistSaveReqVO.java @@ -98,5 +98,7 @@ public class PatientexamlistSaveReqVO { private String billDoctorDepartment; @Schema(description = "审核状态") private String reviewStatus; + private String StudyInsta; + } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/dataobject/patientexamlist/PatientexamlistDO.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/dataobject/patientexamlist/PatientexamlistDO.java index 0f562f855..c09805adb 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/dataobject/patientexamlist/PatientexamlistDO.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/dataobject/patientexamlist/PatientexamlistDO.java @@ -172,5 +172,7 @@ public class PatientexamlistDO extends BaseDO { @TableField(value = "reviewStatus") private String reviewStatus; + @TableField(value = "StudyInsta") + private String StudyInsta; } \ No newline at end of file diff --git a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/controller/admin/ultrasonic/ultrasonicController.java b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/controller/admin/ultrasonic/ultrasonicController.java index de73e59fb..e5a3ece32 100644 --- a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/controller/admin/ultrasonic/ultrasonicController.java +++ b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/controller/admin/ultrasonic/ultrasonicController.java @@ -1,4 +1,12 @@ package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic; + +import cn.iocoder.yudao.module.system.dal.dataobject.dicomworklist.DicomImagesDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dicomworklist.DicomSeriesDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dicomworklist.DicompatientDO; +import cn.iocoder.yudao.module.system.dal.dataobject.org.OrgUnitDO; +import cn.iocoder.yudao.module.system.service.dicomworklist.DicomworklistService; +import cn.iocoder.yudao.module.system.service.org.OrgUnitService; +import com.fasterxml.jackson.databind.SerializationFeature; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -43,6 +51,7 @@ import java.util.*; import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + @Tag(name = "管理后台 - 超声科组件") @RestController @RequestMapping("/ultrasoniccom/ultrasonic") @@ -54,59 +63,60 @@ public class ultrasonicController { private ultrasonicService ultrasonicService; @Resource private medicalimgService medicalimgService; + @Resource + private DicomworklistService dicomworklistService; + + @Resource + private OrgUnitService Service; + @GetMapping("/reporttemplatetlist") @Operation(summary = "获取模版表数据") @DataPermission(enable = false) @PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')") - public CommonResult> getreporttemplatelist(@RequestParam("orgID") String orgID,@RequestParam("type") String type,@RequestParam("isprivate") String isprivate) throws Exception { + public CommonResult> getreporttemplatelist(@RequestParam("orgID") String orgID, @RequestParam("type") String type, @RequestParam("isprivate") String isprivate) throws Exception { List devicelist = ultrasonicService.getreporttemplate(); - List filteredList=new ArrayList<>(); + List filteredList = new ArrayList<>(); // 按照 updateTime 字段降序排列,空值放在最后 List sortedList = devicelist.stream() .sorted(Comparator.comparing(ultrasonicDO::getUpdateTime, Comparator.nullsLast(Comparator.reverseOrder()))) .collect(Collectors.toList()); - devicelist=sortedList; + devicelist = sortedList; - - if (!orgID.isEmpty()) - { + if (!orgID.isEmpty()) { filteredList = devicelist.stream() .filter(ultrasonicDO -> (ultrasonicDO.getOrgId().equals(orgID))) .collect(Collectors.toList()); } - if(filteredList.isEmpty()) - { - filteredList=devicelist; + if (filteredList.isEmpty()) { + filteredList = devicelist; } - if (!type.isEmpty()&&!type.equals("undefined")) - { + if (!type.isEmpty() && !type.equals("undefined")) { // 筛选条件: filteredList = filteredList.stream() .filter(ultrasonicDO -> (ultrasonicDO.getTemplateType().equals(type))) .collect(Collectors.toList()); } - if(isprivate.equals("1")) - { + if (isprivate.equals("1")) { // 筛选条件: filteredList = filteredList.stream() - .filter(ultrasonicDO -> (ultrasonicDO.getPrivateDoctorId()!=null)) + .filter(ultrasonicDO -> (ultrasonicDO.getPrivateDoctorId() != null)) .collect(Collectors.toList()); } ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(filteredList); - List tree = convertJsonToTree(json); + List tree = convertJsonToTree(json); return success(tree); } //返回树结构 - private List convertJsonToTree(String jsonData) { + private List convertJsonToTree(String jsonData) { List> dataList; try { ObjectMapper objectMapper = new ObjectMapper(); @@ -154,8 +164,8 @@ public class ultrasonicController { @Operation(summary = "获取图片列表") @Parameter(name = "orgid", description = "机构ID", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')") - public CommonResult> getimageslist(@RequestParam("orgID") String orgId,@RequestParam("regID") String regId,@RequestParam("select") String select) { - List devicelist = ultrasonicService.getmedicalimgist(orgId,regId,select); + public CommonResult> getimageslist(@RequestParam("orgID") String orgId, @RequestParam("regID") String regId, @RequestParam("select") String select) { + List devicelist = ultrasonicService.getmedicalimgist(orgId, regId, select); return success(BeanUtils.toBean(devicelist, medicalimgDO.class)); } @@ -165,43 +175,35 @@ public class ultrasonicController { @PreAuthorize("@ss.hasPermission('tblist:patientexamlist:update')") public CommonResult updateexamineimagelist(@Valid @RequestBody List updateReqVO) { - if (!updateReqVO.isEmpty()) - { + if (!updateReqVO.isEmpty()) { //最终提交的数据 - List doList=new ArrayList<>(); + List doList = new ArrayList<>(); //当前时间 - LocalDateTime dateTime= LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), + LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); //循环传递进来的参数 赋值 for (upmedicalimgVO s : updateReqVO) { //新增对象 - medicalimgDO medicalimgDO=new medicalimgDO(); + medicalimgDO medicalimgDO = new medicalimgDO(); medicalimgDO.setId(s.getId()); - if(!s.getIsDelete().isEmpty()) - { + if (!s.getIsDelete().isEmpty()) { medicalimgDO.setIsDelete(s.getIsDelete()); medicalimgDO.setDeletePerson(s.getDeletePerson()); medicalimgDO.setDeleteDate(dateTime); } - if(!s.getSelected().isEmpty()) - { + if (!s.getSelected().isEmpty()) { medicalimgDO.setSelected(s.getSelected()); } doList.add(medicalimgDO); } - if (!doList.isEmpty()) - { - boolean bol= medicalimgService.updateBatchById(doList); + if (!doList.isEmpty()) { + boolean bol = medicalimgService.updateBatchById(doList); return success(bol); - } - else - { + } else { return success(false); } - } - else - { + } else { log.error("超声审核更新图片数据方法参数为空"); return success(false); @@ -211,13 +213,11 @@ public class ultrasonicController { } - - @GetMapping("/upreporttemplatetime") @Operation(summary = "更新模版表时间") @DataPermission(enable = false) @PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')") - public CommonResult upreporttemplatetime(@RequestParam("pid") String pid) throws ParseException { + public CommonResult upreporttemplatetime(@RequestParam("pid") String pid) throws ParseException { //当前时间 // 定义日期时间格式 @@ -228,25 +228,94 @@ public class ultrasonicController { // 将字符串解析为 Date 对象 Date currentDateTime = formatter.parse(currentDateTimeString); - //新增对象 - ultrasonicDO ultrasonicDO=new ultrasonicDO(); + //新增对象 + ultrasonicDO ultrasonicDO = new ultrasonicDO(); ultrasonicDO.setId(pid); ultrasonicDO.setUpdateTime(currentDateTime); - boolean bol= ultrasonicService.updateById(ultrasonicDO); + boolean bol = ultrasonicService.updateById(ultrasonicDO); return success(bol); } + @GetMapping("/getdcm") @Operation(summary = "获取dcm数据") @PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')") - public CommonResult GetDcmList() - { + public CommonResult GetDcmList(@RequestParam("orgID") String orgID, @RequestParam("studyInsta") String studyInsta, @RequestParam("regId") String regId) throws JsonProcessingException { + String strJson = ""; + String json=""; + if (!studyInsta.isEmpty() && !orgID.isEmpty()) { - String Res="{\"status\":\"success\",\"patientname\":\"朱晓珍\",\"hospital\":\"东营康惠健康体检中心\",\"seriesList\":[{\"thumbUrl\":\"/static/101缩略图.jpg\",\"seriesdesc\":\"CHEST\",\"instanceList\":[{\"imageid\":\"/static/49814@101@1@1.2.156.112605.189250948694021.20221211000237.4.28076.1.dcm\"}]},{\"thumbUrl\":\"/static/201缩略图.jpg\",\"seriesdesc\":\"CHEST\",\"instanceList\":[{\"imageid\":\"/static/49814@201@1@1.2.156.112605.189250948694021.20221211000325.4.16016.1.dcm\"},{\"imageid\":\"/static/49814@201@2@1.2.156.112605.189250948694021.20221211000325.4.16016.2.dcm\"},{\"imageid\":\"/static/49814@201@3@1.2.156.112605.189250948694021.20221211000325.4.16016.3.dcm\"},{\"imageid\":\"/static/49814@201@4@1.2.156.112605.189250948694021.20221211000326.4.16016.1.dcm\"},{\"imageid\":\"/static/49814@201@5@1.2.156.112605.189250948694021.20221211000326.4.16016.2.dcm\"}]}]}"; +// 先查询基本信息 一个患者基本信息就一条 + DicompatientDO dicompatientDO = dicomworklistService.GetPatientIdData(regId, orgID); +// 获取机构名称 + OrgUnitDO aDo = Service.get(orgID); + //studyInsta 当前检查部位 去查询检查项目 一个检查项目就是一个序列 一个序列里有多个文件 + List doList = dicomworklistService.GetDicomSeriesData(studyInsta, orgID); + if (!doList.isEmpty()) { + StringBuilder seriesassembleList = new StringBuilder(); + //存放条件数据 + List seriesInstList = new ArrayList<>(); + for (DicomSeriesDO d : doList) { + //先循环取出来所需要的service表的需要的条件数据 + seriesInstList.add(d.getSeriesInst()); + } + List imagesDOList = dicomworklistService.GetDicomImageListData(seriesInstList, orgID); - return success(Res); + for (DicomSeriesDO d : doList) { + //判断第一条数据 是他的缩略图 + boolean isFirst = true; + String url=""; + StringBuilder instanceList = new StringBuilder(); + StringBuilder imageid = new StringBuilder(); + StringBuilder seriesList = new StringBuilder(); + if (!imagesDOList.isEmpty()) { + //筛选数据 + List activeImages = imagesDOList.stream() + .filter(DicomImagesDO -> DicomImagesDO.getSeriesInst().equals(d.getSeriesInst())) + .sorted(Comparator.comparing(DicomImagesDO->Integer.parseInt(DicomImagesDO.getImageNumbe()))) // 保持原始顺序 + .collect(Collectors.toList()); + for (DicomImagesDO imagesDO : activeImages) { + if (isFirst) { + // 这是第一条数据的逻辑处理 + // url="/dcm/"+imagesDO.getObjectFile().replace("\\", "\\\\").replaceFirst("\\.dcm$", ".jpg"); + url="/static/ctlogo.png"; + + // 处理完第一条数据后,将isFirst标志设置为false + isFirst = false; + } + imageid.append("{\"imageid\": \"").append("/dcm/"+imagesDO.getObjectFile().replace("\\", "\\\\")).append("\"},"); + } + } + if (imageid.length() > 0) { + imageid.deleteCharAt(imageid.length() - 1); + } + instanceList.append(" \"instanceList\": [").append(imageid).append("]"); + seriesList.append(" { \"SeriesDesc\": \""+d.getSeriesDesc()+"\",\"thumbUrl\": \""+url+"\",\n" + " \"seriesdesc\": \"CHEST\",\n").append(instanceList).append("},"); + seriesassembleList.append(seriesList); + } + + if (seriesassembleList.length() > 0) { + seriesassembleList.deleteCharAt(seriesassembleList.length() - 1); + } + strJson = " { " + + " \"status\": \"success\"," + + " \"patientname\": \"" + dicompatientDO.getPatientNam() + "\"," + + "\"hospital\": \"" + aDo.getOrgName() + "\"," + + " \"seriesList\": [" + + seriesassembleList + + "]" + + " }"; + } + ObjectMapper mapper = new ObjectMapper(); + + json= mapper.writeValueAsString(strJson); + } + + // String Res="{\"status\":\"success\",\"patientname\":\"朱晓珍\",\"hospital\":\"东营康惠健康体检中心\",\"seriesList\":[{\"thumbUrl\":\"/static/101缩略图.jpg\",\"seriesdesc\":\"CHEST\",\"instanceList\":[{\"imageid\":\"/static/49814@101@1@1.2.156.112605.189250948694021.20221211000237.4.28076.1.dcm\"}]},{\"thumbUrl\":\"/static/201缩略图.jpg\",\"seriesdesc\":\"CHEST\",\"instanceList\":[{\"imageid\":\"/static/49814@201@1@1.2.156.112605.189250948694021.20221211000325.4.16016.1.dcm\"},{\"imageid\":\"/static/49814@201@2@1.2.156.112605.189250948694021.20221211000325.4.16016.2.dcm\"},{\"imageid\":\"/static/49814@201@3@1.2.156.112605.189250948694021.20221211000325.4.16016.3.dcm\"},{\"imageid\":\"/static/49814@201@4@1.2.156.112605.189250948694021.20221211000326.4.16016.1.dcm\"},{\"imageid\":\"/static/49814@201@5@1.2.156.112605.189250948694021.20221211000326.4.16016.2.dcm\"}]}]}"; + + return success(strJson); }