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

master
linjj 4 months ago
parent 0e7c9a8b36
commit d21a140e82

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

@ -19,5 +19,5 @@ public interface ArchiveMasterMapper {
//根据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
* @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.updateStatic(masterId, collectId);
GenerateQueue(archiveMasters.get(0), printParam, 10, collectId);
} catch (Exception e) {
log.error("masterId为:" + masterId + "的患者补偿所有采集器失败", e.getMessage(), e);
@ -172,13 +173,13 @@ public class TaskServiceImpl implements TaskService {
//根据患者masterIdcollectId删除
boolean stactic = archiveDetailMapper.delFileBySource(masterId, collectId);
if (stactic) {
return CommonResult.success("删除成功,masterId:" + masterId+"删除分类:"+collectId);
return CommonResult.success("删除成功,masterId:" + masterId + "删除分类:" + collectId);
}
} catch (Exception e) {
log.error("删除接口失败:"+e.getMessage(),e);
return CommonResult.failed("删除失败,masterId:" + masterId+"删除分类:"+collectId);
log.error("删除接口失败:" + e.getMessage(), e);
return CommonResult.failed("删除失败,masterId:" + masterId + "删除分类:" + collectId);
}
return CommonResult.failed("删除失败,masterId:" + masterId+"删除分类:"+collectId);
return CommonResult.failed("删除失败,masterId:" + masterId + "删除分类:" + collectId);
}
@Override
@ -220,7 +221,7 @@ public class TaskServiceImpl implements TaskService {
return CommonResult.success("id为:" + dto.getMid() + "任务表维护成功");
}
} catch (Exception e) {
log.error("维护任务表失败:"+dto.getMid()+"异常处理"+e.getMessage(),e);
log.error("维护任务表失败:" + dto.getMid() + "异常处理" + e.getMessage(), e);
}
return CommonResult.success("id为:" + dto.getMid() + "任务表维护失败");
}
@ -284,23 +285,63 @@ public class TaskServiceImpl implements TaskService {
return true;
}
} catch (Exception e) {
log.error("异常处理:" + e.getMessage(),e);
log.error("异常处理:" + e.getMessage(), e);
return false;
}
} catch (Exception e) {
log.error("异常处理:" + e.getMessage(),e);
log.error("异常处理:" + e.getMessage(), e);
}
return false;
}
@Override
public CommonResult compensate() {
public CommonResult compensate(String startTime, String entTime, String collectId) {
//查询所有需要补偿患者id
List<String> ids = archiveMasterMapper.getMasterid();
for (String id : ids) {
taskService.repairTask(id);
List<String> ids = archiveMasterMapper.getMasterid(startTime, entTime);
for (String masterId : ids) {
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}
</select>
<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>
</mapper>
Loading…
Cancel
Save