初始化辅助检查和体格检查的代码
parent
c8794b60d1
commit
0cbf32143a
@ -0,0 +1,26 @@
|
|||||||
|
package com.supervision.controller;
|
||||||
|
|
||||||
|
import com.supervision.model.DiagnosisAncillaryRecord;
|
||||||
|
import com.supervision.pojo.vo.AskAncillaryResultReqVO;
|
||||||
|
import com.supervision.service.AskAncillaryService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Api(tags = "辅助检查")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("askAncillary")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AskAncillaryController {
|
||||||
|
|
||||||
|
private final AskAncillaryService askAncillaryService;
|
||||||
|
|
||||||
|
@ApiOperation("查询辅助检查的结果")
|
||||||
|
@GetMapping("queryAskAncillaryResult")
|
||||||
|
public DiagnosisAncillaryRecord queryAskAncillaryResult(AskAncillaryResultReqVO reqVO){
|
||||||
|
return askAncillaryService.queryAskAncillaryResult(reqVO);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.supervision.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.supervision.model.Patient;
|
||||||
|
import com.supervision.service.AskPatientService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Api(tags = "病人")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/askPatient")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AskPatientController {
|
||||||
|
|
||||||
|
private final AskPatientService askPatientService;
|
||||||
|
|
||||||
|
@ApiOperation("分页获取病人列表")
|
||||||
|
@RequestMapping("queryPatientPage")
|
||||||
|
public IPage<Patient> queryPatientPage(Integer pageNum, Integer pageSize) {
|
||||||
|
return askPatientService.queryPatientPage(pageNum, pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据病人ID获取病人详细信息")
|
||||||
|
@GetMapping("queryPatientInfo")
|
||||||
|
public Patient queryPatientInfo(String id) {
|
||||||
|
return askPatientService.queryPatientById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.supervision.controller;
|
||||||
|
|
||||||
|
import com.supervision.model.DiagnosisPhysicalRecord;
|
||||||
|
import com.supervision.pojo.vo.AskPhysicalResultReqVO;
|
||||||
|
import com.supervision.service.AskPhysicalService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("askPhysical")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Validated
|
||||||
|
public class AskPhysicalController {
|
||||||
|
|
||||||
|
private final AskPhysicalService askPhysicalService;
|
||||||
|
|
||||||
|
@ApiOperation("查询体格检查的结果")
|
||||||
|
@GetMapping("queryAskPhysicalResult")
|
||||||
|
public DiagnosisPhysicalRecord queryAskPhysicalResult(AskPhysicalResultReqVO reqVO) {
|
||||||
|
return askPhysicalService.queryAskPhysicalResult(reqVO);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.supervision.controller;
|
||||||
|
|
||||||
|
import com.supervision.model.Process;
|
||||||
|
import com.supervision.model.User;
|
||||||
|
import com.supervision.service.AskProcessService;
|
||||||
|
import com.supervision.util.UserUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Api(tags = "诊断流程")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("askProcess")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AskProcessController {
|
||||||
|
|
||||||
|
private final AskProcessService askProcessService;
|
||||||
|
|
||||||
|
@ApiOperation("生成诊断流程任务")
|
||||||
|
@GetMapping("creatDiagnosisProcess")
|
||||||
|
public Process creatDiagnosisProcess(@ApiParam("病人ID") String patientId) {
|
||||||
|
User user = UserUtil.getUser();
|
||||||
|
return askProcessService.creatDiagnosisProcess(patientId, user);
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
package com.supervision.controller;
|
|
||||||
|
|
||||||
import com.supervision.model.Patient;
|
|
||||||
import com.supervision.service.PatientService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@Api(tags = "病人")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/patient")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class PatientController {
|
|
||||||
|
|
||||||
private final PatientService patientService;
|
|
||||||
|
|
||||||
@ApiOperation("根据病人ID获取病人")
|
|
||||||
@GetMapping("queryPatientInfo")
|
|
||||||
public Patient queryPatientInfo(String id) {
|
|
||||||
return patientService.queryPatientById(id);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.supervision.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AskAncillaryResultReqVO {
|
||||||
|
|
||||||
|
@NotBlank(message = "辅助检查工具名称不能为空")
|
||||||
|
private String itemName;
|
||||||
|
|
||||||
|
@NotBlank(message = "流程ID不能为空")
|
||||||
|
private String processId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AskPhysicalResultReqVO {
|
||||||
|
|
||||||
|
@NotBlank(message = "体格检查工具名称不能为空")
|
||||||
|
private String toolName;
|
||||||
|
|
||||||
|
private String locationName;
|
||||||
|
|
||||||
|
@NotBlank(message = "流程ID不能为空")
|
||||||
|
private String processId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.supervision.service;
|
||||||
|
|
||||||
|
import com.supervision.model.DiagnosisAncillaryRecord;
|
||||||
|
import com.supervision.pojo.vo.AskAncillaryResultReqVO;
|
||||||
|
|
||||||
|
public interface AskAncillaryService {
|
||||||
|
|
||||||
|
DiagnosisAncillaryRecord queryAskAncillaryResult(AskAncillaryResultReqVO reqVO);
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.supervision.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.supervision.model.Patient;
|
||||||
|
|
||||||
|
public interface AskPatientService {
|
||||||
|
|
||||||
|
IPage<Patient> queryPatientPage(Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
|
Patient queryPatientById(String id);
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.supervision.service;
|
||||||
|
|
||||||
|
import com.supervision.model.DiagnosisPhysicalRecord;
|
||||||
|
import com.supervision.pojo.vo.AskPhysicalResultReqVO;
|
||||||
|
|
||||||
|
public interface AskPhysicalService {
|
||||||
|
|
||||||
|
DiagnosisPhysicalRecord queryAskPhysicalResult(AskPhysicalResultReqVO reqVO);
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.supervision.service;
|
||||||
|
|
||||||
|
import com.supervision.model.Process;
|
||||||
|
import com.supervision.model.User;
|
||||||
|
|
||||||
|
public interface AskProcessService {
|
||||||
|
|
||||||
|
Process creatDiagnosisProcess(String patientId, User user);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.supervision.service.impl;
|
||||||
|
|
||||||
|
import com.supervision.exception.BusinessException;
|
||||||
|
import com.supervision.model.ConfigAncillaryItem;
|
||||||
|
import com.supervision.model.DiagnosisAncillaryRecord;
|
||||||
|
import com.supervision.model.DiseaseAncillary;
|
||||||
|
import com.supervision.model.Process;
|
||||||
|
import com.supervision.pojo.vo.AskAncillaryResultReqVO;
|
||||||
|
import com.supervision.service.*;
|
||||||
|
import com.supervision.util.UserUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AskAncillaryServiceImpl implements AskAncillaryService {
|
||||||
|
|
||||||
|
private final ProcessService processService;
|
||||||
|
|
||||||
|
private final DiseaseAncillaryService diseaseAncillaryService;
|
||||||
|
|
||||||
|
private final ConfigAncillaryItemService ancillaryItemService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DiagnosisAncillaryRecord queryAskAncillaryResult(AskAncillaryResultReqVO reqVO) {
|
||||||
|
// 首先根据process_id查新到流程ID
|
||||||
|
Process process = Optional.ofNullable(processService.getById(reqVO.getProcessId())).orElseThrow(() -> new BusinessException("未找到流程ID"));
|
||||||
|
// 找到对应的项目
|
||||||
|
ConfigAncillaryItem ancillaryItem = ancillaryItemService.lambdaQuery().eq(ConfigAncillaryItem::getItemName, reqVO.getItemName()).last("limit 1")
|
||||||
|
.oneOpt().orElseThrow(() -> new BusinessException("未找到对应的辅助工具"));
|
||||||
|
|
||||||
|
DiseaseAncillary diseaseAncillary = diseaseAncillaryService.lambdaQuery().eq(DiseaseAncillary::getPatientId, process.getPatientId()).eq(DiseaseAncillary::getItemId, ancillaryItem.getId())
|
||||||
|
.oneOpt().orElseGet(() -> {
|
||||||
|
DiseaseAncillary get = new DiseaseAncillary();
|
||||||
|
get.setResult("无相关资讯");
|
||||||
|
return get;
|
||||||
|
});
|
||||||
|
DiagnosisAncillaryRecord record = new DiagnosisAncillaryRecord();
|
||||||
|
record.setProcessId(process.getId());
|
||||||
|
record.setItemId(ancillaryItem.getId());
|
||||||
|
record.setValue(diseaseAncillary.getResult());
|
||||||
|
record.setCreateUserId(UserUtil.getUser().getId());
|
||||||
|
record.setUpdateUserId(UserUtil.getUser().getId());
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.supervision.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.supervision.exception.BusinessException;
|
||||||
|
import com.supervision.model.Patient;
|
||||||
|
import com.supervision.service.AskPatientService;
|
||||||
|
import com.supervision.service.PatientService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AskPatientServiceImpl implements AskPatientService {
|
||||||
|
|
||||||
|
private final PatientService patientService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<Patient> queryPatientPage(Integer pageNum, Integer pageSize) {
|
||||||
|
return patientService.lambdaQuery().page(new Page<>(pageNum,pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Patient queryPatientById(String id) {
|
||||||
|
return patientService.lambdaQuery().eq(Patient::getId, id).oneOpt().orElseThrow(() -> new BusinessException("未找到用户"));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.supervision.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.supervision.exception.BusinessException;
|
||||||
|
import com.supervision.model.*;
|
||||||
|
import com.supervision.model.Process;
|
||||||
|
import com.supervision.pojo.vo.AskPhysicalResultReqVO;
|
||||||
|
import com.supervision.service.*;
|
||||||
|
import com.supervision.util.UserUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AskPhysicalServiceImpl implements AskPhysicalService {
|
||||||
|
|
||||||
|
private final ConfigPhysicalLocationService locationService;
|
||||||
|
|
||||||
|
private final ConfigPhysicalToolService toolService;
|
||||||
|
|
||||||
|
private final DiseasePhysicalService diseasePhysicalService;
|
||||||
|
|
||||||
|
private final ProcessService processService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DiagnosisPhysicalRecord queryAskPhysicalResult(AskPhysicalResultReqVO reqVO) {
|
||||||
|
// 首先根据process_id查新到流程ID
|
||||||
|
Process process = Optional.ofNullable(processService.getById(reqVO.getProcessId())).orElseThrow(() -> new BusinessException("未找到流程ID"));
|
||||||
|
ConfigPhysicalTool tool = toolService.lambdaQuery().eq(ConfigPhysicalTool::getToolName, reqVO.getToolName()).last("limit 1")
|
||||||
|
.oneOpt().orElseThrow(() -> new BusinessException("工具不支持"));
|
||||||
|
// 是否需要具体的部位,0否1是
|
||||||
|
String locationId = null;
|
||||||
|
if (1 == tool.getRequireLocation()){
|
||||||
|
ConfigPhysicalLocation location = locationService.lambdaQuery().eq(ConfigPhysicalLocation::getLocationName, reqVO.getLocationName()).last("limit 1")
|
||||||
|
.oneOpt().orElseThrow(() -> new BusinessException("为找到对应部位"));
|
||||||
|
locationId = location.getId();
|
||||||
|
}
|
||||||
|
DiseasePhysical result = diseasePhysicalService.lambdaQuery().eq(DiseasePhysical::getPatientId, process.getPatientId())
|
||||||
|
.eq(DiseasePhysical::getToolId, tool.getId()).eq(StrUtil.isNotBlank(locationId), DiseasePhysical::getLocationId, locationId).last("limit 1")
|
||||||
|
.oneOpt()
|
||||||
|
.orElseGet(() -> {
|
||||||
|
DiseasePhysical diseasePhysical = new DiseasePhysical();
|
||||||
|
diseasePhysical.setResult("无相关资讯");
|
||||||
|
return diseasePhysical;
|
||||||
|
});
|
||||||
|
// 检查记录保存到数据库中
|
||||||
|
DiagnosisPhysicalRecord diagnosisPhysicalRecord = new DiagnosisPhysicalRecord();
|
||||||
|
diagnosisPhysicalRecord.setProcessId(process.getId());
|
||||||
|
diagnosisPhysicalRecord.setToolId(tool.getId());
|
||||||
|
diagnosisPhysicalRecord.setLocationId(locationId);
|
||||||
|
diagnosisPhysicalRecord.setResult(result.getResult());
|
||||||
|
diagnosisPhysicalRecord.setCreateUserId(UserUtil.getUser().getCreateUserId());
|
||||||
|
diagnosisPhysicalRecord.setUpdateUserId(UserUtil.getUser().getCreateUserId());
|
||||||
|
diagnosisPhysicalRecord.insert();
|
||||||
|
return diagnosisPhysicalRecord;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.supervision.service.impl;
|
||||||
|
|
||||||
|
import com.supervision.model.Process;
|
||||||
|
import com.supervision.model.User;
|
||||||
|
import com.supervision.service.AskProcessService;
|
||||||
|
import com.supervision.service.ProcessService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AskProcessServiceImpl implements AskProcessService {
|
||||||
|
|
||||||
|
private final ProcessService processService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Process creatDiagnosisProcess(String patientId, User user) {
|
||||||
|
Process process = new Process();
|
||||||
|
process.setPatientId(patientId);
|
||||||
|
process.setUserId(user.getId());
|
||||||
|
process.setStatus(0);
|
||||||
|
process.setCreateUserId(user.getId());
|
||||||
|
process.setUpdateUserId(user.getId());
|
||||||
|
processService.save(process);
|
||||||
|
return process;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.supervision.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.supervision.config.ThreadCache;
|
||||||
|
import com.supervision.domain.UserInfo;
|
||||||
|
import com.supervision.exception.BusinessException;
|
||||||
|
import com.supervision.model.User;
|
||||||
|
|
||||||
|
public class UserUtil {
|
||||||
|
|
||||||
|
public static User getUser(){
|
||||||
|
String userStr = ThreadCache.USER.get();
|
||||||
|
User bean = JSONUtil.toBean(userStr, User.class);
|
||||||
|
if (ObjectUtil.isEmpty(bean)){
|
||||||
|
throw new BusinessException("未获取到用户信息");
|
||||||
|
}
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue