feat: 健康档案功能大屏新增。
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dyvmsapi20170525</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>3.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云核心 SDK -->
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.springframework.stereotype.Component;
|
||||
* @date 2026-03-29
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "aliyun.message")
|
||||
public class AliyunMessageProperties {
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.intc.health.controller;
|
||||
|
||||
import com.intc.common.core.web.controller.BaseController;
|
||||
import com.intc.common.core.web.domain.AjaxResult;
|
||||
import com.intc.common.core.web.page.TableDataInfo;
|
||||
import com.intc.common.log.annotation.Log;
|
||||
import com.intc.common.log.enums.BusinessType;
|
||||
import com.intc.common.security.annotation.RequiresPermissions;
|
||||
import com.intc.health.domain.ChronicDiseaseFollowUpRecord;
|
||||
import com.intc.health.domain.ChronicDiseaseIndicatorRecord;
|
||||
import com.intc.health.domain.ChronicDiseaseStatusHistory;
|
||||
import com.intc.health.service.IChronicDiseaseManageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "慢性疾病管理扩展")
|
||||
@RestController
|
||||
@RequestMapping("/chronicDiseaseManage")
|
||||
public class ChronicDiseaseManageController extends BaseController {
|
||||
@Resource
|
||||
private IChronicDiseaseManageService chronicDiseaseManageService;
|
||||
|
||||
@ApiOperation("查询慢病指标记录")
|
||||
@RequiresPermissions("health:chronicDisease:list")
|
||||
@GetMapping("/indicator/list")
|
||||
public TableDataInfo indicatorList(ChronicDiseaseIndicatorRecord query) {
|
||||
startPage();
|
||||
List<ChronicDiseaseIndicatorRecord> list = chronicDiseaseManageService.selectIndicatorList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询慢病指标详情")
|
||||
@RequiresPermissions("health:chronicDisease:query")
|
||||
@GetMapping("/indicator/{id}")
|
||||
public AjaxResult indicatorInfo(@PathVariable Long id) {
|
||||
return success(chronicDiseaseManageService.selectIndicatorById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增慢病指标记录")
|
||||
@RequiresPermissions("health:chronicDisease:add")
|
||||
@Log(title = "慢性疾病指标记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/indicator")
|
||||
public AjaxResult indicatorAdd(@RequestBody ChronicDiseaseIndicatorRecord record) {
|
||||
return toAjax(chronicDiseaseManageService.insertIndicator(record));
|
||||
}
|
||||
|
||||
@ApiOperation("修改慢病指标记录")
|
||||
@RequiresPermissions("health:chronicDisease:edit")
|
||||
@Log(title = "慢性疾病指标记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/indicator")
|
||||
public AjaxResult indicatorEdit(@RequestBody ChronicDiseaseIndicatorRecord record) {
|
||||
return toAjax(chronicDiseaseManageService.updateIndicator(record));
|
||||
}
|
||||
|
||||
@ApiOperation("删除慢病指标记录")
|
||||
@RequiresPermissions("health:chronicDisease:remove")
|
||||
@Log(title = "慢性疾病指标记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/indicator/{ids}")
|
||||
public AjaxResult indicatorRemove(@PathVariable Long[] ids) {
|
||||
return toAjax(chronicDiseaseManageService.deleteIndicatorByIds(ids));
|
||||
}
|
||||
|
||||
@ApiOperation("查询复诊随访记录")
|
||||
@RequiresPermissions("health:chronicDisease:list")
|
||||
@GetMapping("/followUp/list")
|
||||
public TableDataInfo followUpList(ChronicDiseaseFollowUpRecord query) {
|
||||
startPage();
|
||||
List<ChronicDiseaseFollowUpRecord> list = chronicDiseaseManageService.selectFollowUpList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("新增复诊随访记录")
|
||||
@RequiresPermissions("health:chronicDisease:add")
|
||||
@Log(title = "慢性疾病复诊随访", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/followUp")
|
||||
public AjaxResult followUpAdd(@RequestBody ChronicDiseaseFollowUpRecord record) {
|
||||
return toAjax(chronicDiseaseManageService.insertFollowUp(record));
|
||||
}
|
||||
|
||||
@ApiOperation("修改复诊随访记录")
|
||||
@RequiresPermissions("health:chronicDisease:edit")
|
||||
@Log(title = "慢性疾病复诊随访", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/followUp")
|
||||
public AjaxResult followUpEdit(@RequestBody ChronicDiseaseFollowUpRecord record) {
|
||||
return toAjax(chronicDiseaseManageService.updateFollowUp(record));
|
||||
}
|
||||
|
||||
@ApiOperation("删除复诊随访记录")
|
||||
@RequiresPermissions("health:chronicDisease:remove")
|
||||
@Log(title = "慢性疾病复诊随访", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/followUp/{ids}")
|
||||
public AjaxResult followUpRemove(@PathVariable Long[] ids) {
|
||||
return toAjax(chronicDiseaseManageService.deleteFollowUpByIds(ids));
|
||||
}
|
||||
|
||||
@ApiOperation("查询状态变更历史")
|
||||
@RequiresPermissions("health:chronicDisease:list")
|
||||
@GetMapping("/statusHistory/list")
|
||||
public TableDataInfo statusHistoryList(ChronicDiseaseStatusHistory query) {
|
||||
startPage();
|
||||
List<ChronicDiseaseStatusHistory> list = chronicDiseaseManageService.selectStatusHistoryList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("新增状态变更历史")
|
||||
@RequiresPermissions("health:chronicDisease:edit")
|
||||
@Log(title = "慢性疾病状态变更", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/statusHistory")
|
||||
public AjaxResult statusHistoryAdd(@RequestBody ChronicDiseaseStatusHistory record) {
|
||||
return toAjax(chronicDiseaseManageService.insertStatusHistory(record));
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,12 @@ 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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -46,6 +49,20 @@ public class StatisticAnalysisController extends BaseController {
|
||||
return AjaxResult.success(resultMap);
|
||||
}
|
||||
|
||||
@ApiOperation("活动统计分析")
|
||||
@GetMapping("/activityAnalysis")
|
||||
public Map<String,Object> getActivityAnalysis(AnalysisDto analysisDto){
|
||||
Map<String, Object> resultMap = iStatisticAnalysisService.getActivityAnalysis(analysisDto);
|
||||
return AjaxResult.success(resultMap);
|
||||
}
|
||||
|
||||
@ApiOperation("健康总览大屏")
|
||||
@GetMapping("/healthScreen")
|
||||
public Map<String,Object> getHealthScreen(AnalysisDto analysisDto){
|
||||
Map<String, Object> resultMap = iStatisticAnalysisService.getHealthScreen(analysisDto);
|
||||
return AjaxResult.success(resultMap);
|
||||
}
|
||||
|
||||
@ApiOperation("档案统计分析")
|
||||
@GetMapping("/recordAnalysis")
|
||||
public Map<String,Object> getRecordAnalysis(AnalysisDto analysisDto){
|
||||
@@ -53,6 +70,19 @@ public class StatisticAnalysisController extends BaseController {
|
||||
return AjaxResult.success(resultMap);
|
||||
}
|
||||
|
||||
@ApiOperation("健康档案大屏")
|
||||
@GetMapping("/recordScreen")
|
||||
public Map<String,Object> getRecordScreen(AnalysisDto analysisDto){
|
||||
Map<String, Object> resultMap = iStatisticAnalysisService.getRecordScreen(analysisDto);
|
||||
return AjaxResult.success(resultMap);
|
||||
}
|
||||
|
||||
@ApiOperation("导出健康档案完整信息")
|
||||
@PostMapping("/recordFullExport")
|
||||
public void exportRecordFull(HttpServletResponse response, AnalysisDto analysisDto) throws IOException {
|
||||
iStatisticAnalysisService.exportRecordFull(response, analysisDto);
|
||||
}
|
||||
|
||||
@ApiOperation("就医统计分析")
|
||||
@GetMapping("/doctorAnalysis")
|
||||
public Map<String,Object> getDoctorAnalysis(AnalysisDto analysisDto){
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.intc.health.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.intc.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("慢性疾病复诊随访记录")
|
||||
public class ChronicDiseaseFollowUpRecord extends BaseEntity {
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("慢性疾病档案ID")
|
||||
private Long chronicDiseaseId;
|
||||
|
||||
@ApiModelProperty("成员ID")
|
||||
private Long personId;
|
||||
|
||||
@ApiModelProperty("类型:1-复诊 2-复查 3-随访")
|
||||
private Integer followUpType;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("复诊/随访日期")
|
||||
private Date followUpDate;
|
||||
|
||||
private String hospital;
|
||||
|
||||
private String department;
|
||||
|
||||
private String doctor;
|
||||
|
||||
@ApiModelProperty("复查项目")
|
||||
private String checkItems;
|
||||
|
||||
@ApiModelProperty("结果")
|
||||
private String result;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("下次复诊日期")
|
||||
private Date nextFollowUpDate;
|
||||
|
||||
@ApiModelProperty("状态:1-待完成 2-已完成 3-已过期")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("说明")
|
||||
private String notes;
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.intc.health.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.intc.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("慢性疾病指标记录")
|
||||
public class ChronicDiseaseIndicatorRecord extends BaseEntity {
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("慢性疾病档案ID")
|
||||
private Long chronicDiseaseId;
|
||||
|
||||
@ApiModelProperty("成员ID")
|
||||
private Long personId;
|
||||
|
||||
@ApiModelProperty("指标类型")
|
||||
private String indicatorType;
|
||||
|
||||
@ApiModelProperty("指标名称")
|
||||
private String indicatorName;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
@ApiModelProperty("指标值")
|
||||
private BigDecimal indicatorValue;
|
||||
|
||||
@ApiModelProperty("指标单位")
|
||||
private String indicatorUnit;
|
||||
|
||||
@ApiModelProperty("目标下限")
|
||||
private BigDecimal targetMin;
|
||||
|
||||
@ApiModelProperty("目标上限")
|
||||
private BigDecimal targetMax;
|
||||
|
||||
@ApiModelProperty("状态:1-正常 2-偏高 3-偏低 4-需关注")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("记录说明")
|
||||
private String notes;
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.intc.health.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.intc.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("慢性疾病状态变更历史")
|
||||
public class ChronicDiseaseStatusHistory extends BaseEntity {
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("慢性疾病档案ID")
|
||||
private Long chronicDiseaseId;
|
||||
|
||||
@ApiModelProperty("成员ID")
|
||||
private Long personId;
|
||||
|
||||
@ApiModelProperty("原状态")
|
||||
private Integer oldStatus;
|
||||
|
||||
@ApiModelProperty("新状态")
|
||||
private Integer newStatus;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("变更时间")
|
||||
private Date changeTime;
|
||||
|
||||
@ApiModelProperty("变更原因")
|
||||
private String reason;
|
||||
|
||||
@ApiModelProperty("处理建议")
|
||||
private String treatmentAdvice;
|
||||
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -43,5 +43,20 @@ public class AnalysisDto extends BaseEntity implements Serializable
|
||||
@ApiModelProperty(value="档案id")
|
||||
private Long recordId;
|
||||
|
||||
/** 活动名称 */
|
||||
@ApiModelProperty(value="活动名称")
|
||||
private String name;
|
||||
|
||||
/** 活动类型 */
|
||||
@ApiModelProperty(value="活动类型")
|
||||
private String activityType;
|
||||
|
||||
/** 活动地点 */
|
||||
@ApiModelProperty(value="活动地点")
|
||||
private String place;
|
||||
|
||||
/** 活动量 */
|
||||
@ApiModelProperty(value="活动量")
|
||||
private String activityVolume;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.intc.health.mapper;
|
||||
|
||||
import com.intc.common.datascope.annotation.DataScope;
|
||||
import com.intc.health.domain.ChronicDiseaseFollowUpRecord;
|
||||
import com.intc.health.domain.ChronicDiseaseIndicatorRecord;
|
||||
import com.intc.health.domain.ChronicDiseaseStatusHistory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ChronicDiseaseManageMapper {
|
||||
@DataScope(businessAlias = "a")
|
||||
List<ChronicDiseaseIndicatorRecord> selectIndicatorList(ChronicDiseaseIndicatorRecord query);
|
||||
|
||||
ChronicDiseaseIndicatorRecord selectIndicatorById(Long id);
|
||||
|
||||
int insertIndicator(ChronicDiseaseIndicatorRecord record);
|
||||
|
||||
int updateIndicator(ChronicDiseaseIndicatorRecord record);
|
||||
|
||||
int removeIndicatorByIds(Long[] ids);
|
||||
|
||||
@DataScope(businessAlias = "a")
|
||||
List<ChronicDiseaseFollowUpRecord> selectFollowUpList(ChronicDiseaseFollowUpRecord query);
|
||||
|
||||
ChronicDiseaseFollowUpRecord selectFollowUpById(Long id);
|
||||
|
||||
int insertFollowUp(ChronicDiseaseFollowUpRecord record);
|
||||
|
||||
int updateFollowUp(ChronicDiseaseFollowUpRecord record);
|
||||
|
||||
int removeFollowUpByIds(Long[] ids);
|
||||
|
||||
@DataScope(businessAlias = "a")
|
||||
List<ChronicDiseaseStatusHistory> selectStatusHistoryList(ChronicDiseaseStatusHistory query);
|
||||
|
||||
int insertStatusHistory(ChronicDiseaseStatusHistory record);
|
||||
}
|
||||
@@ -2,13 +2,16 @@ package com.intc.health.mapper;
|
||||
|
||||
import com.intc.common.datascope.annotation.DataScope;
|
||||
import com.intc.health.domain.dto.HealthDoctorRecordDto;
|
||||
import com.intc.health.domain.dto.HealthActivityDto;
|
||||
import com.intc.health.domain.dto.HealthMarRecordDto;
|
||||
import com.intc.health.domain.dto.HealthMilkPowderRecordDto;
|
||||
import com.intc.health.domain.dto.HealthRecordDto;
|
||||
import com.intc.health.domain.dto.HealthTemperatureRecordDto;
|
||||
import com.intc.health.domain.vo.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface StatisticAnalysisMapper {
|
||||
@@ -98,6 +101,60 @@ public interface StatisticAnalysisMapper {
|
||||
@DataScope(businessAlias = "hp")
|
||||
public List<HealthStaticPersonVo> selectStaticPersonList (HealthRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询健康总览大屏成员风险排行
|
||||
*/
|
||||
@DataScope(businessAlias = "hp")
|
||||
public List<HealthStaticPersonVo> selectHealthScreenPersonRankList(HealthRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询健康总览大屏就医汇总
|
||||
*/
|
||||
@DataScope(businessAlias = "a")
|
||||
public Map<String, Object> selectHealthScreenDoctorSummary(HealthDoctorRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询健康总览大屏用药汇总
|
||||
*/
|
||||
@DataScope(businessAlias = "a")
|
||||
public Map<String, Object> selectHealthScreenMedicineSummary(HealthMarRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询健康总览大屏体温汇总
|
||||
*/
|
||||
@DataScope(businessAlias = "a")
|
||||
public Map<String, Object> selectHealthScreenTemperatureSummary(HealthTemperatureRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询健康总览大屏活动汇总
|
||||
*/
|
||||
@DataScope(businessAlias = "a")
|
||||
public Map<String, Object> selectHealthScreenActivitySummary(HealthActivityDto dto);
|
||||
|
||||
/**
|
||||
* 查询健康总览大屏近期活动明细
|
||||
*/
|
||||
@DataScope(businessAlias = "a")
|
||||
public List<HealthActivityVo> selectHealthScreenActivityList(HealthActivityDto dto);
|
||||
|
||||
/**
|
||||
* 查询健康总览大屏近期就医明细
|
||||
*/
|
||||
@DataScope(businessAlias = "a")
|
||||
public List<HealthDoctorRecordVo> selectHealthScreenDoctorList(HealthDoctorRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询健康总览大屏近期用药明细
|
||||
*/
|
||||
@DataScope(businessAlias = "a")
|
||||
public List<HealthMarRecordVo> selectHealthScreenMedicineList(HealthMarRecordDto dto);
|
||||
|
||||
/**
|
||||
* 查询健康总览大屏近期体温明细
|
||||
*/
|
||||
@DataScope(businessAlias = "a")
|
||||
public List<HealthTemperatureRecordVo> selectHealthScreenTemperatureList(HealthTemperatureRecordDto dto);
|
||||
|
||||
|
||||
/**
|
||||
* 查询用药记录
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.intc.health.service;
|
||||
|
||||
import com.intc.health.domain.ChronicDiseaseFollowUpRecord;
|
||||
import com.intc.health.domain.ChronicDiseaseIndicatorRecord;
|
||||
import com.intc.health.domain.ChronicDiseaseStatusHistory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IChronicDiseaseManageService {
|
||||
List<ChronicDiseaseIndicatorRecord> selectIndicatorList(ChronicDiseaseIndicatorRecord query);
|
||||
|
||||
ChronicDiseaseIndicatorRecord selectIndicatorById(Long id);
|
||||
|
||||
int insertIndicator(ChronicDiseaseIndicatorRecord record);
|
||||
|
||||
int updateIndicator(ChronicDiseaseIndicatorRecord record);
|
||||
|
||||
int deleteIndicatorByIds(Long[] ids);
|
||||
|
||||
List<ChronicDiseaseFollowUpRecord> selectFollowUpList(ChronicDiseaseFollowUpRecord query);
|
||||
|
||||
ChronicDiseaseFollowUpRecord selectFollowUpById(Long id);
|
||||
|
||||
int insertFollowUp(ChronicDiseaseFollowUpRecord record);
|
||||
|
||||
int updateFollowUp(ChronicDiseaseFollowUpRecord record);
|
||||
|
||||
int deleteFollowUpByIds(Long[] ids);
|
||||
|
||||
List<ChronicDiseaseStatusHistory> selectStatusHistoryList(ChronicDiseaseStatusHistory query);
|
||||
|
||||
int insertStatusHistory(ChronicDiseaseStatusHistory record);
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.intc.health.service;
|
||||
|
||||
import com.intc.health.domain.dto.AnalysisDto;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -17,9 +19,17 @@ public interface IStatisticAnalysisService {
|
||||
|
||||
public Map<String, Object> getHealthAnalysisInfo();
|
||||
|
||||
public Map<String, Object> getActivityAnalysis(AnalysisDto analysisDto);
|
||||
|
||||
public Map<String, Object> getHealthScreen(AnalysisDto analysisDto);
|
||||
|
||||
|
||||
public Map<String, Object> getRecordAnalysis(AnalysisDto analysisDto);
|
||||
|
||||
public Map<String, Object> getRecordScreen(AnalysisDto analysisDto);
|
||||
|
||||
public void exportRecordFull(HttpServletResponse response, AnalysisDto analysisDto) throws IOException;
|
||||
|
||||
public Map<String, Object> getDoctorAnalysis(AnalysisDto analysisDto);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.intc.health.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.DateUtils;
|
||||
import com.intc.common.core.utils.IdWorker;
|
||||
import com.intc.common.security.utils.SecurityUtils;
|
||||
import com.intc.health.domain.ChronicDiseaseFollowUpRecord;
|
||||
import com.intc.health.domain.ChronicDiseaseIndicatorRecord;
|
||||
import com.intc.health.domain.ChronicDiseaseStatusHistory;
|
||||
import com.intc.health.mapper.ChronicDiseaseManageMapper;
|
||||
import com.intc.health.service.IChronicDiseaseManageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ChronicDiseaseManageServiceImpl implements IChronicDiseaseManageService {
|
||||
@Resource
|
||||
private ChronicDiseaseManageMapper chronicDiseaseManageMapper;
|
||||
|
||||
@Override
|
||||
public List<ChronicDiseaseIndicatorRecord> selectIndicatorList(ChronicDiseaseIndicatorRecord query) {
|
||||
return chronicDiseaseManageMapper.selectIndicatorList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChronicDiseaseIndicatorRecord selectIndicatorById(Long id) {
|
||||
return chronicDiseaseManageMapper.selectIndicatorById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertIndicator(ChronicDiseaseIndicatorRecord record) {
|
||||
record.setId(IdWorker.getId());
|
||||
record.setCreateBy(SecurityUtils.getUsername());
|
||||
record.setCreateTime(DateUtils.getNowDate());
|
||||
if (record.getMeasureTime() == null) {
|
||||
record.setMeasureTime(new Date());
|
||||
}
|
||||
if (record.getStatus() == null) {
|
||||
record.setStatus(1);
|
||||
}
|
||||
return chronicDiseaseManageMapper.insertIndicator(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateIndicator(ChronicDiseaseIndicatorRecord record) {
|
||||
record.setUpdateBy(SecurityUtils.getUsername());
|
||||
record.setUpdateTime(DateUtils.getNowDate());
|
||||
return chronicDiseaseManageMapper.updateIndicator(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteIndicatorByIds(Long[] ids) {
|
||||
return chronicDiseaseManageMapper.removeIndicatorByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChronicDiseaseFollowUpRecord> selectFollowUpList(ChronicDiseaseFollowUpRecord query) {
|
||||
return chronicDiseaseManageMapper.selectFollowUpList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChronicDiseaseFollowUpRecord selectFollowUpById(Long id) {
|
||||
return chronicDiseaseManageMapper.selectFollowUpById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertFollowUp(ChronicDiseaseFollowUpRecord record) {
|
||||
record.setId(IdWorker.getId());
|
||||
record.setCreateBy(SecurityUtils.getUsername());
|
||||
record.setCreateTime(DateUtils.getNowDate());
|
||||
if (record.getFollowUpType() == null) {
|
||||
record.setFollowUpType(1);
|
||||
}
|
||||
if (record.getStatus() == null) {
|
||||
record.setStatus(1);
|
||||
}
|
||||
return chronicDiseaseManageMapper.insertFollowUp(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateFollowUp(ChronicDiseaseFollowUpRecord record) {
|
||||
record.setUpdateBy(SecurityUtils.getUsername());
|
||||
record.setUpdateTime(DateUtils.getNowDate());
|
||||
return chronicDiseaseManageMapper.updateFollowUp(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteFollowUpByIds(Long[] ids) {
|
||||
return chronicDiseaseManageMapper.removeFollowUpByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChronicDiseaseStatusHistory> selectStatusHistoryList(ChronicDiseaseStatusHistory query) {
|
||||
return chronicDiseaseManageMapper.selectStatusHistoryList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertStatusHistory(ChronicDiseaseStatusHistory record) {
|
||||
record.setId(IdWorker.getId());
|
||||
record.setCreateBy(SecurityUtils.getUsername());
|
||||
record.setCreateTime(DateUtils.getNowDate());
|
||||
if (record.getChangeTime() == null) {
|
||||
record.setChangeTime(new Date());
|
||||
}
|
||||
return chronicDiseaseManageMapper.insertStatusHistory(record);
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,10 @@ import com.intc.common.core.utils.DateUtils;
|
||||
import com.intc.common.core.utils.IdWorker;
|
||||
import com.intc.common.security.utils.SecurityUtils;
|
||||
import com.intc.health.domain.ChronicDiseaseRecord;
|
||||
import com.intc.health.domain.ChronicDiseaseStatusHistory;
|
||||
import com.intc.health.domain.dto.ChronicDiseaseRecordDto;
|
||||
import com.intc.health.domain.vo.ChronicDiseaseRecordVo;
|
||||
import com.intc.health.mapper.ChronicDiseaseManageMapper;
|
||||
import com.intc.health.mapper.ChronicDiseaseRecordMapper;
|
||||
import com.intc.health.service.IChronicDiseaseRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -25,6 +27,9 @@ public class ChronicDiseaseRecordServiceImpl implements IChronicDiseaseRecordSer
|
||||
@Resource
|
||||
private ChronicDiseaseRecordMapper chronicDiseaseRecordMapper;
|
||||
|
||||
@Resource
|
||||
private ChronicDiseaseManageMapper chronicDiseaseManageMapper;
|
||||
|
||||
/**
|
||||
* 查询慢性疾病档案
|
||||
*
|
||||
@@ -93,9 +98,29 @@ public class ChronicDiseaseRecordServiceImpl implements IChronicDiseaseRecordSer
|
||||
@Override
|
||||
public int updateChronicDiseaseRecord(ChronicDiseaseRecord chronicDiseaseRecord)
|
||||
{
|
||||
ChronicDiseaseRecordVo oldRecord = null;
|
||||
if (chronicDiseaseRecord.getId() != null && chronicDiseaseRecord.getDiseaseStatus() != null) {
|
||||
oldRecord = chronicDiseaseRecordMapper.selectChronicDiseaseRecordById(chronicDiseaseRecord.getId());
|
||||
}
|
||||
chronicDiseaseRecord.setUpdateBy(SecurityUtils.getUsername());
|
||||
chronicDiseaseRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
return chronicDiseaseRecordMapper.updateChronicDiseaseRecord(chronicDiseaseRecord);
|
||||
int rows = chronicDiseaseRecordMapper.updateChronicDiseaseRecord(chronicDiseaseRecord);
|
||||
if (rows > 0 && oldRecord != null && oldRecord.getDiseaseStatus() != null
|
||||
&& !oldRecord.getDiseaseStatus().equals(chronicDiseaseRecord.getDiseaseStatus())) {
|
||||
ChronicDiseaseStatusHistory history = new ChronicDiseaseStatusHistory();
|
||||
history.setId(IdWorker.getId());
|
||||
history.setChronicDiseaseId(chronicDiseaseRecord.getId());
|
||||
history.setPersonId(oldRecord.getPersonId());
|
||||
history.setOldStatus(oldRecord.getDiseaseStatus());
|
||||
history.setNewStatus(chronicDiseaseRecord.getDiseaseStatus());
|
||||
history.setChangeTime(DateUtils.getNowDate());
|
||||
history.setReason(chronicDiseaseRecord.getRemark() != null ? chronicDiseaseRecord.getRemark() : "档案状态调整");
|
||||
history.setTreatmentAdvice(chronicDiseaseRecord.getNotes());
|
||||
history.setCreateBy(SecurityUtils.getUsername());
|
||||
history.setCreateTime(DateUtils.getNowDate());
|
||||
chronicDiseaseManageMapper.insertStatusHistory(history);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,314 @@
|
||||
<?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.intc.health.mapper.ChronicDiseaseManageMapper">
|
||||
|
||||
<resultMap type="ChronicDiseaseIndicatorRecord" id="ChronicDiseaseIndicatorResult">
|
||||
<id property="id" column="id"/>
|
||||
<result property="chronicDiseaseId" column="chronic_disease_id"/>
|
||||
<result property="personId" column="person_id"/>
|
||||
<result property="indicatorType" column="indicator_type"/>
|
||||
<result property="indicatorName" column="indicator_name"/>
|
||||
<result property="measureTime" column="measure_time"/>
|
||||
<result property="indicatorValue" column="indicator_value"/>
|
||||
<result property="indicatorUnit" column="indicator_unit"/>
|
||||
<result property="targetMin" column="target_min"/>
|
||||
<result property="targetMax" column="target_max"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="notes" column="notes"/>
|
||||
<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="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ChronicDiseaseFollowUpRecord" id="ChronicDiseaseFollowUpResult">
|
||||
<id property="id" column="id"/>
|
||||
<result property="chronicDiseaseId" column="chronic_disease_id"/>
|
||||
<result property="personId" column="person_id"/>
|
||||
<result property="followUpType" column="follow_up_type"/>
|
||||
<result property="followUpDate" column="follow_up_date"/>
|
||||
<result property="hospital" column="hospital"/>
|
||||
<result property="department" column="department"/>
|
||||
<result property="doctor" column="doctor"/>
|
||||
<result property="checkItems" column="check_items"/>
|
||||
<result property="result" column="result"/>
|
||||
<result property="nextFollowUpDate" column="next_follow_up_date"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="notes" column="notes"/>
|
||||
<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="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ChronicDiseaseStatusHistory" id="ChronicDiseaseStatusHistoryResult">
|
||||
<id property="id" column="id"/>
|
||||
<result property="chronicDiseaseId" column="chronic_disease_id"/>
|
||||
<result property="personId" column="person_id"/>
|
||||
<result property="oldStatus" column="old_status"/>
|
||||
<result property="newStatus" column="new_status"/>
|
||||
<result property="changeTime" column="change_time"/>
|
||||
<result property="reason" column="reason"/>
|
||||
<result property="treatmentAdvice" column="treatment_advice"/>
|
||||
<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="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectIndicatorVo">
|
||||
select a.id, a.chronic_disease_id, a.person_id, a.indicator_type, a.indicator_name,
|
||||
a.measure_time, a.indicator_value, a.indicator_unit, a.target_min, a.target_max,
|
||||
a.status, a.notes, a.create_by, a.create_time, a.update_by, a.update_time,
|
||||
a.remark, a.del_flag
|
||||
from chronic_disease_indicator_record a
|
||||
inner join health_person p on a.person_id = p.id and p.del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<select id="selectIndicatorList" parameterType="ChronicDiseaseIndicatorRecord" resultMap="ChronicDiseaseIndicatorResult">
|
||||
<include refid="selectIndicatorVo"/>
|
||||
<where>
|
||||
a.del_flag = 0
|
||||
<if test="chronicDiseaseId != null">and a.chronic_disease_id = #{chronicDiseaseId}</if>
|
||||
<if test="personId != null">and a.person_id = #{personId}</if>
|
||||
<if test="indicatorType != null and indicatorType != ''">and a.indicator_type = #{indicatorType}</if>
|
||||
<if test="indicatorName != null and indicatorName != ''">and a.indicator_name like '%' || #{indicatorName} || '%'</if>
|
||||
<if test="status != null">and a.status = #{status}</if>
|
||||
<if test="startTime != null and startTime != ''">and a.measure_time >= to_timestamp(#{startTime}, 'YYYY-MM-DD HH24:MI:SS')</if>
|
||||
<if test="endTime != null and endTime != ''">and a.measure_time <= to_timestamp(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')</if>
|
||||
</where>
|
||||
${params.dataScope}
|
||||
order by a.measure_time desc, a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectIndicatorById" parameterType="Long" resultMap="ChronicDiseaseIndicatorResult">
|
||||
<include refid="selectIndicatorVo"/>
|
||||
where a.id = #{id} and a.del_flag = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertIndicator" parameterType="ChronicDiseaseIndicatorRecord">
|
||||
insert into chronic_disease_indicator_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="chronicDiseaseId != null">chronic_disease_id,</if>
|
||||
<if test="personId != null">person_id,</if>
|
||||
<if test="indicatorType != null">indicator_type,</if>
|
||||
<if test="indicatorName != null">indicator_name,</if>
|
||||
<if test="measureTime != null">measure_time,</if>
|
||||
<if test="indicatorValue != null">indicator_value,</if>
|
||||
<if test="indicatorUnit != null">indicator_unit,</if>
|
||||
<if test="targetMin != null">target_min,</if>
|
||||
<if test="targetMax != null">target_max,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="notes != null">notes,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
del_flag,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="chronicDiseaseId != null">#{chronicDiseaseId},</if>
|
||||
<if test="personId != null">#{personId},</if>
|
||||
<if test="indicatorType != null">#{indicatorType},</if>
|
||||
<if test="indicatorName != null">#{indicatorName},</if>
|
||||
<if test="measureTime != null">#{measureTime},</if>
|
||||
<if test="indicatorValue != null">#{indicatorValue},</if>
|
||||
<if test="indicatorUnit != null">#{indicatorUnit},</if>
|
||||
<if test="targetMin != null">#{targetMin},</if>
|
||||
<if test="targetMax != null">#{targetMax},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="notes != null">#{notes},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
0,
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateIndicator" parameterType="ChronicDiseaseIndicatorRecord">
|
||||
update chronic_disease_indicator_record
|
||||
<set>
|
||||
<if test="chronicDiseaseId != null">chronic_disease_id = #{chronicDiseaseId},</if>
|
||||
<if test="personId != null">person_id = #{personId},</if>
|
||||
<if test="indicatorType != null">indicator_type = #{indicatorType},</if>
|
||||
<if test="indicatorName != null">indicator_name = #{indicatorName},</if>
|
||||
<if test="measureTime != null">measure_time = #{measureTime},</if>
|
||||
<if test="indicatorValue != null">indicator_value = #{indicatorValue},</if>
|
||||
<if test="indicatorUnit != null">indicator_unit = #{indicatorUnit},</if>
|
||||
<if test="targetMin != null">target_min = #{targetMin},</if>
|
||||
<if test="targetMax != null">target_max = #{targetMax},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="notes != null">notes = #{notes},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="removeIndicatorByIds" parameterType="Long">
|
||||
update chronic_disease_indicator_record set del_flag = 1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
|
||||
</update>
|
||||
|
||||
<sql id="selectFollowUpVo">
|
||||
select a.id, a.chronic_disease_id, a.person_id, a.follow_up_type, a.follow_up_date,
|
||||
a.hospital, a.department, a.doctor, a.check_items, a.result, a.next_follow_up_date,
|
||||
a.status, a.notes, a.create_by, a.create_time, a.update_by, a.update_time,
|
||||
a.remark, a.del_flag
|
||||
from chronic_disease_follow_up_record a
|
||||
inner join health_person p on a.person_id = p.id and p.del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<select id="selectFollowUpList" parameterType="ChronicDiseaseFollowUpRecord" resultMap="ChronicDiseaseFollowUpResult">
|
||||
<include refid="selectFollowUpVo"/>
|
||||
<where>
|
||||
a.del_flag = 0
|
||||
<if test="chronicDiseaseId != null">and a.chronic_disease_id = #{chronicDiseaseId}</if>
|
||||
<if test="personId != null">and a.person_id = #{personId}</if>
|
||||
<if test="followUpType != null">and a.follow_up_type = #{followUpType}</if>
|
||||
<if test="status != null">and a.status = #{status}</if>
|
||||
<if test="hospital != null and hospital != ''">and a.hospital like '%' || #{hospital} || '%'</if>
|
||||
<if test="startTime != null and startTime != ''">and a.follow_up_date >= to_date(#{startTime}, 'YYYY-MM-DD')</if>
|
||||
<if test="endTime != null and endTime != ''">and a.follow_up_date <= to_date(#{endTime}, 'YYYY-MM-DD')</if>
|
||||
</where>
|
||||
${params.dataScope}
|
||||
order by a.follow_up_date desc, a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectFollowUpById" parameterType="Long" resultMap="ChronicDiseaseFollowUpResult">
|
||||
<include refid="selectFollowUpVo"/>
|
||||
where a.id = #{id} and a.del_flag = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertFollowUp" parameterType="ChronicDiseaseFollowUpRecord">
|
||||
insert into chronic_disease_follow_up_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="chronicDiseaseId != null">chronic_disease_id,</if>
|
||||
<if test="personId != null">person_id,</if>
|
||||
<if test="followUpType != null">follow_up_type,</if>
|
||||
<if test="followUpDate != null">follow_up_date,</if>
|
||||
<if test="hospital != null">hospital,</if>
|
||||
<if test="department != null">department,</if>
|
||||
<if test="doctor != null">doctor,</if>
|
||||
<if test="checkItems != null">check_items,</if>
|
||||
<if test="result != null">result,</if>
|
||||
<if test="nextFollowUpDate != null">next_follow_up_date,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="notes != null">notes,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
del_flag,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="chronicDiseaseId != null">#{chronicDiseaseId},</if>
|
||||
<if test="personId != null">#{personId},</if>
|
||||
<if test="followUpType != null">#{followUpType},</if>
|
||||
<if test="followUpDate != null">#{followUpDate},</if>
|
||||
<if test="hospital != null">#{hospital},</if>
|
||||
<if test="department != null">#{department},</if>
|
||||
<if test="doctor != null">#{doctor},</if>
|
||||
<if test="checkItems != null">#{checkItems},</if>
|
||||
<if test="result != null">#{result},</if>
|
||||
<if test="nextFollowUpDate != null">#{nextFollowUpDate},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="notes != null">#{notes},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
0,
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateFollowUp" parameterType="ChronicDiseaseFollowUpRecord">
|
||||
update chronic_disease_follow_up_record
|
||||
<set>
|
||||
<if test="chronicDiseaseId != null">chronic_disease_id = #{chronicDiseaseId},</if>
|
||||
<if test="personId != null">person_id = #{personId},</if>
|
||||
<if test="followUpType != null">follow_up_type = #{followUpType},</if>
|
||||
<if test="followUpDate != null">follow_up_date = #{followUpDate},</if>
|
||||
<if test="hospital != null">hospital = #{hospital},</if>
|
||||
<if test="department != null">department = #{department},</if>
|
||||
<if test="doctor != null">doctor = #{doctor},</if>
|
||||
<if test="checkItems != null">check_items = #{checkItems},</if>
|
||||
<if test="result != null">result = #{result},</if>
|
||||
<if test="nextFollowUpDate != null">next_follow_up_date = #{nextFollowUpDate},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="notes != null">notes = #{notes},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="removeFollowUpByIds" parameterType="Long">
|
||||
update chronic_disease_follow_up_record set del_flag = 1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
|
||||
</update>
|
||||
|
||||
<sql id="selectStatusHistoryVo">
|
||||
select a.id, a.chronic_disease_id, a.person_id, a.old_status, a.new_status,
|
||||
a.change_time, a.reason, a.treatment_advice, a.create_by, a.create_time,
|
||||
a.update_by, a.update_time, a.remark, a.del_flag
|
||||
from chronic_disease_status_history a
|
||||
inner join health_person p on a.person_id = p.id and p.del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<select id="selectStatusHistoryList" parameterType="ChronicDiseaseStatusHistory" resultMap="ChronicDiseaseStatusHistoryResult">
|
||||
<include refid="selectStatusHistoryVo"/>
|
||||
<where>
|
||||
a.del_flag = 0
|
||||
<if test="chronicDiseaseId != null">and a.chronic_disease_id = #{chronicDiseaseId}</if>
|
||||
<if test="personId != null">and a.person_id = #{personId}</if>
|
||||
<if test="oldStatus != null">and a.old_status = #{oldStatus}</if>
|
||||
<if test="newStatus != null">and a.new_status = #{newStatus}</if>
|
||||
</where>
|
||||
${params.dataScope}
|
||||
order by a.change_time desc, a.create_time desc
|
||||
</select>
|
||||
|
||||
<insert id="insertStatusHistory" parameterType="ChronicDiseaseStatusHistory">
|
||||
insert into chronic_disease_status_history
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="chronicDiseaseId != null">chronic_disease_id,</if>
|
||||
<if test="personId != null">person_id,</if>
|
||||
<if test="oldStatus != null">old_status,</if>
|
||||
<if test="newStatus != null">new_status,</if>
|
||||
<if test="changeTime != null">change_time,</if>
|
||||
<if test="reason != null">reason,</if>
|
||||
<if test="treatmentAdvice != null">treatment_advice,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
del_flag,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="chronicDiseaseId != null">#{chronicDiseaseId},</if>
|
||||
<if test="personId != null">#{personId},</if>
|
||||
<if test="oldStatus != null">#{oldStatus},</if>
|
||||
<if test="newStatus != null">#{newStatus},</if>
|
||||
<if test="changeTime != null">#{changeTime},</if>
|
||||
<if test="reason != null">#{reason},</if>
|
||||
<if test="treatmentAdvice != null">#{treatmentAdvice},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
0,
|
||||
</trim>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.remark,
|
||||
p.name as person_name
|
||||
from chronic_disease_record a
|
||||
left join health_person p on a.person_id = p.id
|
||||
inner join health_person p on a.person_id = p.id and p.del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<select id="selectChronicDiseaseRecordList" parameterType="ChronicDiseaseRecordDto" resultMap="ChronicDiseaseRecordResult">
|
||||
|
||||
@@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectHealthDoctorRecordCostVo"/>
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
and exists (select 1 from health_person hp where hp.id = a.person_id and hp.del_flag = '0')
|
||||
<if test="doctorRecordId != null "> and a.doctor_record_id = #{doctorRecordId}</if>
|
||||
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
||||
<if test="healthRecordId != null "> and a.health_record_id = #{healthRecordId}</if>
|
||||
@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectHealthDoctorRecordCostById" parameterType="Long" resultMap="HealthDoctorRecordCostResult">
|
||||
<include refid="selectHealthDoctorRecordCostVo"/>
|
||||
where a.id = #{id}
|
||||
and exists (select 1 from health_person hp where hp.id = a.person_id and hp.del_flag = '0')
|
||||
</select>
|
||||
|
||||
<insert id="insertHealthDoctorRecordCost" parameterType="HealthDoctorRecordCost">
|
||||
|
||||
@@ -53,8 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
hr."name" as health_record_name
|
||||
from
|
||||
health_doctor_record a
|
||||
left join health_person hp on
|
||||
hp.id = a.person_id
|
||||
inner join health_person hp on
|
||||
hp.id = a.person_id and hp.del_flag = '0'
|
||||
left join health_record hr on
|
||||
hr.id = a.health_record_id
|
||||
</sql>
|
||||
|
||||
@@ -35,8 +35,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
hp."name" as person_name
|
||||
from
|
||||
health_height_weight_record a
|
||||
left join health_person hp on
|
||||
hp.id = a.person_id
|
||||
inner join health_person hp on
|
||||
hp.id = a.person_id and hp.del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<select id="selectHealthHeightWeightRecordList" parameterType="HealthHeightWeightRecordDto" resultMap="HealthHeightWeightRecordResult">
|
||||
|
||||
@@ -56,8 +56,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
hmb.short_name || '-' || hmb.brand || '(' || hmb.packaging || ')' as name
|
||||
from
|
||||
health_mar_record a
|
||||
left join health_person hp on
|
||||
hp.id = a.person_id
|
||||
inner join health_person hp on
|
||||
hp.id = a.person_id and hp.del_flag = '0'
|
||||
left join health_record hr on
|
||||
hr.id = a.health_record_id
|
||||
left join health_medicine_basic hmb on
|
||||
|
||||
@@ -37,8 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
hp."name" as person_name
|
||||
from
|
||||
health_milk_powder_record a
|
||||
left join health_person hp on
|
||||
hp.id = a.person_id
|
||||
inner join health_person hp on
|
||||
hp.id = a.person_id and hp.del_flag = '0'
|
||||
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHealthPersonVo">
|
||||
select a.id, a.name,a.sex,a.identity_card, a.phone, 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
|
||||
select a.id, a.name, a.sex, a.identity_card, a.phone, 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">
|
||||
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectHealthPersonById" parameterType="Long" resultMap="HealthPersonResult">
|
||||
<include refid="selectHealthPersonVo"/>
|
||||
where a.id = #{id}
|
||||
where a.id = #{id} and a.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertHealthPerson" parameterType="HealthPerson">
|
||||
|
||||
@@ -38,8 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
hr."name" as health_record_name
|
||||
from
|
||||
health_process_record a
|
||||
left join health_person hp on
|
||||
hp.id = a.person_id
|
||||
inner join health_person hp on
|
||||
hp.id = a.person_id and hp.del_flag = '0'
|
||||
left join health_record hr on
|
||||
hr.id = a.health_record_id</sql>
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
hp."name" as person_name
|
||||
from
|
||||
health_record a
|
||||
left join health_person hp on
|
||||
hp.id = a.person_id
|
||||
inner join health_person hp on
|
||||
hp.id = a.person_id and hp.del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<select id="selectHealthRecordList" parameterType="HealthRecordDto" resultMap="HealthRecordResult">
|
||||
|
||||
@@ -37,8 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
hr."name" as health_record_name
|
||||
from
|
||||
health_temperature_record a
|
||||
left join health_person hp on
|
||||
hp.id = a.person_id
|
||||
inner join health_person hp on
|
||||
hp.id = a.person_id and hp.del_flag = '0'
|
||||
left join health_record hr on
|
||||
hr.id = a.health_record_id
|
||||
</sql>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
(select count(1) from medication_task t where t.plan_id = a.id and t.del_flag = 0 and t.planned_date = current_date) as today_total,
|
||||
(select count(1) from medication_task t where t.plan_id = a.id and t.del_flag = 0 and t.planned_date = current_date and t.status = 1) as today_completed
|
||||
from medication_plan a
|
||||
left join health_person p on a.person_id = p.id
|
||||
inner join health_person p on a.person_id = p.id and p.del_flag = '0'
|
||||
left join chronic_disease_record c on a.chronic_disease_id = c.id
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
a.remind_status, a.remind_time, a.create_time
|
||||
from medication_task a
|
||||
left join medication_plan p on a.plan_id = p.id
|
||||
left join health_person m on a.person_id = m.id
|
||||
inner join health_person m on a.person_id = m.id and m.del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<select id="selectById" parameterType="Long" resultMap="MedicationTaskResult">
|
||||
@@ -119,6 +119,7 @@
|
||||
<select id="countByPlanAndDate" resultType="int">
|
||||
select count(1) from medication_task
|
||||
where del_flag = 0 and plan_id = #{planId} and planned_date = #{date}
|
||||
and exists (select 1 from health_person hp where hp.id = person_id and hp.del_flag = '0')
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPlanAndDate">
|
||||
@@ -129,12 +130,14 @@
|
||||
<select id="countCompletedByPlanAndDate" resultType="int">
|
||||
select count(1) from medication_task
|
||||
where del_flag = 0 and plan_id = #{planId} and planned_date = #{date} and status = 1
|
||||
and exists (select 1 from health_person hp where hp.id = person_id and hp.del_flag = '0')
|
||||
</select>
|
||||
|
||||
<update id="markExpired">
|
||||
update medication_task
|
||||
set status = 2, update_time = current_timestamp
|
||||
where del_flag = 0 and status = 0
|
||||
and exists (select 1 from health_person hp where hp.id = person_id and hp.del_flag = '0')
|
||||
and (planned_date || ' ' || planned_time)::timestamp < #{expireThreshold}
|
||||
</update>
|
||||
|
||||
@@ -160,6 +163,7 @@
|
||||
then 1 else 0 end) as ontime_tasks
|
||||
from medication_task
|
||||
where del_flag = 0
|
||||
and exists (select 1 from health_person hp where hp.id = person_id and hp.del_flag = '0')
|
||||
<if test="personId != null"> and person_id = #{personId}</if>
|
||||
<if test="startDate != null"> and planned_date >= #{startDate}</if>
|
||||
<if test="endDate != null"> and planned_date <= #{endDate}</if>
|
||||
@@ -177,6 +181,7 @@
|
||||
then 1 else 0 end) as ontime_tasks
|
||||
from medication_task
|
||||
where del_flag = 0
|
||||
and exists (select 1 from health_person hp where hp.id = person_id and hp.del_flag = '0')
|
||||
<if test="personId != null"> and person_id = #{personId}</if>
|
||||
<if test="startDate != null"> and planned_date >= #{startDate}</if>
|
||||
<if test="endDate != null"> and planned_date <= #{endDate}</if>
|
||||
@@ -195,6 +200,7 @@
|
||||
then 1 else 0 end) as ontime_tasks
|
||||
from medication_task
|
||||
where del_flag = 0
|
||||
and exists (select 1 from health_person hp where hp.id = person_id and hp.del_flag = '0')
|
||||
<if test="personId != null"> and person_id = #{personId}</if>
|
||||
<if test="startDate != null"> and planned_date >= #{startDate}</if>
|
||||
<if test="endDate != null"> and planned_date <= #{endDate}</if>
|
||||
|
||||
@@ -54,12 +54,13 @@
|
||||
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
|
||||
inner join health_person hp on
|
||||
hp.id = hmr.person_id and hp.del_flag = '0'
|
||||
left join health_record hr on
|
||||
hr.id = hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -92,6 +93,7 @@
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -112,6 +114,7 @@
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -133,6 +136,7 @@
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -155,6 +159,7 @@
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -180,6 +185,7 @@
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -204,6 +210,7 @@
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -225,6 +232,7 @@
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0' and hmr.temperature>=37
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -241,89 +249,340 @@
|
||||
<select id="selectStaticPersonList" parameterType="HealthRecordDto" resultType="com.intc.health.domain.vo.HealthStaticPersonVo">
|
||||
select
|
||||
hp."name" as personName,
|
||||
(
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_record hr
|
||||
where
|
||||
hr.person_id = hp.id
|
||||
and hr.del_flag = '0') as healthRecordCount,
|
||||
(
|
||||
select
|
||||
count(distinct hdr.hospital_name)
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.person_id = hp.id
|
||||
and hdr.del_flag = '0') as hospitalCount,
|
||||
(
|
||||
select
|
||||
count(distinct hdr.doctor)
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.person_id = hp.id
|
||||
and hdr.del_flag = '0') as doctorTotalCount,
|
||||
(
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.person_id = hp.id
|
||||
and hdr.del_flag = '0') as doctorCount,
|
||||
(
|
||||
select
|
||||
case when sum(hdr.total_cost) is null then 0
|
||||
else sum(hdr.total_cost)
|
||||
end
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.person_id = hp.id
|
||||
and hdr.del_flag = '0') as doctorCost,
|
||||
(
|
||||
select
|
||||
count(distinct to_char(hmr.dosing_time, 'yyyy-MM-dd') )
|
||||
from
|
||||
health_mar_record hmr
|
||||
where
|
||||
hmr.person_id = hp.id
|
||||
and hmr.del_flag = '0') as marDayCount,
|
||||
(
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_mar_record hmr
|
||||
where
|
||||
hmr.person_id = hp.id
|
||||
and hmr.del_flag = '0') as marCount,
|
||||
(
|
||||
select
|
||||
count(distinct hmr."medicine_id")
|
||||
from
|
||||
health_mar_record hmr
|
||||
where
|
||||
hmr.person_id = hp.id
|
||||
and hmr.del_flag = '0') as marTypeCount,
|
||||
|
||||
(
|
||||
select
|
||||
count(distinct to_char(hmr.measure_time, 'yyyy-MM-dd') )
|
||||
from
|
||||
health_temperature_record hmr
|
||||
where
|
||||
hmr.person_id = hp.id
|
||||
and hmr.temperature >= 37) as feverDayCount
|
||||
coalesce(hr.healthRecordCount, 0) as healthRecordCount,
|
||||
coalesce(hdr.hospitalCount, 0) as hospitalCount,
|
||||
coalesce(hdr.doctorTotalCount, 0) as doctorTotalCount,
|
||||
coalesce(hdr.doctorCount, 0) as doctorCount,
|
||||
coalesce(hdr.doctorCost, 0) as doctorCost,
|
||||
coalesce(hmr.marDayCount, 0) as marDayCount,
|
||||
coalesce(hmr.marCount, 0) as marCount,
|
||||
coalesce(hmr.marTypeCount, 0) as marTypeCount,
|
||||
coalesce(htr.feverDayCount, 0) as feverDayCount
|
||||
from
|
||||
health_person hp
|
||||
where 1=1
|
||||
left join (
|
||||
select
|
||||
person_id,
|
||||
count(*) as healthRecordCount
|
||||
from health_record
|
||||
where del_flag = '0'
|
||||
group by person_id
|
||||
) hr on hr.person_id = hp.id
|
||||
left join (
|
||||
select
|
||||
person_id,
|
||||
count(distinct hospital_name) as hospitalCount,
|
||||
count(distinct doctor) as doctorTotalCount,
|
||||
count(*) as doctorCount,
|
||||
coalesce(sum(total_cost), 0) as doctorCost
|
||||
from health_doctor_record
|
||||
where del_flag = '0'
|
||||
group by person_id
|
||||
) hdr on hdr.person_id = hp.id
|
||||
left join (
|
||||
select
|
||||
person_id,
|
||||
count(distinct to_char(dosing_time, 'yyyy-MM-dd')) as marDayCount,
|
||||
count(*) as marCount,
|
||||
count(distinct medicine_id) as marTypeCount
|
||||
from health_mar_record
|
||||
where del_flag = '0'
|
||||
group by person_id
|
||||
) hmr on hmr.person_id = hp.id
|
||||
left join (
|
||||
select
|
||||
person_id,
|
||||
count(distinct to_char(measure_time, 'yyyy-MM-dd')) as feverDayCount
|
||||
from health_temperature_record
|
||||
where del_flag = '0'
|
||||
and temperature >= 37
|
||||
group by person_id
|
||||
) htr on htr.person_id = hp.id
|
||||
where hp.del_flag = '0'
|
||||
<if test="personId != null "> and hp.id = #{personId}</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by hp.ranking
|
||||
</select>
|
||||
|
||||
<select id="selectHealthScreenDoctorSummary" parameterType="HealthDoctorRecordDto" resultType="java.util.HashMap">
|
||||
select
|
||||
count(*) as "doctorCount",
|
||||
coalesce(sum(a.total_cost), 0) as "doctorCost",
|
||||
count(distinct a.hospital_name) as "hospitalCount",
|
||||
count(distinct a.doctor) as "doctorTotalCount"
|
||||
from health_doctor_record a
|
||||
inner join health_person hp on hp.id = a.person_id and hp.del_flag = '0'
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and a.visiting_time <= to_date(#{endTime}, 'yyyy-MM-dd') + interval '1 day' - interval '1 second'
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and a.visiting_time >= to_date(#{startTime}, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="healthRecordId != null"> and a.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectHealthScreenPersonRankList" parameterType="HealthRecordDto" resultType="com.intc.health.domain.vo.HealthStaticPersonVo">
|
||||
select
|
||||
hp."name" as personName,
|
||||
coalesce(hr.healthRecordCount, 0) as healthRecordCount,
|
||||
coalesce(hdr.hospitalCount, 0) as hospitalCount,
|
||||
coalesce(hdr.doctorTotalCount, 0) as doctorTotalCount,
|
||||
coalesce(hdr.doctorCount, 0) as doctorCount,
|
||||
coalesce(hdr.doctorCost, 0) as doctorCost,
|
||||
coalesce(hmr.marDayCount, 0) as marDayCount,
|
||||
coalesce(hmr.marCount, 0) as marCount,
|
||||
coalesce(hmr.marTypeCount, 0) as marTypeCount,
|
||||
coalesce(htr.feverDayCount, 0) as feverDayCount
|
||||
from health_person hp
|
||||
left join (
|
||||
select person_id, count(*) as healthRecordCount
|
||||
from health_record
|
||||
where del_flag = '0'
|
||||
group by person_id
|
||||
) hr on hr.person_id = hp.id
|
||||
left join (
|
||||
select
|
||||
person_id,
|
||||
count(distinct hospital_name) as hospitalCount,
|
||||
count(distinct doctor) as doctorTotalCount,
|
||||
count(*) as doctorCount,
|
||||
coalesce(sum(total_cost), 0) as doctorCost
|
||||
from health_doctor_record
|
||||
where del_flag = '0'
|
||||
group by person_id
|
||||
) hdr on hdr.person_id = hp.id
|
||||
left join (
|
||||
select
|
||||
person_id,
|
||||
count(distinct to_char(dosing_time, 'yyyy-MM-dd')) as marDayCount,
|
||||
count(*) as marCount,
|
||||
count(distinct medicine_id) as marTypeCount
|
||||
from health_mar_record
|
||||
where del_flag = '0'
|
||||
group by person_id
|
||||
) hmr on hmr.person_id = hp.id
|
||||
left join (
|
||||
select
|
||||
person_id,
|
||||
count(distinct to_char(measure_time, 'yyyy-MM-dd')) as feverDayCount
|
||||
from health_temperature_record
|
||||
where del_flag = '0'
|
||||
and temperature >= 37
|
||||
group by person_id
|
||||
) htr on htr.person_id = hp.id
|
||||
where hp.del_flag = '0'
|
||||
<if test="personId != null "> and hp.id = #{personId}</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by
|
||||
(
|
||||
least(round(coalesce(htr.feverDayCount, 0) * 1.2), 35)
|
||||
+ least(round(coalesce(hdr.doctorCount, 0) * 2.5), 30)
|
||||
+ least(round(coalesce(hmr.marCount, 0) * 0.15), 12)
|
||||
+ least(coalesce(hr.healthRecordCount, 0) * 2, 10)
|
||||
+ least(round(coalesce(hdr.doctorCost, 0) / 1000), 13)
|
||||
) desc,
|
||||
hp.ranking
|
||||
limit 12
|
||||
</select>
|
||||
|
||||
<select id="selectHealthScreenMedicineSummary" parameterType="HealthMarRecordDto" resultType="java.util.HashMap">
|
||||
select
|
||||
count(*) as "marCount",
|
||||
count(distinct a.medicine_id) as "medicalTypeCount",
|
||||
count(distinct to_char(a.dosing_time, 'yyyy-MM-dd')) as "marDayCount"
|
||||
from health_mar_record a
|
||||
inner join health_person hp on hp.id = a.person_id and hp.del_flag = '0'
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and a.dosing_time <= to_date(#{endTime}, 'yyyy-MM-dd') + interval '1 day' - interval '1 second'
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and a.dosing_time >= to_date(#{startTime}, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="healthRecordId != null and healthRecordId != ''"> and a.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectHealthScreenTemperatureSummary" parameterType="HealthTemperatureRecordDto" resultType="java.util.HashMap">
|
||||
select
|
||||
count(*) as "temperatureTotalCount",
|
||||
count(case when a.temperature < 36.9 then 1 end) as "normalTempCount",
|
||||
count(case when a.temperature >= 36.9 and a.temperature <= 37.5 then 1 end) as "lowerTempCount",
|
||||
count(case when a.temperature > 37.5 and a.temperature < 38.5 then 1 end) as "middleTempCount",
|
||||
count(case when a.temperature >= 38.5 then 1 end) as "higherTempCount",
|
||||
count(distinct case when a.temperature >= 37 then to_char(a.measure_time, 'yyyy-MM-dd') end) as "feverDayCount"
|
||||
from health_temperature_record a
|
||||
inner join health_person hp on hp.id = a.person_id and hp.del_flag = '0'
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and a.measure_time <= to_date(#{endTime}, 'yyyy-MM-dd') + interval '1 day' - interval '1 second'
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and a.measure_time >= to_date(#{startTime}, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="healthRecordId != null "> and a.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectHealthScreenActivitySummary" parameterType="HealthActivityDto" resultType="java.util.HashMap">
|
||||
select
|
||||
count(*) as "activityCount",
|
||||
coalesce(sum(a.total_cost), 0) as "activityCost"
|
||||
from health_activity a
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="endTime != null "> and a.start_time <= #{endTime}</if>
|
||||
<if test="startTime != null "> and a.start_time >= #{startTime}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectHealthScreenActivityList" parameterType="HealthActivityDto" resultType="com.intc.health.domain.vo.HealthActivityVo">
|
||||
select
|
||||
a.id,
|
||||
a.name,
|
||||
a.type,
|
||||
a.place,
|
||||
a.activity_volume as activityVolume,
|
||||
a.exercise_time as exerciseTime,
|
||||
a.start_time as startTime,
|
||||
a.end_time as endTime,
|
||||
a.harvest,
|
||||
a.foods,
|
||||
a.total_cost as totalCost,
|
||||
a.partner,
|
||||
a.cost_detail as costDetail
|
||||
from health_activity a
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="endTime != null "> and a.start_time <= #{endTime}</if>
|
||||
<if test="startTime != null "> and a.start_time >= #{startTime}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by a.start_time desc
|
||||
limit 50
|
||||
</select>
|
||||
|
||||
<select id="selectHealthScreenDoctorList" parameterType="HealthDoctorRecordDto" resultType="com.intc.health.domain.vo.HealthDoctorRecordVo">
|
||||
select
|
||||
a.id,
|
||||
a.hospital_name as hospitalName,
|
||||
a.departments,
|
||||
a.doctor,
|
||||
a.type,
|
||||
a.health_record_id as healthRecordId,
|
||||
a.visiting_time as visitingTime,
|
||||
a.prescribe,
|
||||
a.diagnosis,
|
||||
a.person_id as personId,
|
||||
a.total_cost as totalCost,
|
||||
hp."name" as personName,
|
||||
hr."name" as healthRecordName
|
||||
from health_doctor_record a
|
||||
inner join health_person hp on hp.id = a.person_id and hp.del_flag = '0'
|
||||
left join health_record hr on hr.id = a.health_record_id
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and a.visiting_time <= to_date(#{endTime}, 'yyyy-MM-dd') + interval '1 day' - interval '1 second'
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and a.visiting_time >= to_date(#{startTime}, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="healthRecordId != null"> and a.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by a.visiting_time desc
|
||||
limit 50
|
||||
</select>
|
||||
|
||||
<select id="selectHealthScreenMedicineList" parameterType="HealthMarRecordDto" resultType="com.intc.health.domain.vo.HealthMarRecordVo">
|
||||
select
|
||||
a.id,
|
||||
a.type,
|
||||
a.health_record_id as healthRecordId,
|
||||
a.dosing_time as dosingTime,
|
||||
a.dosage,
|
||||
a.person_id as personId,
|
||||
a.resource,
|
||||
a.place,
|
||||
a.medicine_id as medicineId,
|
||||
a.unit,
|
||||
a.content,
|
||||
a.content_unit as contentUnit,
|
||||
hp."name" as personName,
|
||||
hr."name" as healthRecordName,
|
||||
hmb.short_name || '-' || hmb.brand || '(' || hmb.packaging || ')' as name
|
||||
from health_mar_record a
|
||||
inner join health_person hp on hp.id = a.person_id and hp.del_flag = '0'
|
||||
left join health_record hr on hr.id = a.health_record_id
|
||||
left join health_medicine_basic hmb on hmb.id = a.medicine_id
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and a.dosing_time <= to_date(#{endTime}, 'yyyy-MM-dd') + interval '1 day' - interval '1 second'
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and a.dosing_time >= to_date(#{startTime}, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="healthRecordId != null and healthRecordId != ''"> and a.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by a.dosing_time desc
|
||||
limit 50
|
||||
</select>
|
||||
|
||||
<select id="selectHealthScreenTemperatureList" parameterType="HealthTemperatureRecordDto" resultType="com.intc.health.domain.vo.HealthTemperatureRecordVo">
|
||||
select
|
||||
a.id,
|
||||
a.health_record_id as healthRecordId,
|
||||
a.measure_time as measureTime,
|
||||
a.temperature,
|
||||
a.person_id as personId,
|
||||
hp."name" as personName,
|
||||
hr."name" as healthRecordName
|
||||
from health_temperature_record a
|
||||
inner join health_person hp on hp.id = a.person_id and hp.del_flag = '0'
|
||||
left join health_record hr on hr.id = a.health_record_id
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and a.measure_time <= to_date(#{endTime}, 'yyyy-MM-dd') + interval '1 day' - interval '1 second'
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and a.measure_time >= to_date(#{startTime}, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="healthRecordId != null "> and a.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by a.measure_time desc
|
||||
limit 1000
|
||||
</select>
|
||||
|
||||
<select id="selectHealthRecordCostList" parameterType="HealthRecordDto" resultType="com.intc.health.domain.vo.HealthRecordVo">
|
||||
select
|
||||
(
|
||||
@@ -344,6 +603,7 @@
|
||||
health_record hr
|
||||
<where>
|
||||
hr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -445,6 +705,7 @@
|
||||
|
||||
<where>
|
||||
hr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -469,6 +730,7 @@
|
||||
hr.id = hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -490,6 +752,7 @@
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -511,6 +774,7 @@
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -534,6 +798,7 @@
|
||||
hr.id = hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hmr.visiting_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -560,6 +825,7 @@
|
||||
hr.id = hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hmr.visiting_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -585,6 +851,7 @@
|
||||
hr.id = hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmr.person_id and hp.del_flag = '0')
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hmr.visiting_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
@@ -804,6 +1071,7 @@
|
||||
from
|
||||
health_milk_powder_record hmpr
|
||||
where hmpr.del_flag ='0'
|
||||
and exists (select 1 from health_person hp where hp.id = hmpr.person_id and hp.del_flag = '0')
|
||||
<if test="personId != null "> and hmpr.person_id = #{personId}</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hmpr.suckles_time, 'yyyy-MM-dd')
|
||||
|
||||
Reference in New Issue
Block a user