新增一个根据时间段补偿任务接口

master
linjj 4 months ago
parent 0e7c9a8b36
commit d21a140e82

@ -215,15 +215,17 @@ public class TaskController {
} }
/** /**
* @description: 7 * @description:
* @author linjj * @author linjj
* @date: 2024/8/19 4:32 * @date: 2024/8/19 4:32
*/ */
@PostMapping(value = "compensate") @PostMapping(value = "compensate")
@ApiOperation("补偿7月份后医嘱历史病历") @ApiOperation("根据时间补偿采集器接口")
@ResponseBody @ResponseBody
public CommonResult<?> compensate() { public CommonResult<?> compensate(@RequestParam @ApiParam(required = true, name = "startTime", value = "补偿开始时间") String startTime,
taskService.compensate(); @RequestParam @ApiParam(required = true, name = "entTime", value = "补偿开始时间") String entTime,
@RequestParam @ApiParam(required = true, name = "collectId", value = "采集器id") String collectId) {
taskService.compensate(startTime,entTime,collectId);
return CommonResult.success("补偿完成"); return CommonResult.success("补偿完成");
} }

@ -19,5 +19,5 @@ public interface ArchiveMasterMapper {
//根据masterId获取患者信息 //根据masterId获取患者信息
List<ArchiveMasterVo> getArchiveMasterByMasterId(@Param("masterId")String masterId); List<ArchiveMasterVo> getArchiveMasterByMasterId(@Param("masterId")String masterId);
List<String> getMasterid(); List<String> getMasterid(@Param("startTime")String startTime, @Param("entTime")String entTime);
} }

@ -69,5 +69,5 @@ public interface TaskService {
* @author linjj * @author linjj
* @date: 2024/8/19 4:32 * @date: 2024/8/19 4:32
*/ */
CommonResult compensate(); CommonResult compensate(String startTime,String entTime,String collectId);
} }

@ -115,6 +115,7 @@ public class TaskServiceImpl implements TaskService {
} }
archiveOtherExtMapper.addOther(dto); archiveOtherExtMapper.addOther(dto);
} }
archiveOtherExtMapper.updateStatic(masterId, collectId);
GenerateQueue(archiveMasters.get(0), printParam, 10, collectId); GenerateQueue(archiveMasters.get(0), printParam, 10, collectId);
} catch (Exception e) { } catch (Exception e) {
log.error("masterId为:" + masterId + "的患者补偿所有采集器失败", e.getMessage(), e); log.error("masterId为:" + masterId + "的患者补偿所有采集器失败", e.getMessage(), e);
@ -294,13 +295,53 @@ public class TaskServiceImpl implements TaskService {
} }
@Override @Override
public CommonResult compensate() { public CommonResult compensate(String startTime, String entTime, String collectId) {
//查询所有需要补偿患者id //查询所有需要补偿患者id
List<String> ids = archiveMasterMapper.getMasterid(); List<String> ids = archiveMasterMapper.getMasterid(startTime, entTime);
for (String id : ids) { for (String masterId : ids) {
taskService.repairTask(id); PrintParam printParam = new PrintParam();
//任务表入参
ArchiveOtherExtDto dto = new ArchiveOtherExtDto();
//任务生成时间
Date date = new Date();
SimpleDateFormat SycTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//获取当前患者基础信息
List<ArchiveMasterVo> archiveMasters = archiveMasterMapper.getArchiveMasterByMasterId(masterId);
if (CollectionUtils.isEmpty(archiveMasters)) {
log.info("补偿所有采集查询不到masterId为:" + masterId + "的患者补偿采集器id为:"+collectId+"失败");
continue;
}
try {
//查询当前患者要补偿采集器是否存在任务,不存在时新增任务
List<ArchiveOtherExtVo> others = archiveOtherExtMapper.getOtherByMidAndFlag(archiveMasters.get(0).getId(), Integer.parseInt(collectId));
if (CollectionUtils.isEmpty(others)) {
//任务表新增
dto.setId(SnowflakeIdWorker.idWorker.nextId());
dto.setSycTime(SycTime.format(date));
dto.setOtherID("0");
dto.setSysFlag(Integer.parseInt(collectId));
dto.setSysUpdateTime(SycTime.format(date));
dto.setJzh(archiveMasters.get(0).getPatientId());
dto.setZyh(archiveMasters.get(0).getInpNo());
dto.setStatusFlag(0);
dto.setMID(archiveMasters.get(0).getId());
if (collectId.equals("8")) {
dto.setC1("长临医嘱");
}
if (collectId.equals("1")) {
dto.setC1("护理记录");
}
archiveOtherExtMapper.addOther(dto);
}
//存在任务表中修改任务表状态
archiveOtherExtMapper.updateStatic(masterId, collectId);
GenerateQueue(archiveMasters.get(0), printParam, 10, collectId);
} catch (Exception e) {
log.error("masterId为:" + masterId + "的患者补偿采集器id为:"+collectId+"失败", e.getMessage(), e);
}
log.info("masterId为:" + masterId + "的患者补偿采集器id为:"+collectId+"成功");
} }
return CommonResult.success("补偿7月份患者医嘱成功"); return CommonResult.success("补偿完成");
} }

@ -15,6 +15,6 @@
where id = #{masterId} where id = #{masterId}
</select> </select>
<select id="getMasterid" resultType="java.lang.String"> <select id="getMasterid" resultType="java.lang.String">
select id from archive_master WHERE discharge_date_time>='2024-07-01 00:00:00' and discharge_date_time &lt;='2024-08-10 23:59:59' select id from archive_master WHERE discharge_date_time>=#{startTime} and discharge_date_time &lt;=#{entTime}
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save