Fix Bug #566: fallback修复

This commit is contained in:
2026-05-27 02:49:14 +08:00
parent bf1438dbbe
commit c6c9eed067

View File

@@ -0,0 +1,46 @@
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;
/**
* 住院体征(体温、脉搏、呼吸等)数据访问层
*
* 修复 Bug #566体温单图表区未渲染数据点。
* 原因前端图表组件ECharts默认读取字段名为 `value`(数值)和 `time`(时间)。
* 旧的 SQL 只返回 `temperature`、`record_time`,导致前端无法匹配字段,图表渲染为空。
*
* 解决方案:
* 1. 在查询中为体温数值添加别名 `value`,为记录时间添加别名 `time`。
* 2. 同时保留原始字段别名temperature、recordTime以兼容后端其他业务。
* 3. 增加注释说明字段映射关系,防止后续误删。
*/
@Mapper
public interface InpatientVitalMapper {
/**
* 查询指定患者的体温记录(用于体温单图表渲染)。
*
* @param patientId 患者主键 ID
* @return 体温记录列表,包含以下字段:
* - temperature : 原始体温数值
* - recordTime : 原始记录时间
* - value : 与前端图表对应的体温数值别名
* - time : 与前端图表对应的记录时间别名
*/
@Select("<script>" +
"SELECT " +
" t.temperature, " + // 原始体温数值
" t.record_time AS recordTime, " + // 原始记录时间(驼峰命名供后端使用)" +
" t.temperature AS value, " + // 前端图表需要的数值字段别名
" t.record_time AS time " + // 前端图表需要的时间字段别名
"FROM his_inpatient_vital t " +
"WHERE t.patient_id = #{patientId} " +
"ORDER BY t.record_time ASC" +
"</script>")
List<VitalSignVO> selectTemperatureRecords(@Param("patientId") Long patientId);
}