公共方法操作时间类增加新方法 增加对外接口插入影像
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-09-20 17:13:09 +08:00
parent fc2d662fa6
commit 8cbf9d7c8a
15 changed files with 517 additions and 0 deletions

View File

@ -2,7 +2,10 @@ package cn.iocoder.yudao.framework.common.util.date;
import cn.hutool.core.date.LocalDateTimeUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
@ -145,5 +148,29 @@ public class DateUtils {
public static boolean isYesterday(LocalDateTime date) {
return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now().minusDays(1));
}
/**
* 獲取时间戳
*
*/
public static String timestamp() throws ParseException {
long timestamp = ZonedDateTime.now(ZoneId.of("UTC")).toEpochSecond();
return String.valueOf(timestamp);
}
/**
* 时间字符串转换成 091813.083226
*
*/
public static String formattedTime(String timeStr)
{
// 解析时间
LocalTime time = LocalTime.parse(timeStr, DateTimeFormatter.ofPattern("H:mm:ss"));
// 计算总秒数
long totalSeconds = time.getHour() * 3600 + time.getMinute() * 60 + time.getSecond();
// 格式化为所需的格式
return String.format("%06d.%06d", totalSeconds, 0);
}
}

View File

@ -0,0 +1,10 @@
package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image;
import lombok.Data;
@Data
public class ImageVO {
public String ImageNumber;
public String ObjectFile;
public String urlPrefix;
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image;
import lombok.Data;
import java.util.List;
@Data
public class PatientInfoVO {
public String PatientID;
public String PatientNam;
public String PatientBir;
public String PatientSex;
public String orgId;
public String orgName;
public String StudyDate;
public List<StudyVO> Studies;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image;
import lombok.Data;
import java.awt.*;
import java.util.List;
@Data
public class SeriesVO {
public String SeriesNumb;
public String SeriesDesc;
public String Modality;
public List<ImageVO> image;
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image;
import lombok.Data;
import java.util.List;
@Data
public class StudyVO {
public String StudyDescr;
public String StudyID;
public String StudyModal;
public List<SeriesVO> Series;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
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;
@ -8,11 +9,24 @@ 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;
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.StudyVO;
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg.insimagescreenshotVO;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg.upmedicalimgVO;
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;
import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicomstudiesDO;
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicomimagesMapeer;
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 cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.medicalimg.medicalimgDO;
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.ultrasonicDO;
import cn.iocoder.yudao.module.ultrasoniccom.service.image.dicompatientsServiceImpl;
import cn.iocoder.yudao.module.ultrasoniccom.service.medicalimg.medicalimgService;
import cn.iocoder.yudao.module.ultrasoniccom.service.ultrasonic.ultrasonicService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@ -27,6 +41,7 @@ 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.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -65,7 +80,17 @@ public class ultrasonicController {
private OrgUnitService Service;
@Resource
private AdminUserService userService;
@Resource
private dicompatientsMapper dicompatientsMapper;
@Resource
private dicomstudiesMapper dicomstudiesMapper;
@Resource
private dicomseriesMapper dicomseriesMapper;
@Resource
private dicomimagesMapeer dicomimagesMapeer;
@Resource
private dicompatientsServiceImpl dicompatientsService;
@GetMapping("/reporttemplatetlist")
@Operation(summary = "获取模版表数据")
@DataPermission(enable = false)
@ -466,4 +491,132 @@ public class ultrasonicController {
}
@PostMapping("/InsImageInfo")
@Operation(summary = "影像信息")
public CommonResult<String> InsImageInfo(@RequestBody List<PatientInfoVO> patientInfoVOS,@RequestHeader HttpHeaders headers) throws ParseException {
try {
// 从headers中获取特定的header参数
// String someHeaderValue = headers.getFirst("Some-Header-Name");
if(!patientInfoVOS.isEmpty())
{
List<dicompatientsDO> dicompatientsDOList=new ArrayList<>();
List<dicomstudiesDO> dicomstudiesDOList=new ArrayList<>();
List<dicomseriesDO> dicomseriesDOList=new ArrayList<>();
List<dicomimagesDO> dicomimagesDOList=new ArrayList<>();
for (PatientInfoVO patientInfo : patientInfoVOS)
{
//获取基础信息
String PatientID=patientInfo.getPatientID();
String PatientNam=patientInfo.getPatientNam();
String PatientBir=patientInfo.getPatientBir();
String PatientSex=patientInfo.getPatientSex();
String AccessTime= DateUtils.timestamp();
String orgId=patientInfo.getOrgId();
String orgname=patientInfo.getOrgName();
String StudyDate=patientInfo.getStudyDate();
List<StudyVO> studyVOS= patientInfo.getStudies();
//填充dicompatients信息
dicompatientsDO dicompatientsDO=new dicompatientsDO();
dicompatientsDO.setPatientID(PatientID);
dicompatientsDO.setPatientNam(PatientNam);
dicompatientsDO.setPatientBir(PatientBir);
dicompatientsDO.setPatientSex(PatientSex);
dicompatientsDO.setOrgId(orgId);
dicompatientsDO.setAccessTime(AccessTime);
dicompatientsDOList.add(dicompatientsDO);
if(!studyVOS.isEmpty())
{
for (StudyVO studyVO :studyVOS)
{
// study表的主键
String StudyInsta= UUID.randomUUID().toString();
dicomstudiesDO dicomstudiesDO=new dicomstudiesDO();
dicomstudiesDO.setStudyInsta(StudyInsta);
dicomstudiesDO.setStudyDate(StudyDate.split(" ")[0].replace("-",""));
dicomstudiesDO.setStudyTime(DateUtils.formattedTime(StudyDate.split(" ")[1]));
dicomstudiesDO.setStudyID(studyVO.getStudyID());
dicomstudiesDO.setStudyDescr(studyVO.getStudyDescr());
dicomstudiesDO.setStudyModal(studyVO.getStudyModal());
dicomstudiesDO.setPatientNam(PatientNam);
dicomstudiesDO.setPatientBir(PatientBir);
dicomstudiesDO.setPatientSex(PatientSex);
dicomstudiesDO.setPatientID(PatientID);
dicomstudiesDO.setAccessTime(AccessTime);
dicomstudiesDO.setOrgId(orgId);
dicomstudiesDOList.add(dicomstudiesDO);
List<SeriesVO> series= studyVO.getSeries();
if (!series.isEmpty())
{
for (SeriesVO seriesVO:series)
{
//service表主键
String SeriesInst=UUID.randomUUID().toString();
dicomseriesDO dicomseriesDO=new dicomseriesDO();
dicomseriesDO.setSeriesInst(SeriesInst);
dicomseriesDO.setSeriesNumb(seriesVO.getSeriesNumb());
dicomseriesDO.setSeriesDate(StudyDate.split(" ")[0].replace("-",""));
dicomseriesDO.setSeriesTime(DateUtils.formattedTime(StudyDate.split(" ")[1]));
dicomseriesDO.setSeriesDesc(seriesVO.getSeriesDesc());
dicomseriesDO.setModality(seriesVO.getModality());
dicomseriesDO.setBodyPartEx("CHEST");
dicomseriesDO.setProtocolNa(studyVO.getStudyDescr());
dicomseriesDO.setStationNam("CT室");
dicomseriesDO.setInstitutio(orgname);
dicomseriesDO.setStudyInsta(StudyInsta);
dicomseriesDO.setAccessTime(AccessTime);
dicomseriesDO.setOrgId(orgId);
dicomseriesDOList.add(dicomseriesDO);
List<ImageVO> imageVOS= seriesVO.getImage() ;
if (!imageVOS.isEmpty())
{
for (ImageVO imageVO:imageVOS)
{
//image主键
String SOPInstanc=UUID.randomUUID().toString();
dicomimagesDO dicomimagesDO=new dicomimagesDO();
dicomimagesDO.setSOPInstanc(SOPInstanc);
dicomimagesDO.setImageNumbe(imageVO.getImageNumber());
dicomimagesDO.setImageDate(StudyDate.split(" ")[0].replace("-",""));
dicomimagesDO.setImageTime(DateUtils.formattedTime(StudyDate.split(" ")[1]));
dicomimagesDO.setAcqDate(StudyDate.split(" ")[0].replace("-",""));
dicomimagesDO.setAcqTime(DateUtils.formattedTime(StudyDate.split(" ")[1]));
dicomimagesDO.setSeriesInst(SeriesInst);
dicomimagesDO.setAccessTime(AccessTime);
dicomimagesDO.setOrgId(orgId);
dicomimagesDO.setObjectFile(imageVO.getObjectFile());
dicomimagesDO.setUrlPrefix(imageVO.getUrlPrefix());
dicomimagesDOList.add(dicomimagesDO);
}
}
}
}
}
}
}
if (!dicompatientsDOList.isEmpty()&&!dicomstudiesDOList.isEmpty()&&!dicomseriesDOList.isEmpty()&&!dicomimagesDOList.isEmpty())
{
dicompatientsService.insertAll(dicompatientsDOList,dicomstudiesDOList,dicomseriesDOList,dicomimagesDOList);
}
}
else
{
return success("参数为空");
}
}
catch (Exception e)
{
return success(e.getMessage());
}
return success("插入成功");
}
}

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.ultrasoniccom.dal.image;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@TableName("dicomimages")
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class dicomimagesDO {
@TableId(value ="SOPInstanc", type = IdType.INPUT)
private String SOPInstanc;
@TableField("ImageNumbe")
private String ImageNumbe;
@TableField("ImageDate")
private String ImageDate;
@TableField("ImageTime")
private String ImageTime;
@TableField("AcqDate")
private String AcqDate;
@TableField("AcqTime")
private String AcqTime;
@TableField("SeriesInst")
private String SeriesInst;
@TableField("AccessTime")
private String AccessTime;
@TableField("ObjectFile")
private String ObjectFile;
@TableField("orgId")
private String orgId;
@TableField("urlPrefix")
private String urlPrefix;
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.ultrasoniccom.dal.image;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@TableName("dicompatients")
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class dicompatientsDO {
@TableId(value ="PatientID", type = IdType.INPUT)
private String PatientID;
@TableField("PatientNam")
private String PatientNam;
@TableField("PatientBir")
private String PatientBir;
@TableField("PatientSex")
private String PatientSex;
@TableField("AccessTime")
private String AccessTime;
@TableField("orgId")
private String orgId;
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.ultrasoniccom.dal.image;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@TableName("dicomseries")
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class dicomseriesDO {
@TableId(value ="SeriesInst", type = IdType.INPUT)
private String SeriesInst;
@TableField("SeriesNumb")
private String SeriesNumb;
@TableField("SeriesDate")
private String SeriesDate;
@TableField("SeriesTime")
private String SeriesTime;
@TableField("SeriesDesc")
private String SeriesDesc;
@TableField("Modality")
private String Modality;
@TableField("BodyPartEx")
private String BodyPartEx;
@TableField("ProtocolNa")
private String ProtocolNa;
@TableField("StationNam")
private String StationNam;
@TableField("Institutio")
private String Institutio;
@TableField("StudyInsta")
private String StudyInsta;
@TableField("AccessTime")
private String AccessTime;
@TableField("orgId")
private String orgId;
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.ultrasoniccom.dal.image;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@TableName("dicomstudies")
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class dicomstudiesDO {
@TableId(value ="StudyInsta", type = IdType.INPUT)
private String StudyInsta;
@TableField("StudyDate")
private String StudyDate;
@TableField("StudyTime")
private String StudyTime;
@TableField("StudyID")
private String StudyID;
@TableField("StudyDescr")
private String StudyDescr;
@TableField("StudyModal")
private String StudyModal;
@TableField("PatientNam")
private String PatientNam;
@TableField("PatientBir")
private String PatientBir;
@TableField("PatientSex")
private String PatientSex;
@TableField("PatientID")
private String PatientID;
@TableField("AccessTime")
private String AccessTime;
@TableField("orgId")
private String orgId;
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicomimagesDO;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import org.apache.ibatis.annotations.Mapper;
@InterceptorIgnore(tenantLine = "true")
@Mapper
public interface dicomimagesMapeer extends BaseMapperX<dicomimagesDO> {
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicompatientsDO;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import org.apache.ibatis.annotations.Mapper;
@InterceptorIgnore(tenantLine = "true")
@Mapper
public interface dicompatientsMapper extends BaseMapperX<dicompatientsDO> {
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicomseriesDO;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import org.apache.ibatis.annotations.Mapper;
@InterceptorIgnore(tenantLine = "true")
@Mapper
public interface dicomseriesMapper extends BaseMapperX<dicomseriesDO> {
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicomstudiesDO;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import org.apache.ibatis.annotations.Mapper;
@InterceptorIgnore(tenantLine = "true")
@Mapper
public interface dicomstudiesMapper extends BaseMapperX<dicomstudiesDO> {
}

View File

@ -0,0 +1,45 @@
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;
import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicomstudiesDO;
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicomimagesMapeer;
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 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.List;
@Service
@Validated
public class dicompatientsServiceImpl {
@Autowired
private dicompatientsMapper dicompatientsMapper;
@Autowired
private dicomstudiesMapper dicomstudiesMapper;
@Autowired
private dicomseriesMapper dicomseriesMapper;
@Autowired
private dicomimagesMapeer dicomimagesMapper;
@Transactional
public void insertAll(List<dicompatientsDO> dicompatientsDOList,
List<dicomstudiesDO> dicomstudiesDOList,
List<dicomseriesDO> dicomseriesDOList,
List<dicomimagesDO> dicomimagesDOList) {
dicompatientsMapper.insertBatch(dicompatientsDOList);
dicomstudiesMapper.insertBatch(dicomstudiesDOList);
dicomseriesMapper.insertBatch(dicomseriesDOList);
dicomimagesMapper.insertBatch(dicomimagesDOList);
}
}