From 8e5bdf663d953603597f8b169b9a8af938065ced Mon Sep 17 00:00:00 2001 From: zzc Date: Fri, 16 May 2025 10:24:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BA=AB=E9=AB=98=E4=BD=93=E9=87=8D=E4=BB=AA?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=AA=E5=99=A8ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/web/ExternalController.java | 4 +- .../src/main/resources/mbg.xml | 4 +- .../system/domain/dto/ExternalDto.java | 5 ++ .../system/domain/po/HmsWeightHeight.java | 11 +++ .../domain/po/HmsWeightHeightExample.java | 70 +++++++++++++++++++ .../system/domain/po/PmsPatient.java | 11 +++ .../system/domain/po/PmsPatientExample.java | 70 +++++++++++++++++++ .../system/domain/vo/PmsPatientVo.java | 3 + .../system/service/ExternalService.java | 2 +- .../service/impl/ExternalServiceImpl.java | 64 ++++++++++------- .../service/impl/PmsTreatmentServiceImpl.java | 2 +- .../resources/mapper/dao/PmsPatientDao.xml | 3 +- .../mapper/system/HmsWeightHeightMapper.xml | 29 ++++++-- .../mapper/system/PmsPatientMapper.xml | 28 ++++++-- 14 files changed, 261 insertions(+), 45 deletions(-) diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java index 94ece6ca..d21ad29b 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java @@ -237,8 +237,8 @@ public class ExternalController { @DataSource(DataSourceType.MASTER) @ApiOperation("查询身高体重") @PostMapping("/api/http/getWeightHeight") - public JsonResponse getWeightHeight() { - return JsonResponse.ok(externalService.getWeightHeight()); + public JsonResponse getWeightHeight(@RequestBody @Validated ExternalDto.Weight dto) { + return JsonResponse.ok(externalService.getWeightHeight(dto.getWeightMachineId())); } } diff --git a/acupuncture-generator/src/main/resources/mbg.xml b/acupuncture-generator/src/main/resources/mbg.xml index dcff7c0c..00d18bdc 100644 --- a/acupuncture-generator/src/main/resources/mbg.xml +++ b/acupuncture-generator/src/main/resources/mbg.xml @@ -80,8 +80,8 @@ - - +
+ diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java index bc30b81b..78a45641 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java @@ -29,6 +29,11 @@ public class ExternalDto { private Long id; } + @Data + public static class Weight{ + private String weightMachineId; + } + @Data @ApiModel("人体成分数据上传") public static class RtcfInfoDto{ diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/HmsWeightHeight.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/HmsWeightHeight.java index a0a17883..bfcdcdb0 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/HmsWeightHeight.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/HmsWeightHeight.java @@ -9,6 +9,8 @@ public class HmsWeightHeight implements Serializable { private String weight; + private String testId; + private static final long serialVersionUID = 1L; public Long getId() { @@ -35,6 +37,14 @@ public class HmsWeightHeight implements Serializable { this.weight = weight == null ? null : weight.trim(); } + public String getTestId() { + return testId; + } + + public void setTestId(String testId) { + this.testId = testId == null ? null : testId.trim(); + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -44,6 +54,7 @@ public class HmsWeightHeight implements Serializable { sb.append(", id=").append(id); sb.append(", height=").append(height); sb.append(", weight=").append(weight); + sb.append(", testId=").append(testId); sb.append("]"); return sb.toString(); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/HmsWeightHeightExample.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/HmsWeightHeightExample.java index a22550b7..413252e9 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/HmsWeightHeightExample.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/HmsWeightHeightExample.java @@ -303,6 +303,76 @@ public class HmsWeightHeightExample { addCriterion("weight not between", value1, value2, "weight"); return (Criteria) this; } + + public Criteria andTestIdIsNull() { + addCriterion("test_id is null"); + return (Criteria) this; + } + + public Criteria andTestIdIsNotNull() { + addCriterion("test_id is not null"); + return (Criteria) this; + } + + public Criteria andTestIdEqualTo(String value) { + addCriterion("test_id =", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdNotEqualTo(String value) { + addCriterion("test_id <>", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdGreaterThan(String value) { + addCriterion("test_id >", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdGreaterThanOrEqualTo(String value) { + addCriterion("test_id >=", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdLessThan(String value) { + addCriterion("test_id <", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdLessThanOrEqualTo(String value) { + addCriterion("test_id <=", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdLike(String value) { + addCriterion("test_id like", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdNotLike(String value) { + addCriterion("test_id not like", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdIn(List values) { + addCriterion("test_id in", values, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdNotIn(List values) { + addCriterion("test_id not in", values, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdBetween(String value1, String value2) { + addCriterion("test_id between", value1, value2, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdNotBetween(String value1, String value2) { + addCriterion("test_id not between", value1, value2, "testId"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatient.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatient.java index eb3ef191..137399ef 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatient.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatient.java @@ -50,6 +50,8 @@ public class PmsPatient implements Serializable { private String currentIllnessHistoryQt; + private String weightId; + private static final long serialVersionUID = 1L; public Long getId() { @@ -236,6 +238,14 @@ public class PmsPatient implements Serializable { this.currentIllnessHistoryQt = currentIllnessHistoryQt == null ? null : currentIllnessHistoryQt.trim(); } + public String getWeightId() { + return weightId; + } + + public void setWeightId(String weightId) { + this.weightId = weightId == null ? null : weightId.trim(); + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -265,6 +275,7 @@ public class PmsPatient implements Serializable { sb.append(", updateTime=").append(updateTime); sb.append(", remark=").append(remark); sb.append(", currentIllnessHistoryQt=").append(currentIllnessHistoryQt); + sb.append(", weightId=").append(weightId); sb.append("]"); return sb.toString(); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatientExample.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatientExample.java index 491f9efa..72567fd8 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatientExample.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatientExample.java @@ -1641,6 +1641,76 @@ public class PmsPatientExample { addCriterion("current_illness_history_qt not between", value1, value2, "currentIllnessHistoryQt"); return (Criteria) this; } + + public Criteria andWeightIdIsNull() { + addCriterion("weight_id is null"); + return (Criteria) this; + } + + public Criteria andWeightIdIsNotNull() { + addCriterion("weight_id is not null"); + return (Criteria) this; + } + + public Criteria andWeightIdEqualTo(String value) { + addCriterion("weight_id =", value, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdNotEqualTo(String value) { + addCriterion("weight_id <>", value, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdGreaterThan(String value) { + addCriterion("weight_id >", value, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdGreaterThanOrEqualTo(String value) { + addCriterion("weight_id >=", value, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdLessThan(String value) { + addCriterion("weight_id <", value, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdLessThanOrEqualTo(String value) { + addCriterion("weight_id <=", value, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdLike(String value) { + addCriterion("weight_id like", value, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdNotLike(String value) { + addCriterion("weight_id not like", value, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdIn(List values) { + addCriterion("weight_id in", values, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdNotIn(List values) { + addCriterion("weight_id not in", values, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdBetween(String value1, String value2) { + addCriterion("weight_id between", value1, value2, "weightId"); + return (Criteria) this; + } + + public Criteria andWeightIdNotBetween(String value1, String value2) { + addCriterion("weight_id not between", value1, value2, "weightId"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsPatientVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsPatientVo.java index 084e8bfa..c0109265 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsPatientVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsPatientVo.java @@ -54,6 +54,9 @@ public class PmsPatientVo { private String remark; private String tenantName; + + @ApiModelProperty("身高体重机器ID") + private String weightMachineId; } } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java index eee96d91..851d4274 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java @@ -61,5 +61,5 @@ public interface ExternalService { */ void dmh(String str); - HmsWeightHeight getWeightHeight(); + HmsWeightHeight getWeightHeight(String weightMachineId); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java index 95b468b6..76bfb673 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java @@ -10,12 +10,10 @@ import com.acupuncture.system.domain.po.*; import com.acupuncture.system.domain.vo.ExternalVo; import com.acupuncture.system.domain.vo.UplRtcfInfoVo; import com.acupuncture.system.persist.dao.ExternalDao; -import com.acupuncture.system.persist.mapper.HmsWeightHeightMapper; -import com.acupuncture.system.persist.mapper.PmsTreatmentMapper; -import com.acupuncture.system.persist.mapper.UplReportImageMapper; -import com.acupuncture.system.persist.mapper.UplRtcfInfoMapper; +import com.acupuncture.system.persist.mapper.*; import com.acupuncture.system.service.ExternalService; import com.github.pagehelper.PageHelper; +import org.apache.ibatis.ognl.ASTInstanceof; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -45,6 +43,8 @@ public class ExternalServiceImpl implements ExternalService { private PmsTreatmentMapper pmsTreatmentMapper; @Resource private HmsWeightHeightMapper hmsWeightHeightMapper; + @Resource + private PmsPatientMapper patientMapper; @Override public ExternalVo.Result query(String from, String memberid) { @@ -230,39 +230,51 @@ public class ExternalServiceImpl implements ExternalService { @Override public void dmh(String str) { // 1. 去除首尾空格和换行符 - String trimmedInput = str.trim(); + String input = str.trim(); - // 2. 定义正则表达式匹配模式 - Pattern pattern = Pattern.compile("W:(\\d+\\.\\d+)\\s+H:(\\d+\\.\\d+)"); - Matcher matcher = pattern.matcher(trimmedInput); +// // 2. 定义正则表达式匹配模式 +// Pattern pattern = Pattern.compile("W:(\\d+\\.\\d+)\\s+H:(\\d+\\.\\d+)"); +// Matcher matcher = pattern.matcher(trimmedInput); // 3. 提取并处理匹配结果 - if (matcher.find()) { - String wValue = matcher.group(1); // 提取 W 的数值部分 - String hValue = matcher.group(2); // 提取 H 的数值部分 +// if (matcher.find()) { +// String wValue = matcher.group(1); // 提取 W 的数值部分 +// String hValue = matcher.group(2); // 提取 H 的数值部分 +// 提取ID部分(去掉开头的"RD") + String testId = input.substring(2, input.indexOf("W:")); - // 转换为 Double(自动忽略前导零) - double width = Double.parseDouble(wValue); - double height = Double.parseDouble(hValue); + // 提取体重和身高 + String width = input.substring(input.indexOf("W:") + 2, input.indexOf(" H:")); + String height = input.substring(input.indexOf("H:") + 2); - HmsWeightHeight hmsWeightHeight = new HmsWeightHeight(); - hmsWeightHeight.setHeight(height + ""); - hmsWeightHeight.setWeight(width + ""); - hmsWeightHeight.setId(IdUtil.getSnowflakeNextId()); - hmsWeightHeightMapper.insertSelective(hmsWeightHeight); +// // 转换为 Double(自动忽略前导零) +// double width = Double.parseDouble(wValue); +// double height = Double.parseDouble(hValue); - // 输出结果(或按需处理) - System.out.println("W: " + width); // 输出: W: 66.5 - System.out.println("H: " + height); // 输出: H: 173.5 - } else { - System.out.println("未找到有效的 W 或 H 值"); - } + HmsWeightHeight hmsWeightHeight = new HmsWeightHeight(); + hmsWeightHeight.setHeight(height + ""); + hmsWeightHeight.setWeight(width + ""); + hmsWeightHeight.setId(IdUtil.getSnowflakeNextId()); + hmsWeightHeight.setTestId(testId); + hmsWeightHeightMapper.insertSelective(hmsWeightHeight); + + // 输出结果(或按需处理) + System.out.println("W: " + width); // 输出: W: 66.5 + System.out.println("H: " + height); // 输出: H: 173.5 + System.out.println("id: " + testId); +// } else { +// System.out.println("未找到有效的 W 或 H 值"); +// } } @Override - public HmsWeightHeight getWeightHeight() { + public HmsWeightHeight getWeightHeight(String weightMachineId) { PageHelper.startPage(1, 1); HmsWeightHeightExample hmsWeightHeightExample = new HmsWeightHeightExample(); + HmsWeightHeightExample.Criteria criteria = hmsWeightHeightExample.createCriteria(); + if (StrUtil.isNotEmpty(weightMachineId)) { + criteria.andTestIdEqualTo(weightMachineId); + } hmsWeightHeightExample.setOrderByClause("id desc"); List hmsWeightHeights = hmsWeightHeightMapper.selectByExample(hmsWeightHeightExample); if (CollectionUtil.isNotEmpty(hmsWeightHeights)) { diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java index 6fc267f9..62e29c3a 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java @@ -323,7 +323,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { patientQueueRelation.setDelFlag((byte) 0); patientQueueRelation.setIdCard(pmsTreatment.getIdCard()); patientQueueRelation.setDischargeTime(pmsTreatment.getDischargeTime()); - patientQueueRelation.setIdCardType(pmsTreatment.getIdCardType().byteValue()); + patientQueueRelation.setIdCardType(pmsTreatment.getIdCardType() == null ? null : pmsTreatment.getIdCardType().byteValue()); patientQueueRelation.setCreateBy(SecurityUtils.getUsername()); patientQueueRelation.setPatientId(pmsTreatment.getPatientId()); patientQueueRelation.setQueueId(Long.parseLong(queueId)); diff --git a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml index 90d21e84..aa3118d2 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml @@ -23,7 +23,8 @@ p.create_time as createTime, p.weight, p.height, - t.name as tenantName + t.name as tenantName, + p.weight_id as weightMachineId FROM pms_patient p left join diff --git a/acupuncture-system/src/main/resources/mapper/system/HmsWeightHeightMapper.xml b/acupuncture-system/src/main/resources/mapper/system/HmsWeightHeightMapper.xml index 7ae6854a..4809f12e 100644 --- a/acupuncture-system/src/main/resources/mapper/system/HmsWeightHeightMapper.xml +++ b/acupuncture-system/src/main/resources/mapper/system/HmsWeightHeightMapper.xml @@ -5,6 +5,7 @@ + @@ -65,7 +66,7 @@ - id, height, weight + id, height, weight, test_id @@ -140,6 +147,9 @@ weight = #{record.weight,jdbcType=VARCHAR}, + + test_id = #{record.testId,jdbcType=VARCHAR}, + @@ -149,7 +159,8 @@ update hms_weight_height set id = #{record.id,jdbcType=BIGINT}, height = #{record.height,jdbcType=VARCHAR}, - weight = #{record.weight,jdbcType=VARCHAR} + weight = #{record.weight,jdbcType=VARCHAR}, + test_id = #{record.testId,jdbcType=VARCHAR} @@ -163,13 +174,17 @@ weight = #{weight,jdbcType=VARCHAR}, + + test_id = #{testId,jdbcType=VARCHAR}, + where id = #{id,jdbcType=BIGINT} update hms_weight_height set height = #{height,jdbcType=VARCHAR}, - weight = #{weight,jdbcType=VARCHAR} + weight = #{weight,jdbcType=VARCHAR}, + test_id = #{testId,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT} \ No newline at end of file diff --git a/acupuncture-system/src/main/resources/mapper/system/PmsPatientMapper.xml b/acupuncture-system/src/main/resources/mapper/system/PmsPatientMapper.xml index 7f8a728c..4d0906e6 100644 --- a/acupuncture-system/src/main/resources/mapper/system/PmsPatientMapper.xml +++ b/acupuncture-system/src/main/resources/mapper/system/PmsPatientMapper.xml @@ -25,6 +25,7 @@ + @@ -87,7 +88,8 @@ id, name, pinyin_full, pinyin_simple, gender, birth_date, ethnicity, education_years, phone, id_card_type, id_card, source, current_illness_history, weight, height, del_flag, - tenant_id, create_by, create_time, update_by, update_time, remark, current_illness_history_qt + tenant_id, create_by, create_time, update_by, update_time, remark, current_illness_history_qt, + weight_id @@ -354,6 +364,9 @@ current_illness_history_qt = #{record.currentIllnessHistoryQt,jdbcType=VARCHAR}, + + weight_id = #{record.weightId,jdbcType=VARCHAR}, + @@ -383,7 +396,8 @@ update_by = #{record.updateBy,jdbcType=VARCHAR}, update_time = #{record.updateTime,jdbcType=TIMESTAMP}, remark = #{record.remark,jdbcType=VARCHAR}, - current_illness_history_qt = #{record.currentIllnessHistoryQt,jdbcType=VARCHAR} + current_illness_history_qt = #{record.currentIllnessHistoryQt,jdbcType=VARCHAR}, + weight_id = #{record.weightId,jdbcType=VARCHAR} @@ -457,6 +471,9 @@ current_illness_history_qt = #{currentIllnessHistoryQt,jdbcType=VARCHAR}, + + weight_id = #{weightId,jdbcType=VARCHAR}, + where id = #{id,jdbcType=BIGINT} @@ -483,7 +500,8 @@ update_by = #{updateBy,jdbcType=VARCHAR}, update_time = #{updateTime,jdbcType=TIMESTAMP}, remark = #{remark,jdbcType=VARCHAR}, - current_illness_history_qt = #{currentIllnessHistoryQt,jdbcType=VARCHAR} + current_illness_history_qt = #{currentIllnessHistoryQt,jdbcType=VARCHAR}, + weight_id = #{weightId,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT} \ No newline at end of file