fix: 健康管理系统,健康总览接口开发。
This commit is contained in:
@@ -69,6 +69,18 @@ public class HealthPerson extends BaseEntity
|
||||
@Excel(name = "排序")
|
||||
private int ranking;
|
||||
|
||||
|
||||
/** 性别 */
|
||||
@ApiModelProperty(value="性别)")
|
||||
@NotNull(message="性别不能为空")
|
||||
@Excel(name = "性别")
|
||||
private String sex;
|
||||
|
||||
/** 身份证 */
|
||||
@ApiModelProperty(value="身份证)")
|
||||
@Excel(name = "身份证")
|
||||
private String identityCard;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@@ -86,6 +98,8 @@ public class HealthPerson extends BaseEntity
|
||||
.append("height", getHeight())
|
||||
.append("weight", getWeight())
|
||||
.append("ranking", getRanking())
|
||||
.append("sex", getSex())
|
||||
.append("identityCard", getIdentityCard())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,8 @@ public class HealthMarRecordVo extends HealthMarRecord
|
||||
@ApiModelProperty(value="用药天数")
|
||||
private Integer useDays;
|
||||
|
||||
/** 单位名称 */
|
||||
@ApiModelProperty(value="日期)")
|
||||
private String dosingTimeStr;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.health.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 成员管理Vo对象 health_person
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2024-09-19
|
||||
*/
|
||||
@ApiModel("成员管理Vo对象")
|
||||
@Data
|
||||
public class HealthStaticPersonVo
|
||||
{
|
||||
|
||||
private String personName;
|
||||
|
||||
private String healthRecordCount;
|
||||
|
||||
private String hospitalCount;
|
||||
|
||||
|
||||
private String doctorTotalCount;
|
||||
|
||||
private String doctorCount;
|
||||
|
||||
private String doctorCost;
|
||||
|
||||
private String marDayCount;
|
||||
|
||||
private String marCount;
|
||||
|
||||
private String feverDayCount;
|
||||
|
||||
private String marTypeCount;
|
||||
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.ruoyi.common.datascope.annotation.DataScope;
|
||||
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.HealthStaticPersonVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -44,4 +45,48 @@ public interface StatisticAnalysisMapper {
|
||||
@DataScope(businessAlias = "hmr")
|
||||
public int selectDistinctMedicalCount(HealthRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询用药记录
|
||||
*
|
||||
* @param healthMarRecordDto
|
||||
* @return 收支集合
|
||||
*/
|
||||
@DataScope(businessAlias = "hmr")
|
||||
public List<HealthMarRecordVo> selectMarTypeList(HealthMarRecordDto healthMarRecordDto);
|
||||
|
||||
|
||||
/**
|
||||
* 查询用药记录
|
||||
*
|
||||
* @param healthMarRecordDto
|
||||
* @return 收支集合
|
||||
*/
|
||||
@DataScope(businessAlias = "hmr")
|
||||
public List<HealthMarRecordVo> selectMarDayCountList(HealthMarRecordDto healthMarRecordDto);
|
||||
|
||||
/**
|
||||
* 查询用药记录
|
||||
*
|
||||
* @return 收支集合
|
||||
*/
|
||||
@DataScope(businessAlias = "hmr")
|
||||
public int selectMarDayCount(HealthRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询用药记录
|
||||
*
|
||||
* @return 收支集合
|
||||
*/
|
||||
@DataScope(businessAlias = "hmr")
|
||||
public int selectFeverDayCount(HealthRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询用药记录
|
||||
*
|
||||
* @return 收支集合
|
||||
*/
|
||||
@DataScope(businessAlias = "hp")
|
||||
public List<HealthStaticPersonVo> selectStaticPersonList (HealthRecordDto dto);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ package com.ruoyi.health.service.impl;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.security.utils.DictUtils;
|
||||
import com.ruoyi.health.domain.dto.*;
|
||||
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.domain.vo.*;
|
||||
import com.ruoyi.health.mapper.*;
|
||||
import com.ruoyi.health.service.IStatisticAnalysisService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -91,29 +89,86 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
dto.setStartTime(analysisDto.getStartTime());
|
||||
dto.setPersonId(analysisDto.getId());
|
||||
dto.setHealthRecordId(analysisDto.getRecordId());
|
||||
List<HealthMarRecordVo> marRecordVoList=marRecordMapper.selectHealthMarRecordList(dto);
|
||||
|
||||
//用药总次数
|
||||
map.put("marCount",marRecordVoList.size());
|
||||
//退烧用药
|
||||
map.put("tuishao",marRecordVoList.stream().filter(mar -> mar.getType().equals("1")).count());
|
||||
//抗菌消炎
|
||||
map.put("kangjun",marRecordVoList.stream().filter(mar -> mar.getType().equals("2")).count());
|
||||
//止咳平喘化痰
|
||||
map.put("zhike",marRecordVoList.stream().filter(mar -> mar.getType().equals("3")).count());
|
||||
//抗病毒
|
||||
map.put("kangbingdu",marRecordVoList.stream().filter(mar -> mar.getType().equals("4")).count());
|
||||
//抗过敏
|
||||
map.put("kangguomin",marRecordVoList.stream().filter(mar -> mar.getType().equals("6")).count());
|
||||
//雾化消炎
|
||||
map.put("wuhua",marRecordVoList.stream().filter(mar -> mar.getType().equals("9")).count());
|
||||
//清热解毒
|
||||
map.put("qingre",marRecordVoList.stream().filter(mar -> mar.getType().equals("10")).count());
|
||||
//肠道消化
|
||||
map.put("changdao",marRecordVoList.stream().filter(mar -> mar.getType().equals("7")).count());
|
||||
//鼻炎腺样体
|
||||
map.put("biyan",marRecordVoList.stream().filter(mar -> mar.getType().equals("12")).count());
|
||||
//增强体质调节免疫力
|
||||
map.put("mianyili",marRecordVoList.stream().filter(mar -> mar.getType().equals("13")).count());
|
||||
int marCount=0;
|
||||
List<HealthMarRecordVo> marTypeList=statisticAnalysisMapper.selectMarTypeList(dto);
|
||||
for (HealthMarRecordVo vo:marTypeList
|
||||
){
|
||||
if (null != vo.getType()) {
|
||||
vo.setName(DictUtils.getDictLabel("mar_type", vo.getType().toString()));
|
||||
}else{
|
||||
vo.setName("未分类");
|
||||
}
|
||||
marCount+=vo.getCount();
|
||||
}
|
||||
//用药总次数
|
||||
map.put("marCount",marCount);
|
||||
if(marTypeList.size()>0){
|
||||
map.put("top1Name",marTypeList.get(0).getName());
|
||||
map.put("top1",marTypeList.get(0).getCount());
|
||||
}
|
||||
if(marTypeList.size()>1){
|
||||
map.put("top2Name",marTypeList.get(1).getName());
|
||||
map.put("top2",marTypeList.get(1).getCount());
|
||||
}
|
||||
if(marTypeList.size()>2){
|
||||
map.put("top3Name",marTypeList.get(2).getName());
|
||||
map.put("top3",marTypeList.get(2).getCount());
|
||||
}
|
||||
if(marTypeList.size()>3){
|
||||
map.put("top4Name",marTypeList.get(3).getName());
|
||||
map.put("top4",marTypeList.get(3).getCount());
|
||||
}
|
||||
if(marTypeList.size()>4){
|
||||
map.put("top5Name",marTypeList.get(4).getName());
|
||||
map.put("top5",marTypeList.get(4).getCount());
|
||||
}
|
||||
if(marTypeList.size()>5){
|
||||
map.put("top6Name",marTypeList.get(5).getName());
|
||||
map.put("top6",marTypeList.get(5).getCount());
|
||||
}
|
||||
if(marTypeList.size()>6){
|
||||
map.put("top7Name",marTypeList.get(6).getName());
|
||||
map.put("top7",marTypeList.get(6).getCount());
|
||||
}
|
||||
if(marTypeList.size()>7){
|
||||
map.put("top8Name",marTypeList.get(7).getName());
|
||||
map.put("top8",marTypeList.get(7).getCount());
|
||||
}
|
||||
if(marTypeList.size()>8){
|
||||
map.put("top9Name",marTypeList.get(8).getName());
|
||||
map.put("top9",marTypeList.get(8).getCount());
|
||||
}
|
||||
if(marTypeList.size()>9){
|
||||
map.put("top10Name",marTypeList.get(9).getName());
|
||||
map.put("top10",marTypeList.get(9).getCount());
|
||||
}
|
||||
|
||||
if(marTypeList.size()>10){
|
||||
map.put("top11Name",marTypeList.get(10).getName());
|
||||
map.put("top11",marTypeList.get(10).getCount());
|
||||
}
|
||||
if(marTypeList.size()>11){
|
||||
map.put("top12Name",marTypeList.get(11).getName());
|
||||
map.put("top12",marTypeList.get(11).getCount());
|
||||
}
|
||||
if(marTypeList.size()>12){
|
||||
map.put("top13Name",marTypeList.get(12).getName());
|
||||
map.put("top13",marTypeList.get(12).getCount());
|
||||
}
|
||||
if(marTypeList.size()>13){
|
||||
map.put("top14Name",marTypeList.get(13).getName());
|
||||
map.put("top14",marTypeList.get(13).getCount());
|
||||
}
|
||||
if(marTypeList.size()>14){
|
||||
map.put("top15Name",marTypeList.get(14).getName());
|
||||
map.put("top15",marTypeList.get(14).getCount());
|
||||
}
|
||||
if(marTypeList.size()>15){
|
||||
map.put("top16Name",marTypeList.get(15).getName());
|
||||
map.put("top16",marTypeList.get(15).getCount());
|
||||
}
|
||||
|
||||
//按药品统计
|
||||
List<HealthMarRecordVo> marClassList=statisticAnalysisMapper.selectMarRecordList(dto);
|
||||
@@ -141,123 +196,19 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
//列表
|
||||
map.put("marMapList",marMapList);
|
||||
|
||||
List<HealthMarRecordVo> queryList =new ArrayList<>();
|
||||
|
||||
if("1".equals(analysisDto.getType())){
|
||||
//日列表
|
||||
List <String> staticsTimeList=new ArrayList<>();
|
||||
|
||||
for (HealthMarRecordVo vo:marRecordVoList
|
||||
) {
|
||||
if (null != vo.getUnit()) {
|
||||
vo.setUnitName(DictUtils.getDictLabel("medical_unit", vo.getUnit().toString()));
|
||||
}
|
||||
String dayString=dateFormat.format(vo.getDosingTime());
|
||||
|
||||
if(!staticsTimeList.contains(dayString)){
|
||||
staticsTimeList.add(dayString);
|
||||
}
|
||||
}
|
||||
//用药天数
|
||||
map.put("marDays",staticsTimeList.size());
|
||||
for (String staticsTime :staticsTimeList
|
||||
) {
|
||||
double count=0;
|
||||
String details="";
|
||||
for (HealthMarRecordVo vo:marRecordVoList
|
||||
) {
|
||||
String dayString=dateFormat.format(vo.getDosingTime());
|
||||
|
||||
if(staticsTime.equals(dayString)){
|
||||
count++;
|
||||
details+=vo.getPersonName()+"于"+dateFormatSecond.format(vo.getDosingTime())+"用药【"+vo.getName()+"】"+vo.getDosage()+vo.getUnitName()+";<br/>";
|
||||
}
|
||||
}
|
||||
HealthMarRecordVo healthMarRecordVo=new HealthMarRecordVo();
|
||||
healthMarRecordVo.setContent(count);
|
||||
healthMarRecordVo.setRemark(staticsTime);
|
||||
healthMarRecordVo.setName(details);
|
||||
queryList.add(healthMarRecordVo);
|
||||
}
|
||||
|
||||
//年查询
|
||||
}
|
||||
else if("2".equals(analysisDto.getType())){
|
||||
//月列表
|
||||
List <String> staticsTimeList=new ArrayList<>();
|
||||
for (HealthMarRecordVo vo:marRecordVoList
|
||||
) {
|
||||
String monthString=dateFormat.format(vo.getDosingTime()).substring(0,7);
|
||||
if(!staticsTimeList.contains(monthString)){
|
||||
staticsTimeList.add(monthString);
|
||||
}
|
||||
}
|
||||
for (String staticsTime :staticsTimeList
|
||||
) {
|
||||
double actualCreditBillMonth=0;
|
||||
for (HealthMarRecordVo vo:marRecordVoList
|
||||
) {
|
||||
String monthString=dateFormat.format(vo.getDosingTime()).substring(0,7);
|
||||
if(staticsTime.equals(monthString)){
|
||||
actualCreditBillMonth++;
|
||||
}
|
||||
}
|
||||
HealthMarRecordVo analysisVo=new HealthMarRecordVo();
|
||||
analysisVo.setContent(actualCreditBillMonth);
|
||||
analysisVo.setRemark(staticsTime);
|
||||
queryList.add(analysisVo);
|
||||
}
|
||||
//年查询
|
||||
}else if("3".equals(analysisDto.getType())){
|
||||
List <String> staticsTimeList=new ArrayList<>();
|
||||
for (HealthMarRecordVo vo:marRecordVoList
|
||||
) {
|
||||
String yearString=dateFormat.format(vo.getDosingTime()).substring(0,4);
|
||||
|
||||
if(!staticsTimeList.contains(yearString)){
|
||||
staticsTimeList.add(yearString);
|
||||
}
|
||||
}
|
||||
for (String staticsTime :staticsTimeList
|
||||
) {
|
||||
double actualCreditBillYear=0;
|
||||
for (HealthMarRecordVo vo:marRecordVoList
|
||||
) {
|
||||
String yearString=dateFormat.format(vo.getCreateTime()).substring(0,4);
|
||||
if(staticsTime.equals(yearString)){
|
||||
actualCreditBillYear++;
|
||||
}
|
||||
}
|
||||
HealthMarRecordVo analysisVo=new HealthMarRecordVo();
|
||||
analysisVo.setContent(actualCreditBillYear);
|
||||
analysisVo.setRemark(staticsTime);
|
||||
queryList.add(analysisVo);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<HealthMarRecordVo> marRecordVoList=statisticAnalysisMapper.selectMarDayCountList(dto);
|
||||
map.put("marDays",marRecordVoList.size());
|
||||
ArrayList<Map<String, Object>> marList = new ArrayList<>();
|
||||
ArrayList<Map<String, Object>> tableMarList = new ArrayList<>();
|
||||
for (HealthMarRecordVo vo:queryList
|
||||
for (HealthMarRecordVo vo:marRecordVoList
|
||||
) {
|
||||
Map<String, Object> datamap = new HashMap<>();
|
||||
datamap.put("time", vo.getRemark());
|
||||
datamap.put("value", decimalFormat.format(vo.getContent()));
|
||||
datamap.put("detail", vo.getName());
|
||||
tableMarList.add(datamap);
|
||||
}
|
||||
Collections.reverse(queryList);
|
||||
for (HealthMarRecordVo vo:queryList
|
||||
) {
|
||||
Map<String, Object> datamap = new HashMap<>();
|
||||
datamap.put("time", vo.getRemark());
|
||||
datamap.put("value", decimalFormat.format(vo.getContent()));
|
||||
datamap.put("time", vo.getDosingTimeStr());
|
||||
datamap.put("value", vo.getCount());
|
||||
marList.add(datamap);
|
||||
}
|
||||
//列表
|
||||
map.put("marList",marList);
|
||||
map.put("tableMarList",tableMarList);
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
@@ -429,15 +380,20 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
//健康档案总数
|
||||
map.put("healthRecordCount",healthRecordMapper.selectHealthRecordList(new HealthRecordDto()).size());
|
||||
//活动总数
|
||||
map.put("activityCount",healthActivityMapper.selectHealthActivityList(new HealthActivityDto()).size());
|
||||
List<HealthActivityVo> activityVoList= healthActivityMapper.selectHealthActivityList(new HealthActivityDto());
|
||||
map.put("activityCount",activityVoList.size());
|
||||
map.put("activityCost",activityVoList.stream().mapToDouble(HealthActivityVo::getTotalCost).sum());
|
||||
//就医总数
|
||||
map.put("doctorCount",healthDoctorRecordMapper.selectHealthDoctorRecordList(new HealthDoctorRecordDto()).size());
|
||||
|
||||
List<HealthDoctorRecordVo> healthDoctorRecordList=healthDoctorRecordMapper.selectHealthDoctorRecordList(new HealthDoctorRecordDto());
|
||||
map.put("doctorCount",healthDoctorRecordList.size());
|
||||
map.put("doctorCost",healthDoctorRecordList.stream().mapToDouble(HealthDoctorRecordVo::getTotalCost).sum());
|
||||
//医院总数
|
||||
map.put("hospitalCount",statisticAnalysisMapper.selectHospitalCount(new HealthRecordDto()));
|
||||
|
||||
//医生总数
|
||||
map.put("doctorTotalCount",statisticAnalysisMapper.selectDoctorCount(new HealthRecordDto()));
|
||||
//用药天数
|
||||
map.put("marDayCount",statisticAnalysisMapper.selectMarDayCount(new HealthRecordDto()));
|
||||
//用药次数
|
||||
map.put("marCount",marRecordMapper.selectHealthMarRecordList(new HealthMarRecordDto()).size());
|
||||
//用药类别
|
||||
@@ -446,6 +402,11 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
List<HealthTemperatureRecordVo> temperatureRecordVoList=temperatureRecordMapper.selectHealthTemperatureRecordList(new HealthTemperatureRecordDto());
|
||||
//测量体温次数
|
||||
map.put("temperatureTotalCount",temperatureRecordVoList.size());
|
||||
//发烧天数
|
||||
map.put("feverDayCount",statisticAnalysisMapper.selectFeverDayCount(new HealthRecordDto()));
|
||||
|
||||
//成员列表展示
|
||||
map.put("personList",statisticAnalysisMapper.selectStaticPersonList(new HealthRecordDto()));
|
||||
//低烧次数
|
||||
int lowerTempCount=0;
|
||||
//中烧次数
|
||||
|
||||
Reference in New Issue
Block a user