diff --git a/question/src/main/java/com/ccsens/question/api/PatientReportController.java b/question/src/main/java/com/ccsens/question/api/PatientReportController.java index 2602f9a4..0001a722 100644 --- a/question/src/main/java/com/ccsens/question/api/PatientReportController.java +++ b/question/src/main/java/com/ccsens/question/api/PatientReportController.java @@ -52,6 +52,20 @@ public class PatientReportController { return JsonResponse.newInstance().ok(); } + @MustLogin + @DoctorAudit + @ApiOperation(value = "检查患者是否有未完成的报告单, 无则生成",notes = "检查患者是否有未完成的报告单") + @ApiImplicitParams({ + @ApiImplicitParam(name = "json", value = "报告单信息", required = true) + }) + @RequestMapping(value="/checkPatientComplete", method = RequestMethod.POST) + public JsonResponse checkPatientComplete(@RequestBody @ApiParam @Valid QueryDto dto){ + log.info("检查患者是否有未完成的报告单:{}", dto); + PatientReportVo.CompleteSimple complete = patientReportService.checkPatientComplete(dto.getParam(), dto.getUserId()); + log.info("检查患者是否有未完成的报告单返回:{}", complete); + return JsonResponse.newInstance().ok(complete); + } + @MustLogin @DoctorAudit @ApiOperation(value = "检查是否有未完成的报告单",notes = "检查是否有未完成的报告单") diff --git a/question/src/main/java/com/ccsens/question/bean/dto/PatientReportDto.java b/question/src/main/java/com/ccsens/question/bean/dto/PatientReportDto.java index 54528126..0424b014 100644 --- a/question/src/main/java/com/ccsens/question/bean/dto/PatientReportDto.java +++ b/question/src/main/java/com/ccsens/question/bean/dto/PatientReportDto.java @@ -19,6 +19,16 @@ import javax.validation.constraints.NotNull; */ public class PatientReportDto { + @Data + @ApiModel("患者信息") + public static class Patient{ + @ApiModelProperty("病人ID") + @NotNull(message = "请选择患者信息") + private Long patientId; + @ApiModelProperty("病案号") + private String serialNumber; + } + @Data @ApiModel("忽略未完成的报告单") public static class Ignore{ @@ -33,6 +43,8 @@ public class PatientReportDto { @ApiModelProperty("病人ID") @NotNull(message = "病人ID不能为空") private Long patientId; + @ApiModelProperty("病案号") + private String serialNumber; } @ApiModel("PatientReportDtoEdit") diff --git a/question/src/main/java/com/ccsens/question/bean/vo/PatientReportVo.java b/question/src/main/java/com/ccsens/question/bean/vo/PatientReportVo.java index f25a3b50..639dfab7 100644 --- a/question/src/main/java/com/ccsens/question/bean/vo/PatientReportVo.java +++ b/question/src/main/java/com/ccsens/question/bean/vo/PatientReportVo.java @@ -21,6 +21,22 @@ import java.util.*; */ public class PatientReportVo { + @Data + @ApiModel("报告单遗留未完成简单版") + public static class CompleteSimple { + @ApiModelProperty("是否有未完成的项目 1:有 0:无") + private byte hasUnfinished = 0; + @ApiModelProperty("报告单ID") + private Long id; + @ApiModelProperty("报告单名字") + private String name; + @ApiModelProperty("病人ID") + private Long patientId; + @ApiModelProperty("病案号") + private String serialNumber; + + } + @Data @ApiModel("报告单遗留未完成") public static class Complete { @@ -170,7 +186,7 @@ public class PatientReportVo { String pasiStr = this.pasi == 3 ? "重度" : this.pasi == 2 ? "中度" : this.pasi == 1 ? "轻度" : ""; rows.add( fillRow( - "病案号:", + "病案号:" + (StrUtil.isEmpty(serialNumber) ? "" : serialNumber), "临床诊断:" + (StrUtil.isEmpty(this.clinicalDiagnosis) ? "" : this.clinicalDiagnosis), "严重程度:" + pasiStr) // "检查日期:" + (date == null ? "" : DateUtil.format(date, "yyyy-MM-dd"))) diff --git a/question/src/main/java/com/ccsens/question/persist/dao/HtPatientReportDao.java b/question/src/main/java/com/ccsens/question/persist/dao/HtPatientReportDao.java index ce8b5d72..f054f87f 100644 --- a/question/src/main/java/com/ccsens/question/persist/dao/HtPatientReportDao.java +++ b/question/src/main/java/com/ccsens/question/persist/dao/HtPatientReportDao.java @@ -104,4 +104,12 @@ public interface HtPatientReportDao extends HtPatientReportMapper { * @return 报告单 */ List search(@Param("codes") List codes); + + /** + * 检查患者未完成的报告单 + * @param param 患者信息 + * @param userId 用户ID + * @return 报告单 + */ + PatientReportVo.CompleteSimple checkPatientComplete(@Param("patient") PatientReportDto.Patient param, @Param("userId") Long userId); } diff --git a/question/src/main/java/com/ccsens/question/service/IPatientReportService.java b/question/src/main/java/com/ccsens/question/service/IPatientReportService.java index 90b560cb..8764a032 100644 --- a/question/src/main/java/com/ccsens/question/service/IPatientReportService.java +++ b/question/src/main/java/com/ccsens/question/service/IPatientReportService.java @@ -157,4 +157,12 @@ public interface IPatientReportService { * @return 报告单 */ List search(PatientReportSearchDto.SearchList param); + + /** + * + * @param param + * @param userId + * @return + */ + PatientReportVo.CompleteSimple checkPatientComplete(PatientReportDto.Patient param, Long userId); } diff --git a/question/src/main/java/com/ccsens/question/service/PatientReportService.java b/question/src/main/java/com/ccsens/question/service/PatientReportService.java index 7fa5c920..5d88d849 100644 --- a/question/src/main/java/com/ccsens/question/service/PatientReportService.java +++ b/question/src/main/java/com/ccsens/question/service/PatientReportService.java @@ -87,6 +87,7 @@ public class PatientReportService implements IPatientReportService { htPatientReport.setId(snowflake.nextId()); // htPatientReport.setDoctorId(doctors.get(0).getId()); htPatientReport.setPatientId(generate.getPatientId()); + htPatientReport.setSerialNumber(generate.getSerialNumber()); // htPatientReport.setPatientIdcard(htPatient.getIdcard()); // htPatientReport.setPatientAge(StrUtil.isEmpty(htPatient.getIdcard()) ? null : (byte)IdcardUtil.getAgeByIdCard(htPatient.getIdcard())); htPatientReport.setEvaluationCode(Constant.Ht.Report.PARENT_CODE); @@ -99,6 +100,7 @@ public class PatientReportService implements IPatientReportService { log.info("生成病友报告单:{}", generate); PatientReportVo.Generate generateVo = new PatientReportVo.Generate(); generateVo.setId(htPatientReport.getId()); + generateVo.setName(htPatientReport.getName()); return JsonResponse.newInstance().ok(generateVo); } @@ -607,5 +609,31 @@ public class PatientReportService implements IPatientReportService { return list; } + @Override + public PatientReportVo.CompleteSimple checkPatientComplete(PatientReportDto.Patient param, Long userId) { + PatientReportVo.CompleteSimple simple = htPatientReportDao.checkPatientComplete(param, userId); + log.info("检查患者未完成的报告单:{}", simple); + if (simple != null) { + simple.setHasUnfinished(Constant.Ht.UNCLOSED_REPORT); + return simple; + } + + PatientReportDto.Generate generate = new PatientReportDto.Generate(); + generate.setPatientId(param.getPatientId()); + generate.setSerialNumber(param.getSerialNumber()); + JsonResponse result = generatePatientReport(generate, userId); + if (result.getCode() != CodeEnum.SUCCESS.getCode().intValue()) { + throw new BaseException(result.getCode(), result.getMsg()); + } + + simple = new PatientReportVo.CompleteSimple(); + PatientReportVo.Generate data = result.getData(); + simple.setId(data.getId()); + simple.setName(data.getName()); + simple.setPatientId(param.getPatientId()); + simple.setSerialNumber(param.getSerialNumber()); + return simple; + } + } diff --git a/question/src/main/java/com/ccsens/question/uitl/Constant.java b/question/src/main/java/com/ccsens/question/uitl/Constant.java index f6f86d96..6da85d43 100644 --- a/question/src/main/java/com/ccsens/question/uitl/Constant.java +++ b/question/src/main/java/com/ccsens/question/uitl/Constant.java @@ -62,6 +62,8 @@ public class Constant { public final static byte SEX_WOMAN = 1; /**删除*/ public final static byte IS_DEL = 1; + /**未结束的报告单*/ + public final static byte UNCLOSED_REPORT = 1; diff --git a/question/src/main/resources/mapper_dao/HtPatientReportDao.xml b/question/src/main/resources/mapper_dao/HtPatientReportDao.xml index 69ead2bd..d513f507 100644 --- a/question/src/main/resources/mapper_dao/HtPatientReportDao.xml +++ b/question/src/main/resources/mapper_dao/HtPatientReportDao.xml @@ -256,6 +256,12 @@ + \ No newline at end of file