fix: 自测问题修复,用药统计代码提交。
This commit is contained in:
@@ -30,7 +30,7 @@ public class HealthMarRecordDto extends BaseEntity implements Serializable
|
||||
|
||||
/** 主表ID */
|
||||
@ApiModelProperty(value="主表ID")
|
||||
private String healthRecordId;
|
||||
private Long healthRecordId;
|
||||
|
||||
/** 用药时间 */
|
||||
@ApiModelProperty(value="用药时间")
|
||||
|
||||
@@ -30,4 +30,9 @@ public class HealthMarRecordVo extends HealthMarRecord
|
||||
@Excel(name = "单位名称")
|
||||
private String unitName;
|
||||
|
||||
|
||||
/** 次数 */
|
||||
@ApiModelProperty(value="次数)")
|
||||
private Integer count;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
package com.ruoyi.health.mapper;
|
||||
|
||||
import com.ruoyi.common.datascope.annotation.DataScope;
|
||||
import com.ruoyi.health.domain.dto.HealthMarRecordDto;
|
||||
import com.ruoyi.health.domain.vo.HealthMarRecordVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface StatisticAnalysisMapper {
|
||||
|
||||
/**
|
||||
* 查询用药记录
|
||||
*
|
||||
* @param healthMarRecordDto
|
||||
* @return 收支集合
|
||||
*/
|
||||
@DataScope(businessAlias = "hmr")
|
||||
public List<HealthMarRecordVo> selectMarRecordList(HealthMarRecordDto healthMarRecordDto);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ 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 org.springframework.stereotype.Service;
|
||||
|
||||
@@ -28,6 +29,9 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
@Resource
|
||||
private HealthTemperatureRecordMapper temperatureRecordMapper;
|
||||
|
||||
@Resource
|
||||
private StatisticAnalysisMapper statisticAnalysisMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMarAnalysis(AnalysisDto analysisDto) {
|
||||
@@ -78,14 +82,63 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
//获取数据
|
||||
dto.setEndTime(analysisDto.getEndTime());
|
||||
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());
|
||||
|
||||
//按药品统计
|
||||
List<HealthMarRecordVo> marClassList=statisticAnalysisMapper.selectMarRecordList(dto);
|
||||
//药品用药单位统计
|
||||
for (HealthMarRecordVo vo:marClassList
|
||||
) {
|
||||
if (null != vo.getUnit()) {
|
||||
vo.setUnitName(DictUtils.getDictLabel("medical_unit", vo.getUnit().toString()));
|
||||
}
|
||||
}
|
||||
//用药种类
|
||||
map.put("marCategoryCount",marClassList.size());
|
||||
|
||||
ArrayList<Map<String, Object>> marMapList = new ArrayList<>();
|
||||
for (HealthMarRecordVo vo:marClassList
|
||||
) {
|
||||
Map<String, Object> datamap = new HashMap<>();
|
||||
datamap.put("time", vo.getName());
|
||||
datamap.put("value", vo.getCount());
|
||||
datamap.put("unit", vo.getUnitName());
|
||||
datamap.put("dosage", vo.getDosage());
|
||||
marMapList.add(datamap);
|
||||
}
|
||||
//列表
|
||||
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()) {
|
||||
|
||||
@@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="contentUnit" column="content_unit" />
|
||||
<result property="personName" column="person_name" />
|
||||
<result property="healthRecordName" column="health_record_name" />
|
||||
<result property="count" column="count" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
@@ -73,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||
<if test="resource != null and resource != ''"> and a.resource = #{resource}</if>
|
||||
<if test="place != null and place != ''"> and a.place = #{place}</if>
|
||||
<if test="medicineId != null">medicine_id = #{medicineId},</if>
|
||||
<if test="medicineId != null">a.medicine_id = #{medicineId},</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(a.dosing_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
|
||||
@@ -3,6 +3,73 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.health.mapper.StatisticAnalysisMapper">
|
||||
<resultMap type="HealthMarRecordVo" id="HealthMarRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="healthRecordId" column="health_record_id" />
|
||||
<result property="dosingTime" column="dosing_time" />
|
||||
<result property="dosage" column="dosage" />
|
||||
<result property="personId" column="person_id" />
|
||||
<result property="resource" column="resource" />
|
||||
<result property="place" column="place" />
|
||||
<result property="medicineId" column="medicine_id" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="content" column="content" />
|
||||
<result property="contentUnit" column="content_unit" />
|
||||
<result property="personName" column="person_name" />
|
||||
<result property="healthRecordName" column="health_record_name" />
|
||||
|
||||
</resultMap>
|
||||
<select id="selectMarRecordList" parameterType="HealthMarRecordDto" resultMap="HealthMarRecordResult">
|
||||
select
|
||||
count(*) as count,
|
||||
sum(hmr.dosage) as dosage,
|
||||
hmr.medicine_id,
|
||||
hmb."short_name"||'-'||hmb."brand"||'('||hmb.packaging||')' as name,
|
||||
hmr.unit ,
|
||||
hmr.person_id ,
|
||||
hp."name" as person_name,
|
||||
hmr.health_record_id as health_record_id,
|
||||
hr."name" as health_record_name
|
||||
from
|
||||
health_mar_record hmr
|
||||
left join health_medicine_basic hmb on
|
||||
hmb.id = hmr.medicine_id
|
||||
left join health_person hp on
|
||||
hp.id = hmr.person_id
|
||||
left join health_record hr on
|
||||
hr.id = hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hmr.dosing_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
</if>
|
||||
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
group by
|
||||
hmr.medicine_id,
|
||||
hmb."short_name" ,
|
||||
hmr.person_id ,
|
||||
hp.name ,
|
||||
hmr.health_record_id,
|
||||
hr."name",
|
||||
hmr.unit ,
|
||||
hmb."brand",
|
||||
hmb.packaging
|
||||
order by hmb."short_name" desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user