From 0903a188d1ba93193c7f5d5c1907635093825b0e Mon Sep 17 00:00:00 2001 From: lxd <1004405501@qq.com> Date: Mon, 21 Oct 2024 12:26:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=B9=E5=A4=96=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/common/util/http/HttpUtils.java | 53 ++++- .../pom.xml | 6 + .../admin/applyform/ApplyformController.java | 210 +++++++++++++++--- .../dal/dataobject/applyform/ApplyformDO.java | 6 + .../outapi/JwtTokenAutoConfiguration.java | 1 + .../yudao-module-tblist-biz/pom.xml | 5 + .../PatientexamlistController.java | 71 ++++++ .../patientexamlist/PatientexamlistDO.java | 3 + .../PatientexamlistMapper.java | 4 +- .../yudao-module-ultrasoniccom-biz/pom.xml | 12 +- .../ultrasonic/ultrasonicController.java | 14 +- .../image/dicompatientsServiceImpl.java | 45 +++- .../service/ultrasonic/ultrasonicService.java | 2 +- .../ultrasonic/ultrasonicServiceImpl.java | 3 +- 14 files changed, 394 insertions(+), 41 deletions(-) diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java index d36b2c308..1ee02d420 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java @@ -10,8 +10,13 @@ import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; import javax.servlet.http.HttpServletRequest; -import java.net.URI; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.*; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Map; /** @@ -121,6 +126,52 @@ public class HttpUtils { } return null; } + /** + *post请求 formdata形式 + */ + public static String sendPostFormData(String urlString, Map formData) throws IOException { + HttpURLConnection connection = null; + try { + URL url = new URL(urlString); + connection = (HttpURLConnection) url.openConnection(); + + // 设置请求方法和属性 + connection.setRequestMethod("POST"); + connection.setDoOutput(true); + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + + // 构建请求体 + StringBuilder postData = new StringBuilder(); + for (Map.Entry entry : formData.entrySet()) { + if (postData.length() != 0) postData.append("&"); + postData.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8.toString())); + postData.append("="); + postData.append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString())); + } + + // 发送请求体 + try (OutputStream os = connection.getOutputStream()) { + byte[] input = postData.toString().getBytes(StandardCharsets.UTF_8); + os.write(input, 0, input.length); + } + + // 读取响应 + StringBuilder response = new StringBuilder(); + try (BufferedReader br = new BufferedReader( + new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { + String responseLine; + while ((responseLine = br.readLine()) != null) { + response.append(responseLine.trim()); + } + } + + return response.toString(); + } finally { + if (connection != null) { + connection.disconnect(); + } + } + } } diff --git a/yudao-module-applyregistration/yudao-module-applyregistration-biz/pom.xml b/yudao-module-applyregistration/yudao-module-applyregistration-biz/pom.xml index b70e80338..83e56105e 100644 --- a/yudao-module-applyregistration/yudao-module-applyregistration-biz/pom.xml +++ b/yudao-module-applyregistration/yudao-module-applyregistration-biz/pom.xml @@ -132,6 +132,12 @@ 2.1.0-jdk8-snapshot compile + + cn.iocoder.boot + yudao-module-ultrasoniccom-biz + 2.1.0-jdk8-snapshot + compile + diff --git a/yudao-module-applyregistration/yudao-module-applyregistration-biz/src/main/java/cn/iocoder/yudao/module/applyregistration/controller/admin/applyform/ApplyformController.java b/yudao-module-applyregistration/yudao-module-applyregistration-biz/src/main/java/cn/iocoder/yudao/module/applyregistration/controller/admin/applyform/ApplyformController.java index 76d10d652..5e248b89c 100644 --- a/yudao-module-applyregistration/yudao-module-applyregistration-biz/src/main/java/cn/iocoder/yudao/module/applyregistration/controller/admin/applyform/ApplyformController.java +++ b/yudao-module-applyregistration/yudao-module-applyregistration-biz/src/main/java/cn/iocoder/yudao/module/applyregistration/controller/admin/applyform/ApplyformController.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.applyregistration.controller.admin.applyform; +import cn.iocoder.yudao.framework.common.util.http.HttpUtils; +import cn.iocoder.yudao.module.applyregistration.dal.mysql.applyform.ApplyformMapper; import cn.iocoder.yudao.module.system.api.DatabaseUtils; import cn.iocoder.yudao.module.applyregistration.controller.admin.applyform.devicevo.DeviceVO; import cn.iocoder.yudao.module.applyregistration.controller.admin.applyform.devicevo.deviceupVO; @@ -14,8 +16,17 @@ import cn.iocoder.yudao.module.system.service.apiconfig.ApiconfigService; import cn.iocoder.yudao.module.system.service.dicomworklist.DicomworklistService; import cn.iocoder.yudao.module.system.service.org.OrgUnitService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import cn.iocoder.yudao.module.tblist.controller.admin.patientexamlist.vo.MedicalDataVO; import cn.iocoder.yudao.module.tblist.dal.dataobject.patientexamlist.PatientexamlistDO; import cn.iocoder.yudao.module.tblist.service.patientexamlist.PatientexamlistService; +import cn.iocoder.yudao.module.ultrasoniccom.service.image.dicompatientsServiceImpl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.mzt.logapi.starter.annotation.LogRecord; import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; @@ -66,7 +77,8 @@ public class ApplyformController { private static final Logger log = LoggerFactory.getLogger(ApplyformController.class); @Resource private ApplyformService applyformService; - + @Resource + private ApplyformMapper applyformMapper; @Resource private DeviceService DeviceService; @@ -81,8 +93,9 @@ public class ApplyformController { private PatientexamlistService patientexamlistService; @Resource - private OrgUnitService Service; - + private OrgUnitService Service; + @Resource + private dicompatientsServiceImpl dicompatientsService; @PostMapping("/create") @Operation(summary = "创建申请登记记录") @PreAuthorize("@ss.hasPermission('applyregistration:applyform:create')") @@ -202,7 +215,7 @@ public class ApplyformController { } //处理数据 - private @NotNull List getDicomworklistDOS(deviceupVO deviceVO, AdminUserDO user) { + private @NotNull List getDicomworklistDOS(deviceupVO deviceVO, AdminUserDO user) { List dicomworklistDOS = new ArrayList<>(); for (DicomWorklistVO item : deviceVO.getWorklist()) { // 处理每个元素 @@ -225,7 +238,7 @@ public class ApplyformController { } //处理数据 - private @NotNull List getPatientexamlistDOS(deviceupVO deviceVO, AdminUserDO user) { + private @NotNull List getPatientexamlistDOS(deviceupVO deviceVO, AdminUserDO user) { List patientexamlistDOList = new ArrayList<>(); OrgUnitDO aDo = Service.get(user.getOrgId()); for (DicomWorklistVO item : deviceVO.getWorklist()) { @@ -237,7 +250,7 @@ public class ApplyformController { patientexamlistDO.setId(guid.toString()); patientexamlistDO.setExamId(item.getStudyInsta()); patientexamlistDO.setPName(item.getPatientNam()); - patientexamlistDO.setGender(Objects.equals(item.getPatientSex(), "F") ?"女":"男"); + patientexamlistDO.setGender(Objects.equals(item.getPatientSex(), "F") ? "女" : "男"); patientexamlistDO.setBirthday(PatientBir.atStartOfDay()); patientexamlistDO.setDeviceType(item.getModality()); patientexamlistDO.setExamItemName(item.getExamItemName()); @@ -332,7 +345,7 @@ public class ApplyformController { patientexamlistDO.setId(guid.toString()); patientexamlistDO.setExamId(item.getStudyInsta()); patientexamlistDO.setPName(item.getPatientNam()); - patientexamlistDO.setGender(Objects.equals(item.getPatientSex(), "F") ?"女":"男"); + patientexamlistDO.setGender(Objects.equals(item.getPatientSex(), "F") ? "女" : "男"); patientexamlistDO.setBirthday(PatientBir.atStartOfDay()); patientexamlistDO.setDeviceType(item.getModality()); patientexamlistDO.setExamItemName(item.getExamItemName()); @@ -367,41 +380,186 @@ public class ApplyformController { @GetMapping("/SyncDb") @PreAuthorize("@ss.hasPermission('applyregistration:applyform:query')") - public CommonResult SyncDb(@RequestParam("AppCode") String AppCode) throws SQLException, ClassNotFoundException { + public CommonResult SyncDb(@RequestParam("AppCode") String AppCode, @RequestParam("type") String type) throws SQLException, ClassNotFoundException, IOException { + + String StrMsg = "同步成功"; + //先从数据表中那对应的配置 ApiconfigDO apiconfigDO = apiconfigService.getApiCodeconfig(AppCode); if (apiconfigDO != null) { String sql = apiconfigDO.getApiUrl(); - switch (apiconfigDO.getDatabaseType()) { - case "mysql": - DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.MYSQL, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getDatabasePort()); - DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.MYSQL); - List> executeQuery = DatabaseUtils.executeQuery(DatabaseUtils.DatabaseType.MYSQL, sql); - break; - case "sqlserver": - DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.SQLSERVER, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getRemark()); - DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.SQLSERVER); - break; - case "oracle": - DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.ORACLE, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getRemark()); - DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.ORACLE); - break; + if(sql.isEmpty()) + { + return success("请配置同步接口"); + } + //获取当前登陆用户 + AdminUserDO user = userService.getUser(getLoginUserId()); + //1表示接口 + if (type.equals("1")) { //土贵乌拉 + if (user.getOrgId().equals("150926PDY564156")) { + Map tokendata = new HashMap<>(); + tokendata.put("appkey", "7653571505643966826"); + tokendata.put("appsecret", "z8SVG1NBFY9d74LM"); + String tokenresponse = HttpUtils.sendPostFormData(sql+"/api/pacs/getPacsToken", tokendata); + + JsonObject jsonObject = JsonParser.parseString(tokenresponse).getAsJsonObject(); + JsonObject dataObject = jsonObject.get("data").getAsJsonObject(); + + String accessToken = dataObject.get("access_token").getAsString(); + int expiresIn = dataObject.get("expires_in").getAsInt(); + + LocalDate currentDate = LocalDate.now(); + Map data = new HashMap<>(); + data.put("Yiyuanid", "150926PDY564156"); + data.put("dateStart",currentDate.toString()); + data.put("token", accessToken); + data.put("dateEnd", currentDate.toString()); + String response = HttpUtils.sendPostFormData(sql+"/api/pacs/getpacsdata", data); + JsonObject json = JsonParser.parseString(response).getAsJsonObject(); + ObjectMapper objectMapper = new ObjectMapper(); + PatientInfoVO patientInfo = objectMapper.readValue(json.toString(), PatientInfoVO.class); + if (!patientInfo.rows.isEmpty()) { + + List doList = new ArrayList<>(); + //表示多个患者 + for (rows rows : patientInfo.rows) { //存在循环下一个患者数据 + if (checkIfDataExists(rows.huanzheid)) { + continue; + } + int i = 0; + //一个患者多个检查 + for (Project project : rows.projects) { + i++; + //出生日期 + LocalDate PatientBir = LocalDate.parse(rows.birthdate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + //开单时间 + LocalDateTime examdate = LocalDateTime.parse(rows.kaifangsj, 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")); + UUID guid = UUID.randomUUID(); + ApplyformDO applyformDO = new ApplyformDO(); + applyformDO.setId(guid.toString()); + applyformDO.setRegId(rows.jianchaid);//患者ID + applyformDO.setRegSource(rows.visitType); + applyformDO.setExamId(rows.jianchabh + "_" + i);//检查ID + applyformDO.setPName(rows.name); + applyformDO.setGender(rows.sex); + applyformDO.setSfz(rows.sfz); + applyformDO.setBirthday(PatientBir.atStartOfDay()); + applyformDO.setExamDate(examdate); + applyformDO.setExamItemName(project.jianchamingcheng); + applyformDO.setRegDate(examdate); + applyformDO.setBillgDoctor(rows.resDoctorName); + applyformDO.setExamStatus("未分检"); + applyformDO.setBillDoctorDepartment(rows.departmentName); + applyformDO.setCreateDate(dateTime); + applyformDO.setExamItemCode(project.nhbm); + applyformDO.setOrgId(user.getOrgId()); + doList.add(applyformDO); + } + } + //没有数据 表示数据都同步过了 + if (!doList.isEmpty()) { + applyformService.insertbatch(doList); + } else { + StrMsg = "暂无需要同步的数据"; + } + + } + else + { + StrMsg = "暂无需要同步的数据"; + } + } + } else if (type.equals("2")) //2 数据库 + { + switch (apiconfigDO.getDatabaseType()) { + case "mysql": + DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.MYSQL, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getDatabasePort()); + DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.MYSQL); + List> executeQuery = DatabaseUtils.executeQuery(DatabaseUtils.DatabaseType.MYSQL, sql); + break; + case "sqlserver": + DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.SQLSERVER, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getRemark()); + DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.SQLSERVER); + break; + case "oracle": + DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.ORACLE, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getRemark()); + DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.ORACLE); + break; + } } } - return success(true); + return success(StrMsg); + } + + ///判断数据是否存在 + private boolean checkIfDataExists(String id) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("regId", id); // 假设我们通过id来检查数据是否存在 + int count = Math.toIntExact(applyformMapper.selectCount(queryWrapper)); + return count > 0; } @GetMapping("/getreglisrcount") - public CommonResult GetReglistCount() - { + public CommonResult GetReglistCount() { //获取当前登陆用户 AdminUserDO user = userService.getUser(getLoginUserId()); - ApplyformCountVO applyformCountVO= applyformService.GetRegisCount(user.getOrgId()); + ApplyformCountVO applyformCountVO = applyformService.GetRegisCount(user.getOrgId()); return success(applyformCountVO); } + + @GetMapping("/GetPatientPDFDcm") + @Operation(summary = "获取患者的PDF和dcm信息") + public String GetPatientPDFDcm(@RequestParam(value = "sfz", required = false) String sfz,@RequestParam("regId") String regId,@RequestParam("orgId") String orgId) + { + String msg=""; + String re="调取成功"; + if (regId != null && !regId.isEmpty() && orgId != null && !orgId.isEmpty()) { + Map params = new HashMap<>(); + params.put("regId", regId); + params.put("orgId", orgId); + //存放最后结果 + MedicalDataVO medicalDataVO = new MedicalDataVO(); + //查询出符合条件的患者数据 + List patientexamlistDOList = patientexamlistService.selectMp(params); + if (!patientexamlistDOList.isEmpty()) { + //存放这个患者所有的pdf地址 + List pdfurl = new ArrayList<>(); + //存放这个患者所有的dcm地址 + List dcmurl = new ArrayList<>(); + for (PatientexamlistDO patientexamlistDO : patientexamlistDOList) { + //条件不满足说明这个人没有进行分析 无法提供相关数据 + if (patientexamlistDO.getDiagDoctor() != null && !patientexamlistDO.getDiagDoctor().isEmpty()) { + pdfurl.add(patientexamlistDO.getPdfurl()); + } + } + if(pdfurl.isEmpty()) + { + re = "{\"msg\":\"该患者未进行分析\",\"code\":200,\"data\":{}}"; + } + else + { + //取这个患者的所有的dcm地址 + dcmurl = dicompatientsService.GetDcmUrl(regId, orgId); + medicalDataVO.setPdflist(pdfurl); + medicalDataVO.setDcm(dcmurl); + medicalDataVO.setPdf(""); + Gson gson = new GsonBuilder() + .serializeSpecialFloatingPointValues() // 序列化特殊浮点数值(如 NaN, Infinity) + .disableHtmlEscaping() // 禁用 HTML 转义 + .create(); + re = "{\"msg\":\""+re+"\",\"code\":200,\"data\":" + gson.toJson(medicalDataVO) + "}"; + } + + } + + } + return re; + } } \ No newline at end of file diff --git a/yudao-module-applyregistration/yudao-module-applyregistration-biz/src/main/java/cn/iocoder/yudao/module/applyregistration/dal/dataobject/applyform/ApplyformDO.java b/yudao-module-applyregistration/yudao-module-applyregistration-biz/src/main/java/cn/iocoder/yudao/module/applyregistration/dal/dataobject/applyform/ApplyformDO.java index 3cc295b06..02f41c24d 100644 --- a/yudao-module-applyregistration/yudao-module-applyregistration-biz/src/main/java/cn/iocoder/yudao/module/applyregistration/dal/dataobject/applyform/ApplyformDO.java +++ b/yudao-module-applyregistration/yudao-module-applyregistration-biz/src/main/java/cn/iocoder/yudao/module/applyregistration/dal/dataobject/applyform/ApplyformDO.java @@ -147,4 +147,10 @@ public class ApplyformDO { @TableField("remark") private String remark; + /** + * 身份证号 + */ + @TableField("sfz") + private String sfz; + } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/outapi/JwtTokenAutoConfiguration.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/outapi/JwtTokenAutoConfiguration.java index 7c98f8abf..f7285f753 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/outapi/JwtTokenAutoConfiguration.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/outapi/JwtTokenAutoConfiguration.java @@ -12,6 +12,7 @@ public class JwtTokenAutoConfiguration implements WebMvcConfigurer { registry.addInterceptor(new JwtTokenInterceptor()) .addPathPatterns("/admin-api/ultrasoniccom/ultrasonic/InsImageInfo", "/admin-api/tblist/patientexamlist/GetAnalysisInfo", + "/admin-api/applyregistration/applyform/GetPatientPDFDcm", "/admin-api/tblist/patientexamlist/addPatientExamInfo"); } } diff --git a/yudao-module-tblist/yudao-module-tblist-biz/pom.xml b/yudao-module-tblist/yudao-module-tblist-biz/pom.xml index 049b483b3..e0aa3cdb3 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/pom.xml +++ b/yudao-module-tblist/yudao-module-tblist-biz/pom.xml @@ -126,6 +126,11 @@ 2.1.0-jdk8-snapshot compile + + commons-net + commons-net + + diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java index 720bbc6c3..be35f699e 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java @@ -6,9 +6,12 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.service.org.OrgUnitService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.module.tblist.service.patientexamlist.org.OrgService; + import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.mzt.logapi.starter.annotation.LogRecord; +import org.apache.commons.net.ftp.FTP; +import org.apache.commons.net.ftp.FTPClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.*; @@ -20,6 +23,9 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Operation; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.net.SocketException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -396,5 +402,70 @@ public class PatientexamlistController { return success(msg); } + @PostMapping("/ftppdf") + @Operation(summary = "获取pdf上传ftp") + public void FtpPdf(@RequestBody inspdfscreenshotVO 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()+".pdf"; + + FTPClient ftpClient = new FTPClient(); + + ftpClient.enterLocalPassiveMode(); + try { + // 连接FTP服务器 + ftpClient.connect(ftpServer, ftpPort); + ftpClient.login(ftpUser, ftpPassword); + + // 设置文件传输类型为二进制 + ftpClient.setFileType(FTP.BINARY_FILE_TYPE); + // 解码Base64字符串 + String base64Image = base64String.split(",")[1]; // 去掉数据URL的头部 + // 解码Base64字符串 + byte[] decodedBytes = Base64.getDecoder().decode(base64Image); + + // 创建输入流 + 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()); + PatientexamlistSaveReqVO updateReqVO = new PatientexamlistSaveReqVO(); + updateReqVO.setId(insimagescreenshotVO.getID()); + updateReqVO.setPdfurl("http://114.55.171.231:48082/"+fileName); + patientexamlistService.updatePatientexamlist(updateReqVO); + } 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) { + + } + } + + + } } \ 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 544e9e90e..0ccc86dcb 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 @@ -180,4 +180,7 @@ public class PatientexamlistDO extends BaseDO { @TableField(value = "FavouriteTime",updateStrategy = FieldStrategy.IGNORED) private LocalDateTime FavouriteTime; + + @TableField(value = "pdfurl") + private String pdfurl; } \ 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/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 86b0f6756..c9367ac5f 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 @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.tblist.dal.dataobject.patientexamlist.PatientexamlistDO; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import org.apache.ibatis.annotations.*; import cn.iocoder.yudao.module.tblist.controller.admin.patientexamlist.vo.*; @@ -15,6 +16,7 @@ import cn.iocoder.yudao.module.tblist.controller.admin.patientexamlist.vo.*; * @author 李晓东 */ @Mapper +@InterceptorIgnore(tenantLine = "true") public interface PatientexamlistMapper extends BaseMapperX { //更新 @Update(" UPDATE tb_patientexamlist t1 SET t1.examItemName=#{examItemName} WHERE t1.ID=#{id} ") @@ -65,7 +67,7 @@ public interface PatientexamlistMapper extends BaseMapperX { .betweenIfPresent(PatientexamlistDO::getUploadDate, reqVO.getUploadDate()) .likeIfPresent(PatientexamlistDO::getOrgName, reqVO.getOrgName()) // .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()) diff --git a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/pom.xml b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/pom.xml index bdf398aaa..7cb3b556e 100644 --- a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/pom.xml +++ b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/pom.xml @@ -18,11 +18,7 @@ - - cn.iocoder.boot - yudao-module-applyregistration-biz - ${revision} - + cn.iocoder.boot yudao-module-ultrasoniccom-api @@ -134,6 +130,12 @@ commons-net commons-net + + cn.iocoder.boot + yudao-module-system-biz + 2.1.0-jdk8-snapshot + compile + 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 2ab574245..8caceb692 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 @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.service.dicomworklist.DicomworklistService; import cn.iocoder.yudao.module.system.service.org.OrgUnitService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; + import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.ImageVO; import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.PatientInfoVO; import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.SeriesVO; @@ -31,9 +32,11 @@ import cn.iocoder.yudao.module.ultrasoniccom.service.medicalimg.medicalimgServic import cn.iocoder.yudao.module.ultrasoniccom.service.ultrasonic.ultrasonicService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; -import cn.iocoder.yudao.module.applyregistration.controller.admin.applyform.ApplyformController; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -67,7 +70,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti @Validated public class ultrasonicController { - private static final Logger log = LoggerFactory.getLogger(ApplyformController.class); + @Resource private ultrasonicService ultrasonicService; @Resource @@ -90,6 +93,8 @@ public class ultrasonicController { private dicomimagesMapeer dicomimagesMapeer; @Resource private dicompatientsServiceImpl dicompatientsService; + + @GetMapping("/reporttemplatetlist") @Operation(summary = "获取模版表数据") @DataPermission(enable = false) @@ -275,7 +280,7 @@ public class ultrasonicController { } } else { - log.error("超声审核更新图片数据方法参数为空"); + return success(false); } @@ -311,7 +316,6 @@ public class ultrasonicController { @GetMapping("/getdcm") @Operation(summary = "获取dcm数据") - public CommonResult GetDcmList(@RequestParam("orgID") String orgID, @RequestParam("studyInsta") String studyInsta, @RequestParam("regId") String regId) throws JsonProcessingException { String strJson = ""; String json = ""; @@ -619,4 +623,6 @@ public class ultrasonicController { return success("插入成功"); } + + } diff --git a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/image/dicompatientsServiceImpl.java b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/image/dicompatientsServiceImpl.java index 75cfb1e70..f20c5c0ee 100644 --- a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/image/dicompatientsServiceImpl.java +++ b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/image/dicompatientsServiceImpl.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.ultrasoniccom.service.image; + import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicomimagesDO; import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicompatientsDO; import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicomseriesDO; @@ -8,17 +9,19 @@ import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicomimagesMap import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicompatientsMapper; import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicomseriesMapper; import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicomstudiesMapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; @Service @Validated -public class dicompatientsServiceImpl { +public class dicompatientsServiceImpl { @Autowired private dicompatientsMapper dicompatientsMapper; @@ -42,4 +45,44 @@ public class dicompatientsServiceImpl { dicomseriesMapper.insertBatch(dicomseriesDOList); dicomimagesMapper.insertBatch(dicomimagesDOList); } + + + public List GetDcmUrl(String regId, String orgId) { + //存放该患者所有的dcmurl + List dcmurl = new ArrayList<>(); + QueryWrapper dicomstudiesWrapper = new QueryWrapper<>(); + dicomstudiesWrapper.eq("PatientID", regId); + dicomstudiesWrapper.eq("orgId", orgId); + List dicomstudiesDOList = dicomstudiesMapper.selectList(dicomstudiesWrapper); + if (!dicomstudiesDOList.isEmpty()) { + for (dicomstudiesDO dicomstudiesDO : dicomstudiesDOList) { + String StudyInsta = dicomstudiesDO.getStudyInsta(); + QueryWrapper dicomseriesWrapper = new QueryWrapper<>(); + dicomseriesWrapper.eq("StudyInsta", StudyInsta); + dicomseriesWrapper.eq("orgId", orgId); + dicomseriesWrapper.ne("BodyPartEx", ""); + // dicomseriesWrapper.and(wrapper -> wrapper.notLike("BodyPartEx", "").or().eq("BodyPartEx", "")); + List dicomseriesDOS = dicomseriesMapper.selectList(dicomseriesWrapper); + if (!dicomseriesDOS.isEmpty()) { + for (dicomseriesDO dicomseriesDO : dicomseriesDOS) { + String SeriesInst = dicomseriesDO.getSeriesInst(); + QueryWrapper dicomimagesWrapper = new QueryWrapper<>(); + dicomimagesWrapper.eq("SeriesInst", SeriesInst); + dicomimagesWrapper.eq("orgId", orgId); + List dicomimagesDOS = dicomimagesMapper.selectList(dicomimagesWrapper); + if (!dicomimagesDOS.isEmpty()) { + for (dicomimagesDO dicomimagesDO : dicomimagesDOS) { + String obj= dicomimagesDO.getObjectFile(); + String url= dicomimagesDO.getUrlPrefix(); + dcmurl.add(url+obj); + } + } + } + } + } + } + + return dcmurl; + } + } diff --git a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/ultrasonic/ultrasonicService.java b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/ultrasonic/ultrasonicService.java index a53e36ae1..49631ec16 100644 --- a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/ultrasonic/ultrasonicService.java +++ b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/ultrasonic/ultrasonicService.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.ultrasoniccom.service.ultrasonic; -import cn.iocoder.yudao.module.applyregistration.dal.dataobject.applyform.ApplyformDO; + import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg.medicalimgVO; import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.medicalimg.medicalimgDO; import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.ultrasonicDO; diff --git a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/ultrasonic/ultrasonicServiceImpl.java b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/ultrasonic/ultrasonicServiceImpl.java index dcc71e125..b0aad1c3c 100644 --- a/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/ultrasonic/ultrasonicServiceImpl.java +++ b/yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/service/ultrasonic/ultrasonicServiceImpl.java @@ -1,8 +1,7 @@ package cn.iocoder.yudao.module.ultrasoniccom.service.ultrasonic; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; -import cn.iocoder.yudao.module.applyregistration.dal.dataobject.applyform.ApplyformDO; -import cn.iocoder.yudao.module.applyregistration.dal.mysql.applyform.ApplyformMapper; + import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg.medicalimgVO; import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.medicalimg.medicalimgDO; import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.ultrasonicDO;