LiTaohong пре 6 година
родитељ
комит
b851bb7264
19 измењених фајлова са 536 додато и 288 уклоњено
  1. 1 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientDao.java
  2. 26 3
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/AccountAppealDO.java
  3. 26 32
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/FeedbackDO.java
  4. 29 3
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java
  5. 2 2
      common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FailedUploadFileException.java
  6. 3 3
      common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/PatientCardNotFoundException.java
  7. 8 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  8. 1 30
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/FeedbackVO.java
  9. 8 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/PatientMedicareCardVO.java
  10. 3 4
      svr/svr-patient/sql/sql
  11. 0 1
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientDao.java
  12. 27 59
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientEndpoint.java
  13. 36 15
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientMedicareCardEndpoint.java
  14. 41 58
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/settings/AccountAppealEndpoint.java
  15. 61 46
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/settings/FeedbackEndpoint.java
  16. 113 12
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientMedicareCardService.java
  17. 48 14
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java
  18. 49 4
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/settings/AccountAppealService.java
  19. 54 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/settings/FeedbackService.java

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientDao.java

@ -26,4 +26,5 @@ public interface BasePatientDao extends PagingAndSortingRepository<BasePatientDO
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO")
    List<Map<String,Object>> findBaseInfo(Pageable pageable);
    boolean existsByIdcard(String idcard);
}

+ 26 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/AccountAppealDO.java

@ -16,10 +16,33 @@ import javax.persistence.Table;
@Table(name = "account_appeal")
public class AccountAppealDO extends IntegerIdentityEntity {
    /**
     * 反馈问题类型,功能异常,功能优化,新功能建议,其他
     */
    public enum Type{
        mobileCannotUse(0),
        passwordCannotfound(1),
        idcardOccupied(2);
        private int value;
        private Type(int value){
            this.value = value;
        }
        public int getValue() {
            return value;
        }
        public void setValue(int value) {
            this.value = value;
        }
    }
    /**
	 * 申诉问题类型(0-手机号码无法使用,1-无法找回密码,2-身份证被占用)
	 */
	private String type;
	private int type;
    /**
	 * 申诉内容,问题描述
@ -48,10 +71,10 @@ public class AccountAppealDO extends IntegerIdentityEntity {
	@Column(name = "type")
    public String getType() {
    public int getType() {
        return type;
    }
    public void setType(String type) {
    public void setType(int type) {
        this.type = type;
    }

+ 26 - 32
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/FeedbackDO.java

@ -17,14 +17,33 @@ import javax.persistence.Table;
public class FeedbackDO extends IntegerIdentityEntity {
    /**
	 * 反馈问题大类(功能异常,功能优化,新功能建议,其他等)
	 */
	private String parentType;
     * 反馈问题类型,功能异常,功能优化,新功能建议,其他
     */
    public enum Type{
        functionalAbnomal(0),
        functionalOptimal(1),
        newFunction(2),
        other(3);
        private int value;
        private Type(int value){
            this.value = value;
        }
        public int getValue() {
            return value;
        }
        public void setValue(int value) {
            this.value = value;
        }
    }
    /**
	 * 问题小类(功能异常-某些功能不可用等)
	 * 问题类型(功能异常-无法使用功能,功能优化-不好用、界面难看,新功能建议-你希望有什么功能,其他-其他任何问题)
	 */
	private String type;
	private int type;
    /**
	 * 反馈内容,问题和建议
@ -46,25 +65,11 @@ public class FeedbackDO extends IntegerIdentityEntity {
	 */
	private String mobile;
    /**
	 * 反馈次数
	 */
	private String count;
	@Column(name = "parent_type")
    public String getParentType() {
        return parentType;
    }
    public void setParentType(String parentType) {
        this.parentType = parentType;
    }
	@Column(name = "type")
    public String getType() {
    public int getType() {
        return type;
    }
    public void setType(String type) {
    public void setType(int type) {
        this.type = type;
    }
@ -99,15 +104,4 @@ public class FeedbackDO extends IntegerIdentityEntity {
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
	@Column(name = "count")
    public String getCount() {
        return count;
    }
    public void setCount(String count) {
        this.count = count;
    }
}

+ 29 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java

@ -44,7 +44,23 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
            this.type = type;
            this.desc = desc;
        }
    }
       public String getType() {
           return type;
       }
       public void setType(String type) {
           this.type = type;
       }
       public String getDesc() {
           return desc;
       }
       public void setDesc(String desc) {
           this.desc = desc;
       }
   }
    /**
	 * 卡标识
@ -76,6 +92,11 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
	 */
	private String wxOpenid;
	/**
	 * 机构code,就诊卡跟医院关联
	 */
	private String orgCode;
    /**
	 * 备注
	 */
@ -150,7 +171,12 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
    public void setDel(String del) {
        this.del = del;
    }
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
}

+ 2 - 2
common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FailedUploadFileException.java

@ -1,8 +1,8 @@
package com.yihu.jw.exception.business.file_upload;
public class FastfdsFileURLEmptyException extends RuntimeException {
public class FailedUploadFileException extends RuntimeException {
    public FastfdsFileURLEmptyException(String msg){
    public FailedUploadFileException(String msg){
        super(msg);
    }

+ 3 - 3
common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/PatientCardNotFoundException.java

@ -1,11 +1,11 @@
package com.yihu.jw.exception.business.patient;
/**
 * 居民不存在
 * 居民卡包卡不存在
 */
public class PatientNotFoundException extends RuntimeException{
public class PatientCardNotFoundException extends RuntimeException{
    public PatientNotFoundException(String msg){
    public PatientCardNotFoundException(String msg){
        super(msg);
    }
}

+ 8 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -466,6 +466,10 @@ public class BaseRequestMapping {
        public static final String getPatientById  = "/getPatientById";
        public static final String getBaseInfo  = "/getBaseInfo";
        public static final String sendCaptcha  = "/sendCaptcha";
        public static final String iscompleted  = "/iscompleted";
        public static final String completeInfo  = "/completeInfo";
        public static final String getCompletedInfo  = "/getCompletedInfo";
        public static final String idcardOccupied  = "/idcardOccupied";
    }
   /**
@ -473,7 +477,10 @@ public class BaseRequestMapping {
     */
    public static class PatientMedicareCard extends Basic {
        public static final String PREFIX  = "/patientMedicareCard";
        public static final String getPatientById  = "/getCardsByPatientId";
        public static final String queryCardById  = "/queryCardById";
        public static final String bindMedicareCard  = "/bindMedicareCard";
        public static final String bindPatientIDCard  = "/bindPatientIDCard";
        public static final String bindSocialSecurityCard  = "/bindSocialSecurityCard";
    }

+ 1 - 30
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/FeedbackVO.java

@ -21,16 +21,10 @@ import com.fasterxml.jackson.annotation.JsonFormat;
@ApiModel(value = "FeedbackVO", description = "意见反馈")
public class FeedbackVO extends IntegerIdentityVO{
    /**
	 * 反馈问题大类(功能异常,功能优化,新功能建议,其他等)
	 */
	@ApiModelProperty(value = "反馈问题大类(功能异常,功能优化,新功能建议,其他等)", example = "模块1")
    private String parentType;
    /**
	 * 问题小类(功能异常-某些功能不可用等)
	 */
	@ApiModelProperty(value = "问题小类(功能异常-某些功能不可用等)", example = "模块1")
	@ApiModelProperty(value = "问题类型(功能异常-无法使用功能,功能优化-不好用、界面难看,新功能建议-你希望有什么功能,其他-其他任何问题)")
    private String type;
    /**
@ -57,20 +51,6 @@ public class FeedbackVO extends IntegerIdentityVO{
	@ApiModelProperty(value = "联系手机号码", example = "模块1")
    private String mobile;
    /**
	 * 反馈次数
	 */
	@ApiModelProperty(value = "反馈次数", example = "模块1")
    private String count;
    public String getParentType() {
        return parentType;
    }
    public void setParentType(String parentType) {
        this.parentType = parentType;
    }
    public String getType() {
        return type;
    }
@ -105,13 +85,4 @@ public class FeedbackVO extends IntegerIdentityVO{
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getCount() {
        return count;
    }
    public void setCount(String count) {
        this.count = count;
    }
}

+ 8 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/PatientMedicareCardVO.java

@ -61,9 +61,16 @@ public class PatientMedicareCardVO extends IntegerIdentityVO{
    /**
	 * 微信openid,有些卡会绑定微信
	 */
	@ApiModelProperty(value = "微信openid,有些卡会绑定微信", example = "模块1")
	@ApiModelProperty(value = "微信openid,有些卡会绑定微信", example = "hsfjk89jeoi78768734rg2834rt283ih")
    private String wxOpenid;
    /**
     * 机构code,就诊卡跟医院关联
     */
    @ApiModelProperty(value = "机构code,就诊卡跟医院关联", example = "273489jeoi78768734rg2834rt283ih")
    private String orgCode;
    /**
	 * 备注
	 */

+ 3 - 4
svr/svr-patient/sql/sql

@ -10,6 +10,7 @@ create table `patient_medicare_card`
  `patient_code` varchar(50) not null COMMENT '居民标识',
  `password` varchar(50)  null COMMENT '绑定密码',
  `wx_openid` varchar(50)  null COMMENT '微信openid,有些卡会绑定微信',
  `org_code` varchar(50)  null COMMENT '机构code,就诊卡跟医院关联',
  `remark` varchar(50)  null COMMENT '备注',
  `del` varchar(50) not null COMMENT '状态,0-解除绑定,1-绑定中',
  primary key (id)
@ -37,13 +38,11 @@ drop table IF EXISTS `feedback`;
create table `feedback`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长',
  `parent_type` varchar(1) DEFAULT NULL COMMENT '反馈问题大类(功能异常,功能优化,新功能建议,其他等)',
  `type` varchar(1) DEFAULT NULL COMMENT '问题小类(功能异常-某些功能不可用等)',
  `type` varchar(1) DEFAULT NULL COMMENT '问题类型(功能异常-无法使用功能,功能优化-不好用、界面难看,新功能建议-你希望有什么功能,其他-其他任何问题)',
  `feedback_content` varchar(100) not null COMMENT '反馈内容,问题和建议',
  `answer` varchar(500) not null COMMENT '问题回答',
  `img` varchar(1000) not null COMMENT '图片,存图片地址,逗号分割',
  `mobile` varchar(11) not null COMMENT '联系手机号码',
  `count` varchar(50) not null COMMENT '反馈次数',
  primary key (id)
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='意见反馈';
@ -53,7 +52,7 @@ drop table IF EXISTS `account_appeal`;
create table `account_appeal`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长',
  `type` varchar(1) DEFAULT NULL COMMENT '申诉问题类型(0-手机号码无法使用,1-无法找回密码,2-身份证被占用)',
  `type` int(1) DEFAULT NULL COMMENT '申诉问题类型(0-手机号码无法使用,1-无法找回密码,2-身份证被占用)',
  `content` varchar(100) not null COMMENT '申诉内容,问题描述',
  `name` varchar(10) not null COMMENT '申诉人姓名',
  `idcard` varchar(18) not null COMMENT '申诉人身份证号码',

+ 0 - 1
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientDao.java

@ -32,5 +32,4 @@ public interface PatientDao extends PagingAndSortingRepository<BasePatientDO, St
    @Query("from BasePatientDO p where p.mobile = ?1 and p.del=?2")
    List<BasePatientDO> findByMobileAndDel(String mobile,String del);
    boolean existsByIdcard(String idcard);
}

+ 27 - 59
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientEndpoint.java

@ -1,10 +1,9 @@
package com.yihu.jw.patient.endpoint.personal_info;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.sms.SmsDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.patient.service.personal_Info.PatientService;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.base.patient.BasePatientVO;
import com.yihu.jw.restmodel.base.sms.SmsVO;
@ -18,10 +17,10 @@ import com.yihu.jw.sms.service.BaseSmsGatewayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
@ -42,7 +41,7 @@ import java.util.Map;
public class PatientEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BasePatientService patientService;
    private PatientService patientService;
    @Value("sms.clientId")
    private String clientId;
@ -50,48 +49,6 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseSmsGatewayService baseSmsGatewayService;
    @PostMapping(value = BaseRequestMapping.BasePatient.CREATE)
    @ApiOperation(value = "创建")
    public Envelop create(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
       String msg = patientService.createPatient(jsonData);
       if(!StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS,msg)){
           return success(msg);
       }
        return failed(msg);
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        patientService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.UPDATE)
    @ApiOperation(value = "更新")
    public Envelop update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        String msg = patientService.updatePatient(jsonData);
        if(!StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS,msg)){
            return failed(msg);
        }
        return success(msg);
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.getPatientById)
    @ApiOperation(value = "获取列表")
    public Envelop getPatientById(
            @ApiParam(name = "id", value = "居民id")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        String result = patientService.getPatientById(id);
        return success(result);
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<BasePatientVO> page(
@ -123,20 +80,31 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        return success(basePatients, BasePatientVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.getBaseInfo)
    @ApiOperation(value = "获取居民基础信息列表")
    public ListEnvelop queryPatientBaseInfo(
            @ApiParam(name = "nameOrIdcard", value = "居民姓名或身份证")
            @RequestParam(value = "nameOrIdcard", required = false) String nameOrIdcard,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
    @GetMapping(value = BaseRequestMapping.BasePatient.iscompleted)
    @ApiOperation(value = "判断身份信息是否完善,false-未完善,true-已完善")
    public Envelop isCompleted(@ApiParam(name = "id", value = "居民id", required = true) @RequestParam String id) throws Exception {
        return success(patientService.isCompleted(id));
    }
        List<Map<String,Object>> basePatients = patientService.queryPatientBaseInfo(nameOrIdcard, page,size,sorts);
        return success(basePatients);
    @GetMapping(value = BaseRequestMapping.BasePatient.idcardOccupied)
    @ApiOperation(value = "判断身份证是否被占用,false-未占用,true-已占用")
    public Envelop idcardOccupied(@ApiParam(name = "idcard", value = "居民身份证号", required = true) @RequestParam String idcard) throws Exception {
        return success(patientService.existsByIdcard(idcard));
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.completeInfo)
    @ApiOperation(value = "完善信息")
    public Envelop completeInfo(@ApiParam(name = "jsonData", value = "jsonData数据", required = true) @RequestParam String jsonData,
                                @ApiParam(name = "headPortrait", value = "头像", required = false) @RequestParam MultipartFile headPortrait) throws Exception {
        return success(patientService.completePatientDetails(headPortrait,jsonData));
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.sendCaptcha)
    @ApiOperation(value = "查询完善后信息详情")
    public ObjEnvelop<BasePatientVO> getCompletedInfo(
            @ApiParam(name = "id", value = "居民标识")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        return success(patientService.getCompletedDetails(id),BasePatientVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.sendCaptcha)

+ 36 - 15
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientMedicareCardEndpoint.java

@ -36,13 +36,14 @@ public class PatientMedicareCardEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private PatientMedicareCardService patientMedicareCardService;
    @PostMapping(value = BaseRequestMapping.PatientMedicareCard.CREATE)
    @PostMapping(value = BaseRequestMapping.PatientMedicareCard.bindMedicareCard)
    @ApiOperation(value = "绑定医保卡")
    public Envelop create(
    public Envelop bindMedicareCard(
            @ApiParam(name = "id", value = "居民id", required = true) @RequestParam String id,
            @ApiParam(name = "idcard", value = "居民身份证号", required = true) @RequestParam String idcard,
     @ApiParam(name = "cardNumber", value = "医保卡号", required = true) @RequestParam String cardNumber) throws Exception {
        patientMedicareCardService.bindCard(id,idcard,cardNumber);
            @ApiParam(name = "cardNumber", value = "医保卡号", required = true) @RequestParam String cardNumber,
     @ApiParam(name = "pssword", value = "密码", required = true) @RequestParam String pssword) throws Exception {
        patientMedicareCardService.bindMedicareCard(id,idcard,cardNumber,pssword);
        return success("success");
    }
@ -55,17 +56,36 @@ public class PatientMedicareCardEndpoint extends EnvelopRestEndpoint {
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.PatientMedicareCard.UPDATE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<PatientMedicareCardVO> update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        PatientMedicareCardDO patientMedicareCard = toEntity(jsonData, PatientMedicareCardDO.class);
        if (null == patientMedicareCard.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
        }
        patientMedicareCard = patientMedicareCardService.save(patientMedicareCard);
        return success(patientMedicareCard, PatientMedicareCardVO.class);
    @PostMapping(value = BaseRequestMapping.PatientMedicareCard.bindPatientIDCard)
    @ApiOperation(value = "绑定就诊卡")
    public Envelop bindPatientIDCard(
            @ApiParam(name = "id", value = "居民id", required = true) @RequestParam String id,
            @ApiParam(name = "idcard", value = "居民身份证号", required = true) @RequestParam String idcard,
            @ApiParam(name = "cardNumber", value = "医保卡号", required = true) @RequestParam String cardNumber,
            @ApiParam(name = "orgCode", value = "机构code", required = true) @RequestParam String orgCode,
            @ApiParam(name = "remark", value = "备注", required = true) @RequestParam String remark) throws Exception {
        patientMedicareCardService.bindPatientIDCard(id,idcard,cardNumber,orgCode,remark);
        return success("success");
    }
    @PostMapping(value = BaseRequestMapping.PatientMedicareCard.bindSocialSecurityCard)
    @ApiOperation(value = "绑定电子社保卡")
    public Envelop bindSocialSecurityCard(
            @ApiParam(name = "id", value = "居民id", required = true) @RequestParam String id,
            @ApiParam(name = "idcard", value = "居民身份证号", required = true) @RequestParam String idcard) throws Exception {
        patientMedicareCardService.bindSocialSecurityCard(id,idcard);
        return success("success");
    }
    @GetMapping(value = BaseRequestMapping.PatientMedicareCard.queryCardById)
    @ApiOperation(value = "获取绑定的卡")
    public ListEnvelop queryCard(
            @ApiParam(name = "id", value = "居民id")
            @RequestParam(value = "id", required = false) String id,
            @ApiParam(name = "type", value = "卡的类型")
            @RequestParam(value = "type", required = false) PatientMedicareCardDO.Type type) throws Exception {
        return success(patientMedicareCardService.queryCardByTypeAndPatientCode(id,type.getType()));
    }
    @GetMapping(value = BaseRequestMapping.PatientMedicareCard.PAGE)
@ -99,4 +119,5 @@ public class PatientMedicareCardEndpoint extends EnvelopRestEndpoint {
        return success(patientMedicareCards, PatientMedicareCardVO.class);
    }
}

+ 41 - 58
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/settings/AccountAppealEndpoint.java

@ -13,65 +13,48 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.yihu.jw.entity.base.patient.AccountAppealDO;
import org.springframework.web.multipart.MultipartFile;
/**
*
* 账号申诉控制器
*
* @version
* <pre>
 * 账号申诉控制器
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  		2018年11月27日 	Created
 *
 * </pre>
* @since 1.
*/
 * @since 1.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.AccountAppeal.PREFIX)
@Api(value = "账号申诉管理", description = "账号申诉管理服务接口", tags = {"wlyy基础服务 - 账号申诉管理服务接口"})
public class AccountAppealEndpoint extends EnvelopRestEndpoint {
@Autowired
private AccountAppealService accountAppealService;
@PostMapping(value = BaseRequestMapping.AccountAppeal.CREATE)
@ApiOperation(value = "创建")
public ObjEnvelop<AccountAppealVO> create (
    @ApiParam(name = "jsonData", value = "Json数据", required = true)
    @RequestParam String jsonData) throws Exception {
    AccountAppealDO accountAppeal = toEntity(jsonData, AccountAppealDO.class);
    accountAppeal = accountAppealService.save(accountAppeal);
    return success(accountAppeal, AccountAppealVO.class);
    }
    @Autowired
    private AccountAppealService accountAppealService;
    @PostMapping(value = BaseRequestMapping.AccountAppeal.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    accountAppealService.delete(ids.split(","));
    return success("删除成功");
    @PostMapping(value = BaseRequestMapping.AccountAppeal.CREATE)
    @ApiOperation(value = "创建申诉")
    public ObjEnvelop<AccountAppealVO> create(
            @ApiParam(name = "type", value = "申诉类型", required = true)
            @RequestParam AccountAppealDO.Type type,
            @ApiParam(name = "images", value = "申诉证件照", required = true)
            @RequestParam List<MultipartFile> images,
            @ApiParam(name = "mobile", value = "申诉手机号", required = true)
            @RequestParam String mobile,
            @ApiParam(name = "content", value = "申诉内容", required = true)
            @RequestParam String content ) throws Exception {
        return success(accountAppealService.create(type,content,mobile,images), AccountAppealVO.class);
    }
    @PostMapping(value = BaseRequestMapping.AccountAppeal.UPDATE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<AccountAppealVO> update (
        @ApiParam(name = "jsonData", value = "Json数据", required = true)
        @RequestParam String jsonData) throws Exception {
        AccountAppealDO accountAppeal = toEntity(jsonData, AccountAppealDO.class);
        if (null == accountAppeal.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
        }
        accountAppeal = accountAppealService.save(accountAppeal);
        return success(accountAppeal, AccountAppealVO.class);
        }
        @GetMapping(value = BaseRequestMapping.AccountAppeal.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<AccountAppealVO> page (
    @GetMapping(value = BaseRequestMapping.AccountAppeal.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<AccountAppealVO> page(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -82,22 +65,22 @@ public ObjEnvelop<AccountAppealVO> create (
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            List<AccountAppealDO> accountAppeals = accountAppealService.search(fields, filters, sorts, page, size);
                int count = (int)accountAppealService.getCount(filters);
                return success(accountAppeals, count, page, size, AccountAppealVO.class);
         }
        List<AccountAppealDO> accountAppeals = accountAppealService.search(fields, filters, sorts, page, size);
        int count = (int) accountAppealService.getCount(filters);
        return success(accountAppeals, count, page, size, AccountAppealVO.class);
    }
         @GetMapping(value = BaseRequestMapping.AccountAppeal.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<AccountAppealVO> list (
             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
             @RequestParam(value = "fields", required = false) String fields,
             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
             @RequestParam(value = "filters", required = false) String filters,
             @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
             @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
             List<AccountAppealDO> accountAppeals = accountAppealService.search(fields, filters, sorts);
                  return success(accountAppeals, AccountAppealVO.class);
         }
    @GetMapping(value = BaseRequestMapping.AccountAppeal.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<AccountAppealVO> list(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<AccountAppealDO> accountAppeals = accountAppealService.search(fields, filters, sorts);
        return success(accountAppeals, AccountAppealVO.class);
    }
 }
}

+ 61 - 46
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/settings/FeedbackEndpoint.java

@ -1,7 +1,9 @@
package com.yihu.jw.patient.endpoint.settings;
import com.yihu.jw.entity.base.patient.AccountAppealDO;
import com.yihu.jw.entity.base.patient.FeedbackDO;
import com.yihu.jw.patient.service.settings.FeedbackService;
import com.yihu.jw.restmodel.base.patient.AccountAppealVO;
import com.yihu.jw.restmodel.base.patient.FeedbackVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -14,64 +16,77 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
*
* 意见反馈控制器
*
* @version
* <pre>
 * 意见反馈控制器
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  		2018年11月27日 	Created
 *
 * </pre>
* @since 1.
*/
 * @since 1.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.Feedback.PREFIX)
@Api(value = "意见反馈管理", description = "意见反馈管理服务接口", tags = {"wlyy基础服务 - 意见反馈管理服务接口"})
public class FeedbackEndpoint extends EnvelopRestEndpoint {
@Autowired
private FeedbackService feedbackService;
    @Autowired
    private FeedbackService feedbackService;
@PostMapping(value = BaseRequestMapping.Feedback.CREATE)
@ApiOperation(value = "创建")
public ObjEnvelop<FeedbackVO> create (
    @ApiParam(name = "jsonData", value = "Json数据", required = true)
    @RequestParam String jsonData) throws Exception {
    FeedbackDO feedback = toEntity(jsonData, FeedbackDO.class);
    feedback = feedbackService.save(feedback);
    return success(feedback, FeedbackVO.class);
    @PostMapping(value = BaseRequestMapping.Feedback.CREATE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<FeedbackVO> create(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        FeedbackDO feedback = toEntity(jsonData, FeedbackDO.class);
        feedback = feedbackService.save(feedback);
        return success(feedback, FeedbackVO.class);
    }
    @PostMapping(value = BaseRequestMapping.AccountAppeal.CREATE)
    @ApiOperation(value = "创建反馈")
    public ObjEnvelop<FeedbackVO> create(
            @ApiParam(name = "type", value = "反馈类型", required = true)
            @RequestParam FeedbackDO.Type type,
            @ApiParam(name = "images", value = "反馈图片", required = true)
            @RequestParam List<MultipartFile> images,
            @ApiParam(name = "mobile", value = "反馈手机号", required = true)
            @RequestParam String mobile,
            @ApiParam(name = "content", value = "反馈内容", required = true)
            @RequestParam String content ) throws Exception {
        return success(feedbackService.create(type,content,mobile,images), FeedbackVO.class);
    }
    @PostMapping(value = BaseRequestMapping.Feedback.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    feedbackService.delete(ids.split(","));
    return success("删除成功");
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        feedbackService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.Feedback.UPDATE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<FeedbackVO> update (
        @ApiParam(name = "jsonData", value = "Json数据", required = true)
        @RequestParam String jsonData) throws Exception {
    public ObjEnvelop<FeedbackVO> update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        FeedbackDO feedback = toEntity(jsonData, FeedbackDO.class);
        if (null == feedback.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
            return failed("ID不能为空", ObjEnvelop.class);
        }
        feedback = feedbackService.save(feedback);
        return success(feedback, FeedbackVO.class);
        }
    }
        @GetMapping(value = BaseRequestMapping.Feedback.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<FeedbackVO> page (
    @GetMapping(value = BaseRequestMapping.Feedback.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<FeedbackVO> page(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -82,22 +97,22 @@ public ObjEnvelop<FeedbackVO> create (
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            List<FeedbackDO> feedbacks = feedbackService.search(fields, filters, sorts, page, size);
                int count = (int)feedbackService.getCount(filters);
                return success(feedbacks, count, page, size, FeedbackVO.class);
         }
        List<FeedbackDO> feedbacks = feedbackService.search(fields, filters, sorts, page, size);
        int count = (int) feedbackService.getCount(filters);
        return success(feedbacks, count, page, size, FeedbackVO.class);
    }
         @GetMapping(value = BaseRequestMapping.Feedback.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<FeedbackVO> list (
             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
             @RequestParam(value = "fields", required = false) String fields,
             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
             @RequestParam(value = "filters", required = false) String filters,
             @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
             @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
             List<FeedbackDO> feedbacks = feedbackService.search(fields, filters, sorts);
                  return success(feedbacks, FeedbackVO.class);
         }
    @GetMapping(value = BaseRequestMapping.Feedback.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<FeedbackVO> list(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<FeedbackDO> feedbacks = feedbackService.search(fields, filters, sorts);
        return success(feedbacks, FeedbackVO.class);
    }
 }
}

+ 113 - 12
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientMedicareCardService.java

@ -1,14 +1,21 @@
package com.yihu.jw.patient.service.personal_Info;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.exception.business.patient.PatientCardNotFoundException;
import com.yihu.jw.exception.business.patient.PatientNotFoundException;
import com.yihu.jw.patient.dao.personal_info.PatientMedicareCardDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.patient.service.BasePatientMedicardCardService;
import com.yihu.jw.util.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
@ -20,29 +27,123 @@ import javax.validation.constraints.NotNull;
public class PatientMedicareCardService extends BasePatientMedicardCardService {
    @Autowired
    private PatientMedicareCardDao patientMedicareCardDao;
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private PatientService patientService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 绑定医保卡
     * 绑定医保卡,需要密码
     *
     * @param id
     * @param patientCode
     * @param idcard
     * @param medicareCardNumber
     */
    @Transactional(rollbackFor = Exception.class)
    public void bindCard(@NotNull String id, @NotNull String idcard, @NotNull String medicareCardNumber) {
    public void bindMedicareCard(String patientCode, String idcard,String medicareCardNumber,String password) {
        Assert.notNull(patientCode,"居民code不可为空!");
        Assert.notNull(idcard,"身份证号不可为空!");
        Assert.notNull(medicareCardNumber,"医保卡号不可为空!");
        Assert.notNull(password,"密码不可为空!");
        PatientMedicareCardDO card = makeCardInfo(patientCode,idcard,medicareCardNumber);
        card.setParentType(PatientMedicareCardDO.ParentType.CareCard.name());
        card.setType(PatientMedicareCardDO.Type.MedicareCard.name());
        card.setPassword(MD5.GetMD5Code(password));
        this.save(card);
    }
    public PatientMedicareCardDO makeCardInfo(@NotNull String id,@NotNull String idcard,@NotNull String cardNumber){
        if (!patientService.existsByIdcard(idcard)) {
            throw new PatientNotFoundException("您的身份证号不存在!");
        }
        PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
        patientMedicareCardDO.setCode(medicareCardNumber);
        patientMedicareCardDO.setPatientCode(id);
        patientMedicareCardDO.setParentType(PatientMedicareCardDO.ParentType.CareCard.name());
        patientMedicareCardDO.setType(PatientMedicareCardDO.Type.MedicareCard.name());
        patientMedicareCardDO.setDel("1");
        this.save(patientMedicareCardDO);
        PatientMedicareCardDO card = new PatientMedicareCardDO();
        card.setCode(cardNumber);
        card.setPatientCode(id);
        card.setDel("1");
        return card;
    }
    /**
     * 绑定就诊卡,需要机构和备注
     *
     * @param patientCode
     * @param idcard
     * @param medicareCardNumber
     */
    @Transactional(rollbackFor = Exception.class)
    public void bindPatientIDCard(String patientCode, String idcard,String medicareCardNumber,String orgCode,String remark) {
        Assert.notNull(patientCode,"居民code不可为空!");
        Assert.notNull(idcard,"身份证号不可为空!");
        Assert.notNull(medicareCardNumber,"就诊卡号不可为空!");
        PatientMedicareCardDO card = makeCardInfo(patientCode,idcard,medicareCardNumber);
        card.setParentType(PatientMedicareCardDO.ParentType.CareCard.name());
        card.setType(PatientMedicareCardDO.Type.MedicareCard.name());
        card.setOrgCode(PatientMedicareCardDO.Type.PatientIDCard.name());
        card.setRemark(remark);
        this.save(card);
    }
    /**
     * 绑定电子社保卡
     *
     * @param patientCode
     * @param cardNumber
     */
    @Transactional(rollbackFor = Exception.class)
    public void bindSocialSecurityCard(String patientCode, String cardNumber) {
        Assert.notNull(patientCode,"id不可为空!");
        Assert.notNull(cardNumber,"社保卡号不可为空!");
        PatientMedicareCardDO card = new PatientMedicareCardDO();
        card.setPatientCode(patientCode);
        card.setCode(cardNumber);
        card.setParentType(PatientMedicareCardDO.ParentType.CareCard.name());
        card.setType(PatientMedicareCardDO.Type.SocialSecurityCard.name());
        this.save(card);
    }
    /**
     * 解除卡的绑定
     *
     * @param id
     */
    @Transactional(rollbackFor = Exception.class)
    public void unBindCard(@NotNull String id) {
        Assert.notNull(id,"id不存在");
        PatientMedicareCardDO card = basePatientMedicareCardDao.findOne(id);
        if(null == card){
            throw new PatientCardNotFoundException("该卡片不存在!");
        }
        card.setDel("0");
        this.save(card);
    }
    /**
     * 根据卡片类型查询卡片信息
     *
     * @param patientCode
     */
    @Transactional(rollbackFor = Exception.class)
    public List queryCardByTypeAndPatientCode(String patientCode,String type) {
        Assert.notNull(patientCode,"id不可为空");
        Assert.notNull(type,"类型不可为空");
        String sql = "SELECT " +
                " card.CODE as cardNumber, " +
                " patient.NAME as name, " +
                " patient.idcard as idcard, " +
                "  ifnull(card.remark,'') as remark " +
                "FROM " +
                " patient_medicare_card card " +
                "LEFT JOIN base_patient patient ON card.patient_code = patient.id " +
                "WHERE " +
                " card.patient_code = '"+ patientCode +"' " +
                "AND card.type = " + type ;
        List<Map<String,Object>> cards = jdbcTemplate.queryForList(sql);
        if(CollectionUtils.isEmpty(cards)){
            throw new PatientCardNotFoundException("卡片不存在!");
        }
       return cards;
    }
}

+ 48 - 14
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java

@ -1,15 +1,12 @@
package com.yihu.jw.patient.service.personal_Info;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.junit.Assert.assertEquals;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Preconditions;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.exception.business.patient.CapthcaInvalidException;
import com.yihu.jw.exception.business.patient.PatientNotFoundException;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.personal_info.PatientDao;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.sms.service.BaseSmsService;
@ -18,9 +15,11 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
 * 居民信息服务
@ -30,7 +29,7 @@ import javax.validation.constraints.NotNull;
public class PatientService extends BasePatientService<BasePatientDO, BasePatientDao> {
    @Autowired
    private PatientDao patientDao;
    private BasePatientDao basePatientDao;
    @Autowired
    private BaseSmsService baseSmsService;
@ -46,7 +45,7 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
    public String setPassword(String id, String password){
        Preconditions.checkNotNull(id);
        Preconditions.checkNotNull(password);
        BasePatientDO patient = patientDao.findOne(id);
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
            throw new PatientNotFoundException("当前居民不存在:【 " + id + "】");
        }
@ -67,7 +66,7 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
    public String resetPassword(String id,String newPassword){
        Preconditions.checkNotNull(id);
        Preconditions.checkNotNull(newPassword);
        BasePatientDO patient = patientDao.findOne(id);
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
            throw new PatientNotFoundException("当前居民不存在:【 " + id + "】");
        }
@ -89,7 +88,7 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
        Preconditions.checkNotNull(id,"id不可为空");
        Preconditions.checkNotNull(newMobile,"手机号不可为空");
        Preconditions.checkNotNull(captcha,"验证码不可为空");
        BasePatientDO patient = patientDao.findOne(id);
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
            throw new PatientNotFoundException("当前居民不存在:【 " + id + "】");
        }
@ -108,11 +107,22 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
    /**
     * 完善居民基本信息
     * @param headPortrait 头像
     * @param patientDO
     * @param json
     * @return
     */
    public BasePatientDO completePatientDetails(MultipartFile headPortrait, BasePatientDO patientDO){
    @Transactional(rollbackFor = Exception.class)
    public BasePatientDO completePatientDetails(MultipartFile headPortrait, String json){
        BasePatientDO patientDO = JSONObject.parseObject(json,BasePatientDO.class);
        //如果未上传头像,使用默认头像
        if(null == headPortrait){
            patientDO.setPhoto("default");
        }
        Assert.notNull(patientDO.getName(),"姓名不可为空!");
        Assert.notNull(patientDO.getSex(),"性别不可为空!");
        Assert.notNull(patientDO.getIdcard(),"身份证不可为空!");
        Assert.notNull(patientDO.getCommitteeCode(),"居委会不可为空!");
        Assert.notNull(patientDO.getCommitteeName(),"居委会不可为空!");
        this.save(patientDO);
        return patientDO;
    }
@ -124,10 +134,34 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
     */
    public boolean existsByIdcard(String idcard){
        Preconditions.checkNotNull(idcard,"身份证不可为空");
        return patientDao.existsByIdcard(idcard);
        return basePatientDao.existsByIdcard(idcard);
    }
//    public BasePatientDO findNameAndIdcardById(String id) {
//    }
    /**
     *  判断是否需要完善信息,身份证未填则需要完善
     * @param id
     * @return
     */
    public boolean isCompleted(String id) {
        Assert.notNull(id,"id不可为空");
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
            throw new PatientNotFoundException("居民不存在!");
        }
       return StringUtils.isEmpty(patient.getIdcard());
    }
    /**
     * 查询居民完善后的基本信息
     * @return
     */
    public BasePatientDO getCompletedDetails(String id){
        Assert.notNull(id,"居民id不可为空!");
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
            throw new PatientNotFoundException("居民不存在!");
        }
        return patient;
    }
}

+ 49 - 4
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/settings/AccountAppealService.java

@ -1,16 +1,28 @@
package com.yihu.jw.patient.service.settings;
import com.yihu.jw.entity.base.patient.AccountAppealDO;
import com.yihu.jw.entity.base.patient.FeedbackDO;
import com.yihu.jw.exception.business.file_upload.FailedUploadFileException;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.patient.dao.settings.AccountAppealDao;
import com.yihu.jw.restmodel.base.patient.AccountAppealVO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
/**
 * 
 * 账号申诉服务service
 * 
 * @version 
 * <pre>
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * Administrator    1.0  2018年11月27日 Created
 *
@ -19,4 +31,37 @@ import org.springframework.stereotype.Service;
 */
@Service
public class AccountAppealService extends BaseJpaService<AccountAppealDO, AccountAppealDao> {
    @Autowired
    private FileUploadService fileUploadService;
    @Value("fastDFS.fastdfs_file_url")
    private String fastdfsUrl;
    @Transactional(rollbackFor = Exception.class)
    public AccountAppealDO create(AccountAppealDO.Type type, String content, String mobile, List<MultipartFile> images) {
        Assert.notNull(type, "申诉类型不可为空");
        Assert.notNull(mobile, "申诉手机号不可为空");
        if (!CollectionUtils.isEmpty(images)) {
            images.forEach(one -> {
                InputStream inputStream = null;
                try {
                    inputStream = one.getInputStream();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                String fileName = one.getOriginalFilename();
                try {
                    fileUploadService.uploadStream(inputStream, fileName, fastdfsUrl);
                } catch (Exception e) {
                    throw new FailedUploadFileException("账号申诉证件图片上传失败");
                }
            });
        }
        AccountAppealDO accoutAppeal = new AccountAppealDO();
        accoutAppeal.setType(type.getValue());
        accoutAppeal.setContent(content);
        accoutAppeal.setMobile(mobile);
        return accoutAppeal;
    }
}

+ 54 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/settings/FeedbackService.java

@ -1,9 +1,22 @@
package com.yihu.jw.patient.service.settings;
import com.netflix.discovery.converters.Auto;
import com.yihu.jw.entity.base.patient.FeedbackDO;
import com.yihu.jw.exception.business.file_upload.FailedUploadFileException;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.patient.dao.settings.FeedbackDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
/**
 * 
@ -19,4 +32,45 @@ import org.springframework.stereotype.Service;
 */
@Service
public class FeedbackService extends BaseJpaService<FeedbackDO, FeedbackDao> {
    @Autowired
    private FileUploadService fileUploadService;
    @Value("fastDFS.fastdfs_file_url")
    private String fastdfsUrl;
    /**
     *
     * @param type
     * @param feedbackContent
     * @param mobile
     * @param images
     */
    @Transactional(rollbackFor = Exception.class)
    public FeedbackDO create(FeedbackDO.Type type, String feedbackContent, String mobile, List<MultipartFile> images){
        Assert.notNull(type,"反馈类型不可为空");
        Assert.notNull(feedbackContent,"反馈类型不可为空");
        Assert.notNull(mobile,"手机号不可为空");
        if(!CollectionUtils.isEmpty(images)){
            images.forEach( one -> {
                InputStream inputStream = null;
                try {
                    inputStream  = one.getInputStream();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                String fileName = one.getOriginalFilename();
                try {
                    fileUploadService.uploadStream(inputStream,fileName,fastdfsUrl);
                } catch (Exception e) {
                    throw new FailedUploadFileException("上传反馈图片失败");
                }
            });
        }
        FeedbackDO feedback = new FeedbackDO();
        feedback.setType(type.getValue());
        feedback.setFeedbackContent(feedbackContent);
        feedback.setMobile(mobile);
        return feedback;
    }
}