|  | @ -1,11 +1,9 @@
 | 
	
		
			
				|  |  | package com.yihu.wlyy.web.patient.feedback;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.feedback.Appeal;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.app.feedback.AppealService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.feedback.Feedback;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.app.feedback.FeedbackService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.CommonUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.IdcardValidator;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.web.WeixinBaseController;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
	
		
			
				|  | @ -21,13 +19,11 @@ import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | @Controller
 | 
	
		
			
				|  |  | @RestController
 | 
	
		
			
				|  |  | @RequestMapping(value = "/patient/feedback")
 | 
	
		
			
				|  |  | @Api(description = "居民端意见反馈与账号申诉")
 | 
	
		
			
				|  |  | @Api(description = "居民端意见反馈")
 | 
	
		
			
				|  |  | public class PatientFeedbackController extends WeixinBaseController {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private FeedbackService feedbackService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private AppealService appealService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private CommonUtil CommonUtil;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
	
		
			
				|  | @ -78,75 +74,14 @@ public class PatientFeedbackController extends WeixinBaseController {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/saveAppeal", method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "居民端保存申诉")
 | 
	
		
			
				|  |  |     public String saveAppeal(
 | 
	
		
			
				|  |  |             @ApiParam(name = "description", value = "申诉人姓名")
 | 
	
		
			
				|  |  |             @RequestParam(value = "description", required = true) String description,
 | 
	
		
			
				|  |  |             @ApiParam(name = "type", value = "申诉人类型")
 | 
	
		
			
				|  |  |             @RequestParam(value = "type", required = true) int type,
 | 
	
		
			
				|  |  |             @ApiParam(name = "images", value = "图片")
 | 
	
		
			
				|  |  |             @RequestParam(required = false) String images,
 | 
	
		
			
				|  |  |             @ApiParam(name = "phone", value = "手机号码")
 | 
	
		
			
				|  |  |             @RequestParam(value = "phone", required = true) String phone,
 | 
	
		
			
				|  |  |             @ApiParam(name = "name", value = "申诉人姓名")
 | 
	
		
			
				|  |  |             @RequestParam(value = "name", required = true) String name,
 | 
	
		
			
				|  |  |             @ApiParam(name = "idcard", value = "申诉人身份证号码")
 | 
	
		
			
				|  |  |             @RequestParam(value = "idcard", required = true) String idcard) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             // 校验身份证号
 | 
	
		
			
				|  |  |             IdcardValidator validator = new IdcardValidator();
 | 
	
		
			
				|  |  |             if (validator.isValidatedAllIdcard(idcard)) {
 | 
	
		
			
				|  |  |                 if (idcard.length() == 15) {
 | 
	
		
			
				|  |  |                     idcard = validator.convertIdcarBy15bit(idcard);
 | 
	
		
			
				|  |  |                     if (StringUtils.isEmpty(idcard)) {
 | 
	
		
			
				|  |  |                         return error(-1, "请输入正确的身份证号!");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 return error(-1, "请输入正确的身份证号!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //        图片上传
 | 
	
		
			
				|  |  |             String photos="";
 | 
	
		
			
				|  |  |             if (StringUtils.isNotEmpty(images)) {
 | 
	
		
			
				|  |  |                 String[] mediaIds = images.split(",");
 | 
	
		
			
				|  |  |                 for (String mediaId : mediaIds) {
 | 
	
		
			
				|  |  |                     if (StringUtils.isEmpty(mediaId)) {
 | 
	
		
			
				|  |  |                         continue;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     String temp = saveImageToDisk(mediaId);
 | 
	
		
			
				|  |  |                     if (StringUtils.isNotEmpty(temp)) {
 | 
	
		
			
				|  |  |                         if (photos.length() == 0) {
 | 
	
		
			
				|  |  |                             photos = temp;
 | 
	
		
			
				|  |  |                         } else {
 | 
	
		
			
				|  |  |                             photos += "," + temp;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (StringUtils.isNotEmpty(photos)) {
 | 
	
		
			
				|  |  |                 photos = CommonUtil.copyTempImage(photos);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | //             保存到数据库
 | 
	
		
			
				|  |  |             appealService.saveAppeal(getUID(),description,type,photos,phone,1,name,idcard);
 | 
	
		
			
				|  |  |             return write(200, "保存成功!");
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             error(e);
 | 
	
		
			
				|  |  |             return invalidUserException(e, -1, "保存失败!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @RequestMapping(value = "findByIdcard", method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @RequestMapping(value = "findByCreater", method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "按身份证查询")
 | 
	
		
			
				|  |  |     public String findByIdcard(@ApiParam(name = "idcard", value = "申诉人身份证号码")
 | 
	
		
			
				|  |  |                                @RequestParam(value = "idcard", required = true) String idcard,
 | 
	
		
			
				|  |  |                                @ApiParam(name = "page", value = "第几页")
 | 
	
		
			
				|  |  |     public String findByIdcard(@ApiParam(name = "page", value = "第几页")
 | 
	
		
			
				|  |  |                                @RequestParam(value = "page", required = true) Integer page,
 | 
	
		
			
				|  |  |                                @ApiParam(name = "pagesize", value = "页面大小")
 | 
	
		
			
				|  |  |                                @RequestParam(value = "pagesize", required = true) Integer pagesize){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             JSONArray jsonArray = appealService.findAppealByIdcard(idcard,page,pagesize);
 | 
	
		
			
				|  |  |             JSONArray jsonArray = feedbackService.findByCreater(getUID(),page,pagesize,1);
 | 
	
		
			
				|  |  |             return write(200,"查询成功","list",jsonArray);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             error(e);
 | 
	
	
		
			
				|  | @ -157,21 +92,24 @@ public class PatientFeedbackController extends WeixinBaseController {
 | 
	
		
			
				|  |  |     @RequestMapping(value = "findByCode", method = RequestMethod.GET)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "按code查询")
 | 
	
		
			
				|  |  |     public String findByCode(@ApiParam(name = "code", value = "code")
 | 
	
		
			
				|  |  |                                @RequestParam(value = "code", required = true) String code){
 | 
	
		
			
				|  |  |                              @RequestParam(value = "code", required = true) String code){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Appeal appeal = appealService.findByCode(code);
 | 
	
		
			
				|  |  |             return write(200,"查询成功","data",appeal);
 | 
	
		
			
				|  |  |             Feedback feedback = feedbackService.findByCode(code);
 | 
	
		
			
				|  |  |             return write(200,"查询成功","data",feedback);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             error(e);
 | 
	
		
			
				|  |  |             return error(-1,"查询失败");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取微信服务器图片
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Override
 | 
	
		
			
				|  |  |     public String fetchWxImages() {
 | 
	
		
			
				|  |  |         String photos = "";
 | 
	
		
			
				|  |  |         try {
 |