问卷自评功能
This commit is contained in:
parent
3bb2fd911f
commit
b15520a6bd
@ -1,7 +1,7 @@
|
||||
package com.xinelu.web.controller.familydoctor;
|
||||
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.domain.R;
|
||||
import com.xinelu.familydoctor.entity.DeviceBindResident;
|
||||
import com.xinelu.familydoctor.service.DeviceBindResidentService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -26,38 +26,34 @@ public class DeviceBindResidentController extends BaseController {
|
||||
|
||||
@ApiOperation("绑定设备")
|
||||
@PostMapping("binding")
|
||||
public AjaxResult bind(@RequestBody DeviceBindResident entity) {
|
||||
public R<?> bind(@RequestBody DeviceBindResident entity) {
|
||||
if (deviceBindResidentService.repeatBind(entity)) {
|
||||
return AjaxResult.error("设备【" + entity.getSn() + "】已绑定");
|
||||
return R.fail("设备【" + entity.getSn() + "】已绑定");
|
||||
}
|
||||
AjaxResult ajaxResult;
|
||||
int row = deviceBindResidentService.bindDevice(entity);
|
||||
if (row > 0) {
|
||||
ajaxResult = AjaxResult.success();
|
||||
return R.ok();
|
||||
} else {
|
||||
ajaxResult = AjaxResult.error("绑定失败");
|
||||
return R.fail("绑定失败");
|
||||
}
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
@ApiOperation("已绑定的设备")
|
||||
@GetMapping("bound/{identity}")
|
||||
@ApiImplicitParam(name = "identity", value = "身份证号", required = true)
|
||||
public AjaxResult boundDevice(@PathVariable String identity) {
|
||||
public R<List<DeviceBindResident>> boundDevice(@PathVariable String identity) {
|
||||
List<DeviceBindResident> list = deviceBindResidentService.boundDevice(identity);
|
||||
return AjaxResult.success(list);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("解绑设备")
|
||||
@PostMapping("unbind")
|
||||
public AjaxResult unbindDevice(@RequestBody DeviceBindResident entity) {
|
||||
AjaxResult ajaxResult;
|
||||
public R<?> unbindDevice(@RequestBody DeviceBindResident entity) {
|
||||
int row = deviceBindResidentService.unbindDevice(entity);
|
||||
if (row > 0) {
|
||||
ajaxResult = AjaxResult.success();
|
||||
return R.ok();
|
||||
} else {
|
||||
ajaxResult = AjaxResult.error("解绑失败");
|
||||
return R.fail("解绑失败");
|
||||
}
|
||||
return ajaxResult;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,65 @@
|
||||
package com.xinelu.web.controller.familydoctor;
|
||||
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.familydoctor.entity.EvaluateAdviceTemplate;
|
||||
import com.xinelu.familydoctor.service.EvaluateAdviceTemplateService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 自我评估处方模板接口控制器
|
||||
* @date 2023-10-16 16:59
|
||||
*/
|
||||
@Api(tags = {"自我评估处方模板接口控制器"})
|
||||
@RestController
|
||||
@RequestMapping("/evaluate/advice/template")
|
||||
public class EvaluateAdviceTemplateController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private EvaluateAdviceTemplateService evaluateAdviceTemplateService;
|
||||
|
||||
@ApiOperation("模板列表")
|
||||
@GetMapping("list")
|
||||
public TableDataInfo list(EvaluateAdviceTemplate entity) {
|
||||
startPage();
|
||||
List<EvaluateAdviceTemplate> list = evaluateAdviceTemplateService.findList(entity);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("新增/编辑模板")
|
||||
@PostMapping("save")
|
||||
public AjaxResult save(@RequestBody EvaluateAdviceTemplate entity) {
|
||||
evaluateAdviceTemplateService.save(entity);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("修改模板状态")
|
||||
@PostMapping("change/status")
|
||||
public AjaxResult changeStatus(@RequestBody EvaluateAdviceTemplate entity) {
|
||||
evaluateAdviceTemplateService.changeStatus(entity);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("逻辑删除模板")
|
||||
@PostMapping("del/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "模板ID", required = true)
|
||||
public AjaxResult del(@PathVariable Long id) {
|
||||
evaluateAdviceTemplateService.delTemplate(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("根据自评结果获取处方模板")
|
||||
@GetMapping("get/{templateType}")
|
||||
@ApiImplicitParam(name = "templateType", value = "处方模板类型", required = true)
|
||||
public AjaxResult getTemplate(@PathVariable String templateType) {
|
||||
return AjaxResult.success(evaluateAdviceTemplateService.getTemplate(templateType));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.xinelu.web.controller.familydoctor;
|
||||
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.familydoctor.entity.EvaluateRecord;
|
||||
import com.xinelu.familydoctor.entity.EvaluateSurvey;
|
||||
import com.xinelu.familydoctor.service.EvaluateRecordService;
|
||||
import com.xinelu.familydoctor.service.EvaluateSurveyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 自我评估问卷控制器
|
||||
* @date 2023-10-10 11:02
|
||||
*/
|
||||
@Api(tags = {"自我评估问卷控制器"})
|
||||
@RestController
|
||||
@RequestMapping("/evaluate")
|
||||
public class EvaluateSurveyController extends BaseController {
|
||||
@Resource
|
||||
private EvaluateSurveyService evaluateSurveyService;
|
||||
@Resource
|
||||
private EvaluateRecordService evaluateRecordService;
|
||||
|
||||
@ApiOperation("问卷列表")
|
||||
@GetMapping("survey/list")
|
||||
public TableDataInfo surveyList(EvaluateSurvey entity) {
|
||||
startPage();
|
||||
List<EvaluateSurvey> list = evaluateSurveyService.findList(entity);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("问卷新增")
|
||||
@PostMapping("survey/save")
|
||||
public AjaxResult surveySave(@RequestBody EvaluateSurvey entity) {
|
||||
evaluateSurveyService.insert(entity);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("问卷编辑")
|
||||
@PostMapping("survey/update")
|
||||
public AjaxResult surveyUpdate(@RequestBody EvaluateSurvey entity) {
|
||||
evaluateSurveyService.update(entity);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("修改问卷状态(启用/停用)")
|
||||
@PostMapping("survey/change/state")
|
||||
public AjaxResult changeState() {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("获取问卷")
|
||||
@GetMapping("survey/get/{subject}")
|
||||
@ApiImplicitParam(name = "subject", value = "问卷主题", required = true)
|
||||
public AjaxResult getSurvey(@PathVariable String subject) {
|
||||
EvaluateSurvey survey = evaluateSurveyService.getSurvey(subject);
|
||||
return AjaxResult.success(survey);
|
||||
}
|
||||
|
||||
@ApiOperation("问卷提交")
|
||||
@PostMapping("survey/submit")
|
||||
public AjaxResult surveySubmit(EvaluateRecord evaluateRecord) {
|
||||
evaluateRecordService.submit(evaluateRecord);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("获取评估记录")
|
||||
@GetMapping("record/timeline/{userId}")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true)
|
||||
public AjaxResult record(@PathVariable Long userId) {
|
||||
return AjaxResult.success(evaluateRecordService.getEvaluateTimeline(userId));
|
||||
}
|
||||
|
||||
@ApiOperation("获取评估问卷答案")
|
||||
@GetMapping("survey/answer/{recordId}")
|
||||
@ApiImplicitParam(name = "recordId", value = "评估记录ID", required = true)
|
||||
public AjaxResult detail(@PathVariable Long recordId) {
|
||||
return AjaxResult.success(evaluateRecordService.getAnswers(recordId));
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package com.xinelu.web.controller.familydoctor;
|
||||
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.domain.R;
|
||||
import com.xinelu.familydoctor.entity.*;
|
||||
import com.xinelu.familydoctor.service.PhysicalSignService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -27,51 +27,51 @@ public class PhysicalSignController extends BaseController {
|
||||
|
||||
@ApiOperation("上传血糖")
|
||||
@PostMapping("bg/save")
|
||||
public AjaxResult saveBg(@RequestBody DeviceBgRecord record) {
|
||||
public R<?> saveBg(@RequestBody DeviceBgRecord record) {
|
||||
physicalSignService.saveBg(record);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("上传血压")
|
||||
@PostMapping("bp/save")
|
||||
public AjaxResult saveBp(@RequestBody DeviceBpRecord record) {
|
||||
public R<?> saveBp(@RequestBody DeviceBpRecord record) {
|
||||
physicalSignService.saveBp(record);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("上传血脂")
|
||||
@PostMapping("bf/save")
|
||||
public AjaxResult saveBf(@RequestBody DeviceBfRecord record) {
|
||||
public R<?> saveBf(@RequestBody DeviceBfRecord record) {
|
||||
physicalSignService.saveBf(record);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("上传BMI")
|
||||
@PostMapping("bmi/save")
|
||||
public AjaxResult saveBmi(@RequestBody DeviceBmiRecord record) {
|
||||
public R<?> saveBmi(@RequestBody DeviceBmiRecord record) {
|
||||
physicalSignService.saveBmi(record);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("上传血氧")
|
||||
@PostMapping("bo/save")
|
||||
public AjaxResult saveBo(@RequestBody DeviceBoRecord record) {
|
||||
public R<?> saveBo(@RequestBody DeviceBoRecord record) {
|
||||
physicalSignService.saveBo(record);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("上传心率")
|
||||
@PostMapping("hr/save")
|
||||
public AjaxResult saveHr(@RequestBody DeviceHrRecord record) {
|
||||
public R<?> saveHr(@RequestBody DeviceHrRecord record) {
|
||||
physicalSignService.saveHr(record);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("上传体温")
|
||||
@PostMapping("temp/save")
|
||||
public AjaxResult saveTemp(@RequestBody DeviceTempRecord record) {
|
||||
public R<?> saveTemp(@RequestBody DeviceTempRecord record) {
|
||||
physicalSignService.saveTemp(record);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("获取体征记录")
|
||||
@ -79,8 +79,8 @@ public class PhysicalSignController extends BaseController {
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "identity", value = "身份证号", required = true),
|
||||
@ApiImplicitParam(name = "type", value = "时间类型0:全部1:周2:月3:年", required = true),
|
||||
@ApiImplicitParam(name = "label", value = "查询标识1:血糖2:血压3:血脂4:bmi5:血氧6:心率7:体温", required = true)})
|
||||
public AjaxResult record(String identity, String type, String label) {
|
||||
public R<?> record(String identity, String type, String label) {
|
||||
Map<String, Object> map = physicalSignService.record(identity, type, label);
|
||||
return AjaxResult.success(map);
|
||||
return R.ok(map);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package com.xinelu.common.enums;
|
||||
/**
|
||||
* @description: 问卷主题枚举
|
||||
* @author gaoyu
|
||||
* @date 2023-10-11 10:44
|
||||
*/
|
||||
public enum SurveySubjectEnum {
|
||||
HBP_EVALUATE("1001", "高血压评估问卷"),
|
||||
BG_EVALUATE("1002", "糖尿病评估问卷"),
|
||||
STOKE_EVALUATE("1003", "脑卒中评估问卷"),
|
||||
COPD_EVALUATE("1004", "慢阻肺评估问卷"),
|
||||
CHRONIC_EVALUATE("1005", "慢病评估问卷"),
|
||||
NS_EVALUATE("1006", "糖尿病肾病评估问卷"),
|
||||
ED_EVALUATE("1007", "糖尿病眼病评估问卷"),
|
||||
FD_EVALUATE("1008", "糖尿病足病评估问卷");
|
||||
|
||||
private final String code;
|
||||
private final String label;
|
||||
|
||||
SurveySubjectEnum(String code, String label) {
|
||||
this.code = code;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
@ -3,47 +3,60 @@ package com.xinelu.familydoctor.entity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 血脂记录表
|
||||
* @TableName device_bf_record
|
||||
*/
|
||||
@ApiModel("血脂记录表")
|
||||
@Data
|
||||
public class DeviceBfRecord implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@ApiModelProperty("自增主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 居民身份证号
|
||||
*/
|
||||
@ApiModelProperty("居民身份证号")
|
||||
private String identity;
|
||||
|
||||
/**
|
||||
* 血清总胆固醇(单位:mmol/L)
|
||||
*/
|
||||
@ApiModelProperty("血清总胆固醇(单位:mmol/L)")
|
||||
private BigDecimal tc;
|
||||
|
||||
/**
|
||||
* 甘油三酯(单位:mmol/L)
|
||||
*/
|
||||
@ApiModelProperty("甘油三酯(单位:mmol/L)")
|
||||
private BigDecimal tg;
|
||||
|
||||
/**
|
||||
* 高密度脂蛋白胆固醇(单位:mmol/L)
|
||||
*/
|
||||
@ApiModelProperty("高密度脂蛋白胆固醇(单位:mmol/L)")
|
||||
private BigDecimal hdl;
|
||||
|
||||
/**
|
||||
* 低密度脂蛋白胆固醇(单位:mmol/L)
|
||||
*/
|
||||
@ApiModelProperty("低密度脂蛋白胆固醇(单位:mmol/L)")
|
||||
private BigDecimal ldl;
|
||||
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -3,42 +3,54 @@ package com.xinelu.familydoctor.entity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 血糖记录表
|
||||
* @TableName device_bg_record
|
||||
*/
|
||||
@ApiModel("血糖记录表")
|
||||
@Data
|
||||
public class DeviceBgRecord implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@ApiModelProperty("自增主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 居民身份证号
|
||||
*/
|
||||
@ApiModelProperty("居民身份证号")
|
||||
private String identity;
|
||||
|
||||
/**
|
||||
* 血糖值(单位:mmol/L)
|
||||
*/
|
||||
@ApiModelProperty("血糖值(单位:mmol/L)")
|
||||
private BigDecimal bg;
|
||||
|
||||
/**
|
||||
* 时间段1:凌晨2:早餐前3:早晨后4:午餐前5:午餐后6:晚餐前7:晚餐后8:睡前
|
||||
*/
|
||||
@ApiModelProperty("时间段1:凌晨2:早餐前3:早晨后4:午餐前5:午餐后6:晚餐前7:晚餐后8:睡前")
|
||||
private String bucket;
|
||||
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
/**
|
||||
* 上传方式1:手动2:自动
|
||||
*/
|
||||
@ApiModelProperty("上传方式1:手动2:自动")
|
||||
private String uploadType;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -34,9 +34,9 @@ public class DeviceBindResident implements Serializable {
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 设备类型(0: 其他 1:血压计 2:血糖仪 3:血脂仪 4:血氧仪 5:体重秤 6:体温计)
|
||||
* 设备类型(1:血压计 2:血糖仪 3:动态血压仪)
|
||||
*/
|
||||
@ApiModelProperty("设备类型(0: 其他 1:血压计 2:血糖仪 3:血脂仪 4:血氧仪 5:体重秤 6:体温计)")
|
||||
@ApiModelProperty("设备类型(1:血压计 2:血糖仪 3:动态血压仪)")
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
|
||||
@ -3,32 +3,42 @@ package com.xinelu.familydoctor.entity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* BMI记录表
|
||||
* @TableName device_bmi_record
|
||||
*/
|
||||
@ApiModel("BMI记录表")
|
||||
@Data
|
||||
public class DeviceBmiRecord implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@ApiModelProperty("自增主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 居民身份证号
|
||||
*/
|
||||
@ApiModelProperty("居民身份证号")
|
||||
private String identity;
|
||||
|
||||
/**
|
||||
* BMI(单位:kg/m^2)
|
||||
*/
|
||||
@ApiModelProperty("BMI(单位:kg/m^2)")
|
||||
private BigDecimal bmi;
|
||||
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -2,37 +2,48 @@ package com.xinelu.familydoctor.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 血氧记录表
|
||||
* @TableName device_bo_record
|
||||
*/
|
||||
@ApiModel("血氧记录表")
|
||||
@Data
|
||||
public class DeviceBoRecord implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@ApiModelProperty("自增主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 居民身份证号
|
||||
*/
|
||||
@ApiModelProperty("居民身份证号")
|
||||
private String identity;
|
||||
|
||||
/**
|
||||
* 血氧(单位:%)
|
||||
*/
|
||||
@ApiModelProperty("血氧(单位:%)")
|
||||
private Integer spo2;
|
||||
|
||||
/**
|
||||
* 脉搏(单位:次/分)
|
||||
*/
|
||||
@ApiModelProperty("脉搏(单位:次/分)")
|
||||
private Integer pulse;
|
||||
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -2,47 +2,60 @@ package com.xinelu.familydoctor.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 血压记录表
|
||||
* @TableName device_bp_record
|
||||
*/
|
||||
@ApiModel("血压记录表")
|
||||
@Data
|
||||
public class DeviceBpRecord implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@ApiModelProperty("自增主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 居民身份证号
|
||||
*/
|
||||
@ApiModelProperty("居民身份证号")
|
||||
private String identity;
|
||||
|
||||
/**
|
||||
* 收缩压(单位:mmHg)
|
||||
*/
|
||||
@ApiModelProperty("收缩压(单位:mmHg)")
|
||||
private Integer sbp;
|
||||
|
||||
/**
|
||||
* 舒张压(单位:mmHg)
|
||||
*/
|
||||
@ApiModelProperty("舒张压(单位:mmHg)")
|
||||
private Integer dbp;
|
||||
|
||||
/**
|
||||
* 心率(单位:次/分)
|
||||
*/
|
||||
@ApiModelProperty("心率(单位:次/分)")
|
||||
private Integer hr;
|
||||
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
/**
|
||||
* 上传方式1:手动2:自动
|
||||
*/
|
||||
@ApiModelProperty("上传方式1:手动2:自动")
|
||||
private String uploadType;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -2,37 +2,48 @@ package com.xinelu.familydoctor.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 心率记录表
|
||||
* @TableName device_hr_record
|
||||
*/
|
||||
@ApiModel("心率记录表")
|
||||
@Data
|
||||
public class DeviceHrRecord implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@ApiModelProperty("自增主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 居民身份证号
|
||||
*/
|
||||
@ApiModelProperty("居民身份证号")
|
||||
private String identity;
|
||||
|
||||
/**
|
||||
* 心率(单位:次/分)
|
||||
*/
|
||||
@ApiModelProperty("心率(单位:次/分)")
|
||||
private Integer hr;
|
||||
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
/**
|
||||
* 上传方式1:手动2:自动
|
||||
*/
|
||||
@ApiModelProperty("上传方式1:手动2:自动")
|
||||
private String uploadType;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -3,32 +3,42 @@ package com.xinelu.familydoctor.entity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 体温记录表
|
||||
* @TableName device_temp_record
|
||||
*/
|
||||
@ApiModel("体温记录表")
|
||||
@Data
|
||||
public class DeviceTempRecord implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@ApiModelProperty("自增主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 居民身份证号
|
||||
*/
|
||||
@ApiModelProperty("居民身份证号")
|
||||
private String identity;
|
||||
|
||||
/**
|
||||
* 体温(单位:℃)
|
||||
*/
|
||||
@ApiModelProperty("体温(单位:℃)")
|
||||
private BigDecimal temp;
|
||||
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
package com.xinelu.familydoctor.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 自我评估健康处方模板表
|
||||
* @TableName evaluate_advice_template
|
||||
*/
|
||||
@Data
|
||||
public class EvaluateAdviceTemplate implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 模板类型
|
||||
*/
|
||||
private String templateType;
|
||||
|
||||
/**
|
||||
* 模板内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 模板状态1:启用2:停用
|
||||
*/
|
||||
private String useFlag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除标识1:正常2:删除
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private Map<String, Object> params;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.xinelu.familydoctor.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 自评问卷答案表
|
||||
* @TableName evaluate_answer
|
||||
*/
|
||||
@Data
|
||||
public class EvaluateAnswer implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 自评记录ID
|
||||
*/
|
||||
private Long recordId;
|
||||
|
||||
/**
|
||||
* 问题ID
|
||||
*/
|
||||
private Long questionId;
|
||||
|
||||
/**
|
||||
* 选项ID
|
||||
*/
|
||||
private Long optionId;
|
||||
|
||||
/**
|
||||
* 选项内容
|
||||
*/
|
||||
private String optionContent;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.xinelu.familydoctor.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 自评问题选项表
|
||||
* @TableName evaluate_option
|
||||
*/
|
||||
@Data
|
||||
public class EvaluateOption implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 问题ID
|
||||
*/
|
||||
private Long questionId;
|
||||
|
||||
/**
|
||||
* 问卷ID
|
||||
*/
|
||||
private Long surveyId;
|
||||
|
||||
/**
|
||||
* 选项名称
|
||||
*/
|
||||
private String optionName;
|
||||
|
||||
/**
|
||||
* 选项排序
|
||||
*/
|
||||
private Integer optionSort;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.xinelu.familydoctor.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 自评问题表
|
||||
* @TableName evaluate_question
|
||||
*/
|
||||
@Data
|
||||
public class EvaluateQuestion implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 问卷ID
|
||||
*/
|
||||
private Long surveyId;
|
||||
|
||||
/**
|
||||
* 问题主题
|
||||
*/
|
||||
private String questionName;
|
||||
|
||||
/**
|
||||
* 问题类型1:单选2:多选3:填空
|
||||
*/
|
||||
private String questionType;
|
||||
|
||||
/**
|
||||
* 问题排序
|
||||
*/
|
||||
private Integer questionSort;
|
||||
|
||||
/**
|
||||
* 是否必填1:必填2:非必填
|
||||
*/
|
||||
private String requiredFlag;
|
||||
|
||||
private List<EvaluateOption> options;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.xinelu.familydoctor.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 自评记录表
|
||||
* @TableName evaluate_record
|
||||
*/
|
||||
@Data
|
||||
public class EvaluateRecord implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 问卷ID
|
||||
*/
|
||||
private Long surveyId;
|
||||
|
||||
/**
|
||||
* 问卷主题
|
||||
*/
|
||||
private String surveySubject;
|
||||
|
||||
/**
|
||||
* 评估结果
|
||||
*/
|
||||
private String evaluateResult;
|
||||
|
||||
/**
|
||||
* 健康处方
|
||||
*/
|
||||
private String advice;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
private List<EvaluateAnswer> answers;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.xinelu.familydoctor.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 自评问卷表
|
||||
* @TableName evaluate_survey
|
||||
*/
|
||||
@Data
|
||||
public class EvaluateSurvey implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 问卷主题1001:高血压评估问卷,1002:糖尿病评估问卷,1003:脑卒中评估问卷,1004:慢阻肺评估问卷,1005:慢病评估问卷,
|
||||
* 1006:糖尿病肾病评估问卷,1007:糖尿病眼病评估问卷,1008:糖尿病足病评估问卷
|
||||
*/
|
||||
private String surveySubject;
|
||||
|
||||
/**
|
||||
* 问卷状态1:启用2:停用
|
||||
*/
|
||||
private String useFlag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 删除标识1:正常2:删除
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private List<EvaluateQuestion> questions;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private Map<String, Object> params;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xinelu.familydoctor.mapper;
|
||||
|
||||
import com.xinelu.familydoctor.entity.EvaluateAdviceTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 针对表【evaluate_advice_template(自我评估健康处方模板表)】的数据库操作Mapper
|
||||
* @createDate 2023-10-16 16:51:09
|
||||
* @Entity com.xinelu.familydoctor.entity.EvaluateAdviceTemplate
|
||||
*/
|
||||
public interface EvaluateAdviceTemplateMapper {
|
||||
|
||||
List<EvaluateAdviceTemplate> findList(EvaluateAdviceTemplate record);
|
||||
|
||||
EvaluateAdviceTemplate getTemplateByType(String templateType);
|
||||
|
||||
int insert(EvaluateAdviceTemplate record);
|
||||
|
||||
int update(EvaluateAdviceTemplate record);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.xinelu.familydoctor.mapper;
|
||||
|
||||
import com.xinelu.familydoctor.entity.EvaluateAnswer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 针对表【evaluate_answer(自评问卷答案表)】的数据库操作Mapper
|
||||
* @createDate 2023-10-11 09:51:39
|
||||
* @Entity com.xinelu.familydoctor.entity.EvaluateAnswer
|
||||
*/
|
||||
public interface EvaluateAnswerMapper {
|
||||
|
||||
List<EvaluateAnswer> getAnswers(Long recordId);
|
||||
|
||||
int insert(EvaluateAnswer record);
|
||||
|
||||
int update(EvaluateAnswer recordId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.xinelu.familydoctor.mapper;
|
||||
|
||||
import com.xinelu.familydoctor.entity.EvaluateOption;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 针对表【evaluate_option(自评问题选项表)】的数据库操作Mapper
|
||||
* @createDate 2023-10-11 09:51:26
|
||||
* @Entity com.xinelu.familydoctor.entity.EvaluateOption
|
||||
*/
|
||||
public interface EvaluateOptionMapper {
|
||||
|
||||
List<EvaluateOption> getOptions(Long questionId);
|
||||
|
||||
int insert(EvaluateOption record);
|
||||
|
||||
int update(EvaluateOption record);
|
||||
|
||||
/**
|
||||
* 清空问卷ID与wentiID
|
||||
* @param questionId 问题ID
|
||||
* @param surveyId 问卷ID
|
||||
* @return {@link int}
|
||||
* @author gaoyu
|
||||
* @date 2023-10-11 17:31
|
||||
*/
|
||||
int clearRelationId(@Param("questionId") Long questionId, @Param("surveyId") Long surveyId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.xinelu.familydoctor.mapper;
|
||||
|
||||
import com.xinelu.familydoctor.entity.EvaluateQuestion;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 针对表【evaluate_question(自评问题表)】的数据库操作Mapper
|
||||
* @createDate 2023-10-11 09:51:20
|
||||
* @Entity com.xinelu.familydoctor.entity.EvaluateQuestion
|
||||
*/
|
||||
public interface EvaluateQuestionMapper {
|
||||
|
||||
List<EvaluateQuestion> getQuestions(Long surveyId);
|
||||
|
||||
int insert(EvaluateQuestion record);
|
||||
|
||||
int update(EvaluateQuestion record);
|
||||
|
||||
/**
|
||||
* 清空问卷ID
|
||||
* @param surveyId 问卷ID
|
||||
* @return {@link int}
|
||||
* @author gaoyu
|
||||
* @date 2023-10-11 17:33
|
||||
*/
|
||||
int clearSurveyId(@Param("surveyId") Long surveyId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xinelu.familydoctor.mapper;
|
||||
|
||||
import com.xinelu.familydoctor.entity.EvaluateRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 针对表【evaluate_record(自评记录表)】的数据库操作Mapper
|
||||
* @createDate 2023-10-11 09:51:34
|
||||
* @Entity com.xinelu.familydoctor.entity.EvaluateRecord
|
||||
*/
|
||||
public interface EvaluateRecordMapper {
|
||||
|
||||
List<EvaluateRecord> getTimeline(Long userId);
|
||||
|
||||
int insert(EvaluateRecord record);
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.xinelu.familydoctor.mapper;
|
||||
|
||||
import com.xinelu.familydoctor.entity.EvaluateSurvey;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 针对表【evaluate_survey(自评问卷表)】的数据库操作Mapper
|
||||
* @createDate 2023-10-11 09:51:11
|
||||
* @Entity com.xinelu.familydoctor.entity.EvaluateSurvey
|
||||
*/
|
||||
public interface EvaluateSurveyMapper {
|
||||
|
||||
List<EvaluateSurvey> findList(EvaluateSurvey entity);
|
||||
|
||||
/**
|
||||
* 获取问卷
|
||||
* @param surveySubject 问卷主题
|
||||
* @return {@link com.xinelu.familydoctor.entity.EvaluateSurvey}
|
||||
* @author gaoyu
|
||||
* @date 2023-10-12 17:22
|
||||
*/
|
||||
EvaluateSurvey getSurvey(String surveySubject);
|
||||
|
||||
int insert(EvaluateSurvey record);
|
||||
|
||||
int update(EvaluateSurvey record);
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.xinelu.familydoctor.service;
|
||||
|
||||
import com.xinelu.familydoctor.entity.EvaluateAdviceTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EvaluateAdviceTemplateService {
|
||||
List<EvaluateAdviceTemplate> findList(EvaluateAdviceTemplate entity);
|
||||
EvaluateAdviceTemplate getTemplate(String templateType);
|
||||
void save(EvaluateAdviceTemplate entity);
|
||||
void changeStatus(EvaluateAdviceTemplate entity);
|
||||
void delTemplate(Long id);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.xinelu.familydoctor.service;
|
||||
|
||||
import com.xinelu.familydoctor.entity.EvaluateAnswer;
|
||||
import com.xinelu.familydoctor.entity.EvaluateRecord;
|
||||
import com.xinelu.familydoctor.vo.EvaluateRecordTimelineVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EvaluateRecordService {
|
||||
void submit(EvaluateRecord entity);
|
||||
|
||||
List<EvaluateRecordTimelineVO> getEvaluateTimeline(Long userId);
|
||||
|
||||
List<EvaluateAnswer> getAnswers(Long recordId);
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xinelu.familydoctor.service;
|
||||
|
||||
import com.xinelu.familydoctor.entity.EvaluateSurvey;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EvaluateSurveyService {
|
||||
List<EvaluateSurvey> findList(EvaluateSurvey entity);
|
||||
|
||||
/**
|
||||
* 获取问卷
|
||||
* @param surveySubject 问卷主题
|
||||
* @return {@link com.xinelu.familydoctor.entity.EvaluateSurvey}
|
||||
* @author gaoyu
|
||||
* @date 2023-10-12 17:23
|
||||
*/
|
||||
EvaluateSurvey getSurvey(String surveySubject);
|
||||
|
||||
void insert(EvaluateSurvey entity);
|
||||
|
||||
void update(EvaluateSurvey entity);
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.xinelu.familydoctor.service.impl;
|
||||
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.familydoctor.entity.EvaluateAdviceTemplate;
|
||||
import com.xinelu.familydoctor.mapper.EvaluateAdviceTemplateMapper;
|
||||
import com.xinelu.familydoctor.service.EvaluateAdviceTemplateService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 自我评估处方模板实现类
|
||||
* @date 2023-10-16 16:58
|
||||
*/
|
||||
@Service
|
||||
public class EvaluateAdviceTemplateServiceImpl implements EvaluateAdviceTemplateService {
|
||||
@Resource
|
||||
private EvaluateAdviceTemplateMapper evaluateAdviceTemplateMapper;
|
||||
|
||||
@Override
|
||||
public List<EvaluateAdviceTemplate> findList(EvaluateAdviceTemplate entity) {
|
||||
return evaluateAdviceTemplateMapper.findList(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluateAdviceTemplate getTemplate(String templateType) {
|
||||
return evaluateAdviceTemplateMapper.getTemplateByType(templateType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(EvaluateAdviceTemplate entity) {
|
||||
if (entity.getId() == null) {
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreateBy(SecurityUtils.getUserId());
|
||||
entity.setDelFlag("1");
|
||||
evaluateAdviceTemplateMapper.insert(entity);
|
||||
} else {
|
||||
entity.setUpdateBy(SecurityUtils.getUserId());
|
||||
entity.setUpdateTime(new Date());
|
||||
evaluateAdviceTemplateMapper.update(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeStatus(EvaluateAdviceTemplate entity) {
|
||||
entity.setUpdateBy(SecurityUtils.getUserId());
|
||||
entity.setUpdateTime(new Date());
|
||||
evaluateAdviceTemplateMapper.update(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delTemplate(Long id) {
|
||||
EvaluateAdviceTemplate entity = new EvaluateAdviceTemplate();
|
||||
entity.setId(id);
|
||||
entity.setDelFlag("2");
|
||||
entity.setUpdateBy(SecurityUtils.getUserId());
|
||||
entity.setUpdateTime(new Date());
|
||||
evaluateAdviceTemplateMapper.update(entity);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package com.xinelu.familydoctor.service.impl;
|
||||
|
||||
import com.xinelu.common.utils.DateUtils;
|
||||
import com.xinelu.familydoctor.entity.EvaluateAnswer;
|
||||
import com.xinelu.familydoctor.entity.EvaluateRecord;
|
||||
import com.xinelu.familydoctor.mapper.EvaluateAnswerMapper;
|
||||
import com.xinelu.familydoctor.mapper.EvaluateRecordMapper;
|
||||
import com.xinelu.familydoctor.service.EvaluateRecordService;
|
||||
import com.xinelu.familydoctor.vo.EvaluateRecordResultVO;
|
||||
import com.xinelu.familydoctor.vo.EvaluateRecordTimelineVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 自评记录
|
||||
* @date 2023-10-16 9:23
|
||||
*/
|
||||
@Service
|
||||
public class EvaluateRecordServiceImpl implements EvaluateRecordService {
|
||||
@Resource
|
||||
private EvaluateRecordMapper evaluateRecordMapper;
|
||||
@Resource
|
||||
private EvaluateAnswerMapper evaluateAnswerMapper;
|
||||
|
||||
@Override
|
||||
public void submit(EvaluateRecord entity) {
|
||||
entity.setCreateTime(new Date());
|
||||
evaluateRecordMapper.insert(entity);
|
||||
List<EvaluateAnswer> answers = entity.getAnswers();
|
||||
if (CollectionUtils.isEmpty(answers)) {
|
||||
for (EvaluateAnswer answer : answers) {
|
||||
answer.setRecordId(entity.getId());
|
||||
evaluateAnswerMapper.insert(answer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EvaluateRecordTimelineVO> getEvaluateTimeline(Long userId) {
|
||||
List<EvaluateRecord> records = evaluateRecordMapper.getTimeline(userId);
|
||||
List<EvaluateRecordTimelineVO> timeline = new ArrayList<>();
|
||||
Map<String, List<EvaluateRecordResultVO>> map = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(records)) {
|
||||
records.forEach(r -> {
|
||||
List<EvaluateRecordResultVO> resultList;
|
||||
if (!map.containsKey(DateUtils.formatDate(r.getCreateTime(), "yyyy-MM-dd"))) {
|
||||
resultList = new ArrayList<>();
|
||||
} else {
|
||||
resultList = map.get(DateUtils.formatDate(r.getCreateTime(), "yyyy-MM-dd"));
|
||||
}
|
||||
EvaluateRecordResultVO resultVO = new EvaluateRecordResultVO();
|
||||
resultVO.setRecordId(r.getId());
|
||||
resultVO.setEvaluateResult(r.getEvaluateResult());
|
||||
resultVO.setSurveySubject(r.getSurveySubject());
|
||||
resultVO.setAdvice(r.getAdvice());
|
||||
resultVO.setTime(DateUtils.formatDate(r.getCreateTime(), "HH:mm:ss"));
|
||||
resultVO.setDate(DateUtils.formatDate(r.getCreateTime(), "yyyy-MM-dd"));
|
||||
resultList.add(resultVO);
|
||||
map.put(DateUtils.formatDate(r.getCreateTime(), "yyyy-MM-dd"), resultList);
|
||||
});
|
||||
map.forEach((k, v) -> {
|
||||
EvaluateRecordTimelineVO recordLine = new EvaluateRecordTimelineVO();
|
||||
recordLine.setDate(k);
|
||||
recordLine.setRecords(v);
|
||||
timeline.add(recordLine);
|
||||
});
|
||||
}
|
||||
return timeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EvaluateAnswer> getAnswers(Long recordId) {
|
||||
return evaluateAnswerMapper.getAnswers(recordId);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
package com.xinelu.familydoctor.service.impl;
|
||||
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.familydoctor.entity.EvaluateOption;
|
||||
import com.xinelu.familydoctor.entity.EvaluateQuestion;
|
||||
import com.xinelu.familydoctor.entity.EvaluateSurvey;
|
||||
import com.xinelu.familydoctor.mapper.EvaluateOptionMapper;
|
||||
import com.xinelu.familydoctor.mapper.EvaluateQuestionMapper;
|
||||
import com.xinelu.familydoctor.mapper.EvaluateSurveyMapper;
|
||||
import com.xinelu.familydoctor.service.EvaluateSurveyService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 自评问卷业务实现类
|
||||
* @date 2023-10-11 13:24
|
||||
*/
|
||||
@Service
|
||||
public class EvaluateSurveyServiceImpl implements EvaluateSurveyService {
|
||||
@Resource
|
||||
private EvaluateSurveyMapper evaluateSurveyMapper;
|
||||
@Resource
|
||||
private EvaluateQuestionMapper evaluateQuestionMapper;
|
||||
@Resource
|
||||
private EvaluateOptionMapper evaluateOptionMapper;
|
||||
|
||||
@Override
|
||||
public List<EvaluateSurvey> findList(EvaluateSurvey entity) {
|
||||
return evaluateSurveyMapper.findList(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluateSurvey getSurvey(String surveySubject) {
|
||||
return evaluateSurveyMapper.getSurvey(surveySubject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(EvaluateSurvey entity) {
|
||||
entity.setCreateBy(SecurityUtils.getUserId());
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setDelFlag("1");
|
||||
int row = evaluateSurveyMapper.insert(entity);
|
||||
if (row > 0) {
|
||||
List<EvaluateQuestion> questions = entity.getQuestions();
|
||||
if (!CollectionUtils.isEmpty(questions)) {
|
||||
for (EvaluateQuestion question : questions) {
|
||||
question.setSurveyId(entity.getId());
|
||||
row = evaluateQuestionMapper.insert(question);
|
||||
if (row > 0) {
|
||||
List<EvaluateOption> options = question.getOptions();
|
||||
if (!CollectionUtils.isEmpty(options)) {
|
||||
for (EvaluateOption option : options) {
|
||||
option.setSurveyId(entity.getId());
|
||||
option.setQuestionId(question.getId());
|
||||
evaluateOptionMapper.insert(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(EvaluateSurvey entity) {
|
||||
entity.setUpdateBy(SecurityUtils.getUserId());
|
||||
entity.setUpdateTime(new Date());
|
||||
entity.setDelFlag("1");
|
||||
int row = evaluateSurveyMapper.update(entity);
|
||||
if (row > 0) {
|
||||
List<EvaluateQuestion> questions = entity.getQuestions();
|
||||
if (!CollectionUtils.isEmpty(questions)) {
|
||||
evaluateQuestionMapper.clearSurveyId(entity.getId());
|
||||
for (EvaluateQuestion question : questions) {
|
||||
question.setSurveyId(entity.getId());
|
||||
if (Objects.isNull(question.getId())) {
|
||||
row = evaluateQuestionMapper.insert(question);
|
||||
} else {
|
||||
row = evaluateQuestionMapper.update(question);
|
||||
}
|
||||
if (row > 0) {
|
||||
List<EvaluateOption> options = question.getOptions();
|
||||
if (!CollectionUtils.isEmpty(options)) {
|
||||
evaluateOptionMapper.clearRelationId(question.getId(), entity.getId());
|
||||
for (EvaluateOption option : options) {
|
||||
option.setSurveyId(entity.getId());
|
||||
option.setQuestionId(question.getId());
|
||||
if (Objects.isNull(option.getId())) {
|
||||
evaluateOptionMapper.insert(option);
|
||||
} else {
|
||||
evaluateOptionMapper.update(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xinelu.familydoctor.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 自评记录结果视图
|
||||
* @date 2023-10-16 11:38
|
||||
*/
|
||||
@ApiModel("自评记录结果视图")
|
||||
@Data
|
||||
public class EvaluateRecordResultVO {
|
||||
private Long recordId;
|
||||
private String surveySubject;
|
||||
private String evaluateResult;
|
||||
private String advice;
|
||||
private String time;
|
||||
private String date;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xinelu.familydoctor.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 评估记录时间轴视图
|
||||
* @date 2023-10-16 11:30
|
||||
*/
|
||||
@ApiModel("评估记录时间轴视图")
|
||||
@Data
|
||||
public class EvaluateRecordTimelineVO {
|
||||
private String date;
|
||||
private List<EvaluateRecordResultVO> records;
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
<?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.xinelu.familydoctor.mapper.EvaluateAdviceTemplateMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xinelu.familydoctor.entity.EvaluateAdviceTemplate">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="templateType" column="template_type" jdbcType="VARCHAR"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="useFlag" column="use_flag" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="BIGINT"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="BIGINT"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,template_type,content,
|
||||
use_flag,create_time,create_by,
|
||||
update_time,update_by,remark,
|
||||
del_flag
|
||||
</sql>
|
||||
|
||||
<select id="findList" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from evaluate_advice_template
|
||||
where del_flag = '1'
|
||||
<if test="templateType != null and templateType != ''">
|
||||
and template_type = #{templateType}
|
||||
</if>
|
||||
<if test="useFlag != null and useFlag != ''">
|
||||
and use_flag = #{useFlag}
|
||||
</if>
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
<select id="getTemplateByType" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" /> from evaluate_advice_template
|
||||
where del_flag = '1'
|
||||
and use_flag = '1'
|
||||
and template_type = #{templateType}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.familydoctor.entity.EvaluateAdviceTemplate" useGeneratedKeys="true">
|
||||
insert into evaluate_advice_template
|
||||
( id,template_type,content
|
||||
,use_flag,create_time,create_by
|
||||
,update_time,update_by,remark
|
||||
,del_flag)
|
||||
values (#{id,jdbcType=BIGINT},#{templateType,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR}
|
||||
,#{useFlag,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{createBy,jdbcType=BIGINT}
|
||||
,#{updateTime,jdbcType=TIMESTAMP},#{updateBy,jdbcType=BIGINT},#{remark,jdbcType=VARCHAR}
|
||||
,#{delFlag,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<update id="update" parameterType="com.xinelu.familydoctor.entity.EvaluateAdviceTemplate">
|
||||
update evaluate_advice_template
|
||||
<set>
|
||||
<if test="templateType != null">
|
||||
template_type = #{templateType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="content != null">
|
||||
content = #{content,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="useFlag != null">
|
||||
use_flag = #{useFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -0,0 +1,51 @@
|
||||
<?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.xinelu.familydoctor.mapper.EvaluateAnswerMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xinelu.familydoctor.entity.EvaluateAnswer">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="recordId" column="record_id" jdbcType="BIGINT"/>
|
||||
<result property="questionId" column="question_id" jdbcType="BIGINT"/>
|
||||
<result property="optionId" column="option_id" jdbcType="BIGINT"/>
|
||||
<result property="optionContent" column="option_content" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,record_id,question_id,
|
||||
option_id,option_content
|
||||
</sql>
|
||||
|
||||
<select id="getAnswers" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" />
|
||||
from evaluate_answer
|
||||
where record_id = #{recordId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.familydoctor.entity.EvaluateAnswer" useGeneratedKeys="true">
|
||||
insert into evaluate_answer
|
||||
(record_id,question_id
|
||||
,option_id,option_content)
|
||||
values (#{recordId,jdbcType=BIGINT},#{questionId,jdbcType=BIGINT}
|
||||
,#{optionId,jdbcType=BIGINT},#{optionContent,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<update id="update" parameterType="com.xinelu.familydoctor.entity.EvaluateAnswer">
|
||||
update evaluate_answer
|
||||
<set>
|
||||
<if test="recordId != null">
|
||||
record_id = #{recordId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="questionId != null">
|
||||
question_id = #{questionId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="optionId != null">
|
||||
option_id = #{optionId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="optionContent != null">
|
||||
option_content = #{optionContent,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -0,0 +1,57 @@
|
||||
<?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.xinelu.familydoctor.mapper.EvaluateOptionMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xinelu.familydoctor.entity.EvaluateOption">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="questionId" column="question_id" jdbcType="BIGINT"/>
|
||||
<result property="surveyId" column="survey_id" jdbcType="BIGINT"/>
|
||||
<result property="optionName" column="option_name" jdbcType="VARCHAR"/>
|
||||
<result property="optionSort" column="option_sort" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,question_id,survey_id,
|
||||
option_name,option_sort
|
||||
</sql>
|
||||
|
||||
<select id="getOptions" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from evaluate_option
|
||||
where question_id = #{questionId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.familydoctor.entity.EvaluateOption" useGeneratedKeys="true">
|
||||
insert into evaluate_option
|
||||
(question_id,survey_id
|
||||
,option_name,option_sort)
|
||||
values (#{questionId,jdbcType=BIGINT},#{surveyId,jdbcType=BIGINT}
|
||||
,#{optionName,jdbcType=VARCHAR},#{optionSort,jdbcType=INTEGER})
|
||||
</insert>
|
||||
<update id="update" parameterType="com.xinelu.familydoctor.entity.EvaluateOption">
|
||||
update evaluate_option
|
||||
<set>
|
||||
<if test="questionId != null">
|
||||
question_id = #{questionId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="surveyId != null">
|
||||
survey_id = #{surveyId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="optionName != null">
|
||||
option_name = #{optionName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="optionSort != null">
|
||||
option_sort = #{optionSort,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<update id="clearRelationId">
|
||||
update evaluate_option set question_id = null, survey_id = null
|
||||
where question_id = #{questionId,jdbcType=BIGINT} and survey_id = #{surveyId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -0,0 +1,64 @@
|
||||
<?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.xinelu.familydoctor.mapper.EvaluateQuestionMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xinelu.familydoctor.entity.EvaluateQuestion">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="surveyId" column="survey_id" jdbcType="BIGINT"/>
|
||||
<result property="questionName" column="question_name" jdbcType="VARCHAR"/>
|
||||
<result property="questionType" column="question_type" jdbcType="VARCHAR"/>
|
||||
<result property="questionSort" column="question_sort" jdbcType="INTEGER"/>
|
||||
<result property="requiredFlag" column="required_flag" jdbcType="VARCHAR"/>
|
||||
<collection property="options" ofType="com.xinelu.familydoctor.entity.EvaluateOption"
|
||||
column="id" select="com.xinelu.familydoctor.mapper.EvaluateOptionMapper.getOptions">
|
||||
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
t1.id,t1.survey_id,t1.question_name,
|
||||
t1.question_type,t1.question_sort,t1.required_flag
|
||||
</sql>
|
||||
|
||||
<select id="getQuestions" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from evaluate_question
|
||||
where survey_id = #{surveyId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.familydoctor.entity.EvaluateQuestion" useGeneratedKeys="true">
|
||||
insert into evaluate_question
|
||||
(survey_id,question_name
|
||||
,question_type,question_sort,required_flag)
|
||||
values (#{surveyId,jdbcType=BIGINT},#{questionName,jdbcType=VARCHAR}
|
||||
,#{questionType,jdbcType=VARCHAR},#{questionSort,jdbcType=INTEGER},#{requiredFlag,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<update id="update" parameterType="com.xinelu.familydoctor.entity.EvaluateQuestion">
|
||||
update evaluate_question
|
||||
<set>
|
||||
<if test="surveyId != null">
|
||||
survey_id = #{surveyId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="questionName != null">
|
||||
question_name = #{questionName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="questionType != null">
|
||||
question_type = #{questionType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="questionSort != null">
|
||||
question_sort = #{questionSort,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="requiredFlag != null">
|
||||
required_flag = #{requiredFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<update id="clearSurveyId">
|
||||
update evaluate_question set survey_id = null where survey_id = #{surveyId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -0,0 +1,37 @@
|
||||
<?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.xinelu.familydoctor.mapper.EvaluateRecordMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xinelu.familydoctor.entity.EvaluateRecord">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="userId" column="user_id" jdbcType="BIGINT"/>
|
||||
<result property="surveyId" column="survey_id" jdbcType="BIGINT"/>
|
||||
<result property="surveySubject" column="survey_subject" jdbcType="VARCHAR"/>
|
||||
<result property="evaluateResult" column="evaluate_result" jdbcType="VARCHAR"/>
|
||||
<result property="advice" column="advice" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_id,survey_id,survey_subject,
|
||||
evaluate_result,advice,create_time
|
||||
</sql>
|
||||
|
||||
<select id="getTimeline" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" /> from evaluate_record
|
||||
where user_id = #{userId}
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.familydoctor.entity.EvaluateRecord" useGeneratedKeys="true">
|
||||
insert into evaluate_record
|
||||
(user_id,survey_id,survey_subject
|
||||
,evaluate_result,advice,create_time
|
||||
)
|
||||
values (#{userId,jdbcType=BIGINT},#{surveyId,jdbcType=BIGINT},#{surveySubject,jdbcType=VARCHAR}
|
||||
,#{evaluateResult,jdbcType=VARCHAR},#{advice,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
||||
@ -0,0 +1,92 @@
|
||||
<?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.xinelu.familydoctor.mapper.EvaluateSurveyMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xinelu.familydoctor.entity.EvaluateSurvey">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="surveySubject" column="survey_subject" jdbcType="VARCHAR"/>
|
||||
<result property="useFlag" column="use_flag" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="BIGINT"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="BIGINT"/>
|
||||
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<collection property="questions" ofType="com.xinelu.familydoctor.entity.EvaluateQuestion"
|
||||
column="id" select="com.xinelu.familydoctor.mapper.EvaluateQuestionMapper.getQuestions">
|
||||
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,survey_name,use_flag,
|
||||
create_time,create_by,update_time,
|
||||
update_by,del_flag,remark
|
||||
</sql>
|
||||
|
||||
<select id="findList" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" />
|
||||
from evaluate_survey
|
||||
where del_flag = '1'
|
||||
<if test="surveySubject != null and surveySubject != ''">
|
||||
and survey_subject = #{surveySubject}
|
||||
</if>
|
||||
<if test="useFlag != null and useFlag != ''">
|
||||
and use_flag = #{useFlag}
|
||||
</if>
|
||||
order by id
|
||||
</select>
|
||||
|
||||
<select id="getSurvey" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from evaluate_survey
|
||||
where survey_subject = #{surveySubject}
|
||||
and del_flag = '1'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.familydoctor.entity.EvaluateSurvey" useGeneratedKeys="true">
|
||||
insert into evaluate_survey
|
||||
(survey_subject,use_flag
|
||||
,create_time,create_by,update_time
|
||||
,update_by,del_flag,remark
|
||||
)
|
||||
values (#{surveySubject,jdbcType=VARCHAR},#{useFlag,jdbcType=VARCHAR}
|
||||
,#{createTime,jdbcType=TIMESTAMP},#{createBy,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP}
|
||||
,#{updateBy,jdbcType=BIGINT},#{delFlag,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<update id="update" parameterType="com.xinelu.familydoctor.entity.EvaluateSurvey">
|
||||
update evaluate_survey
|
||||
<set>
|
||||
<if test="surveyName != null">
|
||||
survey_subject = #{surveySubject,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="useFlag != null">
|
||||
use_flag = #{useFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user