肺功能
This commit is contained in:
parent
4c626969ea
commit
c963f82c3c
@ -26,6 +26,7 @@ import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.pft.vo.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.patientinfoRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.pft.PftDO;
|
||||
import cn.iocoder.yudao.module.system.service.pft.PftService;
|
||||
|
||||
@ -94,4 +95,27 @@ public class PftController {
|
||||
BeanUtils.toBean(list, PftRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/insertPftPatientData")
|
||||
@Operation(summary = "批量插入肺功能患者基础信息")
|
||||
public CommonResult<Boolean> insertPftPatientData(@RequestBody List<patientinfoRespVO> patientInfoList) {
|
||||
pftService.insertPftPatientData(patientInfoList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/updatePftAnalysis")
|
||||
@Operation(summary = "根据examid更新肺功能分析结果")
|
||||
@Parameter(name = "examid", description = "检查ID", required = true)
|
||||
@Parameter(name = "analysisResult", description = "分析结果", required = true)
|
||||
public CommonResult<Boolean> updatePftAnalysis(@RequestParam("examid") String examid,
|
||||
@RequestParam("analysisResult") String analysisResult) {
|
||||
return success(pftService.updatePftAnalysis(examid, analysisResult));
|
||||
}
|
||||
|
||||
@GetMapping("/getPftAnalysis")
|
||||
@Operation(summary = "根据examid查询肺功能分析结果")
|
||||
@Parameter(name = "examid", description = "检查ID", required = true)
|
||||
public CommonResult<String> getPftAnalysis(@RequestParam("examid") String examid) {
|
||||
return success(pftService.getPftAnalysis(examid));
|
||||
}
|
||||
|
||||
}
|
||||
@ -94,4 +94,21 @@ public class PftdataController {
|
||||
BeanUtils.toBean(list, PftdataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getByExamidAndRegid")
|
||||
@Operation(summary = "根据检查ID和患者ID获取肺功能数据")
|
||||
public CommonResult<PftdataRespVO> getPftdataByExamidAndRegid(@RequestParam("examid") String examid, @RequestParam("regid") String regid) {
|
||||
PftdataDO pftdata = pftdataService.getPftdataByExamidAndRegid(examid, regid);
|
||||
return success(BeanUtils.toBean(pftdata, PftdataRespVO.class));
|
||||
}
|
||||
|
||||
@PutMapping("/saveDiagnosisByExamidAndRegid")
|
||||
@Operation(summary = "根据examid和regid保存诊断结论")
|
||||
public CommonResult<Boolean> savePftdataDiagnosis(@RequestBody Map<String, String> req) {
|
||||
String examid = req.get("examid");
|
||||
String regid = req.get("regid");
|
||||
String diagnosis = req.get("diagnosis");
|
||||
pftdataService.savePftdataDiagnosis(examid, regid, diagnosis);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -17,12 +17,11 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
@TableName("tb_pftdata")
|
||||
@KeySequence("tb_pftdata_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PftdataDO extends BaseDO {
|
||||
public class PftdataDO{
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
|
||||
@ -8,6 +8,8 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.pft.PftDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.pft.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* 肺功能患者 Mapper
|
||||
@ -37,4 +39,26 @@ public interface PftMapper extends BaseMapperX<PftDO> {
|
||||
.orderByDesc(PftDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据examid更新肺功能分析结果
|
||||
*
|
||||
* @param examid 检查ID
|
||||
* @param analysisResult 分析结果
|
||||
*/
|
||||
@Update("UPDATE tb_pft SET analysisresult = #{analysisResult} WHERE examid = #{examid}")
|
||||
void updateAnalysisByExamid(@Param("examid") String examid, @Param("analysisResult") String analysisResult);
|
||||
|
||||
/**
|
||||
* 根据examid查询肺功能分析结果
|
||||
*
|
||||
* @param examid 检查ID
|
||||
* @return 分析结果
|
||||
*/
|
||||
default String selectAnalysisByExamid(String examid) {
|
||||
PftDO pft = selectOne(new LambdaQueryWrapperX<PftDO>()
|
||||
.eq(PftDO::getExamid, examid)
|
||||
.select(PftDO::getAnalysisresult));
|
||||
return pft != null ? pft.getAnalysisresult() : null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.pft;
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.pft.vo.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.patientinfoRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.pft.PftDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
@ -43,6 +44,29 @@ public interface PftService {
|
||||
*/
|
||||
void deletePftListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 批量插入肺功能患者基础信息
|
||||
*
|
||||
* @param patientInfoList 患者信息列表
|
||||
*/
|
||||
void insertPftPatientData(List<patientinfoRespVO> patientInfoList);
|
||||
|
||||
/**
|
||||
* 根据examid更新肺功能分析结果
|
||||
*
|
||||
* @param examid 检查ID
|
||||
* @param analysisResult 分析结果
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean updatePftAnalysis(String examid, String analysisResult);
|
||||
|
||||
/**
|
||||
* 根据examid查询肺功能分析结果
|
||||
* @param examid 检查ID
|
||||
* @return 分析结果
|
||||
*/
|
||||
String getPftAnalysis(String examid);
|
||||
|
||||
/**
|
||||
* 获得肺功能患者
|
||||
*
|
||||
|
||||
@ -8,6 +8,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.pft.vo.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.patientinfoRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.pft.PftDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
@ -66,6 +67,38 @@ public class PftServiceImpl implements PftService {
|
||||
pftMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertPftPatientData(List<patientinfoRespVO> patientInfoList) {
|
||||
if (CollUtil.isNotEmpty(patientInfoList)) {
|
||||
List<PftDO> pftDataList = new ArrayList<>();
|
||||
for (patientinfoRespVO patientInfo : patientInfoList) {
|
||||
PftDO pft = new PftDO();
|
||||
pft.setRegid(patientInfo.getRegid());
|
||||
String examId = UUID.randomUUID().toString().replaceAll("-", ""); // 去除横线保持简洁
|
||||
pft.setExamid(examId);
|
||||
pft.setName(patientInfo.getName());
|
||||
pft.setGender(patientInfo.getGender());
|
||||
pft.setOrgid(patientInfo.getOrgid());
|
||||
pft.setOrgname(patientInfo.getOrgname());
|
||||
pft.setStatus(0); // 默认状态:0申请中
|
||||
pftDataList.add(pft);
|
||||
}
|
||||
// 批量插入肺功能数据
|
||||
pftMapper.insertBatch(pftDataList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updatePftAnalysis(String examid, String analysisResult) {
|
||||
pftMapper.updateAnalysisByExamid(examid, analysisResult);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPftAnalysis(String examid) {
|
||||
return pftMapper.selectAnalysisByExamid(examid);
|
||||
}
|
||||
|
||||
private void validatePftExists(List<Long> ids) {
|
||||
List<PftDO> list = pftMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
|
||||
@ -59,4 +59,14 @@ public interface PftdataService {
|
||||
*/
|
||||
PageResult<PftdataDO> getPftdataPage(PftdataPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 根据检查ID和患者ID获取肺功能数据
|
||||
*/
|
||||
PftdataDO getPftdataByExamidAndRegid(String examid, String regid);
|
||||
|
||||
/**
|
||||
* 根据examid和regid保存诊断结论
|
||||
*/
|
||||
void savePftdataDiagnosis(String examid, String regid, String diagnosis);
|
||||
|
||||
}
|
||||
@ -87,4 +87,27 @@ public class PftdataServiceImpl implements PftdataService {
|
||||
return pftdataMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PftdataDO getPftdataByExamidAndRegid(String examid, String regid) {
|
||||
return pftdataMapper.selectOne(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<PftdataDO>()
|
||||
.eq(PftdataDO::getExamid, examid)
|
||||
.eq(PftdataDO::getRegid, regid)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void savePftdataDiagnosis(String examid, String regid, String diagnosis) {
|
||||
int updated = pftdataMapper.update(
|
||||
null,
|
||||
new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<PftdataDO>()
|
||||
.eq(PftdataDO::getExamid, examid)
|
||||
.eq(PftdataDO::getRegid, regid)
|
||||
.set(PftdataDO::getDiagnosis, diagnosis)
|
||||
);
|
||||
if (updated == 0) {
|
||||
throw new RuntimeException("未找到对应的肺功能数据记录,无法保存诊断结论");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user