feat:英德中医院his任务检查
parent
acacab53df
commit
cfdbdff8f3
@ -0,0 +1,27 @@
|
|||||||
|
package com.docus.server.synchis.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2025/1/23 13:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InLocEmrView {
|
||||||
|
private Integer patid;
|
||||||
|
private Integer ntime;
|
||||||
|
private String inpatno;
|
||||||
|
private String name;
|
||||||
|
private Integer catalogid;
|
||||||
|
private String catalogname;
|
||||||
|
private Integer id;
|
||||||
|
private String templatetitle;
|
||||||
|
private String recodingname;
|
||||||
|
private Date recordingtime;
|
||||||
|
private Date modifyopertime;
|
||||||
|
// private String content;
|
||||||
|
private String sort;
|
||||||
|
private Date outtime;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.docus.server.synchis.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.docus.server.synchis.entity.InLocEmrView;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* V_JSWZH_WZX_PACS pacs视图
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2024/1/8 8:31
|
||||||
|
*/
|
||||||
|
@DS("ydzyy-hisdb-oracle")
|
||||||
|
public interface YdZyyHisDbMapper {
|
||||||
|
|
||||||
|
int countPatFile(@Param("patId") String patId,@Param("catalogName") String catalogName);
|
||||||
|
|
||||||
|
List<InLocEmrView> queryByPatId(@Param("patId") String patId);
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.docus.server.synchis.service;
|
||||||
|
|
||||||
|
import com.docus.server.archive.entity.TBasic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2025/1/23 13:22
|
||||||
|
*/
|
||||||
|
public interface HisService {
|
||||||
|
void checkTask(TBasic tbasic);
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.docus.server.synchis.service.impl;
|
||||||
|
|
||||||
|
import com.docus.core.util.Func;
|
||||||
|
import com.docus.infrastructure.redis.service.IdService;
|
||||||
|
import com.docus.server.archive.entity.AfCollectTask;
|
||||||
|
import com.docus.server.archive.entity.TBasic;
|
||||||
|
import com.docus.server.archive.mapper.AfCollectTaskMapper;
|
||||||
|
import com.docus.server.synchis.entity.InLocEmrView;
|
||||||
|
import com.docus.server.synchis.mapper.YdZyyHisDbMapper;
|
||||||
|
import com.docus.server.synchis.service.HisService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YongBin Wen
|
||||||
|
* @date 2025/1/23 13:22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class HisServiceImpl implements HisService {
|
||||||
|
@Resource
|
||||||
|
private YdZyyHisDbMapper ydZyyHisDbMapper;
|
||||||
|
@Resource
|
||||||
|
private AfCollectTaskMapper afCollectTaskMapper;
|
||||||
|
@Resource
|
||||||
|
private IdService idService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkTask(TBasic tbasic) {
|
||||||
|
String hisSource="2";
|
||||||
|
String jzh = tbasic.getJzh();
|
||||||
|
String patientId = tbasic.getPatientId();
|
||||||
|
List<AfCollectTask> collectTasks = afCollectTaskMapper.findByPatientIds(Collections.singletonList(patientId));
|
||||||
|
List<InLocEmrView> emrViews = ydZyyHisDbMapper.queryByPatId(jzh);
|
||||||
|
|
||||||
|
List<AfCollectTask> hisCollectTasks = collectTasks.stream()
|
||||||
|
.filter(tsk->hisSource.equals(tsk.getSysflag()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
Map<String, InLocEmrView> emrViewMap = emrViews.stream()
|
||||||
|
.collect(Collectors.toMap(v->v.getId().toString(), Function.identity()));
|
||||||
|
|
||||||
|
List<AfCollectTask> cancelTasks=new ArrayList<>();
|
||||||
|
List<AfCollectTask> updateTasks=new ArrayList<>();
|
||||||
|
for (AfCollectTask task : hisCollectTasks) {
|
||||||
|
String fileId = task.getC7();
|
||||||
|
// 病程记录不检查
|
||||||
|
if (fileId.contains("bcjl")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 视图没有作废
|
||||||
|
InLocEmrView emrView =emrViewMap.get(fileId);
|
||||||
|
if(Objects.isNull(emrView)){
|
||||||
|
cancelTasks.add(task);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 如果更新修改状态
|
||||||
|
Date modifytime = task.getT2();
|
||||||
|
Date viewModifyopertime = emrView.getModifyopertime();
|
||||||
|
if(viewModifyopertime.after(modifytime)) {
|
||||||
|
task.setSyncTime(new Date());
|
||||||
|
task.setState("0");
|
||||||
|
task.setC9("1");
|
||||||
|
task.setPresult("");
|
||||||
|
task.setT1(emrView.getRecordingtime());
|
||||||
|
task.setT2(viewModifyopertime);
|
||||||
|
updateTasks.add(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Func.isNotEmpty(cancelTasks)) {
|
||||||
|
List<Long> fileIds = cancelTasks.stream().map(AfCollectTask::getAfArchiveDetailId).collect(Collectors.toList());
|
||||||
|
List<Long> taskIds = cancelTasks.stream().map(AfCollectTask::getId).collect(Collectors.toList());
|
||||||
|
afCollectTaskMapper.cancelTask(taskIds);
|
||||||
|
afCollectTaskMapper.cancelFileById(fileIds);
|
||||||
|
}
|
||||||
|
if (Func.isNotEmpty(updateTasks)) {
|
||||||
|
afCollectTaskMapper.update(updateTasks);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.docus.server.synchis.mapper.YdZyyHisDbMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="countPatFile" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(1)
|
||||||
|
FROM his_user.PL_INLOCEMR
|
||||||
|
WHERE PATID = #{patId}
|
||||||
|
AND CATALOGNAME = #{catalogName}
|
||||||
|
</select>
|
||||||
|
<select id="queryByPatId" resultType="com.docus.server.synchis.entity.InLocEmrView">
|
||||||
|
SELECT patid,ntime,inpatno,name,catalogid,catalogname,id,templatetitle,recodingname,recordingtime,modifyopertime,sort,outtime
|
||||||
|
FROM his_user.PL_INLOCEMR
|
||||||
|
WHERE PATID = #{patId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue