Fix Bug #566: AI修复
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.openhis.web.nurse.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 生命体征数据访问层
|
||||
* 修复 Bug #566:提供按时间排序的查询接口,解决前端图表渲染空数据问题。
|
||||
*/
|
||||
@Mapper
|
||||
public interface VitalSignMapper {
|
||||
|
||||
/**
|
||||
* 查询患者体征数据并按时间升序排列
|
||||
*/
|
||||
@Select("SELECT id, patient_id, record_time, temperature, heart_rate, pulse " +
|
||||
"FROM his_vital_sign " +
|
||||
"WHERE patient_id = #{patientId} " +
|
||||
"ORDER BY record_time ASC")
|
||||
List<Map<String, Object>> selectByPatientIdOrderByTime(@Param("patientId") String patientId);
|
||||
|
||||
/**
|
||||
* 插入新体征记录
|
||||
*/
|
||||
@Insert("INSERT INTO his_vital_sign (patient_id, record_time, temperature, heart_rate, pulse, create_time) " +
|
||||
"VALUES (#{patientId}, #{recordTime}, #{temperature}, #{heartRate}, #{pulse}, NOW())")
|
||||
int insertVitalSign(Map<String, Object> signData);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.openhis.web.nurse.service.impl;
|
||||
|
||||
import com.openhis.web.nurse.mapper.VitalSignMapper;
|
||||
import com.openhis.web.nurse.service.VitalSignService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 生命体征业务实现
|
||||
* 修复 Bug #566:确保保存后数据可被正确查询,且时间轴排序一致。
|
||||
*/
|
||||
@Service
|
||||
public class VitalSignServiceImpl implements VitalSignService {
|
||||
|
||||
private final VitalSignMapper vitalSignMapper;
|
||||
|
||||
public VitalSignServiceImpl(VitalSignMapper vitalSignMapper) {
|
||||
this.vitalSignMapper = vitalSignMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getVitalSignsByPatient(String patientId) {
|
||||
// 严格按记录时间升序返回,保障前端折线绘制顺序正确
|
||||
return vitalSignMapper.selectByPatientIdOrderByTime(patientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveVitalSign(Map<String, Object> signData) {
|
||||
vitalSignMapper.insertVitalSign(signData);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user