|
|
|
@ -2,31 +2,41 @@ package com.supervision.manage.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.date.TimeInterval;
|
|
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.poi.excel.ExcelReader;
|
|
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.supervision.dto.*;
|
|
|
|
|
import com.supervision.exception.BusinessException;
|
|
|
|
|
import com.supervision.manage.pojo.vo.MedicalAnswerVideoResVo;
|
|
|
|
|
import com.supervision.manage.pojo.vo.MedicalRecInfoVO;
|
|
|
|
|
import com.supervision.manage.pojo.vo.MedicalRecManageVO;
|
|
|
|
|
import com.supervision.manage.pojo.vo.MedicalRecQaVO;
|
|
|
|
|
import com.supervision.manage.pojo.vo.*;
|
|
|
|
|
import com.supervision.manage.service.*;
|
|
|
|
|
import com.supervision.manage.enums.*;
|
|
|
|
|
import com.supervision.manage.service.AskTemplateQuestionLibraryManageService;
|
|
|
|
|
import com.supervision.model.*;
|
|
|
|
|
import com.supervision.model.Process;
|
|
|
|
|
import com.supervision.service.*;
|
|
|
|
|
import com.supervision.service.MedicalRecService;
|
|
|
|
|
import com.supervision.util.UserUtil;
|
|
|
|
|
import com.supervision.vo.manage.*;
|
|
|
|
|
import jakarta.servlet.ServletOutputStream;
|
|
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
|
import org.springframework.core.io.Resource;
|
|
|
|
|
import org.springframework.core.io.ResourceLoader;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
@ -36,6 +46,10 @@ import java.util.stream.Collectors;
|
|
|
|
|
@Service
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final String CASE_TEMPLATE_TEMPLATE_EXCEL_PATH = "classpath:template/虚拟病例信息模板v3.0.xlsx";
|
|
|
|
|
|
|
|
|
|
private final String MEDICAL_ANSWER_TEMPLATE_EXCEL_PATH = "classpath:template/medical_answer_template.xlsx";
|
|
|
|
|
|
|
|
|
|
private final ResourceLoader resourceLoader;
|
|
|
|
@ -48,6 +62,8 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
|
|
|
|
|
private final AskTemplateQuestionLibraryService askTemplateQuestionLibraryService;
|
|
|
|
|
|
|
|
|
|
private final AskTemplateQuestionLibraryManageService askTemplateQuestionLibraryManageService;
|
|
|
|
|
|
|
|
|
|
private final AskTemplateQuestionSimilarityService askTemplateQuestionSimilarityService;
|
|
|
|
|
|
|
|
|
|
private final CommonDicService commonDicService;
|
|
|
|
@ -77,7 +93,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<MedicalRecPageResVO> queryMedicalRecManagePage(String selfDescKeyword, String gender,String patientName,
|
|
|
|
|
public IPage<MedicalRecPageResVO> queryMedicalRecManagePage(String selfDescKeyword, String gender, String patientName,
|
|
|
|
|
String diseaseId, Integer pageNum, Integer pageSize) {
|
|
|
|
|
// 注意,这里的diseaseId不支持查询复杂疾病,如果需要支持复杂疾病,这里需要单独进行改造
|
|
|
|
|
MedicalRecPageReqVO medicalRecPageReqVO = new MedicalRecPageReqVO();
|
|
|
|
@ -113,7 +129,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
Assert.notEmpty(chiildCommonDicList, "系统问题未找到");
|
|
|
|
|
List<String> dicIds = chiildCommonDicList.stream().map(i -> String.valueOf(i.getId())).collect(Collectors.toList());
|
|
|
|
|
List<AskTemplateQuestionLibrary> askTemplateQuestionLibraryList = askTemplateQuestionLibraryService.lambdaQuery().in(AskTemplateQuestionLibrary::getDictId, dicIds).list();
|
|
|
|
|
if (CollUtil.isEmpty(askTemplateQuestionLibraryList)){
|
|
|
|
|
if (CollUtil.isEmpty(askTemplateQuestionLibraryList)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Set<String> libraryIds = qaList.stream().map(MedicalRecQaVO::getLibraryQuestionId).collect(Collectors.toSet());
|
|
|
|
@ -124,7 +140,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveAskPatientAnswer(List<MedicalRecQaVO> qaList,String medicalRecId,Integer answerType){
|
|
|
|
|
private void saveAskPatientAnswer(List<MedicalRecQaVO> qaList, String medicalRecId, Integer answerType) {
|
|
|
|
|
if (CollUtil.isEmpty(qaList)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -142,6 +158,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
askPatientAnswer.insert();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DiseaseAncillaryResVo> queryDiseaseAncillaryByCreat(String diseaseId) {
|
|
|
|
|
// 辅助检查
|
|
|
|
@ -201,7 +218,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
|
|
|
|
|
assertDefaultAnswer(reqVO.getDefaultQaList());
|
|
|
|
|
|
|
|
|
|
BeanUtil.copyProperties(reqVO, medicalRec, "id","patientId");
|
|
|
|
|
BeanUtil.copyProperties(reqVO, medicalRec, "id", "patientId");
|
|
|
|
|
medicalRec.updateById();
|
|
|
|
|
// 然后修改问答
|
|
|
|
|
// 首先找到数据库中的问答
|
|
|
|
@ -227,7 +244,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
askPatientAnswer.setAnswer(medicalRecQaVO.getMedicalRecAnswer());
|
|
|
|
|
askPatientAnswer.setMedicalId(medicalRec.getId());
|
|
|
|
|
askPatientAnswer.setQuestion(CollUtil.getFirst(medicalRecQaVO.getQuestionList()));
|
|
|
|
|
if (null == askPatientAnswer.getAnswerType()){
|
|
|
|
|
if (null == askPatientAnswer.getAnswerType()) {
|
|
|
|
|
askPatientAnswer.setAnswerType(1);
|
|
|
|
|
}
|
|
|
|
|
askPatientAnswer.insert();
|
|
|
|
@ -268,7 +285,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
medicalRecQaVO.setAnswerType(Objects.isNull(e.getAnswerType()) ? 1 : e.getAnswerType());
|
|
|
|
|
// 病历的回答
|
|
|
|
|
medicalRecQaVO.setMedicalRecAnswer(e.getAnswer());
|
|
|
|
|
if (StrUtil.isNotEmpty(e.getQuestion())){
|
|
|
|
|
if (StrUtil.isNotEmpty(e.getQuestion())) {
|
|
|
|
|
medicalRecQaVO.setQuestionList(CollUtil.newArrayList(e.getQuestion()));
|
|
|
|
|
}
|
|
|
|
|
return medicalRecQaVO;
|
|
|
|
@ -290,12 +307,12 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(questionLibrary)) {
|
|
|
|
|
// 问题
|
|
|
|
|
List<String> question = libraryMapQuestion.get(medicalRecQaVO.getLibraryQuestionId());
|
|
|
|
|
if (CollUtil.isNotEmpty(medicalRecQaVO.getQuestionList())){
|
|
|
|
|
if (CollUtil.isNotEmpty(question)){
|
|
|
|
|
if (CollUtil.isNotEmpty(medicalRecQaVO.getQuestionList())) {
|
|
|
|
|
if (CollUtil.isNotEmpty(question)) {
|
|
|
|
|
question.remove(CollUtil.getFirst(medicalRecQaVO.getQuestionList()));
|
|
|
|
|
medicalRecQaVO.getQuestionList().addAll(question);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
medicalRecQaVO.setQuestionList(question);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -331,7 +348,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
@Override
|
|
|
|
|
public MedicalAnswerVideoResVo preUploadMedicalAnswer(MultipartFile multipartFile, String medicalRecId) throws Exception {
|
|
|
|
|
|
|
|
|
|
return answerVideoResourceService.preGenerationMedicalAnswerVideo(multipartFile.getInputStream(),medicalRecId);
|
|
|
|
|
return answerVideoResourceService.preGenerationMedicalAnswerVideo(multipartFile.getInputStream(), medicalRecId);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -352,7 +369,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
|
|
|
|
|
final Map<String, AskTemplateQuestionLibrary> libraryMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(askPatientAnswerList)){
|
|
|
|
|
if (CollUtil.isNotEmpty(askPatientAnswerList)) {
|
|
|
|
|
// 查询问题库信息
|
|
|
|
|
List<String> questionIds = askPatientAnswerList.stream()
|
|
|
|
|
.map(AskPatientAnswer::getLibraryQuestionId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
@ -369,10 +386,10 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
medicalRecQaVO.setMedicalRecAnswer(e.getAnswer());
|
|
|
|
|
// 组装问题列表 和 字典数据
|
|
|
|
|
AskTemplateQuestionLibrary askTemplateQuestionLibrary = libraryMap.get(e.getLibraryQuestionId());
|
|
|
|
|
if (Objects.nonNull(askTemplateQuestionLibrary)){
|
|
|
|
|
if (Objects.nonNull(askTemplateQuestionLibrary)) {
|
|
|
|
|
medicalRecQaVO.setQuestionList(libraryMapQuestion.get(e.getLibraryQuestionId()));
|
|
|
|
|
Long dictId = askTemplateQuestionLibrary.getDictId();
|
|
|
|
|
if (Objects.nonNull(dictId)){
|
|
|
|
|
if (Objects.nonNull(dictId)) {
|
|
|
|
|
medicalRecQaVO.setDictId(dictId);
|
|
|
|
|
medicalRecQaVO.setDictNamePath(childCommonDicMap.getOrDefault(dictId, new CommonDic()).getNameZhPath());
|
|
|
|
|
}
|
|
|
|
@ -401,7 +418,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" +
|
|
|
|
|
URLEncoder.encode("病历问诊问题导入模板.xlsx", "UTF-8"));
|
|
|
|
|
|
|
|
|
|
IoUtil.copy(resource.getInputStream(),outputStream);
|
|
|
|
|
IoUtil.copy(resource.getInputStream(), outputStream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -414,4 +431,309 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
return medicalRecService.lambdaUpdate().eq(MedicalRec::getId, medicalRecId).set(MedicalRec::getStatus, status).update();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void downloadMedicalTemplate(HttpServletResponse response) throws Exception {
|
|
|
|
|
Resource resource = resourceLoader.getResource(CASE_TEMPLATE_TEMPLATE_EXCEL_PATH);
|
|
|
|
|
ServletOutputStream outputStream = response.getOutputStream();
|
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" +
|
|
|
|
|
URLEncoder.encode("虚拟病例信息模板v3.0.xlsx", "UTF-8"));
|
|
|
|
|
|
|
|
|
|
IoUtil.copy(resource.getInputStream(), outputStream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
@Override
|
|
|
|
|
public UploadDiseaseResVo uploadMedical(MultipartFile multipartFile) throws Exception {
|
|
|
|
|
InputStream inputStream = multipartFile.getInputStream();
|
|
|
|
|
|
|
|
|
|
TimeInterval timer = DateUtil.timer();
|
|
|
|
|
ExcelReader reader = ExcelUtil.getReader(inputStream);
|
|
|
|
|
log.info("uploadQuestionLibrary : 读取文件耗时:{} s", timer.intervalSecond());
|
|
|
|
|
// 校验sheet
|
|
|
|
|
assertTemplate(reader);
|
|
|
|
|
// 疾病
|
|
|
|
|
Disease disease = null;
|
|
|
|
|
// 病人
|
|
|
|
|
MedicalRec medicalRec = null;
|
|
|
|
|
// 遍历sheet
|
|
|
|
|
List<Sheet> sheets = reader.getSheets();
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
|
String sheetName = sheets.get(i).getSheetName();
|
|
|
|
|
ExcelReader excelReader = reader.setSheet(i);
|
|
|
|
|
String virtualSheetNameEnum = VirtualSheetNameEnum.fromCode(sheetName);
|
|
|
|
|
Assert.isTrue(StringUtils.isNoneBlank(virtualSheetNameEnum), "未查询到sheet:" + sheetName);
|
|
|
|
|
switch (sheetName) {
|
|
|
|
|
case "基本信息":
|
|
|
|
|
assertTitle(excelReader, "基本信息");
|
|
|
|
|
List<UploadDiseaseDTO> uploadDiseaseResVos = excelReader.readAll(UploadDiseaseDTO.class);
|
|
|
|
|
assertSheetDataBasicInfo(uploadDiseaseResVos);
|
|
|
|
|
disease = diseaseService.saveDisease(uploadDiseaseResVos);
|
|
|
|
|
medicalRec = batchSaveMedicalRec(uploadDiseaseResVos, disease);
|
|
|
|
|
continue;
|
|
|
|
|
case "临床问诊":
|
|
|
|
|
assertTitle(excelReader, "临床问诊");
|
|
|
|
|
List<ClinicalInterviewDTO> clinicalInterviewDTOS = excelReader.readAll(ClinicalInterviewDTO.class);
|
|
|
|
|
if (null == clinicalInterviewDTOS || clinicalInterviewDTOS.isEmpty()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
assertSheetDataClinicalInterview(clinicalInterviewDTOS);
|
|
|
|
|
askTemplateQuestionLibraryManageService.saveSimilarityQuestion(clinicalInterviewDTOS);
|
|
|
|
|
continue;
|
|
|
|
|
case "体格检查":
|
|
|
|
|
assertTitle(excelReader, "体格检查");
|
|
|
|
|
List<UploadPhysicalExaminationDTO> uploadPhysicalExaminationDTOS = excelReader.readAll(UploadPhysicalExaminationDTO.class);
|
|
|
|
|
if (null == uploadPhysicalExaminationDTOS || uploadPhysicalExaminationDTOS.isEmpty()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
assertSheetDataPhysicalExamination(uploadPhysicalExaminationDTOS);
|
|
|
|
|
diseasePhysicalManageService.batchSavePhysicalExaminationList(disease, uploadPhysicalExaminationDTOS);
|
|
|
|
|
continue;
|
|
|
|
|
case "辅助检查":
|
|
|
|
|
assertTitle(excelReader, "辅助检查");
|
|
|
|
|
List<SupplementaryTestDto> supplementaryTestDtos = excelReader.readAll(SupplementaryTestDto.class);
|
|
|
|
|
if (null == supplementaryTestDtos || supplementaryTestDtos.isEmpty()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
assertSheetDataSupplementaryTest(supplementaryTestDtos);
|
|
|
|
|
diseaseAncillaryManageService.batchSaveAncillaryExaminationList(disease, supplementaryTestDtos);
|
|
|
|
|
continue;
|
|
|
|
|
case "处置计划":
|
|
|
|
|
assertTitle(excelReader, "处置计划");
|
|
|
|
|
List<HandlingPlanDto> handlingPlanDtos = excelReader.readAll(HandlingPlanDto.class);
|
|
|
|
|
System.out.println(handlingPlanDtos);
|
|
|
|
|
continue;
|
|
|
|
|
case "评估结果概述":
|
|
|
|
|
assertTitle(excelReader, "评估结果概述");
|
|
|
|
|
List<OverviewEvaluationResultsDto> overviewEvaluationResultsDtos = excelReader.readAll(OverviewEvaluationResultsDto.class);
|
|
|
|
|
if (null == overviewEvaluationResultsDtos || overviewEvaluationResultsDtos.isEmpty()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
updateMedicalRec(medicalRec.getId(), overviewEvaluationResultsDtos);
|
|
|
|
|
continue;
|
|
|
|
|
default:
|
|
|
|
|
Assert.isTrue(true, "未查询到sheet:" + sheetName);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* sheet
|
|
|
|
|
*/
|
|
|
|
|
private void assertTemplate(ExcelReader excelReader) {
|
|
|
|
|
List<Sheet> sheets = excelReader.getSheets();
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
|
Sheet sheet = sheets.get(i);
|
|
|
|
|
String virtualSheetNameEnum = VirtualSheetNameEnum.fromCode(sheet.getSheetName());
|
|
|
|
|
Assert.isTrue(virtualSheetNameEnum != null, "请检查sheet名称:" + sheet.getSheetName());
|
|
|
|
|
}
|
|
|
|
|
// 保证第一个sheet必须为病例信息
|
|
|
|
|
String sheetName = sheets.get(0).getSheetName();
|
|
|
|
|
Assert.isTrue(sheetName.equals("基本信息"), "模板错误,请更换模板,sheet {} " + "必须为第一个" + sheetName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
|
public MedicalRec batchSaveMedicalRec(List<UploadDiseaseDTO> uploadDiseaseResVos, Disease disease) {
|
|
|
|
|
UploadDiseaseDTO uploadDiseaseDTO = uploadDiseaseResVos.get(0);
|
|
|
|
|
// 保存病历
|
|
|
|
|
String name = uploadDiseaseDTO.getName();
|
|
|
|
|
String sex = uploadDiseaseDTO.getSex();
|
|
|
|
|
String ageStar = uploadDiseaseDTO.getAgeStar();
|
|
|
|
|
String maritalStatus = uploadDiseaseDTO.getMaritalStatus();
|
|
|
|
|
String occupation = uploadDiseaseDTO.getOccupation();
|
|
|
|
|
String nation = uploadDiseaseDTO.getNation();
|
|
|
|
|
String birthPlaceOrOrigin = uploadDiseaseDTO.getBirthPlaceOrOrigin();
|
|
|
|
|
String address = uploadDiseaseDTO.getAddress();
|
|
|
|
|
String birthPlace = uploadDiseaseDTO.getBirthPlace();
|
|
|
|
|
String mainSymptom = uploadDiseaseDTO.getMainSymptom();
|
|
|
|
|
|
|
|
|
|
MedicalRec medicalRec = new MedicalRec();
|
|
|
|
|
medicalRec.setDigitalHumanType(1);
|
|
|
|
|
medicalRec.setPatientName(name);
|
|
|
|
|
medicalRec.setPatientGender(sex);
|
|
|
|
|
medicalRec.setPatientAge(Integer.parseInt(ageStar));
|
|
|
|
|
medicalRec.setPatientMarriage(maritalStatus);
|
|
|
|
|
medicalRec.setPatientProfession(occupation);
|
|
|
|
|
medicalRec.setNativePlace(birthPlaceOrOrigin);
|
|
|
|
|
medicalRec.setPatientNation(nation);
|
|
|
|
|
medicalRec.setPatientBirthplace(birthPlace);
|
|
|
|
|
medicalRec.setPatientHabitation(address);
|
|
|
|
|
medicalRec.setDiseaseId(disease.getId());
|
|
|
|
|
medicalRec.setPatientSelfDesc(mainSymptom);
|
|
|
|
|
medicalRec.setStatus(1);
|
|
|
|
|
medicalRec.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|
medicalRec.setUpdateUserId(UserUtil.getUser().getId());
|
|
|
|
|
medicalRec.setMedicalStatus(MedicalStatusEnum.CREATE.getCode());
|
|
|
|
|
medicalRec.setMedicalImportType(MedicalTypeEnum.TEMPLATE_IMPORT.getCode());
|
|
|
|
|
medicalRecService.save(medicalRec);
|
|
|
|
|
medicalRecService.updateMedicalRecNo("QL", "男".equals(sex) ? "M" : "F", medicalRec.getId());
|
|
|
|
|
return medicalRec;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改评价结果描述
|
|
|
|
|
*
|
|
|
|
|
* @param id 病例id
|
|
|
|
|
* @param overviewEvaluationResultsDtos
|
|
|
|
|
*/
|
|
|
|
|
private void updateMedicalRec(String id, List<OverviewEvaluationResultsDto> overviewEvaluationResultsDtos) {
|
|
|
|
|
MedicalRec medicalRec = new MedicalRec();
|
|
|
|
|
medicalRec.setId(id);
|
|
|
|
|
for (OverviewEvaluationResultsDto overviewEvaluationResultsDto : overviewEvaluationResultsDtos) {
|
|
|
|
|
String assessmentItem = overviewEvaluationResultsDto.getAssessmentItem();
|
|
|
|
|
switch (assessmentItem) {
|
|
|
|
|
case "*预期诊断结果":
|
|
|
|
|
String assessmentOverview = overviewEvaluationResultsDto.getAssessmentOverview();
|
|
|
|
|
medicalRec.setFullCheck(assessmentOverview);
|
|
|
|
|
continue;
|
|
|
|
|
case "*初步诊断依据":
|
|
|
|
|
String assessmentOverview1 = overviewEvaluationResultsDto.getAssessmentOverview();
|
|
|
|
|
medicalRec.setPrimarilyDiagnosisCriteria(assessmentOverview1);
|
|
|
|
|
continue;
|
|
|
|
|
case "*证实诊断依据":
|
|
|
|
|
String assessmentOverview2 = overviewEvaluationResultsDto.getAssessmentOverview();
|
|
|
|
|
medicalRec.setConfirmDiagnosisCriteria(assessmentOverview2);
|
|
|
|
|
continue;
|
|
|
|
|
case "*鉴别依据":
|
|
|
|
|
String assessmentOverview3 = overviewEvaluationResultsDto.getAssessmentOverview();
|
|
|
|
|
medicalRec.setDifferentialDiagnosisCriteria(assessmentOverview3);
|
|
|
|
|
continue;
|
|
|
|
|
default:
|
|
|
|
|
Assert.isTrue(true, "请检查评估结果概述sheet第一列是否正确");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
medicalRecService.updateById(medicalRec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验行头
|
|
|
|
|
* todo 这要根据每个sheet进行case
|
|
|
|
|
*
|
|
|
|
|
* @param reader
|
|
|
|
|
* @param sheetName
|
|
|
|
|
*/
|
|
|
|
|
private void assertTitle(ExcelReader reader, String sheetName) {
|
|
|
|
|
List<Object> titleList = reader.readRow(0);
|
|
|
|
|
Assert.isTrue(CollUtil.isNotEmpty(titleList), "表头格式有误,请重新导入");
|
|
|
|
|
switch (sheetName) {
|
|
|
|
|
case "基本信息":
|
|
|
|
|
for (int i = 0; i < UploadDiseaseDTO.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.size(); i++) {
|
|
|
|
|
Assert.isTrue(titleList.size() > i, "表头格式有误,请重新导入");
|
|
|
|
|
Assert.isTrue(UploadDiseaseDTO.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(titleList.get(i)), "表头格式有误,请重新导入");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "临床问诊":
|
|
|
|
|
for (int i = 0; i < ClinicalInterviewDTO.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.size(); i++) {
|
|
|
|
|
Assert.isTrue(titleList.size() > i, "表头格式有误,请重新导入");
|
|
|
|
|
Assert.isTrue(ClinicalInterviewDTO.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(titleList.get(i)), "表头格式有误,请重新导入");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "体格检查":
|
|
|
|
|
for (int i = 0; i < UploadPhysicalExaminationDTO.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.size(); i++) {
|
|
|
|
|
Assert.isTrue(titleList.size() > i, "表头格式有误,请重新导入");
|
|
|
|
|
Assert.isTrue(UploadPhysicalExaminationDTO.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(titleList.get(i)), "表头格式有误,请重新导入");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "辅助检查":
|
|
|
|
|
for (int i = 0; i < SupplementaryTestDto.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.size(); i++) {
|
|
|
|
|
Assert.isTrue(titleList.size() > i, "表头格式有误,请重新导入");
|
|
|
|
|
Assert.isTrue(SupplementaryTestDto.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(titleList.get(i)), "表头格式有误,请重新导入");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "评估结果概述":
|
|
|
|
|
for (int i = 0; i < OverviewEvaluationResultsDto.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.size(); i++) {
|
|
|
|
|
Assert.isTrue(titleList.size() > i, "表头格式有误,请重新导入");
|
|
|
|
|
Assert.isTrue(OverviewEvaluationResultsDto.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(titleList.get(i)), "表头格式有误,请重新导入");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断基本信息中只有一条数据
|
|
|
|
|
*
|
|
|
|
|
* @param uploadDiseaseResVos
|
|
|
|
|
*/
|
|
|
|
|
private void assertSheetDataBasicInfo(List<UploadDiseaseDTO> uploadDiseaseResVos) {
|
|
|
|
|
Assert.notEmpty(uploadDiseaseResVos, "病例基本信息数据数据为空");
|
|
|
|
|
Assert.isTrue(uploadDiseaseResVos.size() != 1, "目前仅限传一个病例");
|
|
|
|
|
uploadDiseaseResVos.forEach(this::assertDiseaseQuestion);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断基本信息中只有一条数据
|
|
|
|
|
*
|
|
|
|
|
* @param uploadDiseaseResVos
|
|
|
|
|
*/
|
|
|
|
|
private void assertSheetDataClinicalInterview(List<ClinicalInterviewDTO> uploadDiseaseResVos) {
|
|
|
|
|
uploadDiseaseResVos.forEach(this::assertClinicalInterview);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void assertSheetDataPhysicalExamination(List<UploadPhysicalExaminationDTO> uploadDiseaseResVos) {
|
|
|
|
|
uploadDiseaseResVos.forEach(this::assertPhysicalExamination);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void assertSheetDataSupplementaryTest(List<SupplementaryTestDto> uploadDiseaseResVos) {
|
|
|
|
|
uploadDiseaseResVos.forEach(this::supplementaryTestDto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void assertDiseaseQuestion(UploadDiseaseDTO diseaseQuestion) {
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseQuestion.getSex(), "性别不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseQuestion.getAgeStar(), "年龄不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.isTrue(StrUtil.isNotEmpty(diseaseQuestion.getDiseaseClassificationName()), "疾病分类名称不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseQuestion.getCommonName(), "通用名不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseQuestion.getCategoryCode(), "疾病代码不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(diseaseQuestion.getMainSymptom(), "主诉不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void assertClinicalInterview(ClinicalInterviewDTO clinicalInterviewDTO) {
|
|
|
|
|
Assert.notEmpty(clinicalInterviewDTO.getConsultationI(), "问诊I不能为空");
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(clinicalInterviewDTO.getConsultationII(), "问诊Ⅱ不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void assertPhysicalExamination(UploadPhysicalExaminationDTO uploadPhysicalExaminationDTO) {
|
|
|
|
|
// Assert.isTrue(StrUtil.isEmpty(uploadPhysicalExaminationDTO.getIiLevelClassification()), "Ⅰ级分类不能为空");
|
|
|
|
|
// Assert.notEmpty(uploadPhysicalExaminationDTO.getIiLevelClassification(), "Ⅱ级分类不能为空");
|
|
|
|
|
// Assert.notEmpty(uploadPhysicalExaminationDTO.getHumanBodyPartI(), "人体部位Ⅰ不能为空");
|
|
|
|
|
// Assert.notEmpty(uploadPhysicalExaminationDTO.getHumanBodyPartIi(), "人体部位Ii不能为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getNormalExamResult(), "正常检查结果不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getStatus(), "状态不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getIsNecessaryExamDefaultYes(), "*是否必查(默认是)不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getPreliminaryDiagnosisBasis(), "初步诊断依据不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getConfirmedDiagnosisBasis(), "证实诊断依据不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getDifferentialDiagnosisBasis(), "鉴别依据不可为空");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void supplementaryTestDto(SupplementaryTestDto uploadPhysicalExaminationDTO) {
|
|
|
|
|
// Assert.isTrue(StrUtil.isEmpty(uploadPhysicalExaminationDTO.getFirstLevelCategory()), "Ⅰ级分类不能为空");
|
|
|
|
|
// Assert.notEmpty(uploadPhysicalExaminationDTO.getSecondLevelCategory(), "Ⅱ级分类不能为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getNormalTestResult(), "正常检查结果不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getPatientTestResult(), "病人检查结果不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getIsRequiredCheck(), "*是否必查(默认是)不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getPreliminaryDiagnosisBasis(), "初步诊断依据不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getConfirmedDiagnosisBasis(), "证实诊断依据不可为空");
|
|
|
|
|
Assert.notEmpty(uploadPhysicalExaminationDTO.getDifferentialDiagnosisBasis(), "鉴别依据不可为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|