| 
															
																@ -11,6 +11,7 @@ import com.yihu.wlyy.service.app.consult.ConsultService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.app.health.*; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.app.health.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.service.common.account.PatientService; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.service.common.account.PatientService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.wlyy.util.ImUtill; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.web.WeixinBaseController; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.web.WeixinBaseController; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.web.doctor.message.DoctorMessageController; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.web.doctor.message.DoctorMessageController; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils; 
															 | 
															
															 | 
															
																import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -84,13 +85,18 @@ public class DoctorHealthEduArticleController extends WeixinBaseController { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 查询 
															 | 
															
															 | 
															
																     * 查询 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 
															 | 
															
															 | 
															
																     * 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param pagesize 分页大小 
															 | 
															
															 | 
															
																     * @param pagesize 分页大小 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param wheaType 文章类型 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 列表 
															 | 
															
															 | 
															
																     * @return 列表 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @RequestMapping(value = "list") 
															 | 
															
															 | 
															
																    @RequestMapping(value = "list") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @ResponseBody 
															 | 
															
															 | 
															
																    @ResponseBody 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public String list(@RequestParam(value = "page", required = true) int page, @RequestParam(value = "pagesize", required = true) int pagesize, @RequestParam(value = "filter", required = false) String filter, @RequestParam(value = "patient", required = false) String patient) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public String list(@RequestParam(value = "page", required = true) int page, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                       @RequestParam(value = "pagesize", required = true) int pagesize, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                       @RequestParam(value = "wheaType", required = true) int wheaType, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                       @RequestParam(value = "filter", required = false) String filter, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                       @RequestParam(value = "patient", required = false) String patient) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        try { 
															 | 
															
															 | 
															
																        try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            List<Map<String, Object>> list = healthEduArticleService.findAll(page, pagesize, filter, getUID(), patient); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            List<Map<String, Object>> list = healthEduArticleService.findAll(page, pagesize, filter, getUID(), patient,wheaType); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            JSONArray jsonArray = new JSONArray(); 
															 | 
															
															 | 
															
																            JSONArray jsonArray = new JSONArray(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            if (list != null) { 
															 | 
															
															 | 
															
																            if (list != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                for (Map<String, Object> map : list) { 
															 | 
															
															 | 
															
																                for (Map<String, Object> map : list) { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -302,6 +308,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param code    文章标识,多个以逗号分隔 
															 | 
															
															 | 
															
																     * @param code    文章标识,多个以逗号分隔 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param patient 患者标识,多个以逗号分隔 
															 | 
															
															 | 
															
																     * @param patient 患者标识,多个以逗号分隔 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param group   所选群组,多个用逗号分隔 
															 | 
															
															 | 
															
																     * @param group   所选群组,多个用逗号分隔 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param  attachedContent 附加内容 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @RequestMapping(value = "send") 
															 | 
															
															 | 
															
																    @RequestMapping(value = "send") 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -310,7 +317,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                       @RequestParam(value = "patient", required = false) String patient, 
															 | 
															
															 | 
															
																                       @RequestParam(value = "patient", required = false) String patient, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                       @RequestParam(value = "group", required = false, defaultValue = "") String group, 
															 | 
															
															 | 
															
																                       @RequestParam(value = "group", required = false, defaultValue = "") String group, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                       @RequestParam(value = "labelType", required = false) String labelType, 
															 | 
															
															 | 
															
																                       @RequestParam(value = "labelType", required = false) String labelType, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                       @RequestParam(value = "teamCode", required = false) long teamCode) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                       @RequestParam(value = "teamCode", required = false) long teamCode, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                       @RequestParam(value = "attachedContent", required = false) String attachedContent) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        try { 
															 | 
															
															 | 
															
																        try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            List<HealthEduArticlePatient> list = new ArrayList<HealthEduArticlePatient>(); 
															 | 
															
															 | 
															
																            List<HealthEduArticlePatient> list = new ArrayList<HealthEduArticlePatient>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            if (StringUtils.isEmpty(code)) { 
															 | 
															
															 | 
															
																            if (StringUtils.isEmpty(code)) { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -351,6 +359,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            String endMsg = "为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。"; 
															 | 
															
															 | 
															
																            String endMsg = "为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            JSONArray messages = new JSONArray(); 
															 | 
															
															 | 
															
																            JSONArray messages = new JSONArray(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            Map<String, Map<String, Object>> msgs = new HashMap<>(); 
															 | 
															
															 | 
															
																            Map<String, Map<String, Object>> msgs = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            String batchNo = UUID.randomUUID().toString(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            Date createTime = new Date(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            for (String p : patientSet) { 
															 | 
															
															 | 
															
																            for (String p : patientSet) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                Patient patientTemp = patientService.findByCode(p); 
															 | 
															
															 | 
															
																                Patient patientTemp = patientService.findByCode(p); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                SignFamily signFamily = signFamilyDao.findByjiatingPatient(p); 
															 | 
															
															 | 
															
																                SignFamily signFamily = signFamilyDao.findByjiatingPatient(p); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -389,8 +399,18 @@ public class DoctorHealthEduArticleController extends WeixinBaseController { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    heap.setSignType(2); 
															 | 
															
															 | 
															
																                    heap.setSignType(2); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    // 行政团队 
															 | 
															
															 | 
															
																                    // 行政团队 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    heap.setAdminTeamCode(signFamily.getAdminTeamId()); 
															 | 
															
															 | 
															
																                    heap.setAdminTeamCode(signFamily.getAdminTeamId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    //附加内容 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    heap.setAttachedContent(attachedContent); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    //批次号记录发送批次 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    heap.setBatchNo(batchNo); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    //创建时间 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    heap.setCzrq(createTime); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    list.add(heap); 
															 | 
															
															 | 
															
																                    list.add(heap); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle()+ "\",\"type\":0,\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patientTemp.getName()); 
															 | 
															
															 | 
															
																                    consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle()+ "\",\"type\":0,\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patientTemp.getName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    if(StringUtils.isNotBlank(attachedContent)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        //发送备注 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, attachedContent, ImUtill.CONTENT_TYPE_TEXT, patientTemp.getName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    if (StringUtils.isNotEmpty(patientTemp.getOpenid())) { 
															 | 
															
															 | 
															
																                    if (StringUtils.isNotEmpty(patientTemp.getOpenid())) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        // 推送消息给微信端 
															 | 
															
															 | 
															
																                        // 推送消息给微信端 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        JSONObject json = new JSONObject(); 
															 | 
															
															 | 
															
																                        JSONObject json = new JSONObject(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -436,15 +456,12 @@ public class DoctorHealthEduArticleController extends WeixinBaseController { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                            PushMsgTask.getInstance().putWxMsg(getAccessToken(), 9, member.getOpenid(), member.getName(), data); 
															 | 
															
															 | 
															
																                            PushMsgTask.getInstance().putWxMsg(getAccessToken(), 9, member.getOpenid(), member.getName(), data); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        } 
															 | 
															
															 | 
															
																                        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    } 
															 | 
															
															 | 
															
																                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    JSONObject json = (JSONObject) map.get("json"); 
															 | 
															
															 | 
															
																                    JSONObject json = (JSONObject) map.get("json"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                for (HealthEduArticlePatient heap : list) { 
															 | 
															
															 | 
															
																                for (HealthEduArticlePatient heap : list) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    BusinessLogs.info(BusinessLogs.BusinessType.article, getUID(), heap.getPatient(), new JSONObject(heap)); 
															 | 
															
															 | 
															
																                    BusinessLogs.info(BusinessLogs.BusinessType.article, getUID(), heap.getPatient(), new JSONObject(heap)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                // 推送消息给患者 
															 | 
															
															 | 
															
																                // 推送消息给患者 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                PushMsgTask.getInstance().put(messages); 
															 | 
															
															 | 
															
																                PushMsgTask.getInstance().put(messages); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                return success("发送成功!"); 
															 | 
															
															 | 
															
																                return success("发送成功!"); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -515,6 +532,29 @@ public class DoctorHealthEduArticleController extends WeixinBaseController { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @RequestMapping(value = "/logs") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @ResponseBody 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public String getPatientHealthLogs(@RequestParam(value = "page", required = true) int page, @RequestParam(value = "pagesize", required = true) int pagesize){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																       try{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																           List<Map<String,Object>> result  =  healthEduArticlePatientService.findByDoctor("fa4dd1995f0f11e68344fa163e8aee56",page,pagesize); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																           return write(200,"查询成功!","list",result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																       }catch (Exception e){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																           return write(-1,"查询失败!"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																       } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @RequestMapping(value = "/log") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @ResponseBody 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public String getPatientHealthLog(@RequestParam(value = "article", required = true) String article, @RequestParam(value = "batchNo", required = false) String batchNo){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        try{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            List<Map<String,Object>> result  =   healthEduArticlePatientService.findByBatchNo("fa4dd1995f0f11e68344fa163e8aee56",article,batchNo); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return write(200,"查询成功!","list",result); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        }catch (Exception e){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return write(-1,"查询失败!"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private String parsrHtml(String html) { 
															 | 
															
															 | 
															
																    private String parsrHtml(String html) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        html = ("<span>" + html + "</span>");//拼接一个HTML标签,防止纯文字字符串转换在linux下面出现的异常。 
															 | 
															
															 | 
															
																        html = ("<span>" + html + "</span>");//拼接一个HTML标签,防止纯文字字符串转换在linux下面出现的异常。 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Parser parser = null; 
															 | 
															
															 | 
															
																        Parser parser = null; 
															 |