diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java index c2787f4..2085d0c 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java @@ -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; + } } diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgdata/ecgdataController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgdata/ecgdataController.java index 742df60..4683711 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgdata/ecgdataController.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgdata/ecgdataController.java @@ -52,6 +52,20 @@ public class ecgdataController { return success(true); } + @PutMapping("/update-wearstarttime") + @Operation(summary = "更新心电图动态数据") + public CommonResult updateecgdatawearstarttime(@Valid @RequestBody upecgdatawearstarttime updateReqVO) { + ecgdataService.updateecgdatawearstarttime(updateReqVO.getId(), updateReqVO.getWearstarttime()); + return success(true); + } + + @GetMapping("/apply-superior-review") + @Operation(summary = "申请上级审核") + public CommonResult 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) diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgdata/vo/upecgdatawearstarttime.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgdata/vo/upecgdatawearstarttime.java new file mode 100644 index 0000000..683da95 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgdata/vo/upecgdatawearstarttime.java @@ -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; +} diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgdata/ecgdataService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgdata/ecgdataService.java index 5716907..9477520 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgdata/ecgdataService.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgdata/ecgdataService.java @@ -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); /** * 删除心电图动态数据 diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgdata/ecgdataServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgdata/ecgdataServiceImpl.java index 348ef5e..4a17734 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgdata/ecgdataServiceImpl.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgdata/ecgdataServiceImpl.java @@ -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);