体检结果汇总---初步

This commit is contained in:
张佳炜 2025-02-18 16:56:52 +08:00
parent ea0d7222f9
commit 522827946a
5 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,78 @@
package cn.iocoder.yudao.module.inspect.controller.admin.checkupresult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo.InspectPatientRespVO;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo.InspectPatientSaveReqVO;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatientitems.vo.InspectPatientitemsRespVO;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatientitems.vo.InspectPatientitemsSaveReqVO;
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectpatient.InspectPatientDO;
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectpatientitems.InspectPatientitemsDO;
import cn.iocoder.yudao.module.inspect.service.inspectpatient.InspectPatientService;
import cn.iocoder.yudao.module.inspect.service.inspectpatientitems.InspectPatientitemsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 体检结果汇总")
@RestController
@RequestMapping("/checkup/result")
@Validated
public class CheckUpResultController {
@Resource
private InspectPatientService patientService;
@Resource
private InspectPatientitemsService patientitemsService;
@GetMapping("/getPatient")
@Operation(summary = "获得患者信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<InspectPatientRespVO> getPatient(@RequestParam("medicalSn") String medicalSn) {
InspectPatientDO patient = patientService.getPatientOfMedicalSn(medicalSn);
InspectPatientRespVO bean = BeanUtils.toBean(patient, InspectPatientRespVO.class);
return success(BeanUtils.toBean(patient, InspectPatientRespVO.class));
}
@GetMapping("/getPatientItems")
@Operation(summary = "获得患者体检项目")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<List<InspectPatientitemsRespVO>> getPatientItems(@RequestParam("medicalSn") String medicalSn) {
List<InspectPatientitemsDO> list = patientitemsService.getPatientItemsOfMedicalSn(medicalSn);
return success(BeanUtils.toBean(list, InspectPatientitemsRespVO.class));
}
@PutMapping("/updatePatient")
@Operation(summary = "更新患者汇总结果分析")
public CommonResult<Boolean> updatePatient(@Valid @RequestBody InspectPatientSaveReqVO updateReqVO) {
patientService.updateSummaryResult(updateReqVO);
return success(true);
}
@PutMapping("/updateAudit")
@Operation(summary = "审核")
public CommonResult<Boolean> passAudit(@RequestParam("medicalSn") String medicalSn,@RequestParam("auditStatus") Integer auditStatus, @RequestParam("inspectionOpinion") String inspectionOpinion) {
patientService.updateAudit(medicalSn, auditStatus, inspectionOpinion);
return success(true);
}
@PostMapping("/updateItemsAnalyse")
@Operation(summary = "更新检查项目汇总结果分析")
public CommonResult<Boolean> createPatientItems(@Valid @RequestBody List<InspectPatientitemsSaveReqVO> createReqVO) {
patientitemsService.updateItemsAnalyse(createReqVO);
return success(true);
}
}

View File

@ -53,4 +53,14 @@ public interface InspectPatientService {
*/ */
PageResult<InspectPatientDO> getPatientPage(InspectPatientPageReqVO pageReqVO); PageResult<InspectPatientDO> getPatientPage(InspectPatientPageReqVO pageReqVO);
//根据条码获取患者信息
InspectPatientDO getPatientOfMedicalSn(String medicalSn);
//更新患者汇总分析结果
void updateSummaryResult(@Valid InspectPatientSaveReqVO updateReqVO);
//通过审核
void updateAudit(String medicalSn, Integer auditStatus, String inspectionOpinion);
} }

View File

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.inspect.service.inspectpatient; package cn.iocoder.yudao.module.inspect.service.inspectpatient;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -69,4 +71,31 @@ public class InspectPatientServiceImpl implements InspectPatientService {
return patientMapper.selectPage(pageReqVO); return patientMapper.selectPage(pageReqVO);
} }
@Override
public InspectPatientDO getPatientOfMedicalSn(String medicalSn) {
LambdaQueryWrapper<InspectPatientDO> lambdaQuery = new LambdaQueryWrapper<>();
lambdaQuery.eq(InspectPatientDO::getMedicalSn, medicalSn);
return patientMapper.selectOne(lambdaQuery);
}
@Override
public void updateSummaryResult(InspectPatientSaveReqVO updateReqVO) {
LambdaUpdateWrapper<InspectPatientDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(InspectPatientDO::getMedicalSn, updateReqVO.getMedicalSn());
lambdaUpdateWrapper.set(InspectPatientDO::getSummaryResult, updateReqVO.getSummaryResult());
int updatedRows = patientMapper.update(null, lambdaUpdateWrapper);
}
@Override
public void updateAudit(String medicalSn,Integer auditStatus, String inspectionOpinion) {
LambdaUpdateWrapper<InspectPatientDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(InspectPatientDO::getMedicalSn, medicalSn);
lambdaUpdateWrapper.set(InspectPatientDO::getAuditStatus, auditStatus);
lambdaUpdateWrapper.set(InspectPatientDO::getInspectionOpinion, inspectionOpinion);
int updatedRows = patientMapper.update(null, lambdaUpdateWrapper);
}
} }

View File

@ -53,4 +53,10 @@ public interface InspectPatientitemsService {
*/ */
PageResult<InspectPatientitemsDO> getPatientitemsPage(InspectPatientitemsPageReqVO pageReqVO); PageResult<InspectPatientitemsDO> getPatientitemsPage(InspectPatientitemsPageReqVO pageReqVO);
//根据条码获取患者检查项
List<InspectPatientitemsDO> getPatientItemsOfMedicalSn(String medicalSn);
//更新患者分析结果
void updateItemsAnalyse(@Valid List<InspectPatientitemsSaveReqVO> updateReqVO );
} }

View File

@ -1,5 +1,10 @@
package cn.iocoder.yudao.module.inspect.service.inspectpatientitems; package cn.iocoder.yudao.module.inspect.service.inspectpatientitems;
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectpatient.InspectPatientDO;
import cn.iocoder.yudao.module.inspect.dal.mysql.inspectpatient.InspectPatientMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -29,6 +34,9 @@ public class InspectPatientitemsServiceImpl implements InspectPatientitemsServic
@Resource @Resource
private InspectPatientitemsMapper patientitemsMapper; private InspectPatientitemsMapper patientitemsMapper;
@Resource
private InspectPatientMapper patientMapper;
@Override @Override
public Integer createPatientitems(InspectPatientitemsSaveReqVO createReqVO) { public Integer createPatientitems(InspectPatientitemsSaveReqVO createReqVO) {
// 插入 // 插入
@ -71,4 +79,39 @@ public class InspectPatientitemsServiceImpl implements InspectPatientitemsServic
return patientitemsMapper.selectPage(pageReqVO); return patientitemsMapper.selectPage(pageReqVO);
} }
@Override
public List<InspectPatientitemsDO> getPatientItemsOfMedicalSn(String medicalSn) {
LambdaQueryWrapper<InspectPatientitemsDO> lambdaQuery = new LambdaQueryWrapper<>();
lambdaQuery.eq(InspectPatientitemsDO::getMedicalSn, medicalSn);
lambdaQuery.eq(InspectPatientitemsDO::getPositive, 1);
return patientitemsMapper.selectList(lambdaQuery);
}
@Override
public void updateItemsAnalyse(List<InspectPatientitemsSaveReqVO> updateReqVO) {
StringBuilder str = new StringBuilder();
//1.更新项目分析结果 循环得出汇总
for (InspectPatientitemsSaveReqVO reqVO : updateReqVO) {
UpdateWrapper<InspectPatientitemsDO> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", reqVO.getId()); // 根据ID设置更新条件
// 可以添加更多的条件
// updateWrapper.eq("other_field", user.getOtherField());
// 设置要更新的字段
updateWrapper.set("analyse", reqVO.getAnalyse());
// 可以设置更多的字段
// updateWrapper.set("another_field", user.getAnotherField());
// 执行更新操作
patientitemsMapper.update(updateWrapper);
str.append(reqVO.getItemResult()).append(":").append(reqVO.getAnalyse()).append(";");
}
//2.更新汇总分析
LambdaUpdateWrapper<InspectPatientDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(InspectPatientDO::getMedicalSn, updateReqVO.get(0).getMedicalSn());
lambdaUpdateWrapper.set(InspectPatientDO::getSummaryResult, str.toString());
int updatedRows = patientMapper.update(null, lambdaUpdateWrapper);
}
} }