| 
					
				 | 
			
			
				@ -1,24 +1,26 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.wlyy.web.doctor.feedback; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.aop.ObserverRequired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.feedback.Appeal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.service.app.feedback.AppealService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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.BaseController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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.ResponseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Created by Reece on 2017/5/6. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@Controller 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RequestMapping(value = "/doctor/feedback") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@Api(description = "医生端意见反馈与账号申诉") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class DoctorFeedbackController extends BaseController { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -61,31 +63,58 @@ public class DoctorFeedbackController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 医生端保存账号申诉 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param description 问题描述 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type        选择类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param images      图片,多图逗号分隔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param phone       手机号码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/saveAppeal", method = RequestMethod.POST) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "医生端保存申诉") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ResponseBody 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ObserverRequired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String saveAppeal( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam String description, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam int type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @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, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam String phone) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @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 imagesUrl = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String imageRow = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String imageUrls = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotEmpty(images)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                images = CommonUtil.copyTempImage(images); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] imgs = images.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (String image : imgs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (image.contains("group1")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        imageUrls += image + ","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            imageRow += CommonUtil.copyTempImage(image) + ","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                imagesUrl = imageUrls + imageRow; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                imagesUrl = imagesUrl.substring(0, imagesUrl.length() - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//             保存到数据库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            appealService.saveAppeal(getUID(),description,type,images,phone,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            appealService.saveAppeal(getUID(),description,type,imagesUrl,phone,2,name,idcard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return write(200, "保存成功!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            error(e); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -93,5 +122,35 @@ public class DoctorFeedbackController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "findByIdcard", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "按身份证查询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findByIdcard(@ApiParam(name = "idcard", value = "申诉人身份证号码") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               @RequestParam(value = "idcard", required = true) String idcard, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               @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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return write(200,"查询成功","list",jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            error(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return error(-1,"查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "findByCode", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "按code查询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findByCode(@ApiParam(name = "code", value = "code") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             @RequestParam(value = "code", required = true) String code){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Appeal appeal = appealService.findByCode(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return write(200,"查询成功","data",appeal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            error(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return error(-1,"查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |