健康报告查询接口

This commit is contained in:
limqhz
2021-03-08 00:08:14 +08:00
parent d35edae11e
commit 2ec2494a01
6 changed files with 216 additions and 354 deletions

View File

@@ -1,12 +1,18 @@
package com.sv.entity;
import java.io.Serializable;
import java.util.Date;
public class HealthDoc {
public class HealthDoc implements Serializable {
private Integer id;
private Integer memberId;
/**
* 用户昵称
*/
private String nickName;
private String docName;
private String docType;
@@ -56,6 +62,14 @@ public class HealthDoc {
this.memberId = memberId;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getDocName() {
return docName;
}
@@ -119,4 +133,4 @@ public class HealthDoc {
public void setDeleted(Byte deleted) {
this.deleted = deleted;
}
}
}

View File

@@ -0,0 +1,54 @@
package com.sv.oms.controller;
import com.sv.entity.HealthDoc;
import com.sv.service.common.MemberHealthDocService;
import com.ydd.framework.core.common.Pagination;
import com.ydd.framework.core.common.dto.ResponseDTO;
import com.ydd.oms.controller.OmsController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* Controller - 用户健康报告
*
* @author limqhz
*/
@RestController
public class MemberHealthDocController extends OmsController {
private final Logger logger = LoggerFactory.getLogger(MemberHealthDocController.class);
@Resource
private MemberHealthDocService memberHealthDocService;
/**
* 分页查询用户会员卡
*/
@RequestMapping(value = "/member/health/docs", method = RequestMethod.GET)
public ResponseDTO findPage(Pagination pagination) {
return ResponseDTO.ok()
.setPagination(memberHealthDocService.findPage(pagination));
}
/**
* 保存用户会员卡
*/
@RequestMapping(value = "/member/health/save", method = RequestMethod.POST)
public ResponseDTO save(HealthDoc healthDoc) {
memberHealthDocService.save(healthDoc);
return ResponseDTO.ok("保存成功");
}
/**
* 删除用户会员卡
*/
@RequestMapping(value = "/member/health/delete", method = RequestMethod.POST)
public ResponseDTO delete(@RequestParam("id") Integer id) {
memberHealthDocService.delete(id);
return ResponseDTO.ok("删除成功");
}
}

View File

@@ -1,6 +1,9 @@
package com.sv.mapper;
import com.sv.entity.HealthDoc;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface HealthDocMapper {
int deleteByPrimaryKey(Integer id);
@@ -14,4 +17,6 @@ public interface HealthDocMapper {
int updateByPrimaryKeySelective(HealthDoc record);
int updateByPrimaryKey(HealthDoc record);
}
List<HealthDoc> findMemAll();
}

View File

@@ -0,0 +1,66 @@
package com.sv.service.common;
import com.github.pagehelper.PageHelper;
import com.sv.entity.HealthDoc;
import com.sv.mapper.HealthDocMapper;
import com.ydd.framework.core.common.Pagination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Service - 用户会员卡
*
* @author yechanglin
* @since 2018-08-02
*/
@Service
@Transactional
public class MemberHealthDocService extends MemberCardCommonService {
private final Logger logger = LoggerFactory.getLogger(MemberHealthDocService.class);
@Resource
private HealthDocMapper healthDocMapper;
/**
* 上传健康报告
*
* @param healthDoc 健康报告
*/
@Transactional
public void save(HealthDoc healthDoc) {
healthDocMapper.insert(healthDoc);
}
/**
* 删除用户健康报告
*
* @param id 编号
* @return 删除数量
*/
public Integer delete(Integer id) {
if (id == null || id <= 0) {
return 0;
}
return healthDocMapper.deleteByPrimaryKey(id);
}
/**
* 查询用户健康报告
*
* @param pagination 分页信息
* @return 分页结果
*/
public Pagination findPage(Pagination pagination) {
PageHelper.startPage(pagination.getPage(), pagination.getPageSize());
PageHelper.orderBy("id desc");
pagination.setQueryResult(healthDocMapper.findMemAll());
return pagination;
}
}

View File

@@ -1,434 +1,153 @@
<?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.sv.mapper.HealthDocMapper">
<resultMap id="BaseResultMap" type="com.sv.entity.HealthDoc">
<constructor>
<idArg column="id" javaType="java.lang.Integer" jdbcType="INTEGER" />
<arg column="member_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
<arg column="doc_name" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="doc_type" javaType="java.lang.String" jdbcType="CHAR" />
<arg column="file_type" javaType="java.lang.String" jdbcType="CHAR" />
<arg column="doc_path" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="platform_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
<arg column="created_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
<arg column="modified_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
<arg column="deleted" javaType="java.lang.Byte" jdbcType="TINYINT" />
<?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.sv.mapper.HealthDocMapper" >
<resultMap id="BaseResultMap" type="com.sv.entity.HealthDoc" >
<constructor >
<idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="member_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="doc_name" jdbcType="VARCHAR" javaType="java.lang.String" />
<arg column="doc_type" jdbcType="CHAR" javaType="java.lang.String" />
<arg column="file_type" jdbcType="CHAR" javaType="java.lang.String" />
<arg column="doc_path" jdbcType="VARCHAR" javaType="java.lang.String" />
<arg column="platform_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
<arg column="created_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
<arg column="modified_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
<arg column="deleted" jdbcType="TINYINT" javaType="java.lang.Byte" />
</constructor>
</resultMap>
<sql id="Base_Column_List">
id, member_id, doc_name, doc_type, file_type, doc_path, platform_id, created_time,
<sql id="Base_Column_List" >
id, member_id, doc_name, doc_type, file_type, doc_path, platform_id, created_time,
modified_time, deleted
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sv_health_docs
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sv_health_docs
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.sv.entity.HealthDoc">
insert into sv_health_docs (id, member_id, doc_name,
doc_type, file_type, doc_path,
platform_id, created_time, modified_time,
deleted)
values (#{id,jdbcType=INTEGER}, #{memberId,jdbcType=INTEGER}, #{docName,jdbcType=VARCHAR},
#{docType,jdbcType=CHAR}, #{fileType,jdbcType=CHAR}, #{docPath,jdbcType=VARCHAR},
#{platformId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP},
#{deleted,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.sv.entity.HealthDoc">
insert into sv_health_docs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="memberId != null">
member_id,
</if>
<if test="docName != null">
doc_name,
</if>
<if test="docType != null">
doc_type,
</if>
<if test="fileType != null">
file_type,
</if>
<if test="docPath != null">
doc_path,
</if>
<if test="platformId != null">
platform_id,
</if>
<if test="createdTime != null">
created_time,
</if>
<if test="modifiedTime != null">
modified_time,
</if>
<if test="deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="memberId != null">
#{memberId,jdbcType=INTEGER},
</if>
<if test="docName != null">
#{docName,jdbcType=VARCHAR},
</if>
<if test="docType != null">
#{docType,jdbcType=CHAR},
</if>
<if test="fileType != null">
#{fileType,jdbcType=CHAR},
</if>
<if test="docPath != null">
#{docPath,jdbcType=VARCHAR},
</if>
<if test="platformId != null">
#{platformId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedTime != null">
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
#{deleted,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.sv.entity.HealthDoc">
update sv_health_docs
<set>
<if test="memberId != null">
member_id = #{memberId,jdbcType=INTEGER},
</if>
<if test="docName != null">
doc_name = #{docName,jdbcType=VARCHAR},
</if>
<if test="docType != null">
doc_type = #{docType,jdbcType=CHAR},
</if>
<if test="fileType != null">
file_type = #{fileType,jdbcType=CHAR},
</if>
<if test="docPath != null">
doc_path = #{docPath,jdbcType=VARCHAR},
</if>
<if test="platformId != null">
platform_id = #{platformId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedTime != null">
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.sv.entity.HealthDoc">
update sv_health_docs
set member_id = #{memberId,jdbcType=INTEGER},
doc_name = #{docName,jdbcType=VARCHAR},
doc_type = #{docType,jdbcType=CHAR},
file_type = #{fileType,jdbcType=CHAR},
doc_path = #{docPath,jdbcType=VARCHAR},
platform_id = #{platformId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
deleted = #{deleted,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
<resultMap id="BaseResultMap" type="com.sv.entity.HealthDoc">
<constructor>
<idArg column="id" javaType="java.lang.Integer" jdbcType="INTEGER" />
<arg column="member_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
<arg column="doc_name" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="doc_type" javaType="java.lang.String" jdbcType="CHAR" />
<arg column="file_type" javaType="java.lang.String" jdbcType="CHAR" />
<arg column="doc_path" javaType="java.lang.String" jdbcType="VARCHAR" />
<arg column="platform_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
<arg column="created_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
<arg column="modified_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
<arg column="deleted" javaType="java.lang.Byte" jdbcType="TINYINT" />
</constructor>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, member_id, doc_name, doc_type, file_type, doc_path, platform_id, created_time,
modified_time, deleted
</sql>
<select id="selectByExample" parameterType="com.sv.entity.HealthDocExample" resultMap="BaseResultMap">
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sv_health_docs
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sv_health_docs
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<select id="findMemAll" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from sv_health_docs
where 1=1
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from sv_health_docs
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.sv.entity.HealthDocExample">
delete from sv_health_docs
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sv.entity.HealthDoc">
insert into sv_health_docs (id, member_id, doc_name,
doc_type, file_type, doc_path,
platform_id, created_time, modified_time,
<insert id="insert" parameterType="com.sv.entity.HealthDoc" >
insert into sv_health_docs (id, member_id, doc_name,
doc_type, file_type, doc_path,
platform_id, created_time, modified_time,
deleted)
values (#{id,jdbcType=INTEGER}, #{memberId,jdbcType=INTEGER}, #{docName,jdbcType=VARCHAR},
#{docType,jdbcType=CHAR}, #{fileType,jdbcType=CHAR}, #{docPath,jdbcType=VARCHAR},
#{platformId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP},
values (#{id,jdbcType=INTEGER}, #{memberId,jdbcType=INTEGER}, #{docName,jdbcType=VARCHAR},
#{docType,jdbcType=CHAR}, #{fileType,jdbcType=CHAR}, #{docPath,jdbcType=VARCHAR},
#{platformId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP},
#{deleted,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.sv.entity.HealthDoc">
<insert id="insertSelective" parameterType="com.sv.entity.HealthDoc" >
insert into sv_health_docs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="memberId != null">
<if test="memberId != null" >
member_id,
</if>
<if test="docName != null">
<if test="docName != null" >
doc_name,
</if>
<if test="docType != null">
<if test="docType != null" >
doc_type,
</if>
<if test="fileType != null">
<if test="fileType != null" >
file_type,
</if>
<if test="docPath != null">
<if test="docPath != null" >
doc_path,
</if>
<if test="platformId != null">
<if test="platformId != null" >
platform_id,
</if>
<if test="createdTime != null">
<if test="createdTime != null" >
created_time,
</if>
<if test="modifiedTime != null">
<if test="modifiedTime != null" >
modified_time,
</if>
<if test="deleted != null">
<if test="deleted != null" >
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="memberId != null">
<if test="memberId != null" >
#{memberId,jdbcType=INTEGER},
</if>
<if test="docName != null">
<if test="docName != null" >
#{docName,jdbcType=VARCHAR},
</if>
<if test="docType != null">
<if test="docType != null" >
#{docType,jdbcType=CHAR},
</if>
<if test="fileType != null">
<if test="fileType != null" >
#{fileType,jdbcType=CHAR},
</if>
<if test="docPath != null">
<if test="docPath != null" >
#{docPath,jdbcType=VARCHAR},
</if>
<if test="platformId != null">
<if test="platformId != null" >
#{platformId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
<if test="createdTime != null" >
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedTime != null">
<if test="modifiedTime != null" >
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
<if test="deleted != null" >
#{deleted,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sv.entity.HealthDocExample" resultType="java.lang.Integer">
select count(*) from sv_health_docs
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<update id="updateByPrimaryKeySelective" parameterType="com.sv.entity.HealthDoc" >
update sv_health_docs
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.memberId != null">
member_id = #{record.memberId,jdbcType=INTEGER},
</if>
<if test="record.docName != null">
doc_name = #{record.docName,jdbcType=VARCHAR},
</if>
<if test="record.docType != null">
doc_type = #{record.docType,jdbcType=CHAR},
</if>
<if test="record.fileType != null">
file_type = #{record.fileType,jdbcType=CHAR},
</if>
<if test="record.docPath != null">
doc_path = #{record.docPath,jdbcType=VARCHAR},
</if>
<if test="record.platformId != null">
platform_id = #{record.platformId,jdbcType=INTEGER},
</if>
<if test="record.createdTime != null">
created_time = #{record.createdTime,jdbcType=TIMESTAMP},
</if>
<if test="record.modifiedTime != null">
modified_time = #{record.modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sv_health_docs
set id = #{record.id,jdbcType=INTEGER},
member_id = #{record.memberId,jdbcType=INTEGER},
doc_name = #{record.docName,jdbcType=VARCHAR},
doc_type = #{record.docType,jdbcType=CHAR},
file_type = #{record.fileType,jdbcType=CHAR},
doc_path = #{record.docPath,jdbcType=VARCHAR},
platform_id = #{record.platformId,jdbcType=INTEGER},
created_time = #{record.createdTime,jdbcType=TIMESTAMP},
modified_time = #{record.modifiedTime,jdbcType=TIMESTAMP},
deleted = #{record.deleted,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sv.entity.HealthDoc">
update sv_health_docs
<set>
<if test="memberId != null">
<set >
<if test="memberId != null" >
member_id = #{memberId,jdbcType=INTEGER},
</if>
<if test="docName != null">
<if test="docName != null" >
doc_name = #{docName,jdbcType=VARCHAR},
</if>
<if test="docType != null">
<if test="docType != null" >
doc_type = #{docType,jdbcType=CHAR},
</if>
<if test="fileType != null">
<if test="fileType != null" >
file_type = #{fileType,jdbcType=CHAR},
</if>
<if test="docPath != null">
<if test="docPath != null" >
doc_path = #{docPath,jdbcType=VARCHAR},
</if>
<if test="platformId != null">
<if test="platformId != null" >
platform_id = #{platformId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
<if test="createdTime != null" >
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedTime != null">
<if test="modifiedTime != null" >
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
<if test="deleted != null" >
deleted = #{deleted,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.sv.entity.HealthDoc">
<update id="updateByPrimaryKey" parameterType="com.sv.entity.HealthDoc" >
update sv_health_docs
set member_id = #{memberId,jdbcType=INTEGER},
doc_name = #{docName,jdbcType=VARCHAR},
@@ -441,4 +160,4 @@
deleted = #{deleted,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
</mapper>

View File

@@ -91,6 +91,10 @@
注意:大小写敏感问题。
-->
<table tableName="sv_health_docs" domainObjectName="HealthDoc"
enableInsert="true"
enableDeleteByPrimaryKey="true"
enableSelectByPrimaryKey="true"
enableUpdateByPrimaryKey="true"
enableCountByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"