Commit a7618f220343f69e7b82d962988243f4dc125e96
1 parent
221890cd11
Exists in
master
and in
1 other branch
推送问卷
Showing 3 changed files with 378 additions and 8 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatdeliverFollowController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatdeliverFollowFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/QuestionnairePushRequest.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatdeliverFollowController.java
View file @
a7618f2
| ... | ... | @@ -8,15 +8,14 @@ |
| 8 | 8 | import com.lyms.platform.operate.web.facade.MatdeliverFollowFacade; |
| 9 | 9 | import com.lyms.platform.operate.web.request.MatDeliverFollowAddRequest; |
| 10 | 10 | import com.lyms.platform.operate.web.request.MatdeliverFollowRequest; |
| 11 | +import com.lyms.platform.operate.web.request.QuestionnairePushRequest; | |
| 11 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | 13 | import org.springframework.stereotype.Controller; |
| 13 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 14 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 15 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 16 | -import org.springframework.web.bind.annotation.ResponseBody; | |
| 14 | +import org.springframework.web.bind.annotation.*; | |
| 17 | 15 | |
| 18 | 16 | import javax.servlet.http.HttpServletRequest; |
| 19 | 17 | import javax.servlet.http.HttpServletResponse; |
| 18 | +import javax.validation.Valid; | |
| 20 | 19 | |
| 21 | 20 | /** |
| 22 | 21 | * <p> |
| ... | ... | @@ -121,5 +120,32 @@ |
| 121 | 120 | matdeliverFollowRequest.setNeed("need"); |
| 122 | 121 | return matdeliverFollowFacade.getPostpartumFollowMake(matdeliverFollowRequest, loginState.getId()); |
| 123 | 122 | } |
| 123 | + | |
| 124 | + /** | |
| 125 | + * 推送问卷 | |
| 126 | + * | |
| 127 | + * @param request | |
| 128 | + * @return | |
| 129 | + */ | |
| 130 | + @ResponseBody | |
| 131 | + @TokenRequired | |
| 132 | + @RequestMapping(value = "/questionnaire/push", method = RequestMethod.POST) | |
| 133 | + public BaseResponse questionnairePush(@RequestBody @Valid QuestionnairePushRequest questionnairePushRequest, HttpServletRequest request) { | |
| 134 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 135 | + return matdeliverFollowFacade.questionnairePush(questionnairePushRequest, loginState.getId()); | |
| 136 | + } | |
| 137 | + | |
| 138 | + /** | |
| 139 | + * 推送问卷 -- 保存产、妇在小程序端填写的数据 | |
| 140 | + * | |
| 141 | + * @param param | |
| 142 | + * @return | |
| 143 | + */ | |
| 144 | + @ResponseBody | |
| 145 | + @RequestMapping(value = "/questionnaire/upload", method = RequestMethod.POST) | |
| 146 | + public BaseResponse addQuestionnaire(@RequestBody @Valid QuestionnairePushRequest param) { | |
| 147 | + return matdeliverFollowFacade.addQuestionnaire(param); | |
| 148 | + } | |
| 149 | + | |
| 124 | 150 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatdeliverFollowFacade.java
View file @
a7618f2
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 4 | +import com.lyms.platform.beans.MsgListRequest; | |
| 5 | +import com.lyms.platform.beans.MsgRequest; | |
| 3 | 6 | import com.lyms.platform.biz.service.*; |
| 4 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | -import com.lyms.platform.common.enums.OptActionEnums; | |
| 6 | -import com.lyms.platform.common.enums.PostpartumFollowMakeEnums; | |
| 7 | -import com.lyms.platform.common.enums.TrackDownDateEnums; | |
| 8 | -import com.lyms.platform.common.enums.YnEnums; | |
| 8 | +import com.lyms.platform.common.enums.*; | |
| 9 | 9 | import com.lyms.platform.common.result.BaseListResponse; |
| 10 | 10 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 11 | 11 | import com.lyms.platform.common.result.BaseResponse; |
| 12 | +import com.lyms.platform.common.utils.BeanUtils; | |
| 12 | 13 | import com.lyms.platform.common.utils.DateUtil; |
| 13 | 14 | import com.lyms.platform.common.utils.ExcelUtil; |
| 14 | 15 | import com.lyms.platform.operate.web.request.MatDeliverFollowAddRequest; |
| 15 | 16 | import com.lyms.platform.operate.web.request.MatdeliverFollowRequest; |
| 17 | +import com.lyms.platform.operate.web.request.QuestionnairePushRequest; | |
| 16 | 18 | import com.lyms.platform.operate.web.result.MatdeliverFollowListResult; |
| 17 | 19 | import com.lyms.platform.operate.web.result.MatdeliverFollowResult; |
| 18 | 20 | import com.lyms.platform.operate.web.service.ITrackDownService; |
| 19 | 21 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 22 | +import com.lyms.platform.operate.web.utils.MessageCenterService; | |
| 20 | 23 | import com.lyms.platform.operate.web.utils.ResponseUtil; |
| 21 | 24 | import com.lyms.platform.operate.web.utils.UnitConstants; |
| 22 | 25 | import com.lyms.platform.permission.model.Organization; |
| ... | ... | @@ -38,6 +41,10 @@ |
| 38 | 41 | import org.apache.log4j.Logger; |
| 39 | 42 | import org.apache.poi.ss.util.CellRangeAddress; |
| 40 | 43 | import org.springframework.beans.factory.annotation.Autowired; |
| 44 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 45 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 46 | +import org.springframework.data.mongodb.core.query.Query; | |
| 47 | +import org.springframework.data.mongodb.core.query.Update; | |
| 41 | 48 | import org.springframework.stereotype.Component; |
| 42 | 49 | |
| 43 | 50 | import javax.servlet.http.HttpServletResponse; |
| ... | ... | @@ -77,6 +84,9 @@ |
| 77 | 84 | @Autowired |
| 78 | 85 | private PersonService personService; |
| 79 | 86 | |
| 87 | + @Autowired | |
| 88 | + protected MongoTemplate mongoTemplate; | |
| 89 | + | |
| 80 | 90 | public BaseResponse matdeliverFollowMakeInit(Integer id) { |
| 81 | 91 | Map map = new HashMap(); |
| 82 | 92 | //是否结案 |
| ... | ... | @@ -662,6 +672,109 @@ |
| 662 | 672 | e.printStackTrace(); |
| 663 | 673 | } |
| 664 | 674 | return out; |
| 675 | + } | |
| 676 | + | |
| 677 | + /** | |
| 678 | + * 问卷推送 | |
| 679 | + * | |
| 680 | + * @param questionnairePushRequest | |
| 681 | + * @param userId | |
| 682 | + * @return | |
| 683 | + */ | |
| 684 | + public BaseResponse questionnairePush(QuestionnairePushRequest questionnairePushRequest, Integer userId) { | |
| 685 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 686 | + | |
| 687 | + // 新增追访信息 | |
| 688 | + | |
| 689 | + String phone = questionnairePushRequest.getPhone(); | |
| 690 | + String parentid = questionnairePushRequest.getParentid(); | |
| 691 | + String deliverId = questionnairePushRequest.getDeliverId(); | |
| 692 | + String pid = questionnairePushRequest.getPid(); | |
| 693 | + | |
| 694 | + if (StringUtils.isNotEmpty(phone) && StringUtils.isNotEmpty(parentid) | |
| 695 | + && StringUtils.isNotEmpty(deliverId) && StringUtils.isNotEmpty(pid)) { | |
| 696 | + MatDeliverFollowAddRequest param = new MatDeliverFollowAddRequest(); | |
| 697 | + // 联系结果、访视类型、备注 | |
| 698 | + param.setContactResult(1); | |
| 699 | + param.setMakeType(PostpartumFollowMakeEnums.TypeEnum.WJTS.getId()); | |
| 700 | + param.setMakeRemark(""); | |
| 701 | + param.setVisitDoctor(userId.toString()); | |
| 702 | + param.setMakeVisitDateStr(new Date()); | |
| 703 | + param.setDeliverId(deliverId); | |
| 704 | + param.setPid(pid); | |
| 705 | + BaseResponse baseResponse = addOrUpdateMatDeliverFollow(param, userId); | |
| 706 | + String followModelId = (String) baseResponse.getObject(); | |
| 707 | + | |
| 708 | + | |
| 709 | + // 推送到指定用户中 | |
| 710 | + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(parentid)), Patients.class); | |
| 711 | + Organization organization = organizationService.getOrganization(Integer.parseInt(hospitalId)); | |
| 712 | + Users users = usersService.getUsers(userId); | |
| 713 | + MsgListRequest msgListRequest = new MsgListRequest(); | |
| 714 | + List<MsgRequest> msgRequests = new ArrayList<>(); | |
| 715 | + // 1 推送服务, 2 推送和短信服务 3短信服务 | |
| 716 | + MsgRequest request = new MsgRequest(); | |
| 717 | + request.setFirst(String.format("%s 女士您好!您身边的 %s,%s医生温馨提醒," + | |
| 718 | + "请及时填写产后健康情况记录表,便于医生掌握您产后情况更好的守护您的健康。", patients.getUsername(), organization.getName(), users.getName())); | |
| 719 | + // 产妇 | |
| 720 | + request.setObjType(ServiceObjEnums.CHANOBJ.getId()); | |
| 721 | + request.setPhone(phone); | |
| 722 | + request.setTimeType(SmsTimeTypeEnums.ONTIME.getId()); | |
| 723 | + request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 724 | + request.setSubTypeId(SmsServiceEnums.FWKT.getId()); | |
| 725 | + request.setStatus(SmsStatusEnums.WFS.getId()); | |
| 726 | + request.setHospitalId(hospitalId); | |
| 727 | + request.setPatientId(parentid); | |
| 728 | + request.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
| 729 | + request.setServiceType(1); | |
| 730 | + | |
| 731 | + request.setTypeId(0); | |
| 732 | + | |
| 733 | + request.setKeyword1(""); | |
| 734 | + request.setKeyword2(""); | |
| 735 | + | |
| 736 | + // 参数传递 医院id + 产后访视主键 | |
| 737 | + JSONObject jsonObject = new JSONObject(); | |
| 738 | + jsonObject.put("hosptialId", hospitalId); | |
| 739 | + jsonObject.put("id", followModelId); | |
| 740 | + request.setRemark(jsonObject.toJSONString()); | |
| 741 | + request.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 742 | + | |
| 743 | + // todo 微信模板ID | |
| 744 | + request.setWxTempId(WxTempleteIdEnums.FU_WU_DING_GOU_TX.getId()); | |
| 745 | + | |
| 746 | + msgRequests.add(request); | |
| 747 | + msgListRequest.setMessages(msgRequests); | |
| 748 | + MessageCenterService.saveMsgCenter(msgListRequest); | |
| 749 | + } | |
| 750 | + | |
| 751 | + BaseResponse baseResponse = new BaseResponse(); | |
| 752 | + return baseResponse; | |
| 753 | + } | |
| 754 | + | |
| 755 | + /** | |
| 756 | + * 推送问卷 -- 保存产、妇在小程序端填写的数据 | |
| 757 | + * | |
| 758 | + * @param param | |
| 759 | + * @return | |
| 760 | + */ | |
| 761 | + public BaseResponse addQuestionnaire(QuestionnairePushRequest param) { | |
| 762 | + String id = param.getId(); | |
| 763 | + BaseResponse baseResponse = new BaseResponse(); | |
| 764 | + if (StringUtils.isNotEmpty(id)) { | |
| 765 | + Update update = new Update(); | |
| 766 | + param.setId(null); | |
| 767 | + Map<String, Object> map = BeanUtils.objectToObjectMap(param); | |
| 768 | + Set<Map.Entry<String, Object>> entries = map.entrySet(); | |
| 769 | + for (Map.Entry<String, Object> entry : entries) { | |
| 770 | + update.set(entry.getKey(), entry.getValue()); | |
| 771 | + } | |
| 772 | + mongoTemplate.updateFirst(Query.query(Criteria.where("_id").is(id)), update, MatdeliverFollowModel.class); | |
| 773 | + return baseResponse; | |
| 774 | + } | |
| 775 | + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 776 | + baseResponse.setErrormsg("参数缺失"); | |
| 777 | + return baseResponse; | |
| 665 | 778 | } |
| 666 | 779 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/QuestionnairePushRequest.java
View file @
a7618f2
| 1 | +package com.lyms.platform.operate.web.request; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | +import java.util.Date; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * | |
| 8 | + * @Author dongqin | |
| 9 | + * @Description | |
| 10 | + * @Date 18:00 2019/8/13 | |
| 11 | + */ | |
| 12 | +public class QuestionnairePushRequest implements Serializable { | |
| 13 | + | |
| 14 | + private static final long serialVersionUID = 6439168172427430950L; | |
| 15 | + | |
| 16 | + private String parentid; | |
| 17 | + | |
| 18 | + private String deliverId; | |
| 19 | + | |
| 20 | + private String phone; | |
| 21 | + | |
| 22 | + private String pid; | |
| 23 | + | |
| 24 | + private String id; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 分娩时间 | |
| 28 | + */ | |
| 29 | + private Date deliveryDate; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 出院时间 | |
| 33 | + */ | |
| 34 | + private Date leaveDate; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 体温 | |
| 38 | + */ | |
| 39 | + private String temperature; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 健康状况 | |
| 43 | + */ | |
| 44 | + private String fitnessDesc; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 心理状况 | |
| 48 | + */ | |
| 49 | + private String mentalityDesc; | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 血压 {\"szy\":13,\"ssy\":12} | |
| 53 | + */ | |
| 54 | + private String bp; | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 乳房 | |
| 58 | + */ | |
| 59 | + private String breast; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 恶露 | |
| 63 | + */ | |
| 64 | + private String lochia; | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * 子宫 | |
| 68 | + */ | |
| 69 | + private String matrix; | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 伤口 | |
| 73 | + */ | |
| 74 | + private String wound; | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * 其他 | |
| 78 | + */ | |
| 79 | + private String otherDesc; | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 分类 | |
| 83 | + */ | |
| 84 | + private String healthType; | |
| 85 | + | |
| 86 | + private String hospitalId; | |
| 87 | + | |
| 88 | + public String getHospitalId() { | |
| 89 | + return hospitalId; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setHospitalId(String hospitalId) { | |
| 93 | + this.hospitalId = hospitalId; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public String getId() { | |
| 97 | + return id; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public void setId(String id) { | |
| 101 | + this.id = id; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public Date getDeliveryDate() { | |
| 105 | + return deliveryDate; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public void setDeliveryDate(Date deliveryDate) { | |
| 109 | + this.deliveryDate = deliveryDate; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public Date getLeaveDate() { | |
| 113 | + return leaveDate; | |
| 114 | + } | |
| 115 | + | |
| 116 | + public void setLeaveDate(Date leaveDate) { | |
| 117 | + this.leaveDate = leaveDate; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public String getTemperature() { | |
| 121 | + return temperature; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public void setTemperature(String temperature) { | |
| 125 | + this.temperature = temperature; | |
| 126 | + } | |
| 127 | + | |
| 128 | + public String getFitnessDesc() { | |
| 129 | + return fitnessDesc; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public void setFitnessDesc(String fitnessDesc) { | |
| 133 | + this.fitnessDesc = fitnessDesc; | |
| 134 | + } | |
| 135 | + | |
| 136 | + public String getMentalityDesc() { | |
| 137 | + return mentalityDesc; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public void setMentalityDesc(String mentalityDesc) { | |
| 141 | + this.mentalityDesc = mentalityDesc; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public String getBp() { | |
| 145 | + return bp; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public void setBp(String bp) { | |
| 149 | + this.bp = bp; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public String getBreast() { | |
| 153 | + return breast; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public void setBreast(String breast) { | |
| 157 | + this.breast = breast; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public String getLochia() { | |
| 161 | + return lochia; | |
| 162 | + } | |
| 163 | + | |
| 164 | + public void setLochia(String lochia) { | |
| 165 | + this.lochia = lochia; | |
| 166 | + } | |
| 167 | + | |
| 168 | + public String getMatrix() { | |
| 169 | + return matrix; | |
| 170 | + } | |
| 171 | + | |
| 172 | + public void setMatrix(String matrix) { | |
| 173 | + this.matrix = matrix; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public String getWound() { | |
| 177 | + return wound; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public void setWound(String wound) { | |
| 181 | + this.wound = wound; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public String getOtherDesc() { | |
| 185 | + return otherDesc; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public void setOtherDesc(String otherDesc) { | |
| 189 | + this.otherDesc = otherDesc; | |
| 190 | + } | |
| 191 | + | |
| 192 | + public String getHealthType() { | |
| 193 | + return healthType; | |
| 194 | + } | |
| 195 | + | |
| 196 | + public void setHealthType(String healthType) { | |
| 197 | + this.healthType = healthType; | |
| 198 | + } | |
| 199 | + | |
| 200 | + public String getPid() { | |
| 201 | + return pid; | |
| 202 | + } | |
| 203 | + | |
| 204 | + public void setPid(String pid) { | |
| 205 | + this.pid = pid; | |
| 206 | + } | |
| 207 | + | |
| 208 | + public String getParentid() { | |
| 209 | + return parentid; | |
| 210 | + } | |
| 211 | + | |
| 212 | + public void setParentid(String parentid) { | |
| 213 | + this.parentid = parentid; | |
| 214 | + } | |
| 215 | + | |
| 216 | + public String getDeliverId() { | |
| 217 | + return deliverId; | |
| 218 | + } | |
| 219 | + | |
| 220 | + public void setDeliverId(String deliverId) { | |
| 221 | + this.deliverId = deliverId; | |
| 222 | + } | |
| 223 | + | |
| 224 | + public String getPhone() { | |
| 225 | + return phone; | |
| 226 | + } | |
| 227 | + | |
| 228 | + public void setPhone(String phone) { | |
| 229 | + this.phone = phone; | |
| 230 | + } | |
| 231 | +} |