浏览代码

申诉,意见反馈接口开发

chenyongxing 8 年之前
父节点
当前提交
a9cef69637

+ 27 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/feedback/Appeal.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.entity.feedback;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@ -30,9 +31,32 @@ public class Appeal extends IdEntity {
    //    申诉人身份:1、患者  2、医生
    private int identity;
    //是否删除   0 删除    1.未删除
    private Integer del ;
    @Column(name="creater_name")
    private String createrName;
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getCreaterName() {
        return createrName;
    }
    public void setCreaterName(String createrName) {
        this.createrName = createrName;
    }
    public Appeal() {
    }
    public Appeal(String code, String creater, String description, int type, String images, String phone, int status, String result, int identity) {
    public Appeal(String code, String creater, String description, int type, String images, String phone, int status, String result, int identity, Integer del, String createrName) {
        this.code = code;
        this.creater = creater;
        this.description = description;
@ -42,6 +66,8 @@ public class Appeal extends IdEntity {
        this.status = status;
        this.result = result;
        this.identity = identity;
        this.del = del;
        this.createrName = createrName;
    }
    public String getCode() {

+ 46 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/feedback/Feedback.java

@ -1,8 +1,8 @@
package com.yihu.wlyy.entity.feedback;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.*;
/**
 * Created by Reece on 2017/5/6.
@ -10,24 +10,64 @@ import javax.persistence.Table;
@Entity
@Table(name = "wlyy_feedback")
public class Feedback extends IdEntity{
//    意见反馈编码
    @Column(name="code")
    private String code;
//    反馈人编码
    @Column(name="creater")
    private String creater;
//    反馈人身份 1、患者  2、医生
    @Column(name="identity")
    private  int identity;
//    问题描述
    @Column(name="description")
    private String description;
//    反馈类别:1、优化建议、2、提交bug、3、新功能建议、4、其他
    @Column(name="type")
    private int type;
//    图片路径,逗号分隔
    @Column(name="images")
    private String images;
//    联系方式: qq号或者邮箱
    @Column(name="contact")
    private String contact;
//    状态 0、未读 1、已读
    @Column(name="status")
    private int status;
    public Feedback(String code, String creater, int identity, String description, int type, String images, String contact, int status) {
    //逻辑删除 0.删除   1.正常
    @Column(name="del")
    private Integer del;
    //创建人名字
    @Column(name="creater_name")
    private String createrName;
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getCreaterName() {
        return createrName;
    }
    public void setCreaterName(String createrName) {
        this.createrName = createrName;
    }
    public Feedback(String code, String creater, int identity, String description, int type, String images, String contact, int status, Integer del, String createrName) {
        this.code = code;
        this.creater = creater;
        this.identity = identity;
@ -36,7 +76,10 @@ public class Feedback extends IdEntity{
        this.images = images;
        this.contact = contact;
        this.status = status;
        this.del = del;
        this.createrName = createrName;
    }
    public Feedback() {
    }

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -139,6 +139,9 @@ public class DoctorInterceptor extends BaseInterceptor {
    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        if(null==request.getAttribute("log-start")){
            return;
        }
        long start = (long) request.getAttribute("log-start");
        long end = new Date().getTime();
        Class cls = ((HandlerMethod) handler).getBeanType();

+ 11 - 10
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java

@ -1,22 +1,20 @@
package com.yihu.wlyy.interceptors;
import java.lang.reflect.Method;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.Date;
/**
 * 患者权限校验
@ -98,6 +96,9 @@ public class PatientInterceptor extends BaseInterceptor {
	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
		if(null==request.getAttribute("log-start")){
			return;
		}
		long start = (long) request.getAttribute("log-start");
		long end = new Date().getTime();
		Class cls = ((HandlerMethod) handler).getBeanType();

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

@ -1,8 +1,12 @@
package com.yihu.wlyy.service.app.feedback;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.feedback.Appeal;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.feedback.AppealDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -16,15 +20,35 @@ public class AppealService extends BaseService {
    @Autowired
    private AppealDao appealDao;
    public void saveAppeal(String doctor,String description,int type,String images,String phone,int identity) throws Exception{
    @Autowired
    private PatientService patientService;
    @Autowired
    private DoctorService doctorService;
    public void saveAppeal(String creater,String description,int type,String images,String phone,int identity) throws Exception{
        Appeal appeal = new Appeal();
        appeal.setCode(getCode());
        appeal.setPhone(phone);
        appeal.setCreater(doctor);
        appeal.setCreater(creater);
        appeal.setDescription(description);
        appeal.setIdentity(identity);
        appeal.setImages(images);
        appeal.setType(type);
        appeal.setImages(images);
        appeal.setPhone(phone);
        appeal.setStatus(0);
        appeal.setIdentity(identity);
        appeal.setDel(1);
        //通过creater获取创建人名字
        String name ="";
        if(creater!=null&&!"".equals(creater)){
            if(identity==1){//说明是患者
                Patient patient = patientService.findByCode(creater);
                name = patient.getName();
            }else{//说明是医生
                Doctor doctor = doctorService.findDoctorByCode(creater);
                name = doctor.getName();
            }
        }
        appeal.setCreaterName(name);
        appealDao.save(appeal);
    }
}

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

@ -1,8 +1,12 @@
package com.yihu.wlyy.service.app.feedback;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.feedback.FeedbackDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -16,15 +20,33 @@ public class FeedbackService extends BaseService {
    @Autowired
    private FeedbackDao feedbackDao;
    public void saveFeedback(String doctor,String description,int type,String images,String contact,int idetity) throws Exception{
    @Autowired
    private PatientService patientService;
    @Autowired
    private DoctorService doctorService;
    public void saveFeedback(String creater,int identity,String description,int type,String images,String contact) throws Exception{
        Feedback feedback = new Feedback();
        feedback.setCode(getCode());
        feedback.setContact(contact);
        feedback.setCreater(doctor);
        feedback.setCreater(creater);
        feedback.setIdentity(identity);
        feedback.setDescription(description);
        feedback.setIdentity(idetity);
        feedback.setImages(images);
        feedback.setType(type);
        feedback.setImages(images);
        feedback.setContact(contact);
        feedback.setStatus(0);
        feedback.setDel(1);
        //通过creater获取创建人名字
        String name ="";
        if(identity==1){//说明是患者
            Patient patient = patientService.findByCode(creater);
            name = patient.getName();
        }else{//说明是医生
            Doctor doctor = doctorService.findDoctorByCode(creater);
            name = doctor.getName();
        }
        feedback.setCreaterName(name);
        feedbackDao.save(feedback);
    }

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

@ -14,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.regex.Pattern;
/**
 * Created by Reece on 2017/5/6.
 */
@ -46,24 +44,24 @@ public class DoctorFeedbackController extends BaseController {
            @RequestParam(required = false) String images,
            @RequestParam(required = false) String contact) {
        try {
            if (StringUtils.isNotEmpty(contact)) {
                //        邮箱正则|QQ号|手机号正则
                String regexEmail = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
                String regexQQ = "^[1-9][0-9]{4,}$";
                String regexPhone = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
                Boolean emailFlag = Pattern.matches(regexEmail, contact);
                Boolean qqFlag = Pattern.matches(regexQQ, contact);
                Boolean phoneFlag = Pattern.matches(regexPhone, contact);
                if (emailFlag || qqFlag || phoneFlag) {
                    return write(-1, "QQ/邮箱格式错误!");
                }
            }
            //if (StringUtils.isNotEmpty(contact)) {
            //    //        邮箱正则|QQ号|手机号正则
            //    String regexEmail = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
            //    String regexQQ = "^[1-9][0-9]{4,}$";
            //    String regexPhone = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
            //    Boolean emailFlag = Pattern.matches(regexEmail, contact);
            //    Boolean qqFlag = Pattern.matches(regexQQ, contact);
            //    Boolean phoneFlag = Pattern.matches(regexPhone, contact);
            //    if (emailFlag || qqFlag || phoneFlag) {
            //        return write(-1, "QQ/邮箱格式错误!");
            //    }
            //}
//        图片上传
            if (StringUtils.isNotEmpty(images)) {
                images = CommonUtil.copyTempImage(images);
            }
//        保存到数据库
            feedbackService.saveFeedback(getUID(),description,type,images,contact,2);
            feedbackService.saveFeedback(getUID(),2,description,type,images,contact);
            return write(200, "保存成功!");
        } catch (Exception e) {
            error(e);
@ -90,8 +88,8 @@ public class DoctorFeedbackController extends BaseController {
            @RequestParam String phone) {
        try {
//        手机号正则
            String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
            if (Pattern.matches(regex, phone)) {
//            String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
//            if (Pattern.matches(regex, phone)) {
//        图片上传
                if (StringUtils.isNotEmpty(images)) {
                    images = CommonUtil.copyTempImage(images);
@ -100,9 +98,9 @@ public class DoctorFeedbackController extends BaseController {
//             保存到数据库
                appealService.saveAppeal(getUID(),description,type,images,phone,2);
                return write(200, "保存成功!");
            } else {
                return write(-1, "手机号码有误!");
            }
            //} else {
            //    return write(-1, "手机号码有误!");
            //}
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存失败!");

+ 18 - 20
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackController.java

@ -14,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.regex.Pattern;
/**
 * Created by Reece on 2017/5/6.
 */
@ -46,25 +44,25 @@ public class PatientFeedbackController extends BaseController {
            @RequestParam(required = false) String images,
            @RequestParam(required = false) String contact) {
        try {
            if (StringUtils.isNotEmpty(contact)) {
                //        邮箱正则|QQ号正则|手机号正则
                String regexEmail = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
                String regexQQ = "^[1-9][0-9]{4,}$";
                String regexPhone = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
                Boolean emailFlag = Pattern.matches(regexEmail, contact);
                Boolean qqFlag = Pattern.matches(regexQQ, contact);
                Boolean phoneFlag = Pattern.matches(regexPhone, contact);
                if (emailFlag || qqFlag || phoneFlag) {
                    return write(-1, "QQ/邮箱/手机号格式错误!");
                }
            }
            //if (StringUtils.isNotEmpty(contact)) {
            //    //        邮箱正则|QQ号正则|手机号正则
            //    String regexEmail = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";
            //    String regexQQ = "^[1-9][0-9]{4,}$";
            //    String regexPhone = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
            //    Boolean emailFlag = Pattern.matches(regexEmail, contact);
            //    Boolean qqFlag = Pattern.matches(regexQQ, contact);
            //    Boolean phoneFlag = Pattern.matches(regexPhone, contact);
            //    if (emailFlag || qqFlag || phoneFlag) {
            //        return write(-1, "QQ/邮箱/手机号格式错误!");
            //    }
            //}
//        图片上传
            if (StringUtils.isNotEmpty(images)) {
                images = CommonUtil.copyTempImage(images);
            }
//        保存到数据库
            feedbackService.saveFeedback(getUID(),description,type,images,contact,1);
            feedbackService.saveFeedback(getUID(),1,description,type,images,contact);
            return write(200, "保存成功!");
        } catch (Exception e) {
            error(e);
@ -91,8 +89,8 @@ public class PatientFeedbackController extends BaseController {
            @RequestParam String phone) {
        try {
//        手机号正则
            String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
            if (Pattern.matches(regex, phone)) {
//            String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
//            if (Pattern.matches(regex, phone)) {
//        图片上传
                if (StringUtils.isNotEmpty(images)) {
                    images = CommonUtil.copyTempImage(images);
@ -100,9 +98,9 @@ public class PatientFeedbackController extends BaseController {
//             保存到数据库
                appealService.saveAppeal(getUID(),description,type,images,phone,1);
                return write(200, "保存成功!");
            } else {
                return write(-1, "手机号码有误!");
            }
            //} else {
            //    return write(-1, "手机号码有误!");
            //}
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存失败!");