Commit be4fb092b58a04c296011c940ec89e8f30b08563

Authored by cfl
1 parent 7605ca3ab5
Exists in master and in 2 other branches dev, luanping

大同需求,增加产检通知重点文字维护的增删改查

Showing 6 changed files with 476 additions and 0 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterCheckItemNoticeManageMapper.java View file @ be4fb09
  1 +package com.lyms.platform.permission.dao.master;
  2 +
  3 +import com.lyms.platform.permission.model.CheckItemManage;
  4 +import com.lyms.platform.permission.model.CheckItemManageQuery;
  5 +import com.lyms.platform.permission.model.CheckItemNoticeManage;
  6 +
  7 +import java.util.List;
  8 +
  9 +public interface MasterCheckItemNoticeManageMapper {
  10 +
  11 + public void addCheckItemNoticeManage(CheckItemNoticeManage checkItemNoticeManage);
  12 +
  13 + public List<CheckItemNoticeManage> getCheckItemNoticeManage(CheckItemManageQuery checkItemManageQuery);
  14 +
  15 + public Integer deleteCheckItemNoticeManage(Integer id);
  16 +
  17 + public Integer updateCheckItemNoticeManage(CheckItemNoticeManage checkItemNoticeManage);
  18 +
  19 +
  20 + public List<CheckItemNoticeManage> queryCheckItemNoticeManage(CheckItemManageQuery checkItemManageQuery);
  21 +
  22 + int queryCheckItemNoticeManageCount(CheckItemManageQuery checkItemManageQuery);
  23 +}
platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemNoticeManage.java View file @ be4fb09
  1 +package com.lyms.platform.permission.model;
  2 +
  3 +
  4 +import java.util.Date;
  5 +
  6 +/**
  7 + * 各医院产检推送通知的重点提示内容维护
  8 + */
  9 +public class CheckItemNoticeManage {
  10 + private Integer id;
  11 + private Integer startWeek;
  12 + private Integer endWeek;
  13 + private String noticeInfo;
  14 + private String affiliateId;
  15 +
  16 + private Integer enable;
  17 + private Integer type;
  18 +
  19 + private Date modified;
  20 + private Date created;
  21 +
  22 + public Integer getId() {
  23 + return id;
  24 + }
  25 +
  26 + public void setId(Integer id) {
  27 + this.id = id;
  28 + }
  29 +
  30 + public Integer getStartWeek() {
  31 + return startWeek;
  32 + }
  33 +
  34 + public void setStartWeek(Integer startWeek) {
  35 + this.startWeek = startWeek;
  36 + }
  37 +
  38 + public Integer getEndWeek() {
  39 + return endWeek;
  40 + }
  41 +
  42 + public void setEndWeek(Integer endWeek) {
  43 + this.endWeek = endWeek;
  44 + }
  45 +
  46 + public String getNoticeInfo() {
  47 + return noticeInfo;
  48 + }
  49 +
  50 + public void setNoticeInfo(String noticeInfo) {
  51 + this.noticeInfo = noticeInfo;
  52 + }
  53 +
  54 + public String getAffiliateId() {
  55 + return affiliateId;
  56 + }
  57 +
  58 + public void setAffiliateId(String affiliateId) {
  59 + this.affiliateId = affiliateId;
  60 + }
  61 +
  62 + public Integer getEnable() {
  63 + return enable;
  64 + }
  65 +
  66 + public void setEnable(Integer enable) {
  67 + this.enable = enable;
  68 + }
  69 +
  70 + public Integer getType() {
  71 + return type;
  72 + }
  73 +
  74 + public void setType(Integer type) {
  75 + this.type = type;
  76 + }
  77 +
  78 + public Date getModified() {
  79 + return modified;
  80 + }
  81 +
  82 + public void setModified(Date modified) {
  83 + this.modified = modified;
  84 + }
  85 +
  86 + public Date getCreated() {
  87 + return created;
  88 + }
  89 +
  90 + public void setCreated(Date created) {
  91 + this.created = created;
  92 + }
  93 +}
platform-biz-service/src/main/java/com/lyms/platform/permission/service/CheckItemNoticeManageService.java View file @ be4fb09
  1 +package com.lyms.platform.permission.service;
  2 +
  3 +import com.lyms.platform.permission.model.CheckItemManage;
  4 +import com.lyms.platform.permission.model.CheckItemManageQuery;
  5 +import com.lyms.platform.permission.model.CheckItemNoticeManage;
  6 +
  7 +import java.util.List;
  8 +
  9 +public interface CheckItemNoticeManageService {
  10 +
  11 + public void addCheckItemNoticeManage(CheckItemNoticeManage checkItemNoticeManage);
  12 +
  13 + public List<CheckItemNoticeManage> getCheckItemNoticeManage(CheckItemManageQuery checkItemManageQuery);
  14 +
  15 + public Integer deleteCheckItemNoticeManage(Integer id);
  16 +
  17 + public Integer updateCheckItemNoticeManage(CheckItemNoticeManage checkItemNoticeManage);
  18 +
  19 + public List<CheckItemNoticeManage> queryCheckItemNoticeManage(CheckItemManageQuery checkItemManageQuery);
  20 +
  21 +}
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CheckItemNoticeManageServiceImpl.java View file @ be4fb09
  1 +package com.lyms.platform.permission.service.impl;
  2 +
  3 +import com.lyms.platform.permission.dao.master.MasterCheckItemNoticeManageMapper;
  4 +import com.lyms.platform.permission.model.CheckItemManageQuery;
  5 +import com.lyms.platform.permission.model.CheckItemNoticeManage;
  6 +import com.lyms.platform.permission.service.CheckItemNoticeManageService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +import java.util.*;
  11 +
  12 +@Service
  13 +public class CheckItemNoticeManageServiceImpl implements CheckItemNoticeManageService {
  14 +
  15 + @Autowired
  16 + private MasterCheckItemNoticeManageMapper checkItemNoticeManageMapper;
  17 +
  18 +
  19 + @Override
  20 + public void addCheckItemNoticeManage(CheckItemNoticeManage checkItemNoticeManage) {
  21 + checkItemNoticeManageMapper.addCheckItemNoticeManage(checkItemNoticeManage);
  22 + }
  23 +
  24 + @Override
  25 + public List<CheckItemNoticeManage> getCheckItemNoticeManage(CheckItemManageQuery checkItemManageQuery) {
  26 +
  27 + return checkItemNoticeManageMapper.getCheckItemNoticeManage(checkItemManageQuery);
  28 + }
  29 +
  30 + @Override
  31 + public Integer deleteCheckItemNoticeManage(Integer id) {
  32 + return checkItemNoticeManageMapper.deleteCheckItemNoticeManage(id);
  33 + }
  34 +
  35 + @Override
  36 + public Integer updateCheckItemNoticeManage(CheckItemNoticeManage checkItemNoticeManage) {
  37 + return checkItemNoticeManageMapper.updateCheckItemNoticeManage(checkItemNoticeManage);
  38 + }
  39 +
  40 + @Override
  41 + public List<CheckItemNoticeManage> queryCheckItemNoticeManage(CheckItemManageQuery checkItemManageQuery) {
  42 + if (checkItemManageQuery.getNeed() != null) {
  43 + checkItemManageQuery.mysqlBuild(checkItemNoticeManageMapper.queryCheckItemNoticeManageCount(checkItemManageQuery));
  44 + }
  45 + return checkItemNoticeManageMapper.queryCheckItemNoticeManage(checkItemManageQuery);
  46 + }
  47 +
  48 +}
platform-biz-service/src/main/resources/mainOrm/master/MasterCheckItemNoticeManage.xml View file @ be4fb09
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.lyms.platform.permission.dao.master.MasterCheckItemNoticeManageMapper">
  4 +
  5 + <resultMap id="CheckItemNoticeManageMap" type="com.lyms.platform.permission.model.CheckItemNoticeManage">
  6 + <id column="id" property="id" jdbcType="INTEGER"/>
  7 + <result column="startweek" property="startWeek" jdbcType="INTEGER"/>
  8 + <result column="endweek" property="endWeek" jdbcType="INTEGER"/>
  9 + <result column="noticeinfo" property="noticeInfo" jdbcType="VARCHAR"/>
  10 + <result column="affiliate" property="affiliateId" jdbcType="VARCHAR"/>
  11 + <result column="type" property="type" jdbcType="INTEGER"/>
  12 + <result column="enable" property="enable" jdbcType="INTEGER"/>
  13 + </resultMap>
  14 +
  15 +
  16 + <insert id="addCheckItemNoticeManage" parameterType="com.lyms.platform.permission.model.CheckItemNoticeManage">
  17 + <selectKey order="AFTER" keyProperty="id" resultType="java.lang.Integer">
  18 + SELECT LAST_INSERT_ID()
  19 + </selectKey>
  20 + INSERT INTO lyms_checkitem_notice(startweek,endweek,noticeinfo,affiliate,modified,created,type,enable)
  21 + VALUES(#{startWeek},#{endWeek},#{noticeInfo},#{affiliateId},#{modified},#{created},#{type},#{enable})
  22 + </insert>
  23 +
  24 +
  25 + <select id="getCheckItemNoticeManage" resultMap="CheckItemManageMap" parameterType="com.lyms.platform.permission.model.CheckItemManageQuery">
  26 + SELECT id,startweek,endweek,noticeinfo,affiliate,type from lyms_checkitem_notice
  27 + where affiliate=#{affiliateId}
  28 + and enable = 1
  29 + <if test="startNum !=null">
  30 + and startweek >= #{startNum,jdbcType=INTEGER}
  31 + and endweek &lt;= #{startNum,jdbcType=INTEGER}
  32 + </if>a
  33 + <if test="type !=null">
  34 + and type=#{type,jdbcType=INTEGER}
  35 + </if>
  36 +
  37 + </select>
  38 +
  39 + <delete id="deleteCheckItemNoticeManage" parameterType="java.lang.Integer">
  40 + update lyms_checkitem_notice
  41 + set enable = 0
  42 + where id = #{id,jdbcType=INTEGER}
  43 + </delete>
  44 +
  45 + <update id="updateCheckItemNoticeManage" parameterType="com.lyms.platform.permission.model.CheckItemNoticeManage">
  46 + update lyms_checkitem_notice
  47 + <set>
  48 + <if test="startWeek!=null and startWeek>=0">
  49 + startweek=#{startWeek,jdbcType=INTEGER},
  50 + </if>
  51 + <if test="endWeek!=null and endWeek>=0">
  52 + endweek=#{endWeek,jdbcType=INTEGER},
  53 + </if>
  54 + <if test="noticeinfo!=null and noticeinfo!=''">
  55 + noticeinfo=#{noticeInfo},
  56 + </if>
  57 + <if test="affiliateId!=null and affiliateId!=''">
  58 + affiliate=#{affiliateId,jdbcType=VARCHAR},
  59 + </if>
  60 + <if test="type != null">
  61 + type=#{type,jdbcType=INTEGER},
  62 + </if>
  63 + <if test="modified!=null">
  64 + modified=#{modified},
  65 + </if>
  66 + </set>
  67 + where id = #{id,jdbcType=INTEGER}
  68 + </update>
  69 +
  70 + <sql id="orderAndLimit">
  71 + <if test="sort != null and sort != '' ">
  72 + order by ${sort}
  73 + <if test="need != null">
  74 + limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
  75 + </if>
  76 + </if>
  77 + </sql>
  78 +
  79 +
  80 + <select id="queryCheckItemNoticeManage" resultMap="CheckItemManageMap"
  81 + parameterType="com.lyms.platform.permission.model.CheckItemManageQuery">
  82 + SELECT id,startweek,endweek,checkItemInfoId,affiliate,type from lyms_checkitem_notice
  83 + where enable = 1
  84 + <if test="affiliateId!=null and affiliateId!=''">
  85 + and affiliate=#{affiliateId,jdbcType=VARCHAR}
  86 + </if>
  87 + <if test="type !=null">
  88 + and type=#{type,jdbcType=INTEGER}
  89 + </if>
  90 + <include refid="orderAndLimit"/>
  91 + </select>
  92 +
  93 + <select id="queryCheckItemNoticeManageCount" resultType="int"
  94 + parameterType="com.lyms.platform.permission.model.CheckItemManageQuery">
  95 + SELECT count(id) from lyms_checkitem_notice
  96 + where enable = 1
  97 + <if test="affiliateId!=null and affiliateId!=''">
  98 + and affiliate=#{affiliateId,jdbcType=VARCHAR}
  99 + </if>
  100 + <if test="type !=null">
  101 + and type=#{type,jdbcType=INTEGER}
  102 + </if>
  103 + </select>
  104 +
  105 +
  106 +</mapper>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CheckItemNoticeManageController.java View file @ be4fb09
  1 +package com.lyms.platform.operate.web.controller;
  2 +
  3 +import com.lyms.platform.common.annotation.TokenRequired;
  4 +import com.lyms.platform.common.base.BaseController;
  5 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  6 +import com.lyms.platform.common.utils.ResultUtils;
  7 +import com.lyms.platform.common.utils.StringUtils;
  8 +import com.lyms.platform.operate.web.result.FrontEndResult;
  9 +import com.lyms.platform.operate.web.utils.CollectionUtils;
  10 +import com.lyms.platform.permission.model.CheckItemManage;
  11 +import com.lyms.platform.permission.model.CheckItemManageQuery;
  12 +import com.lyms.platform.permission.model.CheckItemNoticeManage;
  13 +import com.lyms.platform.permission.service.CheckItemManageService;
  14 +import com.lyms.platform.permission.service.CheckItemNoticeManageService;
  15 +import com.lyms.platform.permission.service.CheckItemService;
  16 +import com.lyms.platform.permission.service.OrganizationService;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.beans.factory.annotation.Qualifier;
  19 +import org.springframework.stereotype.Controller;
  20 +import org.springframework.web.bind.annotation.*;
  21 +
  22 +import javax.servlet.http.HttpServletResponse;
  23 +import java.util.ArrayList;
  24 +import java.util.Date;
  25 +import java.util.List;
  26 +
  27 +/**
  28 + * 维护产检推送项目重点文字控制器
  29 + * 微信公众号推送时,在产前检查字符串后面拼接内容
  30 + */
  31 +@Controller
  32 +@RequestMapping("/checkItemNoticeManage")
  33 +public class CheckItemNoticeManageController extends BaseController {
  34 +
  35 + @Autowired
  36 + private CheckItemNoticeManageService checkItemNoticeManageService;
  37 +
  38 + /**
  39 + *
  40 + * @param affiliateId 机构ID
  41 + * @param type 类型 1孕妇 2儿童
  42 + * @param page
  43 + * @param limit
  44 + * @return
  45 + */
  46 + @RequestMapping(value = "/list", method = RequestMethod.GET)
  47 + @ResponseBody
  48 + public FrontEndResult getCheckItemNoticeManageList(@RequestParam(value = "affiliateId") String affiliateId,
  49 + @RequestParam(value = "type") Integer type,
  50 + @RequestParam(value = "page", required = false) Integer page,
  51 + @RequestParam(value = "limit", required = false) Integer limit) {
  52 + FrontEndResult frontEndResult = new FrontEndResult();
  53 + frontEndResult.setErrorcode(ErrorCodeConstants.SUCCESS);
  54 + if(StringUtils.isEmpty(affiliateId) || type != 1 || type !=2){
  55 + frontEndResult.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR);
  56 + frontEndResult.setErrormsg("参数错误");
  57 + return frontEndResult;
  58 + }
  59 + CheckItemManageQuery checkItemManageQuery = new CheckItemManageQuery();
  60 + checkItemManageQuery.setNeed("true");
  61 + checkItemManageQuery.setSort("startweek asc");
  62 + checkItemManageQuery.setType(type);
  63 + checkItemManageQuery.setPage(page);
  64 + checkItemManageQuery.setLimit(limit);
  65 + checkItemManageQuery.setAffiliateId(affiliateId);
  66 + List<CheckItemNoticeManage> checkItemManagesList = checkItemNoticeManageService.queryCheckItemNoticeManage(checkItemManageQuery);
  67 +
  68 + frontEndResult.setPageInfo(checkItemManageQuery.getPageInfo());
  69 + frontEndResult.setData(checkItemManagesList);
  70 + return frontEndResult;
  71 + }
  72 +
  73 +
  74 + /**
  75 + * 添加展示项信息
  76 + */
  77 + @RequestMapping(value = "/add", method = RequestMethod.POST)
  78 + @TokenRequired
  79 + public void addCheckItemNoticeManage(HttpServletResponse response,
  80 + @RequestParam(value = "startweek") Integer startweek,
  81 + @RequestParam(value = "endweek") Integer endweek,
  82 + @RequestParam(value = "noticeInfo") String noticeInfo,
  83 + @RequestParam(value = "type") Integer type,
  84 + @RequestParam(value = "affiliateId") String affiliateId) {
  85 +
  86 + if (null == startweek || null == endweek
  87 + || StringUtils.isEmpty(noticeInfo)
  88 + || StringUtils.isEmpty(affiliateId)) {
  89 + ResultUtils.buildParameterErrorResultAndWrite(response, "请填写必须项!");
  90 + return;
  91 + } else {
  92 + if (startweek > endweek) {
  93 + ResultUtils.buildParameterErrorResultAndWrite(response, "起始周不能大于结束周!");
  94 + return;
  95 + }
  96 + boolean start = true;
  97 + boolean end = true;
  98 + CheckItemManageQuery checkItemManageQuery = new CheckItemManageQuery();
  99 + checkItemManageQuery.setAffiliateId(affiliateId);
  100 + checkItemManageQuery.setType(type);
  101 + List<CheckItemNoticeManage> list = checkItemNoticeManageService.getCheckItemNoticeManage(checkItemManageQuery);
  102 + if (CollectionUtils.isNotEmpty(list)) {
  103 + for (CheckItemNoticeManage checkItemManage : list) {
  104 + if (checkItemManage.getStartWeek() <= startweek && checkItemManage.getEndWeek() >= startweek) {
  105 + start = false;
  106 + break;
  107 + }
  108 + }
  109 + for (CheckItemNoticeManage checkItemManage : list) {
  110 + if (checkItemManage.getStartWeek() <= endweek && checkItemManage.getEndWeek() >= endweek) {
  111 + end = false;
  112 + break;
  113 + }
  114 + }
  115 + }
  116 + if (end && start) {
  117 + CheckItemNoticeManage checkItemNoticeManage = new CheckItemNoticeManage();
  118 + checkItemNoticeManage.setType(type);
  119 + checkItemNoticeManage.setStartWeek(startweek);
  120 + checkItemNoticeManage.setEndWeek(endweek);
  121 + checkItemNoticeManage.setNoticeInfo(noticeInfo);
  122 + checkItemNoticeManage.setAffiliateId(affiliateId);
  123 + checkItemNoticeManage.setEnable(1);
  124 + checkItemNoticeManage.setCreated(new Date());
  125 + checkItemNoticeManage.setModified(new Date());
  126 + checkItemNoticeManageService.addCheckItemNoticeManage(checkItemNoticeManage);
  127 + ResultUtils.buildSuccessResultAndWrite(response);
  128 + } else {
  129 + ResultUtils.buildParameterErrorResultAndWrite(response, "此范围孕周已已有数据有重合,请确认!");
  130 + }
  131 + }
  132 +
  133 + }
  134 +
  135 + /**
  136 + * 修改展示项
  137 + */
  138 + @RequestMapping(value = "/update", method = RequestMethod.PUT)
  139 + @TokenRequired
  140 + public void updateCheckItem(HttpServletResponse response,
  141 + @RequestParam(value = "id") Integer id,
  142 + @RequestParam(value = "startweek") Integer startweek,
  143 + @RequestParam(value = "endweek") Integer endweek,
  144 + @RequestParam(value = "noticeInfo") String noticeInfo,
  145 + @RequestParam(value = "affiliateId") String affiliateId) {
  146 + if (null == id) {
  147 + ResultUtils.buildParameterErrorResultAndWrite(response, "请选择要修改的数据");
  148 + return;
  149 + }
  150 + CheckItemNoticeManage checkItemNoticeManage = new CheckItemNoticeManage();
  151 + checkItemNoticeManage.setId(id);
  152 + checkItemNoticeManage.setStartWeek(startweek);
  153 + checkItemNoticeManage.setEndWeek(endweek);
  154 + checkItemNoticeManage.setNoticeInfo(noticeInfo);
  155 + checkItemNoticeManage.setAffiliateId(affiliateId);
  156 + checkItemNoticeManage.setModified(new Date());
  157 + Integer count = checkItemNoticeManageService.updateCheckItemNoticeManage(checkItemNoticeManage);
  158 + if (count > 0) {
  159 + ResultUtils.buildResultAndWrite(response, 0, "修改成功");
  160 + } else {
  161 + ResultUtils.buildParameterErrorResultAndWrite(response, "修改失败");
  162 + }
  163 + }
  164 +
  165 + /**
  166 + * 删除展示项
  167 + */
  168 + @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
  169 + @TokenRequired
  170 + public void deleteCheckItem(HttpServletResponse response, @RequestParam("id") Integer id) {
  171 + if (null == id) {
  172 + ResultUtils.buildParameterErrorResultAndWrite(response, "请选择需要删除的数据");
  173 + return;
  174 + }
  175 + Integer count = checkItemNoticeManageService.deleteCheckItemNoticeManage(id);
  176 + if (count == 0 || count == null) {
  177 + ResultUtils.buildParameterErrorResultAndWrite(response, "删除数据失败!!");
  178 + } else {
  179 + ResultUtils.buildSuccessResultAndWrite(response, "删除成功!");
  180 + }
  181 + }
  182 +
  183 +
  184 +}