fix: 健康管理系统,首页接口代码提交。

This commit is contained in:
tianyongbao
2024-11-17 21:07:53 +08:00
parent 9468d671e8
commit 0b44f292ad
5 changed files with 130 additions and 9 deletions

View File

@@ -39,5 +39,12 @@ public class StatisticAnalysisController extends BaseController {
return AjaxResult.success(resultMap); return AjaxResult.success(resultMap);
} }
@ApiOperation("健康总览-健康总览信息")
@GetMapping("/healthAnalysis")
public Map<String,Object> getDebitAccountsInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getHealthAnalysisInfo();
return AjaxResult.success(resultMap);
}
} }

View File

@@ -2,6 +2,7 @@ package com.ruoyi.health.mapper;
import com.ruoyi.common.datascope.annotation.DataScope; import com.ruoyi.common.datascope.annotation.DataScope;
import com.ruoyi.health.domain.dto.HealthMarRecordDto; import com.ruoyi.health.domain.dto.HealthMarRecordDto;
import com.ruoyi.health.domain.dto.HealthRecordDto;
import com.ruoyi.health.domain.vo.HealthMarRecordVo; import com.ruoyi.health.domain.vo.HealthMarRecordVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@@ -19,4 +20,28 @@ public interface StatisticAnalysisMapper {
@DataScope(businessAlias = "hmr") @DataScope(businessAlias = "hmr")
public List<HealthMarRecordVo> selectMarRecordList(HealthMarRecordDto healthMarRecordDto); public List<HealthMarRecordVo> selectMarRecordList(HealthMarRecordDto healthMarRecordDto);
/**
* 查询用药记录
*
* @return 收支集合
*/
@DataScope(businessAlias = "hmr")
public int selectHospitalCount(HealthRecordDto dto);
/**
* 查询用药记录
*
* @return 收支集合
*/
@DataScope(businessAlias = "hmr")
public int selectDoctorCount(HealthRecordDto dto);
/**
* 查询用药记录
*
* @return 收支集合
*/
@DataScope(businessAlias = "hmr")
public int selectDistinctMedicalCount(HealthRecordDto dto);
} }

View File

@@ -15,4 +15,6 @@ public interface IStatisticAnalysisService {
public Map<String, Object> getTemperatureAnalysis(AnalysisDto analysisDto); public Map<String, Object> getTemperatureAnalysis(AnalysisDto analysisDto);
public Map<String, Object> getHealthAnalysisInfo();
} }

View File

@@ -3,15 +3,9 @@ package com.ruoyi.health.service.impl;
import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.utils.DictUtils; import com.ruoyi.common.security.utils.DictUtils;
import com.ruoyi.health.domain.dto.AnalysisDto; import com.ruoyi.health.domain.dto.*;
import com.ruoyi.health.domain.dto.HealthMarRecordDto; import com.ruoyi.health.domain.vo.*;
import com.ruoyi.health.domain.dto.HealthTemperatureRecordDto; import com.ruoyi.health.mapper.*;
import com.ruoyi.health.domain.vo.HealthMarRecordVo;
import com.ruoyi.health.domain.vo.HealthStaticAnalysisVo;
import com.ruoyi.health.domain.vo.HealthTemperatureRecordVo;
import com.ruoyi.health.mapper.HealthMarRecordMapper;
import com.ruoyi.health.mapper.HealthTemperatureRecordMapper;
import com.ruoyi.health.mapper.StatisticAnalysisMapper;
import com.ruoyi.health.service.IStatisticAnalysisService; import com.ruoyi.health.service.IStatisticAnalysisService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -32,6 +26,18 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
@Resource @Resource
private StatisticAnalysisMapper statisticAnalysisMapper; private StatisticAnalysisMapper statisticAnalysisMapper;
@Resource
private HealthPersonMapper healthPersonMapper;
@Resource
private HealthDoctorRecordMapper healthDoctorRecordMapper;
@Resource
private HealthActivityMapper healthActivityMapper;
@Resource
private HealthRecordMapper healthRecordMapper;
@Override @Override
public Map<String, Object> getMarAnalysis(AnalysisDto analysisDto) { public Map<String, Object> getMarAnalysis(AnalysisDto analysisDto) {
@@ -399,4 +405,56 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
return map; return map;
} }
@Override
public Map<String, Object> getHealthAnalysisInfo() {
//返回数据
HashMap<String, Object> map = new HashMap<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
//成员总数
map.put("personCount",healthPersonMapper.selectHealthPersonList(new HealthPersonDto()).size());
//健康档案总数
map.put("healthRecordCount",healthRecordMapper.selectHealthRecordList(new HealthRecordDto()).size());
//活动总数
map.put("activityCount",healthActivityMapper.selectHealthActivityList(new HealthActivityDto()).size());
//就医总数
map.put("doctorCount",healthDoctorRecordMapper.selectHealthDoctorRecordList(new HealthDoctorRecordDto()).size());
//医院总数
map.put("hospitalCount",statisticAnalysisMapper.selectHospitalCount(new HealthRecordDto()));
//医生总数
map.put("doctorTotalCount",statisticAnalysisMapper.selectDoctorCount(new HealthRecordDto()));
//用药次数
map.put("marCount",marRecordMapper.selectHealthMarRecordList(new HealthMarRecordDto()).size());
//用药类别
map.put("medicalTypeCount",statisticAnalysisMapper.selectDistinctMedicalCount(new HealthRecordDto()));
List<HealthTemperatureRecordVo> temperatureRecordVoList=temperatureRecordMapper.selectHealthTemperatureRecordList(new HealthTemperatureRecordDto());
//测量体温次数
map.put("temperatureTotalCount",temperatureRecordVoList.size());
//低烧次数
int lowerTempCount=0;
//中烧次数
int middleTempCount=0;
//超过38.5次数
int higherTempCount=0;
for (HealthTemperatureRecordVo vo:temperatureRecordVoList
){
if (vo.getTemperature()>=36.9&&vo.getTemperature()<=37.5) {
lowerTempCount++;
}else if (vo.getTemperature()>37.5&&vo.getTemperature()<38.5) {
middleTempCount++;
}else if (vo.getTemperature()>=38.5) {
higherTempCount++;
}
}
map.put("lowerTempCount",lowerTempCount);
map.put("middleTempCount",middleTempCount);
map.put("higherTempCount",higherTempCount);
return map;
}
} }

View File

@@ -72,4 +72,33 @@
order by hmb."short_name" desc order by hmb."short_name" desc
</select> </select>
<select id="selectHospitalCount" parameterType="HealthRecordDto" resultType="int">
select
count(distinct hospital_name)
from
health_doctor_record hmr
where 1=1
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectDoctorCount" parameterType="HealthRecordDto" resultType="int">
select
count(distinct doctor )
from
health_doctor_record hmr
where 1=1
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectDistinctMedicalCount" parameterType="HealthRecordDto" resultType="int">
select
count(distinct medicine_id )
from
health_mar_record hmr
where 1=1
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
</mapper> </mapper>