修改逻辑

This commit is contained in:
lxd 2024-08-15 13:08:27 +08:00
parent 5086973d12
commit e3138c423e
5 changed files with 125 additions and 46 deletions

View File

@ -104,5 +104,8 @@ public class PatientexamlistPageReqVO extends PageParam {
@Schema(description = "开单科室") @Schema(description = "开单科室")
private String billDoctorDepartment; private String billDoctorDepartment;
private String StudyInsta;
} }

View File

@ -125,4 +125,7 @@ public class PatientexamlistRespVO {
@Schema(description = "开单科室") @Schema(description = "开单科室")
private String billDoctorDepartment; private String billDoctorDepartment;
private String StudyInsta;
} }

View File

@ -98,5 +98,7 @@ public class PatientexamlistSaveReqVO {
private String billDoctorDepartment; private String billDoctorDepartment;
@Schema(description = "审核状态") @Schema(description = "审核状态")
private String reviewStatus; private String reviewStatus;
private String StudyInsta;
} }

View File

@ -172,5 +172,7 @@ public class PatientexamlistDO extends BaseDO {
@TableField(value = "reviewStatus") @TableField(value = "reviewStatus")
private String reviewStatus; private String reviewStatus;
@TableField(value = "StudyInsta")
private String StudyInsta;
} }

View File

@ -1,4 +1,12 @@
package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic; package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic;
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;
import cn.iocoder.yudao.module.system.dal.dataobject.org.OrgUnitDO;
import cn.iocoder.yudao.module.system.service.dicomworklist.DicomworklistService;
import cn.iocoder.yudao.module.system.service.org.OrgUnitService;
import com.fasterxml.jackson.databind.SerializationFeature;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.Response; import okhttp3.Response;
@ -43,6 +51,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 超声科组件") @Tag(name = "管理后台 - 超声科组件")
@RestController @RestController
@RequestMapping("/ultrasoniccom/ultrasonic") @RequestMapping("/ultrasoniccom/ultrasonic")
@ -54,59 +63,60 @@ public class ultrasonicController {
private ultrasonicService ultrasonicService; private ultrasonicService ultrasonicService;
@Resource @Resource
private medicalimgService medicalimgService; private medicalimgService medicalimgService;
@Resource
private DicomworklistService dicomworklistService;
@Resource
private OrgUnitService Service;
@GetMapping("/reporttemplatetlist") @GetMapping("/reporttemplatetlist")
@Operation(summary = "获取模版表数据") @Operation(summary = "获取模版表数据")
@DataPermission(enable = false) @DataPermission(enable = false)
@PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')") @PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')")
public CommonResult<List<Tree>> getreporttemplatelist(@RequestParam("orgID") String orgID,@RequestParam("type") String type,@RequestParam("isprivate") String isprivate) throws Exception { public CommonResult<List<Tree>> getreporttemplatelist(@RequestParam("orgID") String orgID, @RequestParam("type") String type, @RequestParam("isprivate") String isprivate) throws Exception {
List<ultrasonicDO> devicelist = ultrasonicService.getreporttemplate(); List<ultrasonicDO> devicelist = ultrasonicService.getreporttemplate();
List<ultrasonicDO> filteredList=new ArrayList<>(); List<ultrasonicDO> filteredList = new ArrayList<>();
// 按照 updateTime 字段降序排列空值放在最后 // 按照 updateTime 字段降序排列空值放在最后
List<ultrasonicDO> sortedList = devicelist.stream() List<ultrasonicDO> sortedList = devicelist.stream()
.sorted(Comparator.comparing(ultrasonicDO::getUpdateTime, Comparator.nullsLast(Comparator.reverseOrder()))) .sorted(Comparator.comparing(ultrasonicDO::getUpdateTime, Comparator.nullsLast(Comparator.reverseOrder())))
.collect(Collectors.toList()); .collect(Collectors.toList());
devicelist=sortedList; devicelist = sortedList;
if (!orgID.isEmpty()) {
if (!orgID.isEmpty())
{
filteredList = devicelist.stream() filteredList = devicelist.stream()
.filter(ultrasonicDO -> (ultrasonicDO.getOrgId().equals(orgID))) .filter(ultrasonicDO -> (ultrasonicDO.getOrgId().equals(orgID)))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
if(filteredList.isEmpty()) if (filteredList.isEmpty()) {
{ filteredList = devicelist;
filteredList=devicelist;
} }
if (!type.isEmpty()&&!type.equals("undefined")) if (!type.isEmpty() && !type.equals("undefined")) {
{
// 筛选条件 // 筛选条件
filteredList = filteredList.stream() filteredList = filteredList.stream()
.filter(ultrasonicDO -> (ultrasonicDO.getTemplateType().equals(type))) .filter(ultrasonicDO -> (ultrasonicDO.getTemplateType().equals(type)))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
if(isprivate.equals("1")) if (isprivate.equals("1")) {
{
// 筛选条件 // 筛选条件
filteredList = filteredList.stream() filteredList = filteredList.stream()
.filter(ultrasonicDO -> (ultrasonicDO.getPrivateDoctorId()!=null)) .filter(ultrasonicDO -> (ultrasonicDO.getPrivateDoctorId() != null))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(filteredList); String json = mapper.writeValueAsString(filteredList);
List<Tree> tree = convertJsonToTree(json); List<Tree> tree = convertJsonToTree(json);
return success(tree); return success(tree);
} }
//返回树结构 //返回树结构
private List<Tree> convertJsonToTree(String jsonData) { private List<Tree> convertJsonToTree(String jsonData) {
List<Map<String, Object>> dataList; List<Map<String, Object>> dataList;
try { try {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
@ -154,8 +164,8 @@ public class ultrasonicController {
@Operation(summary = "获取图片列表") @Operation(summary = "获取图片列表")
@Parameter(name = "orgid", description = "机构ID", required = true, example = "1024") @Parameter(name = "orgid", description = "机构ID", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')") @PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')")
public CommonResult<List<medicalimgDO>> getimageslist(@RequestParam("orgID") String orgId,@RequestParam("regID") String regId,@RequestParam("select") String select) { public CommonResult<List<medicalimgDO>> getimageslist(@RequestParam("orgID") String orgId, @RequestParam("regID") String regId, @RequestParam("select") String select) {
List<medicalimgDO> devicelist = ultrasonicService.getmedicalimgist(orgId,regId,select); List<medicalimgDO> devicelist = ultrasonicService.getmedicalimgist(orgId, regId, select);
return success(BeanUtils.toBean(devicelist, medicalimgDO.class)); return success(BeanUtils.toBean(devicelist, medicalimgDO.class));
} }
@ -165,43 +175,35 @@ public class ultrasonicController {
@PreAuthorize("@ss.hasPermission('tblist:patientexamlist:update')") @PreAuthorize("@ss.hasPermission('tblist:patientexamlist:update')")
public CommonResult<Boolean> updateexamineimagelist(@Valid @RequestBody List<upmedicalimgVO> updateReqVO) { public CommonResult<Boolean> updateexamineimagelist(@Valid @RequestBody List<upmedicalimgVO> updateReqVO) {
if (!updateReqVO.isEmpty()) if (!updateReqVO.isEmpty()) {
{
//最终提交的数据 //最终提交的数据
List<medicalimgDO> doList=new ArrayList<>(); List<medicalimgDO> doList = new ArrayList<>();
//当前时间 //当前时间
LocalDateTime dateTime= LocalDateTime.parse(LocalDateTime.now().format(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")); DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
//循环传递进来的参数 赋值 //循环传递进来的参数 赋值
for (upmedicalimgVO s : updateReqVO) { for (upmedicalimgVO s : updateReqVO) {
//新增对象 //新增对象
medicalimgDO medicalimgDO=new medicalimgDO(); medicalimgDO medicalimgDO = new medicalimgDO();
medicalimgDO.setId(s.getId()); medicalimgDO.setId(s.getId());
if(!s.getIsDelete().isEmpty()) if (!s.getIsDelete().isEmpty()) {
{
medicalimgDO.setIsDelete(s.getIsDelete()); medicalimgDO.setIsDelete(s.getIsDelete());
medicalimgDO.setDeletePerson(s.getDeletePerson()); medicalimgDO.setDeletePerson(s.getDeletePerson());
medicalimgDO.setDeleteDate(dateTime); medicalimgDO.setDeleteDate(dateTime);
} }
if(!s.getSelected().isEmpty()) if (!s.getSelected().isEmpty()) {
{
medicalimgDO.setSelected(s.getSelected()); medicalimgDO.setSelected(s.getSelected());
} }
doList.add(medicalimgDO); doList.add(medicalimgDO);
} }
if (!doList.isEmpty()) if (!doList.isEmpty()) {
{ boolean bol = medicalimgService.updateBatchById(doList);
boolean bol= medicalimgService.updateBatchById(doList);
return success(bol); return success(bol);
} } else {
else
{
return success(false); return success(false);
} }
} } else {
else
{
log.error("超声审核更新图片数据方法参数为空"); log.error("超声审核更新图片数据方法参数为空");
return success(false); return success(false);
@ -211,13 +213,11 @@ public class ultrasonicController {
} }
@GetMapping("/upreporttemplatetime") @GetMapping("/upreporttemplatetime")
@Operation(summary = "更新模版表时间") @Operation(summary = "更新模版表时间")
@DataPermission(enable = false) @DataPermission(enable = false)
@PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')") @PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')")
public CommonResult<Boolean> upreporttemplatetime(@RequestParam("pid") String pid) throws ParseException { public CommonResult<Boolean> upreporttemplatetime(@RequestParam("pid") String pid) throws ParseException {
//当前时间 //当前时间
// 定义日期时间格式 // 定义日期时间格式
@ -228,25 +228,94 @@ public class ultrasonicController {
// 将字符串解析为 Date 对象 // 将字符串解析为 Date 对象
Date currentDateTime = formatter.parse(currentDateTimeString); Date currentDateTime = formatter.parse(currentDateTimeString);
//新增对象 //新增对象
ultrasonicDO ultrasonicDO=new ultrasonicDO(); ultrasonicDO ultrasonicDO = new ultrasonicDO();
ultrasonicDO.setId(pid); ultrasonicDO.setId(pid);
ultrasonicDO.setUpdateTime(currentDateTime); ultrasonicDO.setUpdateTime(currentDateTime);
boolean bol= ultrasonicService.updateById(ultrasonicDO); boolean bol = ultrasonicService.updateById(ultrasonicDO);
return success(bol); return success(bol);
} }
@GetMapping("/getdcm") @GetMapping("/getdcm")
@Operation(summary = "获取dcm数据") @Operation(summary = "获取dcm数据")
@PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')") @PreAuthorize("@ss.hasPermission('ultrasoniccom:ultrasonic:create')")
public CommonResult<String> GetDcmList() public CommonResult<String> GetDcmList(@RequestParam("orgID") String orgID, @RequestParam("studyInsta") String studyInsta, @RequestParam("regId") String regId) throws JsonProcessingException {
{ String strJson = "";
String json="";
if (!studyInsta.isEmpty() && !orgID.isEmpty()) {
String Res="{\"status\":\"success\",\"patientname\":\"朱晓珍\",\"hospital\":\"东营康惠健康体检中心\",\"seriesList\":[{\"thumbUrl\":\"/static/101缩略图.jpg\",\"seriesdesc\":\"CHEST\",\"instanceList\":[{\"imageid\":\"/static/49814@101@1@1.2.156.112605.189250948694021.20221211000237.4.28076.1.dcm\"}]},{\"thumbUrl\":\"/static/201缩略图.jpg\",\"seriesdesc\":\"CHEST\",\"instanceList\":[{\"imageid\":\"/static/49814@201@1@1.2.156.112605.189250948694021.20221211000325.4.16016.1.dcm\"},{\"imageid\":\"/static/49814@201@2@1.2.156.112605.189250948694021.20221211000325.4.16016.2.dcm\"},{\"imageid\":\"/static/49814@201@3@1.2.156.112605.189250948694021.20221211000325.4.16016.3.dcm\"},{\"imageid\":\"/static/49814@201@4@1.2.156.112605.189250948694021.20221211000326.4.16016.1.dcm\"},{\"imageid\":\"/static/49814@201@5@1.2.156.112605.189250948694021.20221211000326.4.16016.2.dcm\"}]}]}"; // 先查询基本信息 一个患者基本信息就一条
DicompatientDO dicompatientDO = dicomworklistService.GetPatientIdData(regId, orgID);
// 获取机构名称
OrgUnitDO aDo = Service.get(orgID);
//studyInsta 当前检查部位 去查询检查项目 一个检查项目就是一个序列 一个序列里有多个文件
List<DicomSeriesDO> doList = dicomworklistService.GetDicomSeriesData(studyInsta, orgID);
if (!doList.isEmpty()) {
StringBuilder seriesassembleList = new StringBuilder();
//存放条件数据
List<String> seriesInstList = new ArrayList<>();
for (DicomSeriesDO d : doList) {
//先循环取出来所需要的service表的需要的条件数据
seriesInstList.add(d.getSeriesInst());
}
List<DicomImagesDO> imagesDOList = dicomworklistService.GetDicomImageListData(seriesInstList, orgID);
return success(Res); for (DicomSeriesDO d : doList) {
//判断第一条数据 是他的缩略图
boolean isFirst = true;
String url="";
StringBuilder instanceList = new StringBuilder();
StringBuilder imageid = new StringBuilder();
StringBuilder seriesList = new StringBuilder();
if (!imagesDOList.isEmpty()) {
//筛选数据
List<DicomImagesDO> activeImages = imagesDOList.stream()
.filter(DicomImagesDO -> DicomImagesDO.getSeriesInst().equals(d.getSeriesInst()))
.sorted(Comparator.comparing(DicomImagesDO->Integer.parseInt(DicomImagesDO.getImageNumbe()))) // 保持原始顺序
.collect(Collectors.toList());
for (DicomImagesDO imagesDO : activeImages) {
if (isFirst) {
// 这是第一条数据的逻辑处理
// url="/dcm/"+imagesDO.getObjectFile().replace("\\", "\\\\").replaceFirst("\\.dcm$", ".jpg");
url="/static/ctlogo.png";
// 处理完第一条数据后将isFirst标志设置为false
isFirst = false;
}
imageid.append("{\"imageid\": \"").append("/dcm/"+imagesDO.getObjectFile().replace("\\", "\\\\")).append("\"},");
}
}
if (imageid.length() > 0) {
imageid.deleteCharAt(imageid.length() - 1);
}
instanceList.append(" \"instanceList\": [").append(imageid).append("]");
seriesList.append(" { \"SeriesDesc\": \""+d.getSeriesDesc()+"\",\"thumbUrl\": \""+url+"\",\n" + " \"seriesdesc\": \"CHEST\",\n").append(instanceList).append("},");
seriesassembleList.append(seriesList);
}
if (seriesassembleList.length() > 0) {
seriesassembleList.deleteCharAt(seriesassembleList.length() - 1);
}
strJson = " { " +
" \"status\": \"success\"," +
" \"patientname\": \"" + dicompatientDO.getPatientNam() + "\"," +
"\"hospital\": \"" + aDo.getOrgName() + "\"," +
" \"seriesList\": [" +
seriesassembleList +
"]" +
" }";
}
ObjectMapper mapper = new ObjectMapper();
json= mapper.writeValueAsString(strJson);
}
// String Res="{\"status\":\"success\",\"patientname\":\"朱晓珍\",\"hospital\":\"东营康惠健康体检中心\",\"seriesList\":[{\"thumbUrl\":\"/static/101缩略图.jpg\",\"seriesdesc\":\"CHEST\",\"instanceList\":[{\"imageid\":\"/static/49814@101@1@1.2.156.112605.189250948694021.20221211000237.4.28076.1.dcm\"}]},{\"thumbUrl\":\"/static/201缩略图.jpg\",\"seriesdesc\":\"CHEST\",\"instanceList\":[{\"imageid\":\"/static/49814@201@1@1.2.156.112605.189250948694021.20221211000325.4.16016.1.dcm\"},{\"imageid\":\"/static/49814@201@2@1.2.156.112605.189250948694021.20221211000325.4.16016.2.dcm\"},{\"imageid\":\"/static/49814@201@3@1.2.156.112605.189250948694021.20221211000325.4.16016.3.dcm\"},{\"imageid\":\"/static/49814@201@4@1.2.156.112605.189250948694021.20221211000326.4.16016.1.dcm\"},{\"imageid\":\"/static/49814@201@5@1.2.156.112605.189250948694021.20221211000326.4.16016.2.dcm\"}]}]}";
return success(strJson);
} }