Browse Source

修改药物使用相关接口

master
ma 4 years ago
parent
commit
e83474b55a
  1. 11
      src/main/java/com/ccsens/yanyuan/api/MedicineUseController.java
  2. 14
      src/main/java/com/ccsens/yanyuan/bean/dto/MedicineDto.java
  3. 11
      src/main/java/com/ccsens/yanyuan/bean/po/FollowUp.java
  4. 60
      src/main/java/com/ccsens/yanyuan/bean/po/FollowUpExample.java
  5. 8
      src/main/java/com/ccsens/yanyuan/bean/vo/MedicineVo.java
  6. 4
      src/main/java/com/ccsens/yanyuan/persist/dao/FollowUpDao.java
  7. 4
      src/main/java/com/ccsens/yanyuan/service/IMedicineService.java
  8. 13
      src/main/java/com/ccsens/yanyuan/service/MedicineService.java
  9. 3
      src/main/resources/mapper_dao/FollowUpDao.xml
  10. 54
      src/main/resources/mapper_raw/FollowUpMapper.xml
  11. 2
      src/main/resources/mbg.xml

11
src/main/java/com/ccsens/yanyuan/api/MedicineUseController.java

@ -5,9 +5,7 @@ import com.ccsens.util.CodeError;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.yanyuan.bean.dto.MedicineDto;
import com.ccsens.yanyuan.bean.dto.ToolDto;
import com.ccsens.yanyuan.bean.vo.MedicineVo;
import com.ccsens.yanyuan.bean.vo.ToolVo;
import com.ccsens.yanyuan.service.IMedicineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -20,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
@ -37,11 +36,11 @@ public class MedicineUseController {
@MustLogin
@ApiOperation(value = "查询药物使用", notes = "查询药物使用")
@RequestMapping(value = "/query", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<MedicineVo.MedicineUse> queryMedicineUse(@ApiParam @Validated @RequestBody QueryDto<MedicineDto.QueryMedicineUse> params) throws Exception{
public JsonResponse<List<MedicineVo.MedicineUse>> queryMedicineUse(@ApiParam @Validated @RequestBody QueryDto<MedicineDto.QueryMedicineUse> params) throws Exception{
log.info("查询药物使用:{}",params);
MedicineVo.MedicineUse medicineUse = medicineService.queryMedicineUse(params.getParam(),params.getUserId());
log.info("查询药物使用结束{}",medicineUse);
return JsonResponse.newInstance().ok(medicineUse);
List<MedicineVo.MedicineUse> medicineUses = medicineService.queryMedicineUse(params.getParam(), params.getUserId());
log.info("查询药物使用结束{}",medicineUses);
return JsonResponse.newInstance().ok(medicineUses);
}
@MustLogin

14
src/main/java/com/ccsens/yanyuan/bean/dto/MedicineDto.java

@ -1,5 +1,6 @@
package com.ccsens.yanyuan.bean.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -22,16 +23,17 @@ public class MedicineDto {
public static class AddMedicineUse {
@ApiModelProperty("项目id(使用者id)")
private Long projectId;
@ApiModelProperty("是否测评")
private String isTest;
@ApiModelProperty("是否测评(0否1是)")
private Byte isTest;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("测试时间")
private Date testAt;
@ApiModelProperty("Mmse得分")
private String mmseScore;
@ApiModelProperty("moca得分")
private String mocaScore;
@ApiModelProperty("adl得分")
private String adlScore;
@ApiModelProperty("adi得分")
private String adiScore;
@ApiModelProperty("npi得分")
private String npiScore;
@ApiModelProperty("总分")
@ -67,8 +69,8 @@ public class MedicineDto {
private String mmseScore;
@ApiModelProperty("moca得分")
private String mocaScore;
@ApiModelProperty("adl得分")
private String adlScore;
@ApiModelProperty("adi得分")
private String adiScore;
@ApiModelProperty("npi得分")
private String npiScore;
@ApiModelProperty("总分")

11
src/main/java/com/ccsens/yanyuan/bean/po/FollowUp.java

@ -8,6 +8,8 @@ public class FollowUp implements Serializable {
private String userId;
private Long recordUserId;
private Byte isTest;
private Date testAt;
@ -64,6 +66,14 @@ public class FollowUp implements Serializable {
this.userId = userId == null ? null : userId.trim();
}
public Long getRecordUserId() {
return recordUserId;
}
public void setRecordUserId(Long recordUserId) {
this.recordUserId = recordUserId;
}
public Byte getIsTest() {
return isTest;
}
@ -224,6 +234,7 @@ public class FollowUp implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", recordUserId=").append(recordUserId);
sb.append(", isTest=").append(isTest);
sb.append(", testAt=").append(testAt);
sb.append(", mmseScore=").append(mmseScore);

60
src/main/java/com/ccsens/yanyuan/bean/po/FollowUpExample.java

@ -245,6 +245,66 @@ public class FollowUpExample {
return (Criteria) this;
}
public Criteria andRecordUserIdIsNull() {
addCriterion("record_user_id is null");
return (Criteria) this;
}
public Criteria andRecordUserIdIsNotNull() {
addCriterion("record_user_id is not null");
return (Criteria) this;
}
public Criteria andRecordUserIdEqualTo(Long value) {
addCriterion("record_user_id =", value, "recordUserId");
return (Criteria) this;
}
public Criteria andRecordUserIdNotEqualTo(Long value) {
addCriterion("record_user_id <>", value, "recordUserId");
return (Criteria) this;
}
public Criteria andRecordUserIdGreaterThan(Long value) {
addCriterion("record_user_id >", value, "recordUserId");
return (Criteria) this;
}
public Criteria andRecordUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("record_user_id >=", value, "recordUserId");
return (Criteria) this;
}
public Criteria andRecordUserIdLessThan(Long value) {
addCriterion("record_user_id <", value, "recordUserId");
return (Criteria) this;
}
public Criteria andRecordUserIdLessThanOrEqualTo(Long value) {
addCriterion("record_user_id <=", value, "recordUserId");
return (Criteria) this;
}
public Criteria andRecordUserIdIn(List<Long> values) {
addCriterion("record_user_id in", values, "recordUserId");
return (Criteria) this;
}
public Criteria andRecordUserIdNotIn(List<Long> values) {
addCriterion("record_user_id not in", values, "recordUserId");
return (Criteria) this;
}
public Criteria andRecordUserIdBetween(Long value1, Long value2) {
addCriterion("record_user_id between", value1, value2, "recordUserId");
return (Criteria) this;
}
public Criteria andRecordUserIdNotBetween(Long value1, Long value2) {
addCriterion("record_user_id not between", value1, value2, "recordUserId");
return (Criteria) this;
}
public Criteria andIsTestIsNull() {
addCriterion("is_test is null");
return (Criteria) this;

8
src/main/java/com/ccsens/yanyuan/bean/vo/MedicineVo.java

@ -1,5 +1,6 @@
package com.ccsens.yanyuan.bean.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -17,14 +18,15 @@ public class MedicineVo {
private String id;
@ApiModelProperty("是否测评")
private String isTest;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("测试时间")
private Date testAt;
@ApiModelProperty("Mmse得分")
private String mmseScore;
@ApiModelProperty("moca得分")
private String mocaScore;
@ApiModelProperty("adl得分")
private String adlScore;
@ApiModelProperty("adi得分")
private String adiScore;
@ApiModelProperty("npi得分")
private String npiScore;
@ApiModelProperty("总分")
@ -45,5 +47,7 @@ public class MedicineVo {
private String sevName;
@ApiModelProperty("其他药物服用情况")
private String sevMedicine;
@ApiModelProperty("记录者userId")
private Long recordUserId;
}
}

4
src/main/java/com/ccsens/yanyuan/persist/dao/FollowUpDao.java

@ -5,6 +5,8 @@ import com.ccsens.yanyuan.persist.mapper.FollowUpMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@ -16,5 +18,5 @@ public interface FollowUpDao extends FollowUpMapper {
* @param uuId 使用者uuid
* @return 使用者用药情况
*/
MedicineVo.MedicineUse queryByUserId(@Param("userId") String uuId);
List<MedicineVo.MedicineUse> queryByUserId(@Param("userId") String uuId);
}

4
src/main/java/com/ccsens/yanyuan/service/IMedicineService.java

@ -4,6 +4,8 @@ import com.ccsens.util.CodeError;
import com.ccsens.yanyuan.bean.dto.MedicineDto;
import com.ccsens.yanyuan.bean.vo.MedicineVo;
import java.util.List;
/**
* @author AUSU
*/
@ -15,7 +17,7 @@ public interface IMedicineService {
* @param userId 用户id
* @return 药物使用记录
*/
MedicineVo.MedicineUse queryMedicineUse(MedicineDto.QueryMedicineUse param, Long userId);
List<MedicineVo.MedicineUse> queryMedicineUse(MedicineDto.QueryMedicineUse param, Long userId);
/**
* 添加药物使用记录

13
src/main/java/com/ccsens/yanyuan/service/MedicineService.java

@ -4,6 +4,7 @@ package com.ccsens.yanyuan.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.util.CodeError;
import com.ccsens.util.RedisUtil;
import com.ccsens.yanyuan.bean.dto.MedicineDto;
@ -17,6 +18,8 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Slf4j
@ -32,18 +35,21 @@ public class MedicineService implements IMedicineService {
private RedisUtil redisUtil;
@Override
public MedicineVo.MedicineUse queryMedicineUse(MedicineDto.QueryMedicineUse param, Long userId) {
public List<MedicineVo.MedicineUse> queryMedicineUse(MedicineDto.QueryMedicineUse param, Long userId) {
String uuId = userYDao.queryUUIdById(param.getProjectId());
return followUpDao.queryByUserId(uuId);
}
@Override
public CodeError.Code addMedicineUse(MedicineDto.AddMedicineUse param, Long userId) {
String uuIdById = userYDao.queryUUIdById(userId);
String uuIdById = userYDao.queryUUIdById(param.getProjectId());
FollowUp followUp = new FollowUp();
BeanUtil.copyProperties(param,followUp);
followUp.setId(UUID.randomUUID().toString());
followUp.setUserId(uuIdById);
followUp.setAdlScore(param.getAdiScore());
followUp.setStatus((byte)1);
followUp.setRecordUserId(userId);
followUpDao.insertSelective(followUp);
return CodeError.SUCCESS;
}
@ -56,6 +62,9 @@ public class MedicineService implements IMedicineService {
FollowUp followUp = new FollowUp();
BeanUtil.copyProperties(param,followUp);
followUp.setId(param.getId());
if (StrUtil.isNotBlank(param.getAdiScore())) {
followUp.setAdlScore(param.getAdiScore());
}
followUpDao.updateByPrimaryKeySelective(followUp);
redisUtil.del(param.getId());
}

3
src/main/resources/mapper_dao/FollowUpDao.xml

@ -7,11 +7,12 @@
SELECT
id,
user_id,
test_at,
is_test,
test_at,
mmse_score,
moca_score,
adl_score,
adl_score AS adiScore,
npi_score,
total_score,
first_medicine,

54
src/main/resources/mapper_raw/FollowUpMapper.xml

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.ccsens.yanyuan.bean.po.FollowUp">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="record_user_id" jdbcType="BIGINT" property="recordUserId" />
<result column="is_test" jdbcType="TINYINT" property="isTest" />
<result column="test_at" jdbcType="TIMESTAMP" property="testAt" />
<result column="mmse_score" jdbcType="VARCHAR" property="mmseScore" />
@ -83,9 +84,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, is_test, test_at, mmse_score, moca_score, adl_score, npi_score, total_score,
first_medicine, second_medicine, third_medicine, forth_medicine, fifth_medicine,
sixth_medicine, sev_name, sev_medicine, create_at, update_at, status, rec_status
id, user_id, record_user_id, is_test, test_at, mmse_score, moca_score, adl_score,
npi_score, total_score, first_medicine, second_medicine, third_medicine, forth_medicine,
fifth_medicine, sixth_medicine, sev_name, sev_medicine, create_at, update_at, status,
rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.yanyuan.bean.po.FollowUpExample" resultMap="BaseResultMap">
select
@ -118,22 +120,22 @@
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.yanyuan.bean.po.FollowUp">
insert into u_follow_up (id, user_id, is_test,
test_at, mmse_score, moca_score,
adl_score, npi_score, total_score,
first_medicine, second_medicine, third_medicine,
forth_medicine, fifth_medicine, sixth_medicine,
sev_name, sev_medicine, create_at,
update_at, status, rec_status
)
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{isTest,jdbcType=TINYINT},
#{testAt,jdbcType=TIMESTAMP}, #{mmseScore,jdbcType=VARCHAR}, #{mocaScore,jdbcType=VARCHAR},
#{adlScore,jdbcType=VARCHAR}, #{npiScore,jdbcType=VARCHAR}, #{totalScore,jdbcType=VARCHAR},
#{firstMedicine,jdbcType=VARCHAR}, #{secondMedicine,jdbcType=VARCHAR}, #{thirdMedicine,jdbcType=VARCHAR},
#{forthMedicine,jdbcType=VARCHAR}, #{fifthMedicine,jdbcType=VARCHAR}, #{sixthMedicine,jdbcType=VARCHAR},
#{sevName,jdbcType=VARCHAR}, #{sevMedicine,jdbcType=VARCHAR}, #{createAt,jdbcType=TIMESTAMP},
#{updateAt,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT}, #{recStatus,jdbcType=TINYINT}
)
insert into u_follow_up (id, user_id, record_user_id,
is_test, test_at, mmse_score,
moca_score, adl_score, npi_score,
total_score, first_medicine, second_medicine,
third_medicine, forth_medicine, fifth_medicine,
sixth_medicine, sev_name, sev_medicine,
create_at, update_at, status,
rec_status)
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{recordUserId,jdbcType=BIGINT},
#{isTest,jdbcType=TINYINT}, #{testAt,jdbcType=TIMESTAMP}, #{mmseScore,jdbcType=VARCHAR},
#{mocaScore,jdbcType=VARCHAR}, #{adlScore,jdbcType=VARCHAR}, #{npiScore,jdbcType=VARCHAR},
#{totalScore,jdbcType=VARCHAR}, #{firstMedicine,jdbcType=VARCHAR}, #{secondMedicine,jdbcType=VARCHAR},
#{thirdMedicine,jdbcType=VARCHAR}, #{forthMedicine,jdbcType=VARCHAR}, #{fifthMedicine,jdbcType=VARCHAR},
#{sixthMedicine,jdbcType=VARCHAR}, #{sevName,jdbcType=VARCHAR}, #{sevMedicine,jdbcType=VARCHAR},
#{createAt,jdbcType=TIMESTAMP}, #{updateAt,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT},
#{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.yanyuan.bean.po.FollowUp">
insert into u_follow_up
@ -144,6 +146,9 @@
<if test="userId != null">
user_id,
</if>
<if test="recordUserId != null">
record_user_id,
</if>
<if test="isTest != null">
is_test,
</if>
@ -209,6 +214,9 @@
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="recordUserId != null">
#{recordUserId,jdbcType=BIGINT},
</if>
<if test="isTest != null">
#{isTest,jdbcType=TINYINT},
</if>
@ -283,6 +291,9 @@
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.recordUserId != null">
record_user_id = #{record.recordUserId,jdbcType=BIGINT},
</if>
<if test="record.isTest != null">
is_test = #{record.isTest,jdbcType=TINYINT},
</if>
@ -349,6 +360,7 @@
update u_follow_up
set id = #{record.id,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
record_user_id = #{record.recordUserId,jdbcType=BIGINT},
is_test = #{record.isTest,jdbcType=TINYINT},
test_at = #{record.testAt,jdbcType=TIMESTAMP},
mmse_score = #{record.mmseScore,jdbcType=VARCHAR},
@ -378,6 +390,9 @@
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="recordUserId != null">
record_user_id = #{recordUserId,jdbcType=BIGINT},
</if>
<if test="isTest != null">
is_test = #{isTest,jdbcType=TINYINT},
</if>
@ -441,6 +456,7 @@
<update id="updateByPrimaryKey" parameterType="com.ccsens.yanyuan.bean.po.FollowUp">
update u_follow_up
set user_id = #{userId,jdbcType=VARCHAR},
record_user_id = #{recordUserId,jdbcType=BIGINT},
is_test = #{isTest,jdbcType=TINYINT},
test_at = #{testAt,jdbcType=TIMESTAMP},
mmse_score = #{mmseScore,jdbcType=VARCHAR},

2
src/main/resources/mbg.xml

@ -55,7 +55,7 @@
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<table tableName="u_user_scan_tool" domainObjectName="UserScanTool"></table>
<table tableName="u_follow_up" domainObjectName="FollowUp"></table>
<!-- <table tableName="u_mental_test" domainObjectName="MentalTest"></table>-->
<!-- <table tableName="u_mental_test" domainObjectName="MentalTest"></table>-->
<!--<table tableName="s_config" domainObjectName="Config"></table>

Loading…
Cancel
Save