yeshijie 7 éve
szülő
commit
12f1ff2bc5

+ 50 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/feedback/Feedback.java

@ -1,8 +1,12 @@
package com.yihu.wlyy.entity.feedback;
package com.yihu.wlyy.entity.feedback;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
/**
 * Created by Reece on 2017/5/6.
 * Created by Reece on 2017/5/6.
@ -21,7 +25,7 @@ public class Feedback extends IdEntity{
//    反馈人身份 1、患者  2、医生
//    反馈人身份 1、患者  2、医生
    @Column(name="identity")
    @Column(name="identity")
    private  int identity;
    private Integer identity;
//    问题描述
//    问题描述
    @Column(name="description")
    @Column(name="description")
@ -39,7 +43,7 @@ public class Feedback extends IdEntity{
    @Column(name="contact")
    @Column(name="contact")
    private String contact;
    private String contact;
//    状态 0、未读 1、已读
//  状态 0、未读 1、待处理  2、已处理
    @Column(name="status")
    @Column(name="status")
    private int status;
    private int status;
@ -51,6 +55,11 @@ public class Feedback extends IdEntity{
    @Column(name="creater_name")
    @Column(name="creater_name")
    private String createrName;
    private String createrName;
    private String phone; //    '手机号'
    private String result; //    '处理结果'
    private String idcard;//反馈人身份证
    private Date createTime;//反馈时间
    public Integer getDel() {
    public Integer getDel() {
        return del;
        return del;
    }
    }
@ -146,4 +155,42 @@ public class Feedback extends IdEntity{
    public void setStatus(int status) {
    public void setStatus(int status) {
        this.status = status;
        this.status = status;
    }
    }
    public void setIdentity(Integer identity) {
        this.identity = identity;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getResult() {
        return result;
    }
    public void setResult(String result) {
        this.result = result;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
}
}

+ 20 - 3
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/feedback/FeedbackController.java

@ -2,7 +2,6 @@ package com.yihu.wlyy.controller.manager.feedback;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.service.manager.feedback.AppealService;
import com.yihu.wlyy.service.manager.feedback.FeedbackService;
import com.yihu.wlyy.service.manager.feedback.FeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -24,8 +23,7 @@ import java.util.Map;
@RequestMapping(value = "admin/feedback")
@RequestMapping(value = "admin/feedback")
@Api(description = "管理系统意见反馈接口")
@Api(description = "管理系统意见反馈接口")
public class FeedbackController extends BaseController {
public class FeedbackController extends BaseController {
    @Autowired
    private AppealService appealService;
    @Autowired
    @Autowired
    private FeedbackService feedbackService;
    private FeedbackService feedbackService;
@ -109,4 +107,23 @@ public class FeedbackController extends BaseController {
        }
        }
    }
    }
    /**
     * 根据反馈id,回复内容result进行处理
     * @param id
     * @param result
     * @return
     */
    @RequestMapping(value="dealFeedback", method = RequestMethod.POST)
    @ResponseBody
    public String dealAppeal(@RequestParam(required = true,value="id") Long id,
                             @RequestParam(required = true,value="result") String result){
        try {
            feedbackService.dealFeedback(id,result);
            return write(200,"操作成功!");
        }catch (Exception e){
            error(e);
            return error(-1, "操作失败!");
        }
    }
}
}

+ 43 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/feedback/Feedback.java

@ -1,9 +1,12 @@
package com.yihu.wlyy.entity.feedback;
package com.yihu.wlyy.entity.feedback;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Table;
import java.util.Date;
/**
/**
 * 意见反馈表
 * 意见反馈表
@ -26,13 +29,18 @@ public class Feedback extends IdEntity {
    private String images;
    private String images;
    //    联系方式: qq号或者邮箱
    //    联系方式: qq号或者邮箱
    private String contact;
    private String contact;
    //    状态 0、未读 1、已读
    //    /状态 0、未读 1、待处理  2、已处理
    private int status;
    private int status;
    //    是否删除 0、删除 1、正常
    //    是否删除 0、删除 1、正常
    private int del;
    private int del;
    //    创建人姓名
    //    创建人姓名
    private String createrName;
    private String createrName;
    private String result; //    '处理结果'
    private String phone; //    '手机号'
    private String idcard;//反馈人身份证
    private Date createTime;//反馈时间
    public Feedback() {
    public Feedback() {
    }
    }
@ -115,4 +123,38 @@ public class Feedback extends IdEntity {
    public void setStatus(int status) {
    public void setStatus(int status) {
        this.status = status;
        this.status = status;
    }
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getResult() {
        return result;
    }
    public void setResult(String result) {
        this.result = result;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
}
}

+ 14 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/FeedbackService.java

@ -156,4 +156,18 @@ public class FeedbackService extends BaseService {
            }
            }
        }
        }
    }
    }
    /***
     * 根据反馈id保存处理结果
     * @param id
     * @param result
     * @throws Exception
     */
    public void dealFeedback(Long id,String result) throws Exception {
        Feedback feedback = feedbackDao.findFeedbackById(id);
        feedback.setResult(result);
        feedback.setStatus(2);
        feedbackDao.save(feedback);
    }
}
}

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -178,6 +178,8 @@ public class SwaggerConfig {
                        regex("/im_new/.*"),
                        regex("/im_new/.*"),
                        regex("/version/.*"),
                        regex("/version/.*"),
                        regex("/express/.*"),
                        regex("/express/.*"),
                        regex("/doctorFeeback/.*"),
                        regex("/patientFeeback/.*"),
                        regex("/esstatistics/.*")
                        regex("/esstatistics/.*")
                ))
                ))
                .build()
                .build()

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/feedback/FeedbackDao.java

@ -1,11 +1,20 @@
package com.yihu.wlyy.repository.feedback;
package com.yihu.wlyy.repository.feedback;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.entity.feedback.Feedback;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
/**
 * Created by Reece on 2017/5/6.
 * Created by Reece on 2017/5/6.
 */
 */
public interface FeedbackDao extends PagingAndSortingRepository<Feedback, Long>,JpaSpecificationExecutor<Feedback> {
public interface FeedbackDao extends PagingAndSortingRepository<Feedback, Long>,JpaSpecificationExecutor<Feedback> {
    @Query("from Feedback p where p.creater = ?1 and p.identity=?2 and p.del=1 ")
    Page<Feedback> findByCreater(String creater,Integer identity,Pageable pageRequest);
    @Query("select p from Feedback p where p.code=?1")
    Feedback findByCode(String code);
}
}

+ 22 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/feedback/AppealService.java

@ -5,11 +5,14 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.feedback.Appeal;
import com.yihu.wlyy.entity.feedback.Appeal;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.feedback.AppealDao;
import com.yihu.wlyy.repository.feedback.AppealDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.PageRequest;
@ -29,9 +32,12 @@ public class AppealService extends BaseService {
    @Autowired
    @Autowired
    private PatientService patientService;
    private PatientService patientService;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    @Autowired
    private DoctorService doctorService;
    private DoctorService doctorService;
    @Autowired
    private DoctorDao doctorDao;
    /**
    /**
     * 保存账号申诉
     * 保存账号申诉
@ -78,10 +84,24 @@ public class AppealService extends BaseService {
     * @param idcard
     * @param idcard
     * @param page
     * @param page
     * @param pagesize
     * @param pagesize
     * @param type 类型 1居民 2医生
     * @return
     * @return
     */
     */
    public JSONArray findAppealByIdcard(String idcard,Integer page,Integer pagesize){
    public JSONArray findAppealByIdcard(String idcard,String userCode,Integer page,Integer pagesize,Integer type){
        JSONArray re = new JSONArray();
        JSONArray re = new JSONArray();
        if(StringUtils.isEmpty(idcard)&&StringUtils.isEmpty(userCode)){
            return re;
        }
        if(StringUtils.isEmpty(idcard)){
            if(type==1){
                Patient patient = patientDao.findByCode(userCode);
                idcard = patient.getIdcard();
            }else {
                Doctor doctor = doctorDao.findByCode(userCode);
                idcard = doctor.getIdcard();
            }
        }
        pagesize = pagesize==null? 10:pagesize;
        pagesize = pagesize==null? 10:pagesize;
        // 排序
        // 排序

+ 50 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/feedback/FeedbackService.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.service.app.feedback;
package com.yihu.wlyy.service.app.feedback;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.Patient;
@ -7,10 +9,17 @@ import com.yihu.wlyy.repository.feedback.FeedbackDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
/**
 * Created by Reece on 2017/5/6.
 * Created by Reece on 2017/5/6.
 */
 */
@ -42,12 +51,53 @@ public class FeedbackService extends BaseService {
        if(identity==1){//说明是患者
        if(identity==1){//说明是患者
            Patient patient = patientService.findByCode(creater);
            Patient patient = patientService.findByCode(creater);
            name = patient.getName();
            name = patient.getName();
            feedback.setIdcard(patient.getIdcard());
            feedback.setPhone(patient.getMobile());
        }else{//说明是医生
        }else{//说明是医生
            Doctor doctor = doctorService.findDoctorByCode(creater);
            Doctor doctor = doctorService.findDoctorByCode(creater);
            name = doctor.getName();
            name = doctor.getName();
            feedback.setIdcard(doctor.getIdcard());
            feedback.setPhone(doctor.getMobile());
        }
        }
        feedback.setCreateTime(new Date());
        feedback.setCreaterName(name);
        feedback.setCreaterName(name);
        feedbackDao.save(feedback);
        feedbackDao.save(feedback);
    }
    }
    /**
     * 按用户code查找
     * @param userCode
     * @param page
     * @param pagesize
     * @param type 类型 1居民 2医生
     * @return
     */
    public JSONArray findByCreater(String userCode, Integer page, Integer pagesize, Integer type){
        JSONArray re = new JSONArray();
        page = page == null?0:page;
        pagesize = pagesize==null? 10:pagesize;
        // 排序
        Sort sort = new Sort(Direction.DESC, "createTime");
        // 分页信息
        PageRequest pageRequest = new PageRequest(page, pagesize, sort);
        Page<Feedback> pages = feedbackDao.findByCreater(userCode,type,pageRequest);
        pages.forEach(feedback -> {
            JSONObject json = new JSONObject();
            json.put("code",feedback.getCode());
            json.put("createTime", DateUtil.dateToStrLong(feedback.getCreateTime()));
            json.put("type",feedback.getType());
            json.put("status",feedback.getStatus());
            json.put("description",feedback.getDescription());
            re.add(json);
        });
        return re;
    }
    public Feedback findByCode(String code){
        return feedbackDao.findByCode(code);
    }
}
}

+ 120 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorAppealController.java

@ -0,0 +1,120 @@
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.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.*;
/**
 * 因账号申诉不需要登录 所以剥离出来
 * Created by yeshijie on 2017/10/30.
 */
@Controller
@RestController
@RequestMapping(value = "/doctorFeeback/feedback")
@Api(description = "医生端账号申诉")
public class DoctorAppealController extends BaseController{
    @Autowired
    private AppealService appealService;
    @Autowired
    private CommonUtil commonUtil;
    @RequestMapping(value = "/saveAppeal", method = RequestMethod.POST)
    @ApiOperation(value = "医生端保存申诉")
    @ResponseBody
    @ObserverRequired
    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 imagesUrl = null;
            String imageRow = "";
            String imageUrls = "";
            if (StringUtils.isNotEmpty(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,imagesUrl,phone,2,name,idcard);
            return write(200, "保存成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存失败!");
        }
    }
    @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,getUID(),page,pagesize,2);
            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,"查询失败");
        }
    }
}

+ 7 - 73
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackController.java

@ -2,11 +2,9 @@ package com.yihu.wlyy.web.doctor.feedback;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.aop.ObserverRequired;
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.entity.feedback.Feedback;
import com.yihu.wlyy.service.app.feedback.FeedbackService;
import com.yihu.wlyy.service.app.feedback.FeedbackService;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.IdcardValidator;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -22,13 +20,11 @@ import org.springframework.web.bind.annotation.*;
@Controller
@Controller
@RestController
@RestController
@RequestMapping(value = "/doctor/feedback")
@RequestMapping(value = "/doctor/feedback")
@Api(description = "医生端意见反馈与账号申诉")
@Api(description = "医生端意见反馈")
public class DoctorFeedbackController extends BaseController {
public class DoctorFeedbackController extends BaseController {
    @Autowired
    @Autowired
    private FeedbackService feedbackService;
    private FeedbackService feedbackService;
    @Autowired
    @Autowired
    private AppealService appealService;
    @Autowired
    private CommonUtil CommonUtil;
    private CommonUtil CommonUtil;
    /**
    /**
@ -63,75 +59,14 @@ public class DoctorFeedbackController extends BaseController {
        }
        }
    }
    }
    @RequestMapping(value = "/saveAppeal", method = RequestMethod.POST)
    @ApiOperation(value = "医生端保存申诉")
    @ResponseBody
    @ObserverRequired
    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 imagesUrl = null;
            String imageRow = "";
            String imageUrls = "";
            if (StringUtils.isNotEmpty(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,imagesUrl,phone,2,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 = "按身份证查询")
    @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,
                               @RequestParam(value = "page", required = true) Integer page,
                               @ApiParam(name = "pagesize", value = "页面大小")
                               @ApiParam(name = "pagesize", value = "页面大小")
                               @RequestParam(value = "pagesize", required = true) Integer pagesize){
                               @RequestParam(value = "pagesize", required = true) Integer pagesize){
        try {
        try {
            JSONArray jsonArray = appealService.findAppealByIdcard(idcard,page,pagesize);
            JSONArray jsonArray = feedbackService.findByCreater(getUID(),page,pagesize,2);
            return write(200,"查询成功","list",jsonArray);
            return write(200,"查询成功","list",jsonArray);
        }catch (Exception e){
        }catch (Exception e){
            error(e);
            error(e);
@ -144,13 +79,12 @@ public class DoctorFeedbackController extends BaseController {
    public String findByCode(@ApiParam(name = "code", 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 {
        try {
            Appeal appeal = appealService.findByCode(code);
            return write(200,"查询成功","data",appeal);
            Feedback feedback = feedbackService.findByCode(code);
            return write(200,"查询成功","data",feedback);
        }catch (Exception e){
        }catch (Exception e){
            error(e);
            error(e);
            return error(-1,"查询失败");
            return error(-1,"查询失败");
        }
        }
    }
    }
}
}

+ 120 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientAppealController.java

@ -0,0 +1,120 @@
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.util.IdcardValidator;
import com.yihu.wlyy.web.WeixinBaseController;
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.RestController;
/**
 * Created by yeshijie on 2017/10/30.
 */
@Controller
@RestController
@RequestMapping(value = "/patientFeedback/feedback")
@Api(description = "居民端意见反馈与账号申诉")
public class PatientAppealController extends WeixinBaseController {
    @Autowired
    private AppealService appealService;
    @Autowired
    private com.yihu.wlyy.util.CommonUtil commonUtil;
    @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)
    @ApiOperation(value = "按身份证查询")
    public String findByIdcard(@ApiParam(name = "idcard", value = "申诉人身份证号码")
                               @RequestParam(value = "idcard", required = false) 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,getUID(),page,pagesize,1);
            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,"查询失败");
        }
    }
}

+ 11 - 73
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackController.java

@ -1,11 +1,9 @@
package com.yihu.wlyy.web.patient.feedback;
package com.yihu.wlyy.web.patient.feedback;
import com.alibaba.fastjson.JSONArray;
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.service.app.feedback.FeedbackService;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.IdcardValidator;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -21,13 +19,11 @@ import org.springframework.web.bind.annotation.*;
@Controller
@Controller
@RestController
@RestController
@RequestMapping(value = "/patient/feedback")
@RequestMapping(value = "/patient/feedback")
@Api(description = "居民端意见反馈与账号申诉")
@Api(description = "居民端意见反馈")
public class PatientFeedbackController extends WeixinBaseController {
public class PatientFeedbackController extends WeixinBaseController {
    @Autowired
    @Autowired
    private FeedbackService feedbackService;
    private FeedbackService feedbackService;
    @Autowired
    @Autowired
    private AppealService appealService;
    @Autowired
    private CommonUtil CommonUtil;
    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 = "按身份证查询")
    @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,
                               @RequestParam(value = "page", required = true) Integer page,
                               @ApiParam(name = "pagesize", value = "页面大小")
                               @ApiParam(name = "pagesize", value = "页面大小")
                               @RequestParam(value = "pagesize", required = true) Integer pagesize){
                               @RequestParam(value = "pagesize", required = true) Integer pagesize){
        try {
        try {
            JSONArray jsonArray = appealService.findAppealByIdcard(idcard,page,pagesize);
            JSONArray jsonArray = feedbackService.findByCreater(getUID(),page,pagesize,1);
            return write(200,"查询成功","list",jsonArray);
            return write(200,"查询成功","list",jsonArray);
        }catch (Exception e){
        }catch (Exception e){
            error(e);
            error(e);
@ -157,21 +92,24 @@ public class PatientFeedbackController extends WeixinBaseController {
    @RequestMapping(value = "findByCode", method = RequestMethod.GET)
    @RequestMapping(value = "findByCode", method = RequestMethod.GET)
    @ApiOperation(value = "按code查询")
    @ApiOperation(value = "按code查询")
    public String findByCode(@ApiParam(name = "code", 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 {
        try {
            Appeal appeal = appealService.findByCode(code);
            return write(200,"查询成功","data",appeal);
            Feedback feedback = feedbackService.findByCode(code);
            return write(200,"查询成功","data",feedback);
        }catch (Exception e){
        }catch (Exception e){
            error(e);
            error(e);
            return error(-1,"查询失败");
            return error(-1,"查询失败");
        }
        }
    }
    }
    /**
    /**
     * 获取微信服务器图片
     * 获取微信服务器图片
     *
     *
     * @return
     * @return
     */
     */
    @Override
    public String fetchWxImages() {
    public String fetchWxImages() {
        String photos = "";
        String photos = "";
        try {
        try {