新增患者组件相关接口

This commit is contained in:
lxd 2025-07-15 16:43:20 +08:00
parent 8f00d081e4
commit 7a82168c86
5 changed files with 82 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.List;
/**
@ -74,5 +75,16 @@ public class NumberUtils {
}
return NumberUtil.mul(values);
}
/**
* 通过身份证号码计算年龄
*
* @param idCard 身份证号码
* @return 年龄
*/
public static Integer calculateAgeFromIdCard(String idCard) {
String yearStr = idCard.substring(6, 10); // 提取出生年份假设为18位身份证
int birthYear = Integer.parseInt(yearStr);
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
return currentYear - birthYear;
}
}

View File

@ -52,6 +52,20 @@ public class ecgdataController {
return success(true);
}
@PutMapping("/update-wearstarttime")
@Operation(summary = "更新心电图动态数据")
public CommonResult<Boolean> updateecgdatawearstarttime(@Valid @RequestBody upecgdatawearstarttime updateReqVO) {
ecgdataService.updateecgdatawearstarttime(updateReqVO.getId(), updateReqVO.getWearstarttime());
return success(true);
}
@GetMapping("/apply-superior-review")
@Operation(summary = "申请上级审核")
public CommonResult<Boolean> applySuperiorReview(@RequestParam("id") Integer id,@RequestParam("orgid") String orgid) {
ecgdataService.applySuperiorReview(id, orgid);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除心电图动态数据")
@Parameter(name = "id", description = "编号", required = true)

View File

@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.system.controller.admin.ecgdata.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class upecgdatawearstarttime {
@Schema(description = "主键ID自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "18914")
private Integer id;
@JsonFormat(shape = JsonFormat.Shape.NUMBER)
private LocalDateTime wearstarttime;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.service.ecgdata;
import java.time.LocalDateTime;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.system.controller.admin.ecgdata.vo.*;
@ -29,6 +30,14 @@ public interface ecgdataService {
* @param updateReqVO 更新信息
*/
void updateecgdata(@Valid ecgdataSaveReqVO updateReqVO);
/*
* 更新心电图动态数据表的佩戴时间
* */
void updateecgdatawearstarttime(Integer id, LocalDateTime wearstarttime);
/*
* 动态心电申请功能
* */
void applySuperiorReview(Integer id, String orgid);
/**
* 删除心电图动态数据

View File

@ -1,11 +1,14 @@
package cn.iocoder.yudao.module.system.service.ecgdata;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.patientinfoRespVO;
import com.alibaba.excel.util.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.time.LocalDateTime;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.ecgdata.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.ecgdata.ecgdataDO;
@ -47,6 +50,26 @@ public class ecgdataServiceImpl implements ecgdataService {
ecgdataMapper.updateById(updateObj);
}
@Override
public void updateecgdatawearstarttime(Integer id, LocalDateTime wearstarttime)
{
ecgdataSaveReqVO updateReqVO = new ecgdataSaveReqVO();
updateReqVO.setId(id);
updateReqVO.setWearstarttime(wearstarttime);
ecgdataDO updateObj = BeanUtils.toBean(updateReqVO, ecgdataDO.class);
ecgdataMapper.updateById(updateObj);
}
@Override
public void applySuperiorReview(Integer id, String orgid)
{
ecgdataSaveReqVO updateReqVO = new ecgdataSaveReqVO();
updateReqVO.setId(id);
updateReqVO.setManagerorg(orgid);
ecgdataDO updateObj = BeanUtils.toBean(updateReqVO, ecgdataDO.class);
ecgdataMapper.updateById(updateObj);
}
@Override
public void deleteecgdata(Integer id) {
// 校验存在
@ -95,7 +118,12 @@ public class ecgdataServiceImpl implements ecgdataService {
ecgdata.setExamid(examId);
ecgdata.setName(patientInfo.getName());
ecgdata.setGender(patientInfo.getGender());
// ecgdata.setAge(patientInfo.getAge())
// 根据身份证号计算年龄
String idCard = patientInfo.getIdcard();
if (StringUtils.isNotBlank(idCard)) {
Integer age = NumberUtils.calculateAgeFromIdCard(idCard);
ecgdata.setAge(age);
}
ecgdata.setOrgid(patientInfo.getOrgid());
ecgdata.setOrgname(patientInfo.getOrgname());
ecgDataList.add(ecgdata);