Merge remote-tracking branch '公司/master'
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run

This commit is contained in:
lxd 2024-08-15 13:08:36 +08:00
commit 6f0e433a2f
6 changed files with 142 additions and 4 deletions

View File

@ -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<DicomworklistDO> {
// 根据Series的SeriesInst集合查询Dicomiamge表对应的数据
List<DicomImagesDO> GetDicomImageListData(@Param("seriesInstList") List<String> seriesInstList, @Param("orgId") String orgId);
@Select(" SELECT t1.* FROM dicompatients t1 WHERE t1.dataSync='0' ")
List<DicompatientDO> GetDicompatientsByDataSync();
@Select(" SELECT t1.* FROM dicomstudies t1 WHERE t1.PatientID=#{patientID} ")
List<DicomstudiesDO> GetDicomstudiesByPatientID(@Param("patientID") String patientID);
@Select(" SELECT t1.* FROM dicomseries t1 WHERE t1.StudyInsta=#{studyInsta} ")
List<DicomSeriesDO> GetDicomSeriesByStudyInsta(@Param("studyInsta") String studyInsta);
@Update(" UPDATE dicompatients t1 SET t1.dataSync='1' WHERE t1.PatientID=#{patientID} ")
int UpdateDataSyncOfDicompatientsByPatientID(@Param("patientID") String patientID);
}

View File

@ -143,6 +143,14 @@ public class PatientexamlistController {
return success(pageResult);
}
@GetMapping("/dicomDataSync")
@Operation(summary = "dicom数据同步")
@PreAuthorize("@ss.hasPermission('tblist:patientexamlist:query')")
public CommonResult<Boolean> dicomDataSync() {
patientexamlistService.dicomDataSync();
return success(true);
}
@GetMapping("/export-excel")
@Operation(summary = "导出PACS检查列表 Excel")
@PreAuthorize("@ss.hasPermission('tblist:patientexamlist:export')")

View File

@ -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)

View File

@ -55,7 +55,7 @@ public class PatientexamlistDO extends BaseDO {
* 出生日期
*/
@TableField("birthday")
private Date birthday;
private LocalDateTime birthday;
/**
* 检查日期
*/

View File

@ -70,4 +70,12 @@ public interface PatientexamlistService {
*/
PageResult<PatientexamlistDO> getReportPrintStatisticsPage(ReportPrintPageReqVO pageReqVO);
/**
* 同步dicom数据至tb_patientexamlist
*
* @param
* @return
*/
void dicomDataSync();
}

View File

@ -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<DicompatientDO> dicomPatients = dicomworklistMapper.GetDicompatientsByDataSync();
List<DicomstudiesDO> dicomStudies = null;
List<DicomSeriesDO> 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;
}
}