From 8e6cb5c79fd2655ec4847fc3ea267db2c093f56a Mon Sep 17 00:00:00 2001 From: zhaoyun Date: Wed, 27 May 2026 02:59:11 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#566:=20fallback=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/VitalSignController.java | 34 ++++++++ .../web/inpatient/mapper/VitalSignMapper.java | 43 +++------- .../inpatient/service/VitalSignService.java | 31 +++++++ .../openhis/web/inpatient/vo/VitalSignVO.java | 86 +++++++++++++++++++ .../src/api/inpatient/vitalSign.js | 14 +++ .../inpatient/nurse/temperatureChart.vue | 68 +++++++++++++++ 6 files changed, 247 insertions(+), 29 deletions(-) create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/controller/VitalSignController.java create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/service/VitalSignService.java create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/vo/VitalSignVO.java create mode 100644 openhis-ui-vue3/src/api/inpatient/vitalSign.js create mode 100644 openhis-ui-vue3/src/views/inpatient/nurse/temperatureChart.vue diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/controller/VitalSignController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/controller/VitalSignController.java new file mode 100644 index 000000000..590be8bf5 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/controller/VitalSignController.java @@ -0,0 +1,34 @@ +package com.openhis.web.inpatient.controller; + +import com.openhis.web.inpatient.service.VitalSignService; +import com.openhis.web.inpatient.vo.VitalSignVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 住院体征(体温单)接口 + * + * 修复 Bug #566:体征数据已录入成功,但在“体温单”图表区中未渲染显示数据点。 + * 该接口负责根据住院登记单号查询对应的体征记录,前端体温图表通过此接口获取数据。 + */ +@RestController +public class VitalSignController { + + @Autowired + private VitalSignService vitalSignService; + + /** + * 查询指定住院登记单的体征记录(包括体温、脉搏、呼吸、血压等)。 + * + * @param registrationId 住院登记单主键 ID + * @return 体征记录列表,按记录时间升序返回 + */ + @GetMapping("/api/inpatient/vital-signs") + public List listVitalSigns(@RequestParam("registrationId") Long registrationId) { + return vitalSignService.getVitalSignsByRegistrationId(registrationId); + } +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/mapper/VitalSignMapper.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/mapper/VitalSignMapper.java index 6bdc71186..0a0a3d7de 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/mapper/VitalSignMapper.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/mapper/VitalSignMapper.java @@ -1,47 +1,32 @@ package com.openhis.web.inpatient.mapper; +import com.openhis.web.inpatient.vo.VitalSignVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; -import java.util.Map; /** - * 体征数据访问层 + * 住院体征(体温单)数据访问层 * - * 修复说明: - * - 原查询未严格按时间范围过滤且未排序,导致前端图表无法正确映射坐标。 - * - 新增 {@link #selectVitalSignsByPatientAndTime},确保按 measure_time 升序返回, - * 并显式映射前端所需的字段别名,解决 Bug #566 图表区数据点未渲染问题。 + * 修复 Bug #566:新增查询已录入体征数据的 SQL,供前端体温图表使用。 */ @Mapper public interface VitalSignMapper { /** - * 查询指定患者在指定时间范围内的体征数据 + * 查询指定住院登记单的体征记录,按记录时间升序返回。 * - * @param patientId 患者ID - * @param startTime 开始时间 (格式: yyyy-MM-dd HH:mm:ss) - * @param endTime 结束时间 (格式: yyyy-MM-dd HH:mm:ss) - * @return 体征数据列表,按测量时间升序排列 + * @param registrationId 住院登记单 ID + * @return 体征记录列表 */ - @Select("SELECT id, patient_id, " + - "TO_CHAR(measure_time, 'MM-DD HH24:MI') AS time_label, " + - "measure_time, " + - "temperature, " + - "heart_rate, " + - "pulse, " + - "respiration, " + - "blood_pressure_systolic, " + - "blood_pressure_diastolic " + - "FROM his_vital_sign " + - "WHERE patient_id = #{patientId} " + - "AND measure_time >= #{startTime}::timestamp " + - "AND measure_time <= #{endTime}::timestamp " + - "ORDER BY measure_time ASC") - List> selectVitalSignsByPatientAndTime( - @Param("patientId") Long patientId, - @Param("startTime") String startTime, - @Param("endTime") String endTime); + @Select("") + List selectByRegistrationId(@Param("registrationId") Long registrationId); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/service/VitalSignService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/service/VitalSignService.java new file mode 100644 index 000000000..a1235e46f --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/service/VitalSignService.java @@ -0,0 +1,31 @@ +package com.openhis.web.inpatient.service; + +import com.openhis.web.inpatient.mapper.VitalSignMapper; +import com.openhis.web.inpatient.vo.VitalSignVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 住院体征业务 Service + * + * 修复 Bug #566:提供查询体征数据的业务方法,确保前端图表能够获取到已录入的体征记录。 + */ +@Service +public class VitalSignService { + + @Autowired + private VitalSignMapper vitalSignMapper; + + /** + * 根据住院登记单 ID 查询体征记录。 + * + * @param registrationId 住院登记单主键 + * @return 按记录时间升序排列的体征列表 + */ + public List getVitalSignsByRegistrationId(Long registrationId) { + // 直接返回查询结果,若无记录返回空列表 + return vitalSignMapper.selectByRegistrationId(registrationId); + } +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/vo/VitalSignVO.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/vo/VitalSignVO.java new file mode 100644 index 000000000..bba9ab2eb --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/vo/VitalSignVO.java @@ -0,0 +1,86 @@ +package com.openhis.web.inpatient.vo; + +import java.time.LocalDateTime; + +/** + * 体征(体温单)视图对象 + * + * 修复 Bug #566:定义前端需要的字段结构,确保图表能够正确解析体温等关键指标。 + */ +public class VitalSignVO { + + private Long id; + private Long registrationId; + private LocalDateTime recordTime; + private Double temperature; // 体温(℃) + private Integer pulse; // 脉搏(次/分) + private Integer respiration; // 呼吸(次/分) + private Integer systolicBp; // 收缩压(mmHg) + private Integer diastolicBp; // 舒张压(mmHg) + + // getters & setters + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getRegistrationId() { + return registrationId; + } + + public void setRegistrationId(Long registrationId) { + this.registrationId = registrationId; + } + + public LocalDateTime getRecordTime() { + return recordTime; + } + + public void setRecordTime(LocalDateTime recordTime) { + this.recordTime = recordTime; + } + + public Double getTemperature() { + return temperature; + } + + public void setTemperature(Double temperature) { + this.temperature = temperature; + } + + public Integer getPulse() { + return pulse; + } + + public void setPulse(Integer pulse) { + this.pulse = pulse; + } + + public Integer getRespiration() { + return respiration; + } + + public void setRespiration(Integer respiration) { + this.respiration = respiration; + } + + public Integer getSystolicBp() { + return systolicBp; + } + + public void setSystolicBp(Integer systolicBp) { + this.systolicBp = systolicBp; + } + + public Integer getDiastolicBp() { + return diastolicBp; + } + + public void setDiastolicBp(Integer diastolicBp) { + this.diastolicBp = diastolicBp; + } +} diff --git a/openhis-ui-vue3/src/api/inpatient/vitalSign.js b/openhis-ui-vue3/src/api/inpatient/vitalSign.js new file mode 100644 index 000000000..d09a1780a --- /dev/null +++ b/openhis-ui-vue3/src/api/inpatient/vitalSign.js @@ -0,0 +1,14 @@ +import request from '@/utils/request'; + +/** + * 获取住院体征(体温单)数据 + * @param {Object} params { registrationId } + * @returns {Promise} 返回体征记录列表,前端体温图表使用 + */ +export function getVitalSignsApi(params) { + return request({ + url: '/inpatient/vital-signs', + method: 'get', + params, + }); +} diff --git a/openhis-ui-vue3/src/views/inpatient/nurse/temperatureChart.vue b/openhis-ui-vue3/src/views/inpatient/nurse/temperatureChart.vue new file mode 100644 index 000000000..0613c85b5 --- /dev/null +++ b/openhis-ui-vue3/src/views/inpatient/nurse/temperatureChart.vue @@ -0,0 +1,68 @@ + + + + +