fix: 功能优化完善,统计功能代码提交。
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.health.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.health.domain.dto.AnalysisDto;
|
||||
import com.ruoyi.health.service.IStatisticAnalysisService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 统计分析Controller
|
||||
* @author 22077662
|
||||
*/
|
||||
@Api(tags = "统计分析")
|
||||
@RestController
|
||||
@RequestMapping("/analysis")
|
||||
public class StatisticAnalysisController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IStatisticAnalysisService iStatisticAnalysisService;
|
||||
|
||||
@ApiOperation("用药统计分析")
|
||||
@GetMapping("/marAnalysis")
|
||||
public Map<String,Object> getMarAnalysis(AnalysisDto analysisDto){
|
||||
Map<String, Object> resultMap = iStatisticAnalysisService.getMarAnalysis(analysisDto);
|
||||
return AjaxResult.success(resultMap);
|
||||
}
|
||||
|
||||
@ApiOperation("体温统计分析")
|
||||
@GetMapping("/temperatureAnalysis")
|
||||
public Map<String,Object> getTemperatureAnalysis(AnalysisDto analysisDto){
|
||||
Map<String, Object> resultMap = iStatisticAnalysisService.getTemperatureAnalysis(analysisDto);
|
||||
return AjaxResult.success(resultMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -119,7 +119,15 @@ public class HealthMedicineBasic extends BaseEntity
|
||||
@Excel(name = "功能主治")
|
||||
private String indications;
|
||||
|
||||
/** 药品简称 */
|
||||
@ApiModelProperty(value="药品简称")
|
||||
@Excel(name = "药品简称")
|
||||
private String shortName;
|
||||
|
||||
/** 包装单位 */
|
||||
@ApiModelProperty(value="包装单位")
|
||||
@Excel(name = "包装单位")
|
||||
private String packageUnit;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -152,6 +160,8 @@ public class HealthMedicineBasic extends BaseEntity
|
||||
.append("character", getCharacter())
|
||||
.append("storage", getStorage())
|
||||
.append("indications", getIndications())
|
||||
.append("shortName", getShortName())
|
||||
.append("packageUnit", getPackageUnit())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,20 @@ public class HealthMedicineStockIn extends BaseEntity
|
||||
/** 年龄体重 */
|
||||
private String ageWeight;
|
||||
|
||||
/** 单个单位 */
|
||||
private String unit;
|
||||
|
||||
/** 总数量 */
|
||||
@ApiModelProperty(value="总数量)")
|
||||
@NotNull(message="总数量")
|
||||
@Excel(name = "总数量")
|
||||
private Double totalCount;
|
||||
|
||||
/** 包装单位 */
|
||||
@ApiModelProperty(value="包装单位")
|
||||
@Excel(name = "包装单位")
|
||||
private String packageUnit;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@@ -129,6 +143,9 @@ public class HealthMedicineStockIn extends BaseEntity
|
||||
.append("totalPrice", getTotalPrice())
|
||||
.append("usage", getUsage())
|
||||
.append("ageWeight", getAgeWeight())
|
||||
.append("unit", getUnit())
|
||||
.append("packageUnit", getPackageUnit())
|
||||
.append("totalCount", getTotalCount())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package com.ruoyi.health.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
/**
|
||||
* 成员管理对象 health_person
|
||||
*
|
||||
@@ -63,6 +64,11 @@ public class HealthPerson extends BaseEntity
|
||||
@Excel(name = "体重")
|
||||
private Double weight;
|
||||
|
||||
/** 排序 */
|
||||
@ApiModelProperty(value="排序")
|
||||
@Excel(name = "排序")
|
||||
private int ranking;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@@ -79,6 +85,7 @@ public class HealthPerson extends BaseEntity
|
||||
.append("nickName", getNickName())
|
||||
.append("height", getHeight())
|
||||
.append("weight", getWeight())
|
||||
.append("ranking", getRanking())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.ruoyi.health.domain.dto;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*统计分析Dto对象
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2023-12-15
|
||||
*/
|
||||
@ApiModel("统计分析Dto对象")
|
||||
@Data
|
||||
public class AnalysisDto extends BaseEntity implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 查询id */
|
||||
@ApiModelProperty(value="id")
|
||||
private Long id;
|
||||
|
||||
/** 类型 日 */
|
||||
@ApiModelProperty(value="类型")
|
||||
private String type;
|
||||
|
||||
/** 开始日期 */
|
||||
@ApiModelProperty(value="开始日期")
|
||||
private String startTime;
|
||||
|
||||
/** 结束日期 */
|
||||
@ApiModelProperty(value="结束日期")
|
||||
private String endTime;
|
||||
|
||||
/** 类型 */
|
||||
@ApiModelProperty(value="类型")
|
||||
private String dataType;
|
||||
|
||||
/** 档案Id */
|
||||
@ApiModelProperty(value="档案id")
|
||||
private Long recordId;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.ruoyi.health.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* 药品基础信息Dto对象 health_medicine_basic
|
||||
*
|
||||
@@ -20,6 +21,10 @@ public class HealthMedicineBasicDto implements Serializable
|
||||
@ApiModelProperty(value="药品名称")
|
||||
private String name;
|
||||
|
||||
/** 药品简称 */
|
||||
@ApiModelProperty(value="药品简称")
|
||||
private String shortName;
|
||||
|
||||
/** 药品分类 */
|
||||
@ApiModelProperty(value="药品分类")
|
||||
private String classification;
|
||||
|
||||
@@ -25,4 +25,9 @@ public class HealthMarRecordVo extends HealthMarRecord
|
||||
@Excel(name = "健康档案")
|
||||
private String healthRecordName;
|
||||
|
||||
/** 单位名称 */
|
||||
@ApiModelProperty(value="单位名称)")
|
||||
@Excel(name = "单位名称")
|
||||
private String unitName;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.ruoyi.health.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 活动记录Vo对象 health_activity
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2024-10-07
|
||||
*/
|
||||
@ApiModel("活动记录Vo对象")
|
||||
@Data
|
||||
public class HealthStaticAnalysisVo
|
||||
{
|
||||
|
||||
private String name;//名称
|
||||
|
||||
private Double total;//总值
|
||||
|
||||
private Double max;//最大值
|
||||
|
||||
private Double min;//最小值
|
||||
|
||||
private Double average;//平均值
|
||||
|
||||
private Double value;//值
|
||||
|
||||
private String strValue;//字符串值
|
||||
|
||||
private int count;//次数
|
||||
|
||||
private String details;//详细
|
||||
|
||||
private String time;//时间
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ruoyi.health.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface StatisticAnalysisMapper {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi.health.service;
|
||||
|
||||
import com.ruoyi.health.domain.dto.AnalysisDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 22077662
|
||||
*/
|
||||
public interface IStatisticAnalysisService {
|
||||
|
||||
|
||||
public Map<String, Object> getMarAnalysis(AnalysisDto analysisDto);
|
||||
|
||||
|
||||
public Map<String, Object> getTemperatureAnalysis(AnalysisDto analysisDto);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
package com.ruoyi.health.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.security.utils.DictUtils;
|
||||
import com.ruoyi.health.domain.dto.AnalysisDto;
|
||||
import com.ruoyi.health.domain.dto.HealthMarRecordDto;
|
||||
import com.ruoyi.health.domain.dto.HealthTemperatureRecordDto;
|
||||
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.service.IStatisticAnalysisService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
|
||||
@Resource
|
||||
private HealthMarRecordMapper marRecordMapper;
|
||||
|
||||
@Resource
|
||||
private HealthTemperatureRecordMapper temperatureRecordMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMarAnalysis(AnalysisDto analysisDto) {
|
||||
//返回数据
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.###");
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat dateFormatSecond = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat formatterMonth = new SimpleDateFormat("yyyy-MM");
|
||||
//月查询
|
||||
if(analysisDto.getType().equals("2")){
|
||||
if(StringUtils.isEmpty(analysisDto.getStartTime())&&StringUtils.isEmpty(analysisDto.getEndTime())){
|
||||
String endTime=dateFormat.format(DateUtils.addMonths(DateUtils.getNowDate(),0));
|
||||
String startTime=dateFormat.format(DateUtils.addMonths(DateUtils.getNowDate(),-24));
|
||||
analysisDto.setStartTime(startTime);
|
||||
analysisDto.setEndTime(endTime);
|
||||
}else {
|
||||
analysisDto.setStartTime(analysisDto.getStartTime()+"-01");
|
||||
if(analysisDto.getEndTime().equals(formatterMonth.format(new Date()))){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd");
|
||||
analysisDto.setEndTime(analysisDto.getEndTime()+"-"+sdf.format(new Date()));
|
||||
}else {
|
||||
analysisDto.setEndTime(analysisDto.getEndTime()+"-31");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//年查询
|
||||
}else if(analysisDto.getType().equals("3")){
|
||||
if(StringUtils.isEmpty(analysisDto.getStartTime())&&StringUtils.isEmpty(analysisDto.getEndTime())){
|
||||
String endTime=dateFormat.format(DateUtils.getNowDate());
|
||||
String startTime=dateFormat.format(DateUtils.addYears(DateUtils.getNowDate(),-5));
|
||||
analysisDto.setStartTime(startTime);
|
||||
analysisDto.setEndTime(endTime);
|
||||
}else {
|
||||
analysisDto.setStartTime(analysisDto.getStartTime()+"-01-01");
|
||||
SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
|
||||
if(analysisDto.getEndTime().equals(sdfYear.format(new Date()))){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
|
||||
analysisDto.setEndTime(analysisDto.getEndTime()+"-"+sdf.format(new Date()));
|
||||
}else {
|
||||
analysisDto.setEndTime(analysisDto.getEndTime()+"-12-31");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
HealthMarRecordDto dto=new HealthMarRecordDto();
|
||||
//获取数据
|
||||
dto.setEndTime(analysisDto.getEndTime());
|
||||
dto.setStartTime(analysisDto.getStartTime());
|
||||
|
||||
List<HealthMarRecordVo> marRecordVoList=marRecordMapper.selectHealthMarRecordList(dto);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ArrayList<Map<String, Object>> marList = new ArrayList<>();
|
||||
ArrayList<Map<String, Object>> tableMarList = new ArrayList<>();
|
||||
for (HealthMarRecordVo vo:queryList
|
||||
) {
|
||||
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()));
|
||||
marList.add(datamap);
|
||||
}
|
||||
//列表
|
||||
map.put("marList",marList);
|
||||
map.put("tableMarList",tableMarList);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTemperatureAnalysis(AnalysisDto analysisDto) {
|
||||
//返回数据
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.###");
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat dateFormatSecond = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat second = new SimpleDateFormat("HH:mm:ss");
|
||||
HealthTemperatureRecordDto dto=new HealthTemperatureRecordDto();
|
||||
//获取数据
|
||||
dto.setEndTime(analysisDto.getEndTime());
|
||||
dto.setStartTime(analysisDto.getStartTime());
|
||||
dto.setPersonId(analysisDto.getId());
|
||||
dto.setHealthRecordId(analysisDto.getRecordId());
|
||||
List<HealthTemperatureRecordVo> temperatureRecordVoList=temperatureRecordMapper.selectHealthTemperatureRecordList(dto);
|
||||
//测量总次数
|
||||
int totalCount=0;
|
||||
//正常体温次数
|
||||
int normalTempCount=0;
|
||||
//低烧次数
|
||||
int lowerTempCount=0;
|
||||
//中烧次数
|
||||
int middleTempCount=0;
|
||||
//超过38.5次数
|
||||
int higherTempCount=0;
|
||||
// 最大值,最小值
|
||||
double maxTemp=0;
|
||||
double minTemp=0;
|
||||
if(!temperatureRecordVoList.isEmpty()) {
|
||||
maxTemp = temperatureRecordVoList.stream().mapToDouble(HealthTemperatureRecordVo::getTemperature).max().getAsDouble();
|
||||
minTemp = temperatureRecordVoList.stream().mapToDouble(HealthTemperatureRecordVo::getTemperature).min().getAsDouble();
|
||||
}
|
||||
for (HealthTemperatureRecordVo vo:temperatureRecordVoList
|
||||
){
|
||||
totalCount++;
|
||||
if (vo.getTemperature()<36.9) {
|
||||
normalTempCount++;
|
||||
}else 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++;
|
||||
}
|
||||
}
|
||||
//平均体温
|
||||
double accumulateTemp = temperatureRecordVoList.stream().mapToDouble(HealthTemperatureRecordVo::getTemperature).sum();
|
||||
double averageTemp=0;
|
||||
if(totalCount!=0){
|
||||
averageTemp= accumulateTemp /totalCount;
|
||||
}
|
||||
map.put("averageTemp", decimalFormat.format(averageTemp));
|
||||
//测量总次数
|
||||
map.put("totalCount",totalCount);
|
||||
map.put("normalTempCount",normalTempCount);
|
||||
map.put("lowerTempCount",lowerTempCount);
|
||||
map.put("middleTempCount",middleTempCount);
|
||||
map.put("higherTempCount",higherTempCount);
|
||||
map.put("maxTemp",maxTemp);
|
||||
map.put("minTemp",minTemp);
|
||||
|
||||
List<HealthStaticAnalysisVo> queryList =new ArrayList<>();
|
||||
if("1".equals(analysisDto.getType())){
|
||||
//日列表
|
||||
List <String> staticsTimeList=new ArrayList<>();
|
||||
for (HealthTemperatureRecordVo vo:temperatureRecordVoList
|
||||
) {
|
||||
String dayString=dateFormat.format(vo.getMeasureTime());
|
||||
if(!staticsTimeList.contains(dayString)){
|
||||
staticsTimeList.add(dayString);
|
||||
}
|
||||
}
|
||||
|
||||
for (String staticsTime :staticsTimeList
|
||||
) {
|
||||
String details="";
|
||||
//测量次数
|
||||
int measureCount=0;
|
||||
//当天最高体温
|
||||
double max=0;
|
||||
//当天最低体温
|
||||
double min=45;
|
||||
//当天最低体温
|
||||
double average=0;
|
||||
//当天体温总计
|
||||
double total=0;
|
||||
|
||||
for (HealthTemperatureRecordVo vo:temperatureRecordVoList
|
||||
) {
|
||||
String dayString=dateFormat.format(vo.getMeasureTime());
|
||||
if(staticsTime.equals(dayString)){
|
||||
double temp=vo.getTemperature();
|
||||
total+=temp;
|
||||
if(temp>max){
|
||||
max=temp;
|
||||
}
|
||||
if(temp<min){
|
||||
min=temp;
|
||||
}
|
||||
measureCount++;
|
||||
|
||||
details+="在"+second.format(vo.getMeasureTime())+"时间测量体温"+vo.getTemperature()+"℃;<br/>";
|
||||
}
|
||||
}
|
||||
average=total/measureCount;
|
||||
HealthStaticAnalysisVo analysisVo=new HealthStaticAnalysisVo();
|
||||
analysisVo.setTime(staticsTime);
|
||||
analysisVo.setDetails(details);
|
||||
analysisVo.setMax(max);
|
||||
analysisVo.setMin(min);
|
||||
analysisVo.setCount(measureCount);
|
||||
analysisVo.setAverage(average);
|
||||
queryList.add(analysisVo);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<Map<String, Object>> temperatureList = new ArrayList<>();
|
||||
for (HealthTemperatureRecordVo vo:temperatureRecordVoList
|
||||
) {
|
||||
Map<String, Object> datamap = new HashMap<>();
|
||||
datamap.put("time", dateFormatSecond.format(vo.getMeasureTime()));
|
||||
datamap.put("value", decimalFormat.format(vo.getTemperature()));
|
||||
temperatureList.add(datamap);
|
||||
}
|
||||
//列表
|
||||
map.put("temperatureList",temperatureList);
|
||||
|
||||
ArrayList<Map<String, Object>> tableList = new ArrayList<>();
|
||||
for (HealthStaticAnalysisVo vo:queryList
|
||||
) {
|
||||
Map<String, Object> datamap = new HashMap<>();
|
||||
datamap.put("time", vo.getTime());
|
||||
datamap.put("count", vo.getCount());
|
||||
// datamap.put("value", decimalFormat.format(vo.getValue()));
|
||||
datamap.put("detail", vo.getDetails());
|
||||
datamap.put("max", vo.getMax());
|
||||
datamap.put("min", vo.getMin());
|
||||
datamap.put("average", decimalFormat.format(vo.getAverage()));
|
||||
|
||||
tableList.add(datamap);
|
||||
}
|
||||
//列表
|
||||
map.put("tableList",tableList);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,10 +33,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="character" column="character" />
|
||||
<result property="storage" column="storage" />
|
||||
<result property="indications" column="indications" />
|
||||
<result property="shortName" column="short_name" />
|
||||
<result property="packageUnit" column="package_unit" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHealthMedicineBasicVo">
|
||||
select a.id, a.name, a.classification, a.category, a.brand, a.packaging, a.manufacturers, a.treatment_type, a.is_import, a.ingredients, a.usage, a.dosage_form, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.remark, a.code, a.specifications, a.unit, a.adverse_reaction, a.address, a.content, a.content_unit, a.character, a.storage, a.indications from health_medicine_basic a
|
||||
select
|
||||
a.id,
|
||||
a.name,
|
||||
a.classification,
|
||||
a.category,
|
||||
a.brand,
|
||||
a.packaging,
|
||||
a.manufacturers,
|
||||
a.treatment_type,
|
||||
a.is_import,
|
||||
a.ingredients,
|
||||
a.usage,
|
||||
a.dosage_form,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.remark,
|
||||
a.code,
|
||||
a.specifications,
|
||||
a.unit,
|
||||
a.adverse_reaction,
|
||||
a.address,
|
||||
a.content,
|
||||
a.content_unit,
|
||||
a.character,
|
||||
a.storage,
|
||||
a.indications,
|
||||
a.short_name,
|
||||
a.package_unit
|
||||
from
|
||||
health_medicine_basic a
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="selectHealthMedicineBasicList" parameterType="HealthMedicineBasicDto" resultMap="HealthMedicineBasicResult">
|
||||
@@ -44,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
<if test="name != null and name != ''"> and a.name like '%'|| #{name}||'%'</if>
|
||||
<if test="shortName != null and shortName != ''"> and a.short_name like '%'|| #{shortName}||'%'</if>
|
||||
<if test="classification != null and classification != ''"> and a.classification = #{classification}</if>
|
||||
<if test="category != null and category != ''"> and a.category = #{category}</if>
|
||||
<if test="brand != null and brand != ''"> and a.brand = #{brand}</if>
|
||||
@@ -95,6 +131,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="character != null">character,</if>
|
||||
<if test="storage != null">storage,</if>
|
||||
<if test="indications != null">indications,</if>
|
||||
<if test="shortName != null">short_name,</if>
|
||||
<if test="packageUnit != null">package_unit,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -125,6 +163,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="character != null">#{character},</if>
|
||||
<if test="storage != null">#{storage},</if>
|
||||
<if test="indications != null">#{indications},</if>
|
||||
<if test="shortName != null">#{shortName},</if>
|
||||
<if test="packageUnit != null">#{packageUnit},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -158,6 +198,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="character != null">character = #{character},</if>
|
||||
<if test="storage != null">storage = #{storage},</if>
|
||||
<if test="indications != null">indications = #{indications},</if>
|
||||
<if test="shortName != null">short_name = #{shortName},</if>
|
||||
<if test="packageUnit != null">package_unit = #{packageUnit},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -27,6 +27,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="medicineName" column="medicine_name" />
|
||||
<result property="usage" column="usage" />
|
||||
<result property="ageWeight" column="age_weight" />
|
||||
<result property="packageUnit" column="package_unit" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="totalCount" column="total_count" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHealthMedicineStockInVo">
|
||||
@@ -51,8 +54,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.left_count,
|
||||
a.used_count,
|
||||
a.purchase_address,
|
||||
a.unit,
|
||||
a.total_price,
|
||||
hmb."name" as medicine_name
|
||||
hmb."name" as medicine_name,
|
||||
a.package_unit,
|
||||
a.total_count
|
||||
from
|
||||
health_medicine_stock_in a
|
||||
left join health_medicine_basic hmb on
|
||||
@@ -110,6 +116,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="totalPrice != null">total_price,</if>
|
||||
<if test="usage != null">usage,</if>
|
||||
<if test="ageWeight != null">age_weight,</if>
|
||||
<if test="unit != null">unit,</if>
|
||||
<if test="packageUnit != null">package_unit,</if>
|
||||
<if test="totalCount != null">total_count,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -133,6 +142,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="totalPrice != null">#{totalPrice},</if>
|
||||
<if test="usage != null">#{usage},</if>
|
||||
<if test="ageWeight != null">#{ageWeight},</if>
|
||||
<if test="unit != null">#{unit},</if>
|
||||
<if test="packageUnit != null">#{packageUnit},</if>
|
||||
<if test="totalCount != null">#{packageUnit},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -159,6 +171,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="totalPrice != null">total_price = #{totalPrice},</if>
|
||||
<if test="usage != null">usage = #{usage},</if>
|
||||
<if test="ageWeight != null">age_weight = #{ageWeight},</if>
|
||||
<if test="unit != null">unit = #{unit},</if>
|
||||
<if test="packageUnit != null">package_unit = #{packageUnit},</if>
|
||||
<if test="totalCount != null">total_count = #{packageUnit},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -18,10 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="nickName" column="nick_name" />
|
||||
<result property="height" column="height" />
|
||||
<result property="weight" column="weight" />
|
||||
<result property="ranking" column="ranking" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHealthPersonVo">
|
||||
select a.id, a.name, a.type, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.remark, a.birthday, a.nick_name, a.height, a.weight from health_person a
|
||||
select a.id, a.name, a.type, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.remark, a.birthday, a.nick_name, a.height, a.weight, a.ranking from health_person a
|
||||
</sql>
|
||||
|
||||
<select id="selectHealthPersonList" parameterType="HealthPersonDto" resultMap="HealthPersonResult">
|
||||
@@ -34,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by a.create_time desc
|
||||
order by a.ranking asc
|
||||
</select>
|
||||
|
||||
<select id="selectHealthPersonById" parameterType="Long" resultMap="HealthPersonResult">
|
||||
@@ -58,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
<if test="height != null">height,</if>
|
||||
<if test="weight != null">weight,</if>
|
||||
<if test="ranking != null">ranking,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -73,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
<if test="height != null">#{height},</if>
|
||||
<if test="weight != null">#{weight},</if>
|
||||
<if test="ranking != null">#{ranking},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -91,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||
<if test="height != null">height = #{height},</if>
|
||||
<if test="weight != null">weight = #{weight},</if>
|
||||
<if test="ranking != null">ranking = #{ranking},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.health.mapper.StatisticAnalysisMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user