feat: 添加封存病案根据封存id进行扫描视图采集

collector-patient-scan
wyb 2 years ago
parent e59ecf1df0
commit 95bd4434f3

@ -9,6 +9,8 @@ import com.docus.server.collect.service.PatientScanService;
import com.docus.server.collect.service.PatientScanSynchronizer;
import com.docus.server.collect.service.dto.PatScanSyncResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@ -113,4 +115,17 @@ public class PatientScanController {
}
@GetMapping("/collect/seal/collectBySealId")
@ApiOperation("根据封存id进行封存病案扫描视图采集")
@ApiImplicitParams({
@ApiImplicitParam(name = "sealId", value = "t_seal 的seal_id,封存id", required = true, dataTypeClass = String.class)
})
public CommonResult<PatScanSyncResult> collectByDisDate(@RequestParam("sealId") String sealId) {
String source = "根据封存id进行封存病案扫描视图采集";
log.info("{}封存id为:{}", source, sealId);
PatScanSyncResult result = synchronizer.syncSeal("source", sealId);
return CommonResult.success(result);
}
}

@ -3,6 +3,7 @@ package com.docus.server.collect.converter;
import com.docus.server.collect.entity.DownloadTask;
import com.docus.server.collect.entity.PatientScan;
import com.docus.server.collect.entity.TBasic;
import com.docus.server.collect.entity.TSeal;
import com.docus.server.collect.enums.DownWayEnum;
import com.docus.server.collect.enums.DownloadStateEnum;
import com.docus.server.collect.infrastructure.client.dto.ReportDownDto;
@ -46,6 +47,30 @@ public class FileReportConverter {
return fileInfoDTO;
}
/**
* -,id
* @param tSeal
* @param patientScan
* @return
*/
public ReportFileInfoDTO convertReportFileInfoDTO(TSeal tSeal, PatientScan patientScan) {
ReportFileInfoDTO fileInfoDTO = new ReportFileInfoDTO();
fileInfoDTO.setPatientId(tSeal.getPatientId());
fileInfoDTO.setInpatientNo(tSeal.getInpatientNo());
fileInfoDTO.setAdmisstimes(tSeal.getAdmissTimes());
fileInfoDTO.setJzh(tSeal.getJzh());
fileInfoDTO.setIp("gdszy-patsm-sync");
fileInfoDTO.setUserName("admin");
fileInfoDTO.setReportUserFullName("pat-sm");
fileInfoDTO.setSerialNum(patientScan.getId()+patientScan.getZdAssortName()+patientScan.getFileName());
fileInfoDTO.setAssortId(patientScan.getZdAssortId());
fileInfoDTO.setFileTitle(patientScan.getFileName().substring(0,patientScan.getFileName().indexOf(".")));
fileInfoDTO.setDownUrl(patientScan.getImagePath()+"/"+patientScan.getFileName());
fileInfoDTO.setDownWayEnum(DownWayEnum.SMB);
return fileInfoDTO;
}
/**
*
*

@ -3,6 +3,7 @@ package com.docus.server.collect.infrastructure.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.docus.server.collect.dto.TBasicQrDto;
import com.docus.server.collect.entity.TBasic;
import com.docus.server.collect.entity.TSeal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -21,4 +22,13 @@ public interface PatientBasicMapper {
* @return
*/
List<TBasic> getBasicInfo(@Param("dto") TBasicQrDto dto);
/**
* idid
* @date 2024/1/15 10:41
* @author YongBin Wen
* @param sealId id
* @return
*/
TSeal getBySealId(@Param("sealId") String sealId);
}

@ -6,6 +6,7 @@ import com.docus.server.collect.dto.PatientScanConditionDTO;
import com.docus.server.collect.dto.TBasicQrDto;
import com.docus.server.collect.entity.PatientScan;
import com.docus.server.collect.entity.TBasic;
import com.docus.server.collect.entity.TSeal;
import com.docus.server.collect.infrastructure.dao.CollectTaskDao;
import com.docus.server.collect.infrastructure.mapper.PatientBasicMapper;
import com.docus.server.collect.service.dto.PatScanSyncResult;
@ -15,7 +16,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
*
@ -39,10 +42,10 @@ public class PatientScanSynchronizer {
private String patmGSys;
/**
*
*
*
* @param source
* @param patientScanConditionDTOList
* @param patientScanConditionDTOList
* @return
*/
public PatScanSyncResult sync(String source, List<PatientScanConditionDTO> patientScanConditionDTOList) {
@ -85,6 +88,75 @@ public class PatientScanSynchronizer {
return result;
}
/**
* -
*
* @param source /
* @param sealId id
* @return
*/
public PatScanSyncResult syncSeal(String source, String sealId) {
PatScanSyncResult result = new PatScanSyncResult();
result.setPatientTotalCount(1);
result.setSuccessPatientCount(0);
result.setFileCount(0);
TSeal seal = patientBasicMapper.getBySealId(sealId);
if (Objects.isNull(seal)) {
String resultMsg = source + "封存id:" + sealId + " 没有找到封存病案信息,请检查!";
result.setMsg(resultMsg);
return result;
}
String jzh = seal.getJzh();
TBasicQrDto basicQrDto = new TBasicQrDto();
basicQrDto.setJzh(jzh);
List<TBasic> tBasicList = patientBasicMapper.getBasicInfo(basicQrDto);
if (Func.isEmpty(tBasicList)) {
String resultMsg = source + "封存id:" + sealId + "jzh:" + jzh + " 没有找到基础病案信息,无法获取出院时间,请检查!";
result.setMsg(resultMsg);
return result;
}
if (tBasicList.size() > 1) {
String resultMsg = source + "封存id:" + sealId + "jzh:" + jzh + " 找到多条基础病案信息,无法获取出院时间,请检查!";
result.setMsg(resultMsg);
return result;
}
TBasic tBasic = tBasicList.get(0);
String basicDisDate = tBasic.getDisDate();
if (Func.isBlank(basicDisDate)) {
String resultMsg = source + "封存id:" + sealId + "jzh:" + jzh + " 获取基础病案信息,无法获取出院时间,请检查!";
result.setMsg(resultMsg);
return result;
}
String disDate;
String dateTimePattern = "yyyy-MM-dd HH:mm:ss";
try {
Date parse = Func.parseDate(basicDisDate, dateTimePattern);
disDate = Func.formatDate(parse);
} catch (Exception ex) {
String resultMsg = source + "封存id:" + sealId + "jzh:" + jzh + " 出院时间:" + basicDisDate + "解析失败,请检查!";
result.setMsg(resultMsg);
return result;
}
PatientScanConditionDTO condition = new PatientScanConditionDTO();
condition.setDisDate(disDate);
condition.setDisDateTime(disDate + " 00:00:00");
condition.setName(seal.getName());
condition.setInpatientNo(seal.getInpatientNo());
List<PatientScan> patientScanList = patientScanService.getScanDataByConditions(condition);
log.info("{}封存id:{},住院号:{},出院日期:{},患者姓名:{} 采集视图数据:{} 条!", source, sealId, condition.getInpatientNo(), condition.getDisDateTime(), condition.getName(), patientScanList.size());
saveCollectTaskAndSealReport(seal, patientScanList);
log.info("{}封存id{},住院号:{},出院日期:{},患者姓名:{} , 采集视图数据:{} 条,执行成功!", source, sealId, condition.getInpatientNo(), condition.getDisDateTime(), condition.getName(), patientScanList.size());
result.setFileCount(patientScanList.size());
result.setSuccessPatientCount(1);
return result;
}
private void saveCollectTaskAndReport(TBasic tBasic, List<PatientScan> patientScanList) {
for (PatientScan patientScan : patientScanList) {
// 转换后的对象缺失的补充
@ -96,6 +168,17 @@ public class PatientScanSynchronizer {
}
}
private void saveCollectTaskAndSealReport(TSeal tSeal, List<PatientScan> patientScanList) {
for (PatientScan patientScan : patientScanList) {
// 转换后的对象缺失的补充
ReportFileInfoDTO reportFileInfoDTO = fileReportConverter.convertReportFileInfoDTO(tSeal, patientScan);
reportFileInfoDTO.setSysFlag(patmGSys);
Long taskId = collectTaskDao.saveTask(reportFileInfoDTO);
reportFileInfoDTO.setTaskId(taskId);
fileReportService.saveDownloadTaskAndSealReport(reportFileInfoDTO);
}
}
private List<TBasic> getBasicInfo(PatientScanConditionDTO patientScanConditionDTO) {
String disDate = patientScanConditionDTO.getDisDate();

@ -73,7 +73,6 @@ public class FileReportServiceImpl implements FileReportService {
@Override
public void saveDownloadTaskAndSealReport(ReportFileInfoDTO fileInfoDTO) {
// TODO 封存病案
TSeal sealCondition = new TSeal(fileInfoDTO);
// 查询基础数据,更新新的病案信息
TSeal seal = downloadTaskDao.findSealByCondition(sealCondition);

@ -51,6 +51,13 @@
</if>
limit 2
</select>
<select id="getBySealId" resultType="com.docus.server.collect.entity.TSeal">
SELECT *
FROM
`docus_medicalrecord`.`t_seal`
where
seal_id=#{sealId}
</select>
</mapper>

Loading…
Cancel
Save