From 3087779e5a98bf7cc80c010fe888df8c41ac4816 Mon Sep 17 00:00:00 2001 From: lichuanyang <1176537920@qq.com> Date: Thu, 15 Aug 2024 13:07:18 +0800 Subject: [PATCH] =?UTF-8?q?dicom=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dicomworklist/DicomworklistMapper.java | 14 ++- .../PatientexamlistController.java | 8 ++ .../vo/PatientexamlistPageReqVO.java | 3 +- .../patientexamlist/PatientexamlistDO.java | 2 +- .../PatientexamlistService.java | 8 ++ .../PatientexamlistServiceImpl.java | 111 ++++++++++++++++++ 6 files changed, 142 insertions(+), 4 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dicomworklist/DicomworklistMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dicomworklist/DicomworklistMapper.java index 834047b12..554f8dcee 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dicomworklist/DicomworklistMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dicomworklist/DicomworklistMapper.java @@ -7,9 +7,8 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.system.dal.dataobject.dicomworklist.*; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; -import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.system.controller.admin.dicomworklist.vo.*; -import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.*; /** * 分检业务表 Mapper @@ -69,4 +68,15 @@ public interface DicomworklistMapper extends BaseMapperX { // 根据Series的SeriesInst集合查询Dicomiamge表对应的数据 List GetDicomImageListData(@Param("seriesInstList") List seriesInstList, @Param("orgId") String orgId); + @Select(" SELECT t1.* FROM dicompatients t1 WHERE t1.dataSync='0' ") + List GetDicompatientsByDataSync(); + + @Select(" SELECT t1.* FROM dicomstudies t1 WHERE t1.PatientID=#{patientID} ") + List GetDicomstudiesByPatientID(@Param("patientID") String patientID); + + @Select(" SELECT t1.* FROM dicomseries t1 WHERE t1.StudyInsta=#{studyInsta} ") + List GetDicomSeriesByStudyInsta(@Param("studyInsta") String studyInsta); + + @Update(" UPDATE dicompatients t1 SET t1.dataSync='1' WHERE t1.PatientID=#{patientID} ") + int UpdateDataSyncOfDicompatientsByPatientID(@Param("patientID") String patientID); } \ 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/PatientexamlistController.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java index 4b8caf07a..ea3936eb4 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 @@ -143,6 +143,14 @@ public class PatientexamlistController { return success(pageResult); } + @GetMapping("/dicomDataSync") + @Operation(summary = "dicom数据同步") + @PreAuthorize("@ss.hasPermission('tblist:patientexamlist:query')") + public CommonResult dicomDataSync() { + patientexamlistService.dicomDataSync(); + return success(true); + } + @GetMapping("/export-excel") @Operation(summary = "导出PACS检查列表 Excel") @PreAuthorize("@ss.hasPermission('tblist:patientexamlist:export')") 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..5b67e72c8 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 @@ -25,7 +25,8 @@ public class PatientexamlistPageReqVO extends PageParam { private String gender; @Schema(description = "出生日期") - private Date birthday; + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime birthday; @Schema(description = "检查日期:年月日时分秒") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 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..515a95035 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 @@ -55,7 +55,7 @@ public class PatientexamlistDO extends BaseDO { * 出生日期 */ @TableField("birthday") - private Date birthday; + private LocalDateTime birthday; /** * 检查日期 */ diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistService.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistService.java index c0a7fb50e..d83a5720a 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistService.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistService.java @@ -70,4 +70,12 @@ public interface PatientexamlistService { */ PageResult getReportPrintStatisticsPage(ReportPrintPageReqVO pageReqVO); + /** + * 同步dicom数据至tb_patientexamlist + * + * @param + * @return + */ + void dicomDataSync(); + } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistServiceImpl.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistServiceImpl.java index 49d75def6..fe9e4488a 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistServiceImpl.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/patientexamlist/PatientexamlistServiceImpl.java @@ -1,11 +1,18 @@ package cn.iocoder.yudao.module.tblist.service.patientexamlist; import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.module.system.dal.dataobject.dicomworklist.*; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.dicomworklist.DicomworklistMapper; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; import java.util.*; import cn.iocoder.yudao.module.tblist.controller.admin.patientexamlist.vo.*; @@ -19,6 +26,7 @@ import cn.iocoder.yudao.module.tblist.dal.mysql.patientexamlist.PatientexamlistM import javax.annotation.Resource; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; /** @@ -33,6 +41,12 @@ public class PatientexamlistServiceImpl implements PatientexamlistService { @Resource private PatientexamlistMapper patientexamlistMapper; + @Resource + private DicomworklistMapper dicomworklistMapper; + + @Resource + private AdminUserService userService; + @Override public String createPatientexamlist(PatientexamlistSaveReqVO createReqVO) { // 插入 @@ -85,4 +99,101 @@ public class PatientexamlistServiceImpl implements PatientexamlistService { return patientexamlistMapper.selectPage(pageReqVO); } + @Override + public void dicomDataSync() { + + //当前登陆用户 + AdminUserDO user = userService.getUser(getLoginUserId()); + //当前时间 + LocalDateTime dateTime = null; + //生成UUID + UUID guid = null; + //num + int num = 0; + + PatientexamlistDO patientexamlist = null; + List dicomPatients = dicomworklistMapper.GetDicompatientsByDataSync(); + List dicomStudies = null; + List dicomSeries = null; + if (dicomPatients != null && dicomPatients.size() > 0) { + for (DicompatientDO dicomPatient : dicomPatients) { + dicomStudies = dicomworklistMapper.GetDicomstudiesByPatientID(dicomPatient.getPatientID()); + if (dicomStudies != null && dicomStudies.size() > 0) { + for (DicomstudiesDO dicomStudie : dicomStudies) { + patientexamlist = new PatientexamlistDO(); + + //当前时间 + 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(); + //获取dicomSeries + dicomSeries = dicomworklistMapper.GetDicomSeriesByStudyInsta(dicomStudie.getStudyInsta()); + + patientexamlist.setId(guid.toString()); + patientexamlist.setRegId(dicomPatient.getPatientID()); + patientexamlist.setExamId(dicomStudie.getStudyInsta()); + patientexamlist.setExamDate(formatLocalDateTime2(String.valueOf(dicomStudie.getAccessTime()))); + patientexamlist.setExamItemCode(dicomStudie.getStudyID()); + patientexamlist.setExamItemName(dicomStudie.getStudyDescr()); + patientexamlist.setPName(dicomPatient.getPatientNam()); + patientexamlist.setGender(formatSex1(dicomPatient.getPatientSex())); + patientexamlist.setBirthday(formatLocalDateTime1(dicomPatient.getPatientBir())); + patientexamlist.setDeviceName(dicomStudie.getStudyModal()); + patientexamlist.setDeviceType(dicomStudie.getStudyModal()); + patientexamlist.setReportstatus("待分析"); + patientexamlist.setApplicationDate(dateTime); + patientexamlist.setBillDoctorDepartment("影像科"); + patientexamlist.setCreateDate(dateTime); + patientexamlist.setOrgId(dicomStudie.getOrgId()); + if (dicomSeries != null && dicomSeries.size() > 0) { + patientexamlist.setOrgName(dicomSeries.get(0).getInstitutio()); + //patientexamlist.setSeDc(null); + } + //框架需要 + //patientexamlist.setExamId(null); + //patientexamlist.setExamId(null); + //patientexamlist.setExamId(null); + //patientexamlist.setExamId(null); + //patientexamlist.setExamId(null); + //patientexamlist.setExamId(null); + patientexamlistMapper.insert(patientexamlist); + } + } + dicomworklistMapper.UpdateDataSyncOfDicompatientsByPatientID(dicomPatient.getPatientID()); + } + } + } + + //其它方法 + private String formatSex1(String sex) { + String _out = ""; + if (sex != null && sex.trim().toUpperCase().equals("M")) _out = "男"; + else if (sex != null && sex.trim().toUpperCase().equals("F")) _out = "女"; + return _out; + } + + private LocalDateTime formatLocalDateTime1(String dateTime) { + LocalDateTime _out = null; + if (dateTime != null) { + try { + _out = LocalDateTime.parse(dateTime.trim() + " 00:00:00", DateTimeFormatter.ofPattern("yyyyMMdd HH:mm:ss")); + } catch (Exception ex) { + _out = null; + } + } + return _out; + } + + private LocalDateTime formatLocalDateTime2(String dateTime) { + LocalDateTime _out = null; + if (dateTime != null) { + try { + long timestamp = Long.parseLong(dateTime) * 1000; + _out = LocalDateTime.ofEpochSecond(timestamp / 1000, 0, ZoneOffset.of("+08:00")); + } catch (Exception ex) { + _out = null; + } + } + return _out; + } } \ No newline at end of file