|  | @ -0,0 +1,69 @@
 | 
	
		
			
				|  |  | package com.yihu.wlyy.web.doctor.template;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.wlyy.aop.ObserverRequired;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.template.DoctorGuidanceTemp;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.template.DoctorGuidanceTempDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.template.DoctorFeldsherTemplateService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.template.DoctorGuidanceTempService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.web.BaseController;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiParam;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.json.JSONArray;
 | 
	
		
			
				|  |  | import org.json.JSONObject;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestMethod;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RequestParam;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * 医生健康指导模板
 | 
	
		
			
				|  |  |  * <p>
 | 
	
		
			
				|  |  |  * Created by Reece on 2017/9/14.
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | @RestController
 | 
	
		
			
				|  |  | @RequestMapping(value = "/doctor/feldsher")
 | 
	
		
			
				|  |  | @Api(description = "医生健康指导模板")
 | 
	
		
			
				|  |  | public class DoctorFeldsherTemplateController extends BaseController {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DoctorFeldsherTemplateService feldsherTemplateService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     DoctorGuidanceTempDao guidanceTempDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * @param doctorCode   医生code
 | 
	
		
			
				|  |  |      * @param sessionId    会话Id
 | 
	
		
			
				|  |  |      * @param sessionType  会话类型
 | 
	
		
			
				|  |  |      * @param businessType 消息类型
 | 
	
		
			
				|  |  |      * @param from         发送者
 | 
	
		
			
				|  |  |      * @param content      消息内容
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/sendDoctorTemplate", method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "医生助手给医生发送模板消息")
 | 
	
		
			
				|  |  |     public String sendDoctorTemplate(@RequestParam @ApiParam(value = "医生code") String doctorCode,
 | 
	
		
			
				|  |  |                                      @RequestParam @ApiParam(value = "会话Id", required = false) String sessionId,
 | 
	
		
			
				|  |  |                                      @RequestParam @ApiParam(value = "会话类型", required = false) String sessionType,
 | 
	
		
			
				|  |  |                                      @RequestParam @ApiParam(value = "消息类型") String businessType,
 | 
	
		
			
				|  |  |                                      @RequestParam @ApiParam(value = "发送者", required = false) String from,
 | 
	
		
			
				|  |  |                                      @RequestParam @ApiParam(value = "消息内容") String content) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Boolean flag = feldsherTemplateService.sendDoctorTemplate(doctorCode, sessionId, sessionType, businessType, from, content);
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 return write(200, "发送成功!");
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 return write( -1, "发送失败!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             return invalidUserException(e, -1, "发送失败!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |