Commit 771397a12e4ce6bb874697bfd45852c7734e4a8f

Authored by zhangchao
1 parent 3bdcbc0ae5
Exists in dev

#fix:新增儿保意见反馈功能

Showing 9 changed files with 530 additions and 1 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/FeedbackDao.java View file @ 771397a
  1 +package com.lyms.platform.biz.dal;
  2 +
  3 +import com.lyms.platform.common.dao.operator.MongoQuery;
  4 +import com.lyms.platform.pojo.BabyFeedbackModel;
  5 +
  6 +import java.util.List;
  7 +
  8 +public interface FeedbackDao {
  9 + public int queryListCount(MongoQuery mongoQuery);
  10 +
  11 + public List<BabyFeedbackModel> queryList(MongoQuery query);
  12 +
  13 + public void add(BabyFeedbackModel model);
  14 +
  15 + public void update(MongoQuery mongoQuery, BabyFeedbackModel model);
  16 +
  17 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/FeedbackDaoImpl.java View file @ 771397a
  1 +package com.lyms.platform.biz.dal.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.FeedbackDao;
  4 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  5 +import com.lyms.platform.common.dao.operator.MongoQuery;
  6 +import com.lyms.platform.pojo.BabyFeedbackModel;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import java.util.List;
  10 +
  11 +@Repository("feedbackDao")
  12 +public class FeedbackDaoImpl extends BaseMongoDAOImpl<BabyFeedbackModel> implements FeedbackDao {
  13 + @Override
  14 + public int queryListCount(MongoQuery mongoQuery) {
  15 + return (int)count(mongoQuery.convertToMongoQuery());
  16 + }
  17 +
  18 + @Override
  19 + public List<BabyFeedbackModel> queryList(MongoQuery query) {
  20 + return find(query.convertToMongoQuery());
  21 + }
  22 +
  23 + @Override
  24 + public void add(BabyFeedbackModel model) {
  25 + save(model);
  26 + }
  27 +
  28 + @Override
  29 + public void update(MongoQuery mongoQuery, BabyFeedbackModel model) {
  30 + update(mongoQuery.convertToMongoQuery(),model);
  31 + }
  32 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/FeedbackService.java View file @ 771397a
  1 +package com.lyms.platform.biz.service;
  2 +
  3 +import com.lyms.platform.biz.dal.FeedbackDao;
  4 +import com.lyms.platform.common.dao.operator.MongoCondition;
  5 +import com.lyms.platform.common.dao.operator.MongoOper;
  6 +import com.lyms.platform.common.dao.operator.MongoQuery;
  7 +import com.lyms.platform.common.utils.MongoConvertHelper;
  8 +import com.lyms.platform.common.utils.ReflectionUtils;
  9 +import com.lyms.platform.pojo.BabyFeedbackModel;
  10 +import com.lyms.platform.pojo.BabyMsgModel;
  11 +import com.lyms.platform.pojo.BabyMsgModelRecord;
  12 +import com.lyms.platform.query.FeedbackQuery;
  13 +import com.lyms.platform.query.MsgQuery;
  14 +import org.apache.commons.lang.StringUtils;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.data.domain.Sort;
  17 +import org.springframework.stereotype.Service;
  18 +
  19 +import java.util.List;
  20 +
  21 +@Service
  22 +public class FeedbackService {
  23 + @Autowired
  24 + private FeedbackDao feedbackDao;
  25 +
  26 + public List<BabyFeedbackModel> queryList(FeedbackQuery msgQuery) {
  27 + MongoQuery query = msgQuery.convertToQuery();
  28 + if (StringUtils.isNotEmpty(msgQuery.getNeed())) {
  29 + msgQuery.mysqlBuild(feedbackDao.queryListCount(msgQuery.convertToQuery()));
  30 + query.start(msgQuery.getOffset()).end(msgQuery.getLimit());
  31 + }
  32 + return feedbackDao.queryList(query.addOrder(Sort.Direction.DESC, "id"));
  33 + }
  34 +
  35 +
  36 + public void add(BabyFeedbackModel model) {
  37 + feedbackDao.add(model);
  38 + }
  39 +
  40 +
  41 + public void update(BabyFeedbackModel model) {
  42 + feedbackDao.update(new MongoQuery(new MongoCondition("id", model.getId(), MongoOper.IS)), model);
  43 + }
  44 +}
platform-dal/src/main/java/com/lyms/platform/pojo/BabyFeedbackModel.java View file @ 771397a
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.common.result.BaseModel;
  4 +import org.springframework.data.mongodb.core.mapping.Document;
  5 +
  6 +import java.util.Date;
  7 +
  8 +@Document(collection="lyms_baby_feedback")
  9 +public class BabyFeedbackModel extends BaseModel {
  10 + private static final long serialVersionUID = -1;
  11 +
  12 + //消息id
  13 + private String id;
  14 + //意见内容
  15 + private String content;
  16 + //反馈人id
  17 + private String publishId;
  18 + //反馈人名称
  19 + private String publishName;
  20 + //1.有效 2.无效
  21 + private Integer yn;
  22 + //最后修改时间
  23 +
  24 + private Date modified;
  25 + //创建时间
  26 + private Date created;
  27 +
  28 + private String hospitalId;
  29 +
  30 + //1无法正常使用、2内容意见、3其他反馈
  31 + private Integer type;
  32 +
  33 + //回复内容
  34 + private String callBack;
  35 +
  36 + public String getCallBack() {
  37 + return callBack;
  38 + }
  39 +
  40 + public void setCallBack(String callBack) {
  41 + this.callBack = callBack;
  42 + }
  43 +
  44 + public String getHospitalId() {
  45 + return hospitalId;
  46 + }
  47 +
  48 + public void setHospitalId(String hospitalId) {
  49 + this.hospitalId = hospitalId;
  50 + }
  51 +
  52 + public String getId() {
  53 + return id;
  54 + }
  55 +
  56 + public void setId(String id) {
  57 + this.id = id;
  58 + }
  59 +
  60 + public String getContent() {
  61 + return content;
  62 + }
  63 +
  64 + public void setContent(String content) {
  65 + this.content = content;
  66 + }
  67 +
  68 + public String getPublishId() {
  69 + return publishId;
  70 + }
  71 +
  72 + public void setPublishId(String publishId) {
  73 + this.publishId = publishId;
  74 + }
  75 +
  76 + public String getPublishName() {
  77 + return publishName;
  78 + }
  79 +
  80 + public void setPublishName(String publishName) {
  81 + this.publishName = publishName;
  82 + }
  83 +
  84 + public Integer getYn() {
  85 + return yn;
  86 + }
  87 +
  88 + public void setYn(Integer yn) {
  89 + this.yn = yn;
  90 + }
  91 +
  92 + public Date getModified() {
  93 + return modified;
  94 + }
  95 +
  96 + public void setModified(Date modified) {
  97 + this.modified = modified;
  98 + }
  99 +
  100 + public Date getCreated() {
  101 + return created;
  102 + }
  103 +
  104 + public void setCreated(Date created) {
  105 + this.created = created;
  106 + }
  107 +
  108 + public Integer getType() {
  109 + return type;
  110 + }
  111 + public void setType(Integer type) {
  112 + this.type = type;
  113 + }
  114 +}
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java View file @ 771397a
... ... @@ -266,8 +266,28 @@
266 266  
267 267 private Integer serviceType;
268 268  
  269 + private Integer serviceTypeNe;
  270 +
  271 + private Integer serviceStatusNe;
  272 +
269 273 private Boolean serviceTypeIsExist;
270 274  
  275 + public Integer getServiceTypeNe() {
  276 + return serviceTypeNe;
  277 + }
  278 +
  279 + public void setServiceTypeNe(Integer serviceTypeNe) {
  280 + this.serviceTypeNe = serviceTypeNe;
  281 + }
  282 +
  283 + public Integer getServiceStatusNe() {
  284 + return serviceStatusNe;
  285 + }
  286 +
  287 + public void setServiceStatusNe(Integer serviceStatusNe) {
  288 + this.serviceStatusNe = serviceStatusNe;
  289 + }
  290 +
271 291 public Boolean getServiceTypeIsExist() {
272 292 return serviceTypeIsExist;
273 293 }
... ... @@ -2168,6 +2188,15 @@
2168 2188 if (null != sieveStatus && !"0".equals(sieveStatus)) {
2169 2189 condition = condition.and("sieveStatus", sieveStatus, MongoOper.IS);
2170 2190 }
  2191 +
  2192 + if (null != serviceStatusNe ) {
  2193 + condition = condition.and("serviceStatus", serviceStatusNe, MongoOper.NE);
  2194 + }
  2195 +
  2196 + if (null != serviceTypeNe ) {
  2197 + condition = condition.and("serviceType", serviceTypeNe, MongoOper.NE);
  2198 + }
  2199 +
2171 2200 if (null != sieveStatusList) {
2172 2201 condition = condition.and("sieveStatus", sieveStatusList, MongoOper.NIN);
2173 2202 }
platform-dal/src/main/java/com/lyms/platform/query/FeedbackQuery.java View file @ 771397a
  1 +package com.lyms.platform.query;
  2 +
  3 +import com.lyms.platform.common.base.IConvertToNativeQuery;
  4 +import com.lyms.platform.common.dao.BaseQuery;
  5 +import com.lyms.platform.common.dao.operator.MongoCondition;
  6 +import com.lyms.platform.common.dao.operator.MongoOper;
  7 +import com.lyms.platform.common.dao.operator.MongoQuery;
  8 +import org.apache.commons.lang.StringUtils;
  9 +import org.springframework.data.mongodb.core.query.Criteria;
  10 +
  11 +import java.util.Date;
  12 +
  13 +public class FeedbackQuery extends BaseQuery implements IConvertToNativeQuery {
  14 +
  15 + private String id;
  16 + //反馈人id
  17 + private String publishId;
  18 + //反馈人名称
  19 + private String publishName;
  20 + //1.有效 2.无效
  21 + private Integer yn;
  22 + //创建时间
  23 + private Date created;
  24 +
  25 + private Date createdStart;
  26 +
  27 + private Date createdEnd;
  28 +
  29 + private String hospitalId;
  30 + //1无法正常使用、2内容意见、3其他反馈
  31 + private Integer type;
  32 +
  33 + public String getId() {
  34 + return id;
  35 + }
  36 +
  37 + public void setId(String id) {
  38 + this.id = id;
  39 + }
  40 +
  41 + public String getPublishId() {
  42 + return publishId;
  43 + }
  44 +
  45 + public void setPublishId(String publishId) {
  46 + this.publishId = publishId;
  47 + }
  48 +
  49 + public String getPublishName() {
  50 + return publishName;
  51 + }
  52 +
  53 + public void setPublishName(String publishName) {
  54 + this.publishName = publishName;
  55 + }
  56 +
  57 + public Integer getYn() {
  58 + return yn;
  59 + }
  60 +
  61 + public void setYn(Integer yn) {
  62 + this.yn = yn;
  63 + }
  64 +
  65 + public Date getCreated() {
  66 + return created;
  67 + }
  68 +
  69 + public void setCreated(Date created) {
  70 + this.created = created;
  71 + }
  72 +
  73 + public String getHospitalId() {
  74 + return hospitalId;
  75 + }
  76 +
  77 + public void setHospitalId(String hospitalId) {
  78 + this.hospitalId = hospitalId;
  79 + }
  80 +
  81 + public Integer getType() {
  82 + return type;
  83 + }
  84 +
  85 + public void setType(Integer type) {
  86 + this.type = type;
  87 + }
  88 +
  89 + public Date getCreatedStart() {
  90 + return createdStart;
  91 + }
  92 +
  93 + public void setCreatedStart(Date createdStart) {
  94 + this.createdStart = createdStart;
  95 + }
  96 +
  97 + public Date getCreatedEnd() {
  98 + return createdEnd;
  99 + }
  100 +
  101 + public void setCreatedEnd(Date createdEnd) {
  102 + this.createdEnd = createdEnd;
  103 + }
  104 +
  105 + @Override
  106 + public MongoQuery convertToQuery() {
  107 + MongoCondition condition = MongoCondition.newInstance();
  108 +
  109 + if (StringUtils.isNotBlank(id)) {
  110 + condition = condition.and("id", id, MongoOper.IS);
  111 + }
  112 + if (StringUtils.isNotBlank(hospitalId)) {
  113 + condition = condition.and("hospitalId", hospitalId, MongoOper.IS);
  114 + }
  115 + if (created!=null) {
  116 + condition = condition.and("created", created, MongoOper.IS);
  117 + }
  118 + if (yn!=null) {
  119 + condition = condition.and("yn", yn, MongoOper.IS);
  120 + }
  121 + if (type!=null){
  122 + condition = condition.and("type", type, MongoOper.IS);
  123 + }
  124 + if (publishId!=null){
  125 + condition = condition.and("publishId", publishId, MongoOper.IS);
  126 + }
  127 + if (publishName!=null){
  128 + condition = condition.and("publishName", publishName, MongoOper.IS);
  129 + }
  130 + Criteria c1 = null;
  131 +
  132 + if (null != createdStart && createdEnd != null) {
  133 + if (null != c1) {
  134 + c1 = c1.where("created").gte(createdStart).lte(createdEnd);
  135 + } else {
  136 + c1 = Criteria.where("created").gte(createdStart).lte(createdEnd);
  137 + }
  138 + }
  139 + if (c1!=null) {
  140 + condition = condition.andCondition(new MongoCondition(c1));
  141 + }
  142 + return condition.toMongoQuery();
  143 + }
  144 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FeedbackController.java View file @ 771397a
  1 +package com.lyms.platform.operate.web.controller;
  2 +
  3 +import com.lyms.platform.common.annotation.TokenRequired;
  4 +import com.lyms.platform.common.base.LoginContext;
  5 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  6 +import com.lyms.platform.common.result.BaseResponse;
  7 +import com.lyms.platform.common.utils.StringUtils;
  8 +import com.lyms.platform.operate.web.facade.FeedbackFacade;
  9 +import com.lyms.platform.pojo.BabyFeedbackModel;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Controller;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import javax.servlet.http.HttpServletRequest;
  15 +
  16 +@Controller
  17 +@RequestMapping("/baby/feedback")
  18 +public class FeedbackController {
  19 + @Autowired
  20 + private FeedbackFacade feedbackFacade;
  21 +
  22 + /*
  23 + * 小程序意见反馈列表
  24 + * */
  25 + @RequestMapping(method = RequestMethod.GET, value = "/getList")
  26 + @ResponseBody
  27 + public BaseResponse msgList(
  28 + String babyId,Integer limit,Integer page) {
  29 + return feedbackFacade.getList(page,limit,babyId);
  30 + }
  31 +
  32 + /*
  33 + * 小程序新增反馈
  34 + * */
  35 + @RequestMapping(method = RequestMethod.POST, value = "/add")
  36 + @ResponseBody
  37 + public BaseResponse add(@RequestBody BabyFeedbackModel babyFeedbackModel) {
  38 + return feedbackFacade.add(babyFeedbackModel);
  39 + }
  40 +
  41 + @RequestMapping(method = RequestMethod.GET)
  42 + @ResponseBody
  43 + @TokenRequired
  44 + public BaseResponse list(@RequestParam Integer page,
  45 + @RequestParam Integer limit,
  46 + Integer type,
  47 + String startTime,String endTime,
  48 + HttpServletRequest request) {
  49 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  50 + return feedbackFacade.getPageList(page,limit,type,startTime,endTime,loginState.getId());
  51 + }
  52 +
  53 + /*
  54 + * 编辑消息
  55 + * */
  56 + @RequestMapping(method = RequestMethod.POST, value = "/update")
  57 + @ResponseBody
  58 + @TokenRequired
  59 + public BaseResponse msgUpdate(@RequestBody BabyFeedbackModel model) {
  60 + if (StringUtils.isEmpty(model.getId())){
  61 + BaseResponse objectResponse = new BaseResponse();
  62 + objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST);
  63 + objectResponse.setErrormsg("失败");
  64 + return objectResponse;
  65 + }
  66 + return feedbackFacade.update(model);
  67 + }
  68 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyMsgFacade.java View file @ 771397a
... ... @@ -239,7 +239,8 @@
239 239 babyModels = babyService.queryBabyWithQuery(babyModelQuery);
240 240 } else if (crowd == 2) {
241 241 //2是未开通服务
242   - babyModelQuery.setServiceTypeIsExist(true);
  242 + babyModelQuery.setServiceTypeNe(ServiceTypeEnums.ADD_SERVICE.getId());
  243 + babyModelQuery.setServiceStatusNe(ServiceStatusEnums.ADD_OPEN.getId());
243 244 babyModels = babyService.queryBabyWithQuery(babyModelQuery);
244 245 } else if (crowd == 3) {
245 246 babyModels = babyService.queryBabyWithQuery(babyModelQuery);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/FeedbackFacade.java View file @ 771397a
  1 +package com.lyms.platform.operate.web.facade;
  2 +
  3 +import com.lyms.platform.biz.service.FeedbackService;
  4 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  5 +import com.lyms.platform.common.enums.YnEnums;
  6 +import com.lyms.platform.common.result.BaseListResponse;
  7 +import com.lyms.platform.common.result.BaseResponse;
  8 +import com.lyms.platform.common.utils.DateUtil;
  9 +import com.lyms.platform.pojo.BabyFeedbackModel;
  10 +import com.lyms.platform.query.FeedbackQuery;
  11 +import org.apache.commons.lang.StringUtils;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import java.util.Date;
  16 +import java.util.List;
  17 +
  18 +@Component
  19 +public class FeedbackFacade {
  20 + @Autowired
  21 + private FeedbackService feedbackService;
  22 + @Autowired
  23 + private AutoMatchFacade autoMatchFacade;
  24 +
  25 + public BaseResponse getPageList(Integer page, Integer limit,
  26 + Integer type,String startTime,String endTime,Integer userId){
  27 + FeedbackQuery feedbackQuery=new FeedbackQuery();
  28 + feedbackQuery.setPage(page);
  29 + feedbackQuery.setLimit(limit);
  30 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  31 + feedbackQuery.setHospitalId(hospitalId);
  32 + if (StringUtils.isNotEmpty(startTime) && StringUtils.isNotEmpty(endTime))
  33 + {
  34 + feedbackQuery.setCreatedStart(DateUtil.parseYMDHMS(startTime + " 00:00:00"));
  35 + feedbackQuery.setCreatedEnd(DateUtil.parseYMDHMS(endTime + " 23:59:59"));
  36 + }
  37 + if (type!=null){
  38 + feedbackQuery.setType(type);
  39 + }
  40 + List<BabyFeedbackModel> list= feedbackService.queryList(feedbackQuery);
  41 + BaseListResponse objectResponse = new BaseListResponse();
  42 + objectResponse.setData(list);
  43 + objectResponse.setPageInfo(feedbackQuery.getPageInfo());
  44 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  45 + objectResponse.setErrormsg("成功");
  46 + return objectResponse;
  47 + }
  48 +
  49 + public BaseResponse getList(Integer page, Integer limit,String babyId){
  50 + FeedbackQuery feedbackQuery=new FeedbackQuery();
  51 + feedbackQuery.setPage(page);
  52 + feedbackQuery.setLimit(limit);
  53 + feedbackQuery.setPublishId(babyId);
  54 + List<BabyFeedbackModel> list= feedbackService.queryList(feedbackQuery);
  55 + BaseListResponse objectResponse = new BaseListResponse();
  56 + objectResponse.setData(list);
  57 + objectResponse.setPageInfo(feedbackQuery.getPageInfo());
  58 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  59 + objectResponse.setErrormsg("成功");
  60 + return objectResponse;
  61 + }
  62 +
  63 + public BaseResponse add(BabyFeedbackModel model) {
  64 + BaseResponse objectResponse = new BaseResponse();
  65 + model.setCreated(new Date());
  66 + model.setYn(YnEnums.YES.getId());
  67 + feedbackService.add(model);
  68 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  69 + objectResponse.setErrormsg("成功");
  70 + return objectResponse;
  71 + }
  72 +
  73 + public BaseResponse update(BabyFeedbackModel model) {
  74 + BaseResponse objectResponse = new BaseResponse();
  75 + feedbackService.update(model);
  76 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  77 + objectResponse.setErrormsg("成功");
  78 + return objectResponse;
  79 + }
  80 +}