Parcourir la source

居民端、医生端意见反馈与账号申诉

wujunjie il y a 8 ans
Parent
commit
8347aed47d

+ 118 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/feedback/Appeal.java

@ -0,0 +1,118 @@
package com.yihu.wlyy.entity.feedback;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Reece on 2017/5/6.
 */
@Entity
@Table(name = "wlyy_appeal")
public class Appeal extends IdEntity {
    //   '账号申诉编码'
    private String code;
    //    申诉人编码
    private String creater;
    //    '问题描述'
    private String description;
    //    申诉类别:1、手机号变更、2、重置密码、3、其他
    private int type;
    //    图片路径,逗号分隔
    private String images;
    //    联系手机号
    private String phone;
    //    状态 0、未读 1、待处理  2、已处理
    private int status;
    //    '处理结果'
    private String result;
    //    申诉人身份:1、患者  2、医生
    private int identity;
    public Appeal() {
    }
    public Appeal(String code, String creater, String description, int type, String images, String phone, int status, String result, int identity) {
        this.code = code;
        this.creater = creater;
        this.description = description;
        this.type = type;
        this.images = images;
        this.phone = phone;
        this.status = status;
        this.result = result;
        this.identity = identity;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    public String getImages() {
        return images;
    }
    public void setImages(String images) {
        this.images = images;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public String getResult() {
        return result;
    }
    public void setResult(String result) {
        this.result = result;
    }
    public int getIdentity() {
        return identity;
    }
    public void setIdentity(int identity) {
        this.identity = identity;
    }
}

+ 106 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/feedback/Feedback.java

@ -0,0 +1,106 @@
package com.yihu.wlyy.entity.feedback;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Reece on 2017/5/6.
 */
@Entity
@Table(name = "wlyy_feedback")
public class Feedback extends IdEntity{
//    意见反馈编码
    private String code;
//    反馈人编码
    private String creater;
//    反馈人身份 1、患者  2、医生
    private  int identity;
//    问题描述
    private String description;
//    反馈类别:1、优化建议、2、提交bug、3、新功能建议、4、其他
    private int type;
//    图片路径,逗号分隔
    private String images;
//    联系方式: qq号或者邮箱
    private String contact;
//    状态 0、未读 1、已读
    private int status;
    public Feedback(String code, String creater, int identity, String description, int type, String images, String contact, int status) {
        this.code = code;
        this.creater = creater;
        this.identity = identity;
        this.description = description;
        this.type = type;
        this.images = images;
        this.contact = contact;
        this.status = status;
    }
    public Feedback() {
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    public int getIdentity() {
        return identity;
    }
    public void setIdentity(int identity) {
        this.identity = identity;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    public String getImages() {
        return images;
    }
    public void setImages(String images) {
        this.images = images;
    }
    public String getContact() {
        return contact;
    }
    public void setContact(String contact) {
        this.contact = contact;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
}

+ 11 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/feedback/AppealDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.repository.feedback;
import com.yihu.wlyy.entity.feedback.Appeal;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Reece on 2017/5/6.
 */
public interface AppealDao extends PagingAndSortingRepository<Appeal, Long>,JpaSpecificationExecutor<Appeal> {
}

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

@ -0,0 +1,11 @@
package com.yihu.wlyy.repository.feedback;
import com.yihu.wlyy.entity.feedback.Feedback;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Reece on 2017/5/6.
 */
public interface FeedbackDao extends PagingAndSortingRepository<Feedback, Long>,JpaSpecificationExecutor<Feedback> {
}

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

@ -0,0 +1,30 @@
package com.yihu.wlyy.service.app.feedback;
import com.yihu.wlyy.entity.feedback.Appeal;
import com.yihu.wlyy.repository.feedback.AppealDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * Created by Reece on 2017/5/6.
 */
@Service
@Transactional
public class AppealService extends BaseService {
    @Autowired
    private AppealDao appealDao;
    public void saveAppeal(String doctor,String description,int type,String images,String phone,int identity) {
        Appeal appeal = new Appeal();
        appeal.setCode(getCode());
        appeal.setPhone(phone);
        appeal.setCreater(doctor);
        appeal.setDescription(description);
        appeal.setIdentity(identity);
        appeal.setImages(images);
        appeal.setType(type);
        appealDao.save(appeal);
    }
}

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

@ -0,0 +1,31 @@
package com.yihu.wlyy.service.app.feedback;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.repository.feedback.FeedbackDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * Created by Reece on 2017/5/6.
 */
@Service
@Transactional
public class FeedbackService extends BaseService {
    @Autowired
    private FeedbackDao feedbackDao;
    public void saveFeedback(String doctor,String description,int type,String images,String contact,int idetity) {
        Feedback feedback = new Feedback();
        feedback.setCode(getCode());
        feedback.setContact(contact);
        feedback.setCreater(doctor);
        feedback.setDescription(description);
        feedback.setIdentity(idetity);
        feedback.setImages(images);
        feedback.setType(type);
        feedbackDao.save(feedback);
    }
}

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

@ -0,0 +1,113 @@
package com.yihu.wlyy.web.doctor.feedback;
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.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 java.util.regex.Pattern;
/**
 * Created by Reece on 2017/5/6.
 */
@Controller
@RequestMapping(value = "/doctor/feedback")
@Api(description = "医生端意见反馈与账号申诉")
public class DoctorFeedbackController extends BaseController {
    @Autowired
    private FeedbackService feedbackService;
    @Autowired
    private AppealService appealService;
    /**
     * 医生端保存意见反馈
     *
     * @param description 问题描述
     * @param type        选择类型
     * @param images      图片,多图逗号分隔
     * @param contact     联系方式
     * @return
     */
    @RequestMapping(value = "/saveFeedback", method = RequestMethod.GET)
    @ApiOperation(value = "医生端保存反馈")
    @ResponseBody
    public String saveFeedback(
            @RequestParam String description,
            @RequestParam int type,
            @RequestParam(required = false) String images,
            @RequestParam(required = false) String contact) {
        try {
            String email = null;
            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,}$";
                Boolean emailFlag = Pattern.matches(regexEmail, contact);
                Boolean qqFlag = Pattern.matches(regexQQ, contact);
                if (emailFlag || qqFlag) {
                    return write(-1, "QQ/邮箱格式错误!");
                }
                email = contact;
            }
//        图片上传
            if (StringUtils.isNotEmpty(images)) {
                images = CommonUtil.copyTempImage(images);
            }
//        保存到数据库
            feedbackService.saveFeedback(getUID(),description,type,images,contact,2);
            return write(200, "保存成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存失败!");
        }
    }
    /**
     * 医生端保存账号申诉
     *
     * @param description 问题描述
     * @param type        选择类型
     * @param images      图片,多图逗号分隔
     * @param phone       手机号码
     * @return
     */
    @RequestMapping(value = "/saveAppeal", method = RequestMethod.GET)
    @ApiOperation(value = "医生端保存申诉")
    @ResponseBody
    public String saveAppeal(
            @RequestParam String description,
            @RequestParam int type,
            @RequestParam(required = false) String images,
            @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)) {
//        图片上传
                if (StringUtils.isNotEmpty(images)) {
                    images = CommonUtil.copyTempImage(images);
                }
//             保存到数据库
                appealService.saveAppeal(getUID(),description,type,images,phone,2);
                return write(200, "保存成功!");
            } else {
                return write(-1, "手机号码有误!");
            }
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存失败!");
        }
    }
}

+ 112 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackController.java

@ -0,0 +1,112 @@
package com.yihu.wlyy.web.patient.feedback;
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.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 java.util.regex.Pattern;
/**
 * Created by Reece on 2017/5/6.
 */
@Controller
@RequestMapping(value = "/patient/feedback")
@Api(description = "居民端意见反馈与账号申诉")
public class PatientFeedbackController extends BaseController {
    @Autowired
    private FeedbackService feedbackService;
    @Autowired
    private AppealService appealService;
    /**
     * 居民端保存意见反馈
     *
     * @param description 问题描述
     * @param type        选择类型
     * @param images      图片,多图逗号分隔
     * @param contact     联系方式
     * @return
     */
    @RequestMapping(value = "/saveFeedback", method = RequestMethod.GET)
    @ApiOperation(value = "居民端保存反馈")
    @ResponseBody
    public String saveFeedback(
            @RequestParam String description,
            @RequestParam int type,
            @RequestParam(required = false) String images,
            @RequestParam(required = false) String contact) {
        try {
            String email = null;
            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,}$";
                Boolean emailFlag = Pattern.matches(regexEmail, contact);
                Boolean qqFlag = Pattern.matches(regexQQ, contact);
                if (emailFlag || qqFlag) {
                    return write(-1, "QQ/邮箱格式错误!");
                }
                email = contact;
            }
//        图片上传
            if (StringUtils.isNotEmpty(images)) {
                images = CommonUtil.copyTempImage(images);
            }
//        保存到数据库
            feedbackService.saveFeedback(getUID(),description,type,images,contact,1);
            return write(200, "保存成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存失败!");
        }
    }
    /**
     * 居民端保存账号申诉
     *
     * @param description 问题描述
     * @param type        选择类型
     * @param images      图片,多图逗号分隔
     * @param phone       手机号码
     * @return
     */
    @RequestMapping(value = "/saveAppeal", method = RequestMethod.GET)
    @ApiOperation(value = "居民端保存申诉")
    @ResponseBody
    public String saveAppeal(
            @RequestParam String description,
            @RequestParam int type,
            @RequestParam(required = false) String images,
            @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)) {
//        图片上传
                if (StringUtils.isNotEmpty(images)) {
                    images = CommonUtil.copyTempImage(images);
                }
//             保存到数据库
                appealService.saveAppeal(getUID(),description,type,images,phone,1);
                return write(200, "保存成功!");
            } else {
                return write(-1, "手机号码有误!");
            }
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存失败!");
        }
    }
}

+ 5 - 5
patient-co-wlyy/src/main/resources/weixin_menu.txt

@ -74,15 +74,15 @@
		   "name":"我的设备",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdsb%2fhtml%2fmy-equipments.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
		{
		   "type":"view",
		   "name":"我的预约",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdyy%2fhtml%2fmy-appointment.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
        {
         	"type":"click",
         	"name":"操作说明",
         	"key":"caozuoshuoming"
        },
        {
        	 "type":"view",
        	 "name":"意见反馈",
        	 "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdyy%2fhtml%2fmy-appointment.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        }
	 ]
  }