From 39a77bcd6e3b95a3ef8225509f32feafb1dd9f4f Mon Sep 17 00:00:00 2001 From: lichuanyang <1176537920@qq.com> Date: Fri, 25 Oct 2024 21:52:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=97=85=E7=90=86=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PatientexamlistMapper.java | 7 +- .../ultrasonic/ultrasonicController.java | 263 +++++++++--------- 2 files changed, 128 insertions(+), 142 deletions(-) diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/mysql/patientexamlist/PatientexamlistMapper.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/mysql/patientexamlist/PatientexamlistMapper.java index c9367ac5f..bbf3d41cb 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/mysql/patientexamlist/PatientexamlistMapper.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/dal/mysql/patientexamlist/PatientexamlistMapper.java @@ -52,6 +52,7 @@ public interface PatientexamlistMapper extends BaseMapperX { .eqIfPresent(PatientexamlistDO::getDeviceType, reqVO.getDeviceType()) .likeIfPresent(PatientexamlistDO::getPName, reqVO.getPname()) .isNotNull(PatientexamlistDO::getDiagDate) + .eq(PatientexamlistDO::getReportstatus, "已审核") .orderByDesc(PatientexamlistDO::getExamDate)); } @@ -66,8 +67,8 @@ public interface PatientexamlistMapper extends BaseMapperX { .eqIfPresent(PatientexamlistDO::getReportstatus, reqVO.getReportstatus()) .betweenIfPresent(PatientexamlistDO::getUploadDate, reqVO.getUploadDate()) .likeIfPresent(PatientexamlistDO::getOrgName, reqVO.getOrgName()) - // .eqIfPresent(PatientexamlistDO::getOrgId, reqVO.getOrgId()) - .likeIfPresent(PatientexamlistDO::getDeviceType,reqVO.getDeviceType()) + // .eqIfPresent(PatientexamlistDO::getOrgId, reqVO.getOrgId()) + .likeIfPresent(PatientexamlistDO::getDeviceType, reqVO.getDeviceType()) // .eqIfPresent(PatientexamlistDO::getHighLevelOrgId, reqVO.getHighLevelOrgId()) .betweenIfPresent(PatientexamlistDO::getCreateDate, reqVO.getCreateDate()) .eqIfPresent(PatientexamlistDO::getExamDescription, reqVO.getExamDescription()) @@ -76,7 +77,7 @@ public interface PatientexamlistMapper extends BaseMapperX { .eqIfPresent(PatientexamlistDO::getDiagDoctor, reqVO.getDiagDoctor()) .betweenIfPresent(PatientexamlistDO::getCreateTime, reqVO.getCreateTime()) .eqIfPresent(PatientexamlistDO::getOrgId, reqVO.getHighLevelOrgId()) - .eqIfPresent(PatientexamlistDO::getIsFavourite,reqVO.getIsFavourite()) + .eqIfPresent(PatientexamlistDO::getIsFavourite, reqVO.getIsFavourite()) .eq(PatientexamlistDO::getOrgId, reqVO.getOrgId()) // 始终添加orgId条件 .or(wrapper -> { if (reqVO.getHighLevelOrgId() != null) { 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 cd0e4c5be..797866f02 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 @@ -153,14 +153,14 @@ public class ultrasonicController { ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(filteredList); - List tree = convertJsonToTree(json,isprivate); + List tree = convertJsonToTree(json, isprivate); return success(tree); } - //返回树结构 - private List convertJsonToTree(String jsonData,String isprivate) { + //返回树结构 + private List convertJsonToTree(String jsonData, String isprivate) { try { ObjectMapper objectMapper = new ObjectMapper(); List> dataList = objectMapper.readValue(jsonData, List.class); @@ -180,7 +180,7 @@ public class ultrasonicController { tree.tempname = (String) data.get("templateName"); tree.examDescription = (String) data.get("examDescription"); tree.diagResults = (String) data.get("diagResults"); - tree.dataType=(String) data.get("dataType"); + tree.dataType = (String) data.get("dataType"); treeMap.put(id, tree); if (privateId != null && !privateId.isEmpty()) { @@ -189,15 +189,12 @@ public class ultrasonicController { publicTrees.add(tree); // 添加到公共节点列表 } } - if (isprivate.equals("1")) - { + if (isprivate.equals("1")) { // 构建公共树 buildTree(privateTrees, "0", treeMap); // 将私有节点添加到结果列表 return new ArrayList<>(privateTrees); // - } - else - { + } else { // 构建公共树 buildTree(publicTrees, "0", treeMap); // 将私有节点添加到结果列表 @@ -205,7 +202,6 @@ public class ultrasonicController { } - } catch (JsonProcessingException e) { return new ArrayList<>(); } @@ -329,14 +325,13 @@ public class ultrasonicController { public CommonResult GetDcmList(@RequestParam("orgID") String orgID, @RequestParam("studyInsta") String studyInsta, @RequestParam("regId") String regId) throws JsonProcessingException { String strJson = ""; String json = ""; - String Dcmprefix=""; + String Dcmprefix = ""; if (!studyInsta.isEmpty() && !orgID.isEmpty()) { - OrgUnitDO unitDO= Service.getonekey(orgID); - if(!unitDO.getDcmprefix().isEmpty()) - { - Dcmprefix=unitDO.getDcmprefix(); - } + OrgUnitDO unitDO = Service.getonekey(orgID); + if (!unitDO.getDcmprefix().isEmpty()) { + Dcmprefix = unitDO.getDcmprefix(); + } // 先查询基本信息 一个患者基本信息就一条 DicompatientDO dicompatientDO = dicomworklistService.GetPatientIdData(regId, orgID); // 获取机构名称 @@ -375,7 +370,7 @@ public class ultrasonicController { // 处理完第一条数据后,将isFirst标志设置为false isFirst = false; } - imageid.append("{\"imageid\": \"").append("/"+Dcmprefix+"/" + imagesDO.getObjectFile().replace("\\", "\\\\")).append("\"},"); + imageid.append("{\"imageid\": \"").append("/" + Dcmprefix + "/" + imagesDO.getObjectFile().replace("\\", "\\\\")).append("\"},"); } } if (imageid.length() > 0) { @@ -415,7 +410,7 @@ public class ultrasonicController { LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); //当前登陆用户 - // AdminUserDO user = userService.getUser(getLoginUserId()); + // AdminUserDO user = userService.getUser(getLoginUserId()); // 生成随机 UUID UUID randomUUID = UUID.randomUUID(); medicalimgDO medicalimgDO = new medicalimgDO(); @@ -430,107 +425,108 @@ public class ultrasonicController { return medicalimgService.insimage(medicalimgDO); } + @PostMapping("/ftpimage") @Operation(summary = "获取图片上传ftp") - public void FtpImage(@RequestBody insimagescreenshotVO insimagescreenshotVO) - { - String base64String = insimagescreenshotVO.getImagebase(); - String ftpServer = "114.55.171.231"; - int ftpPort = 21; // FTP端口,默认为21 - String ftpUser = "pacs"; - String ftpPassword = "pacs"; - String uploadPath = "/"; - String fileName = System.currentTimeMillis()+".jpg"; + public void FtpImage(@RequestBody insimagescreenshotVO insimagescreenshotVO) { + String base64String = insimagescreenshotVO.getImagebase(); + String ftpServer = "192.168.0.110"; //114.55.171.231 + int ftpPort = 21; // FTP端口,默认为21 + String ftpUser = "pacs"; + String ftpPassword = "pacs123"; + String uploadPath = "/"; + String fileName = System.currentTimeMillis() + ".jpg"; - FTPClient ftpClient = new FTPClient(); + FTPClient ftpClient = new FTPClient(); - ftpClient.enterLocalPassiveMode(); - try { - // 连接FTP服务器 - ftpClient.connect(ftpServer, ftpPort); - ftpClient.login(ftpUser, ftpPassword); + ftpClient.enterLocalPassiveMode(); + try { + // 连接FTP服务器 + ftpClient.connect(ftpServer, ftpPort); + ftpClient.login(ftpUser, ftpPassword); - // 设置文件传输类型为二进制 - ftpClient.setFileType(FTP.BINARY_FILE_TYPE); + // 设置文件传输类型为二进制 + ftpClient.setFileType(FTP.BINARY_FILE_TYPE); // 解码Base64字符串 - String base64Image = base64String.split(",")[1]; // 去掉数据URL的头部 - // 解码Base64字符串 - byte[] decodedBytes = Base64.getDecoder().decode(base64Image); + String base64Image = base64String.split(",")[1]; // 去掉数据URL的头部 + // 解码Base64字符串 + byte[] decodedBytes = Base64.getDecoder().decode(base64Image); - // 创建输入流 - InputStream inputStream = new ByteArrayInputStream(decodedBytes); + // 创建输入流 + InputStream inputStream = new ByteArrayInputStream(decodedBytes); - // 上传文件 - boolean result = ftpClient.storeFile(uploadPath + "/" + fileName, inputStream); - if (result) { - //上传成功 - //当前时间 - LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), - DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); - AdminUserDO user = userService.getUser(getLoginUserId()); - // 生成随机 UUID - UUID randomUUID = UUID.randomUUID(); - medicalimgDO medicalimgDO = new medicalimgDO(); - medicalimgDO.setId(randomUUID.toString()); - medicalimgDO.setImgUrl("/video/"+fileName); - medicalimgDO.setCreatePerson(""); - medicalimgDO.setCreateDate(dateTime); - medicalimgDO.setRegId(insimagescreenshotVO.getID()); - medicalimgDO.setOrgId(user.getOrgId()); - medicalimgDO.setSelected("0"); - if (insimagescreenshotVO.getImgType() == null || insimagescreenshotVO.getImgType().trim().equals("")) - medicalimgDO.setImgType("1"); - else - medicalimgDO.setImgType(insimagescreenshotVO.getImgType().trim()); - int count=medicalimgService.insimage(medicalimgDO); - } else { - System.out.println("文件上传失败"); - } + // 上传文件 + boolean result = ftpClient.storeFile(uploadPath + "/" + fileName, inputStream); + if (result) { + //上传成功 + //当前时间 + LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + AdminUserDO user = userService.getUser(getLoginUserId()); + // 生成随机 UUID + UUID randomUUID = UUID.randomUUID(); + medicalimgDO medicalimgDO = new medicalimgDO(); + medicalimgDO.setId(randomUUID.toString()); + medicalimgDO.setImgUrl("http://192.168.0.110:48082/" + fileName); + medicalimgDO.setCreatePerson(""); + medicalimgDO.setCreateDate(dateTime); + medicalimgDO.setRegId(insimagescreenshotVO.getID()); + if (insimagescreenshotVO.getOrgId() != null && !insimagescreenshotVO.getOrgId().trim().equals("")) + medicalimgDO.setOrgId(insimagescreenshotVO.getOrgId().trim()); + else if (user != null && user.getOrgId() != null) + medicalimgDO.setOrgId(user.getOrgId()); + medicalimgDO.setSelected("0"); + if (insimagescreenshotVO.getImgType() == null || insimagescreenshotVO.getImgType().trim().equals("")) + medicalimgDO.setImgType("1"); + else + medicalimgDO.setImgType(insimagescreenshotVO.getImgType().trim()); + int count = medicalimgService.insimage(medicalimgDO); + } else { + System.out.println("文件上传失败"); + } - // 断开连接 - ftpClient.logout(); - ftpClient.disconnect(); - } catch (SocketException e) { - System.err.println("无法连接到FTP服务器: " + e.getMessage()); - } catch (IOException e) { - System.err.println("IO异常: " + e.getMessage()); - } finally { - try { - if (ftpClient.isConnected()) { - ftpClient.disconnect(); - } - } catch (IOException ignored) { + // 断开连接 + ftpClient.logout(); + ftpClient.disconnect(); + } catch (SocketException e) { + System.err.println("无法连接到FTP服务器: " + e.getMessage()); + } catch (IOException e) { + System.err.println("IO异常: " + e.getMessage()); + } finally { + try { + if (ftpClient.isConnected()) { + ftpClient.disconnect(); + } + } catch (IOException ignored) { - } - } + } + } - } + } @PostMapping("/InsImageInfo") @Operation(summary = "影像信息") - public CommonResult InsImageInfo(@RequestBody List patientInfoVOS) throws ParseException { + public CommonResult InsImageInfo(@RequestBody List patientInfoVOS) throws ParseException { try { - if(!patientInfoVOS.isEmpty()) - { - List dicompatientsDOList=new ArrayList<>(); - List dicomstudiesDOList=new ArrayList<>(); - List dicomseriesDOList=new ArrayList<>(); - List dicomimagesDOList=new ArrayList<>(); - for (PatientInfoVO patientInfo : patientInfoVOS) - { + if (!patientInfoVOS.isEmpty()) { + List dicompatientsDOList = new ArrayList<>(); + List dicomstudiesDOList = new ArrayList<>(); + List dicomseriesDOList = new ArrayList<>(); + List dicomimagesDOList = new ArrayList<>(); + for (PatientInfoVO patientInfo : patientInfoVOS) { //获取基础信息 - String PatientID=patientInfo.getPatientID(); - String PatientNam=patientInfo.getPatientNam(); - String PatientBir=DateUtils.formatedcsrq(Long.parseLong(patientInfo.getPatientBir())) ; - String PatientSex=patientInfo.getPatientSex(); - String AccessTime= DateUtils.timestamp(); - String orgId=patientInfo.getOrgId(); - String orgname=patientInfo.getOrgName(); - String StudyDate=patientInfo.getStudyDate(); - List studyVOS= patientInfo.getStudies(); + String PatientID = patientInfo.getPatientID(); + String PatientNam = patientInfo.getPatientNam(); + String PatientBir = DateUtils.formatedcsrq(Long.parseLong(patientInfo.getPatientBir())); + String PatientSex = patientInfo.getPatientSex(); + String AccessTime = DateUtils.timestamp(); + String orgId = patientInfo.getOrgId(); + String orgname = patientInfo.getOrgName(); + String StudyDate = patientInfo.getStudyDate(); + List studyVOS = patientInfo.getStudies(); //填充dicompatients信息 - dicompatientsDO dicompatientsDO=new dicompatientsDO(); + dicompatientsDO dicompatientsDO = new dicompatientsDO(); dicompatientsDO.setPatientID(PatientID); dicompatientsDO.setPatientNam(PatientNam); dicompatientsDO.setPatientBir(PatientBir); @@ -540,16 +536,14 @@ public class ultrasonicController { dicompatientsDO.setDataSync("1"); dicompatientsDOList.add(dicompatientsDO); - if(!studyVOS.isEmpty()) - { - for (StudyVO studyVO :studyVOS) - { + if (!studyVOS.isEmpty()) { + for (StudyVO studyVO : studyVOS) { // study表的主键 - // String StudyInsta= UUID.randomUUID().toString(); - String StudyInsta= studyVO.getStudyID(); - dicomstudiesDO dicomstudiesDO=new dicomstudiesDO(); + // String StudyInsta= UUID.randomUUID().toString(); + String StudyInsta = studyVO.getStudyID(); + dicomstudiesDO dicomstudiesDO = new dicomstudiesDO(); dicomstudiesDO.setStudyInsta(StudyInsta); - dicomstudiesDO.setStudyDate(StudyDate.split(" ")[0].replace("-","")); + dicomstudiesDO.setStudyDate(StudyDate.split(" ")[0].replace("-", "")); dicomstudiesDO.setStudyTime(DateUtils.formattedTime(StudyDate.split(" ")[1])); dicomstudiesDO.setStudyID(studyVO.getStudyID()); dicomstudiesDO.setStudyDescr(studyVO.getStudyDescr()); @@ -561,20 +555,18 @@ public class ultrasonicController { dicomstudiesDO.setAccessTime(AccessTime); dicomstudiesDO.setOrgId(orgId); dicomstudiesDOList.add(dicomstudiesDO); - List series= studyVO.getSeries(); + List series = studyVO.getSeries(); - if (!series.isEmpty()) - { + if (!series.isEmpty()) { - for (SeriesVO seriesVO:series) - { + for (SeriesVO seriesVO : series) { //service表主键 - String SeriesInst=UUID.randomUUID().toString(); - // String SeriesInst= seriesVO.getSeriesNumb(); - dicomseriesDO dicomseriesDO=new dicomseriesDO(); + String SeriesInst = UUID.randomUUID().toString(); + // String SeriesInst= seriesVO.getSeriesNumb(); + dicomseriesDO dicomseriesDO = new dicomseriesDO(); dicomseriesDO.setSeriesInst(SeriesInst); dicomseriesDO.setSeriesNumb(seriesVO.getSeriesNumb()); - dicomseriesDO.setSeriesDate(StudyDate.split(" ")[0].replace("-","")); + dicomseriesDO.setSeriesDate(StudyDate.split(" ")[0].replace("-", "")); dicomseriesDO.setSeriesTime(DateUtils.formattedTime(StudyDate.split(" ")[1])); dicomseriesDO.setSeriesDesc(seriesVO.getSeriesDesc()); dicomseriesDO.setModality(seriesVO.getModality()); @@ -586,19 +578,17 @@ public class ultrasonicController { dicomseriesDO.setAccessTime(AccessTime); dicomseriesDO.setOrgId(orgId); dicomseriesDOList.add(dicomseriesDO); - List imageVOS= seriesVO.getImage() ; - if (!imageVOS.isEmpty()) - { - for (ImageVO imageVO:imageVOS) - { + List imageVOS = seriesVO.getImage(); + if (!imageVOS.isEmpty()) { + for (ImageVO imageVO : imageVOS) { //image主键 - String SOPInstanc=UUID.randomUUID().toString(); - dicomimagesDO dicomimagesDO=new dicomimagesDO(); + String SOPInstanc = UUID.randomUUID().toString(); + dicomimagesDO dicomimagesDO = new dicomimagesDO(); dicomimagesDO.setSOPInstanc(SOPInstanc); dicomimagesDO.setImageNumbe(imageVO.getImageNumber()); - dicomimagesDO.setImageDate(StudyDate.split(" ")[0].replace("-","")); + dicomimagesDO.setImageDate(StudyDate.split(" ")[0].replace("-", "")); dicomimagesDO.setImageTime(DateUtils.formattedTime(StudyDate.split(" ")[1])); - dicomimagesDO.setAcqDate(StudyDate.split(" ")[0].replace("-","")); + dicomimagesDO.setAcqDate(StudyDate.split(" ")[0].replace("-", "")); dicomimagesDO.setAcqTime(DateUtils.formattedTime(StudyDate.split(" ")[1])); dicomimagesDO.setSeriesInst(SeriesInst); dicomimagesDO.setAccessTime(AccessTime); @@ -618,23 +608,18 @@ public class ultrasonicController { } } - if (!dicompatientsDOList.isEmpty()&&!dicomstudiesDOList.isEmpty()&&!dicomseriesDOList.isEmpty()&&!dicomimagesDOList.isEmpty()) - { - dicompatientsService.insertAll(dicompatientsDOList,dicomstudiesDOList,dicomseriesDOList,dicomimagesDOList); + if (!dicompatientsDOList.isEmpty() && !dicomstudiesDOList.isEmpty() && !dicomseriesDOList.isEmpty() && !dicomimagesDOList.isEmpty()) { + dicompatientsService.insertAll(dicompatientsDOList, dicomstudiesDOList, dicomseriesDOList, dicomimagesDOList); } + } else { + return success("参数为空"); } - else - { - return success("参数为空"); - } - } - catch (Exception e) - { - return success(e.getMessage()); + } catch (Exception e) { + return success(e.getMessage()); } - return success("插入成功"); + return success("插入成功"); }