Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

liuwenbin 6 years ago
parent
commit
138958bc3d
45 changed files with 1163 additions and 507 deletions
  1. 42 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/DictHospitalDeptDao.java
  2. 15 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientDao.java
  3. 2 1
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientMedicardCardService.java
  4. 5 0
      common/common-entity/pom.xml
  5. 26 3
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/AccountAppealDO.java
  6. 27 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  7. 26 32
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/FeedbackDO.java
  8. 58 16
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java
  9. 3 31
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java
  10. 9 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FailedUploadFileException.java
  11. 1 1
      common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/CapthcaInvalidException.java
  12. 0 11
      common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/NotFoundPatientException.java
  13. 11 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/PatientCardNotFoundException.java
  14. 11 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/PatientNotFoundException.java
  15. 13 2
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  16. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/patient/PatientRequestMapping.java
  17. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/org/BaseOrgVO.java
  18. 1 30
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/FeedbackVO.java
  19. 8 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/PatientMedicareCardVO.java
  20. 43 4
      svr/svr-base/pom.xml
  21. 44 44
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHospitalDeptDao.java
  22. 6 9
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/open/register/RegisterEndpoint.java
  23. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java
  24. 3 11
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  25. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDOReader.java
  26. 4 0
      svr/svr-patient/pom.xml
  27. 6 7
      svr/svr-patient/sql/sql
  28. 0 10
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientDao.java
  29. 1 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientMedicareCardDao.java
  30. 0 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicepackage/ServicePackageDao.java
  31. 0 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicepackage/ServicePackageItemDao.java
  32. 0 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicepackage/ServicePackageSignRecordDao.java
  33. 72 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/file_upload/FileUploadEndpoint.java
  34. 81 83
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientEndpoint.java
  35. 87 58
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientMedicareCardEndpoint.java
  36. 0 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/servicepackage/PackageServiceEndpoint.java
  37. 41 58
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/settings/AccountAppealEndpoint.java
  38. 52 47
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/settings/FeedbackEndpoint.java
  39. 2 2
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/myFamily/MyFamilyService.java
  40. 140 1
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientMedicareCardService.java
  41. 175 32
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java
  42. 18 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/service_package/PackageService.java
  43. 49 4
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/settings/AccountAppealService.java
  44. 54 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/settings/FeedbackService.java
  45. 14 5
      svr/svr-patient/src/main/resources/application.yml

+ 42 - 0
business/base-service/src/main/java/com/yihu/jw/dict/dao/DictHospitalDeptDao.java

@ -0,0 +1,42 @@
package com.yihu.jw.dict.dao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * 
 * 医院科室字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHospitalDeptDO, Integer>, JpaSpecificationExecutor<DictHospitalDeptDO>  {
    @Query("select code as code,name as name from DictHospitalDeptDO where orgCode in ?1")
    List<Map<String,Object>> findByOrgCodeIn(String orgCode, Pageable pageable);
    @Query("select code as code,name as name from DictHospitalDeptDO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictHospitalDeptDO> findByOrgCode(String orgCode);
    List<DictHospitalDeptDO> findByOrgCodeIn(String orgCode);
    Long countByCodeIn(String orgCode);
    boolean existsByCodeAndOrgCode(String code, String orgCode);
    DictHospitalDeptDO findByCode(String code);
}

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

@ -3,6 +3,7 @@ package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -28,4 +29,18 @@ 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 existsByIdcardAndIdNot(String idcard,String id);
    boolean existsByIdcard(String idcard);
    @Query("from BasePatientDO where mobile = ?1")
    List<BasePatientDO> findByMobile(String mobile);
    @Query("from BasePatientDO p where p.mobile = ?1 and p.del=?2")
    List<BasePatientDO> findByMobileAndDel(String mobile,String del);
    @Modifying
    @Query(" update BasePatientDO a set a.openid=?2 where a.id=?1 ")
    int updateOpenId(String id, String openId);
}

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientMedicardCardService.java

@ -5,6 +5,7 @@ import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -25,7 +26,7 @@ import java.util.Set;
 * @since 1.
 */
@Service
public class BasePatientMedicardCardService extends BaseJpaService<PatientMedicareCardDO, BasePatientMedicareCardDao> {
public class BasePatientMedicardCardService<T, R extends CrudRepository> extends BaseJpaService<PatientMedicareCardDO, BasePatientMedicareCardDao> {
    @Autowired
    private BasePatientMedicareCardDao basePatientMedicareCardDao;

+ 5 - 0
common/common-entity/pom.xml

@ -23,5 +23,10 @@
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.0.13.Final</version>
        </dependency>
    </dependencies>
</project>

+ 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;
    }

+ 27 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -2,9 +2,14 @@ package com.yihu.jw.entity.base.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
@ -21,11 +26,13 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    /**
	 * saas配置id
	 */
//    @NotNull(message = "saasid不可为空")
	private String saasId;
    /**
	 * 身份证号
	 */
//    @NotNull(message = "身份证号不可为空")
	private String idcard;
    /**
@ -46,17 +53,19 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    /**
	 * 生日
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
//	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date birthday;
    /**
	 * 性别,1男,2女
	 */
//    @Range(min = 1, max = 2, message = "1-男,2-女")
	private Integer sex;
    /**
	 * 手机号
	 */
//    @Length(min = 11,max = 11,message = "手机号长度为11位")
	private String mobile;
    /**
@ -109,6 +118,11 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
     */
    private String streetName;
    /**
     * 地址
     */
    private String address;
    /**
     * 居住省代码
     */
@ -382,6 +396,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.streetName = streetName;
    }
    @Column(name = "committee_code")
    public String getCommitteeCode() {
        return committeeCode;
    }
@ -390,6 +405,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.committeeCode = committeeCode;
    }
    @Column(name = "committee_name")
    public String getCommitteeName() {
        return committeeName;
    }
@ -398,7 +414,16 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.committeeName = committeeName;
    }
	@Column(name = "points")
    @Column(name = "address")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    @Column(name = "points")
    public String getPoints() {
        return points;
    }

+ 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;
    }
}

+ 58 - 16
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java

@ -16,6 +16,52 @@ import javax.persistence.Table;
@Table(name = "patient_medicare_card")
public class PatientMedicareCardDO extends IntegerIdentityEntity {
   public enum ParentType {
        CareCard("A", "医疗卡"),
        Coupons("B", "优惠券"),
        BankCard("C", "银行卡");
        private String type;
        private String desc;
         ParentType(String type, String desc) {
            this.type = type;
            this.desc = desc;
        }
    }
   public enum Type {
        MedicareCard("A_01", "医保卡"),
        SocialSecurityCard("A_02", "电子社保卡"),
        PatientIDCard("A_03", "电子就诊卡");
        private String type;
        private String desc;
         Type(String type, String desc) {
            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;
       }
   }
    /**
	 * 卡标识
	 */
@ -36,12 +82,6 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
	 */
	private String patientCode;
    /**
	 * 医疗保险号
	 */
	private String medicareNumber;
    /**
	 * 绑定密码
	 */
@ -52,6 +92,11 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
	 */
	private String wxOpenid;
	/**
	 * 机构code,就诊卡跟医院关联
	 */
	private String orgCode;
    /**
	 * 备注
	 */
@ -95,14 +140,6 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
        this.patientCode = patientCode;
    }
	@Column(name = "medicare_number")
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
	@Column(name = "password")
    public String getPassword() {
        return password;
@ -134,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;
    }
}

+ 3 - 31
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java

@ -16,34 +16,6 @@ import java.util.Date;
@Table(name = "base_service_package_sign_record")
public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Serializable {
    public enum Status {
        create("新建", "1"),
        complete("已完成", "2");
        private String name;
        private String value;
        Status(String name, String value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    private String saasId;
    private String servicePackageId;//服务包id
    private String servicePackageName;//服务包名称
@ -59,7 +31,7 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
    private Long price;//服务总价
    private Date startTime;//服务开始时间
    private Date endTime;//服务结束时间
    private String status;//状态(1新建,2已完成)
    private Integer status;//状态(0待审核,1已同意,待支付,2.支付成功,已生效,-1未通过,-2已取消,-3已过期)
    private String doctorTeamCode;//医生服务团队code
    private String operator;//签约申请人处理人
    private Date createTime;//创建时间
@ -193,11 +165,11 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
        this.endTime = endTime;
    }
    public String getStatus() {
    public Integer getStatus() {
        return status;
    }
    public void setStatus(String status) {
    public void setStatus(Integer status) {
        this.status = status;
    }

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

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

+ 1 - 1
common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/CapthcaInvalidException.java

@ -1,7 +1,7 @@
package com.yihu.jw.exception.business.patient;
/**
 * 居民不存在
 * 验证码无效(错误或过期)
 */
public class CapthcaInvalidException extends RuntimeException{

+ 0 - 11
common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/NotFoundPatientException.java

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

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

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

+ 11 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/PatientNotFoundException.java

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

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

@ -319,7 +319,7 @@ public class BaseRequestMapping {
     * 服务包
     */
    public static class ServicePackage extends Basic{
        public static final String PREFIX  = "/service_package";
        public static final String PREFIX  = "/servicepackage";
    }
    /**
@ -457,6 +457,7 @@ public class BaseRequestMapping {
        public static final String queryOrgCodeAndNameListBySaasId  = "/queryOrgCodeAndNameListBySaasId";
    }
    /**
     * 居民信息
     */
@ -465,6 +466,12 @@ 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";
        public static final String updateMobile  = "/updateMobile";
        public static final String resetPassword  = "/resetPassword";
        public static final String Regist = "regist";
        public static final String GetKey = "getKey";
        public static final String Login = "login";
@ -476,7 +483,11 @@ 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";
        public static final String unBindCard  = "/unBindCard";
    }

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/patient/PatientRequestMapping.java

@ -40,6 +40,7 @@ public class PatientRequestMapping {
        public static final String signPackage  = "/signPackage";
        public static final String findDoctorById  = "/findDoctorById";
        public static final String findOrgByCode  = "/findOrgByCode";
        public static final String findPatientSignExist  = "/findPatientSignExist";
    }
    /**
     * myFamily

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/org/BaseOrgVO.java

@ -1,9 +1,11 @@
package com.yihu.jw.restmodel.base.org;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
@ -142,6 +144,8 @@ public class BaseOrgVO extends UuidIdentityVOWithOperator {
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
    private String del;
    private List<DictHospitalDeptVO> depts;
    public String getCode() {
        return code;
    }
@ -283,5 +287,11 @@ public class BaseOrgVO extends UuidIdentityVOWithOperator {
        this.del = del;
    }
    public List<DictHospitalDeptVO> getDepts() {
        return depts;
    }
    public void setDepts(List<DictHospitalDeptVO> depts) {
        this.depts = depts;
    }
}

+ 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;
    /**
	 * 备注
	 */

+ 43 - 4
svr/svr-base/pom.xml

@ -60,8 +60,8 @@
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.cloud</groupId>-->
            <!--<artifactId>spring-cloud-starter-zipkin</artifactId>-->
        <!--<groupId>org.springframework.cloud</groupId>-->
        <!--<artifactId>spring-cloud-starter-zipkin</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
@ -98,8 +98,8 @@
            <artifactId>common-web</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>com.yihu.jw</groupId>-->
            <!--<artifactId>common-tracer</artifactId>-->
        <!--<groupId>com.yihu.jw</groupId>-->
        <!--<artifactId>common-tracer</artifactId>-->
        <!--</dependency>-->
        <!-- 文件服务器 -->
        <dependency>
@ -118,6 +118,11 @@
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>elasticsearch-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.github.swagger2markup</groupId>
@ -131,7 +136,41 @@
            </exclusions>
        </dependency>
        <!-- 发送邮件 -->
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.4.7</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 start-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.yihu.ehr</groupId>
                    <artifactId>commons-util</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-collections4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <!-- xlsx  依赖这个包 -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>

+ 44 - 44
svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHospitalDeptDao.java

@ -1,44 +1,44 @@
package com.yihu.jw.base.dao.dict;
import com.yihu.jw.entity.base.dict.DictDiseaseDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import feign.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * 
 * 医院科室字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHospitalDeptDO, Integer>, JpaSpecificationExecutor<DictHospitalDeptDO>  {
    @Query("select code as code,name as name from DictHospitalDeptDO where orgCode in ?1")
    List<Map<String,Object>> findByOrgCodeIn( String orgCode, Pageable pageable);
    @Query("select code as code,name as name from DictHospitalDeptDO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictHospitalDeptDO> findByOrgCode(String orgCode);
    List<DictHospitalDeptDO> findByOrgCodeIn(String orgCode);
    Long countByCodeIn(String orgCode);
    boolean existsByCodeAndOrgCode(String code,String orgCode);
    DictHospitalDeptDO findByCode(String code);
}
//package com.yihu.jw.base.dao.dict;
//
//import com.yihu.jw.entity.base.dict.DictDiseaseDO;
//import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
//import feign.Param;
//import org.springframework.data.domain.Pageable;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//import java.util.Map;
//
///**
// *
// * 医院科室字典 数据库访问层
// *
// * @version
// * <pre>
// * Author	Version		Date		Changes
// * litaohong 	1.0  		2018年08月31日 	Created
// *
// * </pre>
// * @since 1.
// */
//public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHospitalDeptDO, Integer>, JpaSpecificationExecutor<DictHospitalDeptDO>  {
//
//    @Query("select code as code,name as name from DictHospitalDeptDO where orgCode in ?1")
//    List<Map<String,Object>> findByOrgCodeIn( String orgCode, Pageable pageable);
//
//    @Query("select code as code,name as name from DictHospitalDeptDO")
//    List<Map<String,Object>> findCodeAndName(Pageable pageable);
//
//    List<DictHospitalDeptDO> findByOrgCode(String orgCode);
//
//    List<DictHospitalDeptDO> findByOrgCodeIn(String orgCode);
//
//    Long countByCodeIn(String orgCode);
//
//    boolean existsByCodeAndOrgCode(String code,String orgCode);
//
//    DictHospitalDeptDO findByCode(String code);
//
//}

+ 6 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/open/register/RegisterEndpoint.java

@ -25,21 +25,18 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.*;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import java.io.UnsupportedEncodingException;
import java.util.Calendar;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
//import javax.mail.*;
//import javax.mail.internet.InternetAddress;
//import javax.mail.internet.MimeBodyPart;
//import javax.mail.internet.MimeMessage;
//import javax.mail.internet.MimeMultipart;
/**
 * @author yeshijie on 2018/10/16.
 */

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java

@ -3,9 +3,9 @@ package com.yihu.jw.base.service.dict;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
import com.yihu.jw.base.enums.SystemDictEnum;
import com.yihu.jw.base.service.org.BaseOrgService;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

+ 3 - 11
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -2,33 +2,27 @@ package com.yihu.jw.base.service.doctor;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.dict.DictDoctorDutyDao;
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.base.service.dict.DictDoctorDutyService;
import com.yihu.jw.base.service.dict.DictHospitalDeptService;
import com.yihu.jw.base.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.service.org.tree.SimpleTree;
import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.org.dao.BaseOrgDao;
@ -36,13 +30,11 @@ import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.text.ParseException;
import java.util.*;
/**

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDOReader.java

@ -1,10 +1,10 @@
package com.yihu.jw.base.service.doctor.excelImport;
import com.yihu.jw.base.dao.dict.DictDoctorDutyDao;
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.org.dao.BaseOrgDao;

+ 4 - 0
svr/svr-patient/pom.xml

@ -196,6 +196,10 @@
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>

+ 6 - 7
svr/svr-patient/sql/sql

@ -8,9 +8,10 @@ create table `patient_medicare_card`
  `parent_type` varchar(1) DEFAULT NULL COMMENT '卡的大类(A-医疗卡,B-优惠券,C-银行卡,unknow-其他)',
  `type` varchar(1) DEFAULT NULL COMMENT '卡的小类:医疗卡包含 A_01 医保卡,A_02 电子社保卡 A_03 电子就诊卡等等',
  `patient_code` varchar(50) not null COMMENT '居民标识',
  `password` varchar(50) not null COMMENT '绑定密码',
  `wx_openid` varchar(50) not null COMMENT '微信openid,有些卡会绑定微信',
  `remark` 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 - 10
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientDao.java

@ -17,7 +17,6 @@ public interface PatientDao extends PagingAndSortingRepository<BasePatientDO, St
    BasePatientDO findByIdAndDel(String id, String del);
    @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 where idcard like ?1")
    List<Map<String,Object>> findByIdcard(String idcard, Pageable pageable);
@ -27,14 +26,5 @@ public interface PatientDao extends PagingAndSortingRepository<BasePatientDO, St
    @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);
    @Query("from BasePatientDO where mobile = ?1")
    List<BasePatientDO> findByMobile(String mobile);
    @Query("from BasePatientDO p where p.mobile = ?1 and p.del=?2")
    List<BasePatientDO> findByMobileAndDel(String mobile,String del);
    @Modifying
    @Query(" update BasePatientDO a set a.openid=?2 where a.id=?1 ")
    int updateOpenId(String id, String openId);
}

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

@ -27,4 +27,5 @@ public interface PatientMedicareCardDao extends PagingAndSortingRepository<Patie
    @Query("select id from PatientMedicareCardDO where patientCode = ?1")
    Set<Object> findIdListByPatientCode(String patientCode);
}

svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicePackage/ServicePackageDao.java → svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicepackage/ServicePackageDao.java


svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicePackage/ServicePackageItemDao.java → svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicepackage/ServicePackageItemDao.java


svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicePackage/ServicePackageSignRecordDao.java → svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicepackage/ServicePackageSignRecordDao.java


+ 72 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/file_upload/FileUploadEndpoint.java

@ -0,0 +1,72 @@
package com.yihu.jw.patient.endpoint.file_upload;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.io.InputStream;
/**
 * 文件上传公共类
 */
@RestController
@RequestMapping(BaseRequestMapping.FileUpload.PREFIX)
@Api(tags = "文件上传相关操作", description = "文件上传相关操作")
public class FileUploadEndpoint extends EnvelopRestEndpoint {
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Autowired
    FileUploadService fileUploadService;
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_IMG)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
    public ObjEnvelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        // 得到文件的完整名称  xxx.txt
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_ATTACHMENT)
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public ObjEnvelop<UploadVO> uploadStream(@ApiParam(value = "文件", required = true)
                                                 @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        // 得到文件的完整名称  xxx.txt
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STRING)
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
    public ObjEnvelop<UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流")
                                                 @RequestBody String jsonData) throws Exception {
        UploadVO uploadVO = fileUploadService.uploadImages(jsonData,fastdfs_file_url);
        return success("上传成功", uploadVO);
    }
}

+ 81 - 83
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientEndpoint.java

@ -4,7 +4,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.security.Token;
import com.yihu.jw.entity.base.sms.SmsDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.patient.dao.personal_info.PatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.personal_Info.PatientService;
import com.yihu.jw.patient.util.CommonUtils;
import com.yihu.jw.patient.util.ConstantUtils;
@ -24,11 +24,12 @@ import com.yihu.jw.util.security.MD5;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.*;
@ -47,21 +48,24 @@ import java.util.*;
@Api(value = "居民信息管理", description = "居民信息管理服务接口", tags = {"wlyy基础服务 - 居民信息管理服务接口"})
public class PatientEndpoint extends EnvelopRestEndpoint {
    @Value("${sms.clientId}")
    @Autowired
    private PatientService patientService;
    @Value("sms.clientId")
    private String clientId;
    @Autowired
    private BaseSmsGatewayService baseSmsGatewayService;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private PatientService patientService;
    private BasePatientDao basePatientDao;
    @Autowired
    private RSAService rsaService;
    @Autowired
    private TokenService tokenService;
    @Autowired
    private BaseSmsService baseSmsService;
@ -86,67 +90,33 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    @ApiOperation("居民注册接口")
    @RequestMapping(value = BaseRequestMapping.BasePatient.Regist, method = RequestMethod.POST)
    @ResponseBody
    public Envelop regist(@ApiParam(value = "手机号", name = "mobile") @RequestParam(required = true)String mobile ,
    public Envelop regist(@ApiParam(value = "手机号", name = "mobile") @RequestParam(required = true) String mobile,
                          @ApiParam(value = "验证码", name = "captcha") @RequestParam(value = "captcha", required = true) String captcha,
                          @ApiParam(value = "微信openId", name = "openid") @RequestParam(value = "openid", required = false) String openid,
                          @ApiParam(value = "密码", name = "password") @RequestParam(value = "password", required = false) String password) {
        Envelop envelop = new Envelop();
        boolean b = CommonUtils.isMobile(mobile);
        if(!b){
        if (!b) {
            envelop.setMessage("手机号码格式不正确");
            envelop.setStatus(-1);
            return envelop;
        }
        //验证手机是否被注册
        List<BasePatientDO> list = patientDao.findByMobileAndDel(mobile,"1");
        if(list!=null && list.size()> 0){
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile, "1");
        if (list != null && list.size() > 0) {
            envelop.setMessage("该手机号已经注册!");
            envelop.setStatus(-1);
            return envelop;
        }
        // 对验证码进行校验
        int res = baseSmsService.check(mobile, 0, captcha);
        if(-2 == res){
            envelop.setMessage("验证码已过期!");
            envelop.setStatus(-1);
            return envelop;
        }else if(-1 == res){
            envelop.setMessage("请输入正确的验证码!");
            envelop.setStatus(-1);
            return envelop;
        }else if(0 == res){
            envelop.setMessage("验证码无效!");
            envelop.setStatus(-1);
            return envelop;
        } else{
            BasePatientDO patient = new BasePatientDO();
            patient.setMobile(mobile);
            if(StringUtils.isNotBlank(password)){
                //增加密码
                String salt = UUID.randomUUID().toString().replace("-", "");
                patient.setSalt(salt);
                password = rsaService.decryptString(password);
                password = StringUtils.reverse(password);
                if(password.length()<6 || password.length()>20){
                    envelop.setMessage("密码长度需为6-20位");
                    envelop.setStatus(-1);
                    return envelop;
                }
                patient.setPassword(MD5.GetMD5Code(password + salt));
            }
            if(!"undefined".equals(openid) && StringUtils.isNotBlank(openid)){
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            Map<String, Object> result = patientService.regis(mobile, captcha, password, openid);
            if ("-1".equals(result.get("code"))) {
                envelop.setStatus(-1);
                envelop.setMessage(result.get("message") + "");
            } else {
                envelop.setStatus(200);
                envelop.setMessage(result.get("message") + "");
            }
            patient.setDel("1");
            patient.setPatientStatus("1");
            patientService.save(patient);
            envelop.setMessage("注册成功");
            envelop.setStatus(200);
            return envelop;
        }
        return envelop;
    }
    /**
@ -167,21 +137,21 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        Envelop envelop = new Envelop();
        boolean b = CommonUtils.isMobile(mobile);
        if(!b){
        if (!b) {
            envelop.setMessage("手机号码格式不正确");
            envelop.setStatus(-1);
            return envelop;
        }
        //验证手机是否被注册
        List<BasePatientDO> list = patientDao.findByMobileAndDel(mobile,"1");
        if(CollectionUtils.isEmpty(list)){
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile, "1");
        if (CollectionUtils.isEmpty(list)) {
            envelop.setMessage("该手机未注册");
            envelop.setStatus(-1);
            return envelop;
        }
        if(list.size()> 1){
        if (list.size() > 1) {
            envelop.setMessage("该手机号存在多个账号,请联系管理员");
            envelop.setStatus(-1);
            return envelop;
@ -189,7 +159,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        BasePatientDO p = list.get(0);
        //用于判断是否登陆成功,若登陆成功,且openId不为空,则更新openId
        boolean isLogin = false;
        if(org.apache.commons.lang3.StringUtils.isNotBlank(password)){
        if (org.apache.commons.lang3.StringUtils.isNotBlank(password)) {
            password = rsaService.decryptString(password);
            password = org.apache.commons.lang3.StringUtils.reverse(password);
            //生成MD5
@ -197,7 +167,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
            if (loginPassword.equals(p.getPassword())) {
                //使用密码登录成功
                isLogin = true;
            }else{
            } else {
                //使用密码登录失败
                envelop.setMessage("密码错误");
                envelop.setStatus(-1);
@ -206,15 +176,15 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        } else {
            //验证码登陆
            int res = baseSmsService.check(mobile, 4, captcha);
            if(-2 == res){
            if (-2 == res) {
                envelop.setMessage("验证码已过期!");
                envelop.setStatus(-1);
                return envelop;
            }else if(-1 == res){
            } else if (-1 == res) {
                envelop.setMessage("请输入正确的验证码!");
                envelop.setStatus(-1);
                return envelop;
            }else if(0 == res) {
            } else if (0 == res) {
                envelop.setMessage("验证码无效!");
                envelop.setStatus(-1);
                return envelop;
@ -223,10 +193,10 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                isLogin = true;
            }
        }
        if(isLogin){
            if(StringUtils.isNotBlank(openId) && !"undefined".equals(openId)){
        if (isLogin) {
            if (StringUtils.isNotBlank(openId) && !"undefined".equals(openId)) {
                //更新openId
                if(!openId.equals(p.getOpenid())){
                if (!openId.equals(p.getOpenid())) {
                    patientService.updateOpenId(p.getId(), openId);
                }
            }
@ -250,10 +220,10 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    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);
       }
        String msg = patientService.createPatient(jsonData);
        if (!StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS, msg)) {
            return success(msg);
        }
        return failed(msg);
    }
@ -272,7 +242,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        String msg = patientService.updatePatient(jsonData);
        if(!StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS,msg)){
        if (!StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS, msg)) {
            return failed(msg);
        }
        return success(msg);
@ -318,20 +288,48 @@ 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 = "id", value = "居民标识", required = true) @RequestParam String id,
                                  @ApiParam(name = "idcard", value = "居民身份证号", required = true) @RequestParam String idcard) throws Exception {
        return success(patientService.existsByIdcard(idcard, id));
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.completeInfo)
    @ApiOperation(value = "完善信息")
    public Envelop completeInfo(@ApiParam(name = "jsonData", value = "jsonData数据", required = true) @RequestParam String jsonData,
                                @ApiParam(name = "photo", value = "头像", required = false) @RequestParam MultipartFile photo) throws Exception {
        return success(patientService.completePatientDetails(photo, jsonData));
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.updateMobile)
    @ApiOperation(value = "修改手机号")
    public Envelop updateMobile(@ApiParam(name = "id", value = "居民标识", required = true) @RequestParam String id,
                                @ApiParam(name = "newMobile", value = "新的手机号", required = true) @RequestParam String newMobile,
                                @ApiParam(name = "captcha", value = "验证码", required = true) @RequestParam String captcha) throws Exception {
        return success(patientService.updateMobile(id, newMobile, captcha));
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.resetPassword)
    @ApiOperation(value = "设置密码")
    public Envelop updatePasswd(@ApiParam(name = "id", value = "居民标识", required = true) @RequestParam String id,
                                @ApiParam(name = "password", value = "密码", required = true) @RequestParam String password) throws Exception {
        return success(patientService.resetPassword(id, password));
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.getCompletedInfo)
    @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)
@ -341,7 +339,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "mobile", required = true) String mobile,
            @ApiParam(name = "type", value = "短信验证码类型", required = true)
            @RequestParam(value = "type") SmsTemplateDO.Type type) throws Exception {
        SmsDO smsDO = baseSmsGatewayService.send(clientId, type,mobile);
        SmsDO smsDO = baseSmsGatewayService.send(clientId, type, mobile);
        return success(smsDO, SmsVO.class);
    }

+ 87 - 58
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientMedicareCardEndpoint.java

@ -14,64 +14,91 @@ 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;
/**
*
* 居民卡包控制器
*
* @version
* <pre>
 * 居民卡包控制器
 *
 * @version <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  		2018年11月27日 	Created
 *
 * </pre>
* @since 1.
*/
 * @since 1.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.PatientMedicareCard.PREFIX)
@Api(value = "居民卡包管理", description = "居民卡包管理服务接口", tags = {"wlyy基础服务 - 居民卡包管理服务接口"})
public class PatientMedicareCardEndpoint extends EnvelopRestEndpoint {
@Autowired
private PatientMedicareCardService patientMedicareCardService;
@PostMapping(value = BaseRequestMapping.PatientMedicareCard.CREATE)
@ApiOperation(value = "创建")
public ObjEnvelop<PatientMedicareCardVO> create (
    @ApiParam(name = "jsonData", value = "Json数据", required = true)
    @RequestParam String jsonData) throws Exception {
    PatientMedicareCardDO patientMedicareCard = toEntity(jsonData, PatientMedicareCardDO.class);
    patientMedicareCard = patientMedicareCardService.save(patientMedicareCard);
    return success(patientMedicareCard, PatientMedicareCardVO.class);
    @Autowired
    private PatientMedicareCardService patientMedicareCardService;
    @PostMapping(value = BaseRequestMapping.PatientMedicareCard.bindMedicareCard)
    @ApiOperation(value = "绑定医保卡")
    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,
     @ApiParam(name = "pssword", value = "密码", required = true) @RequestParam String pssword) throws Exception {
        patientMedicareCardService.bindMedicareCard(id,idcard,cardNumber,pssword);
        return success("success");
    }
    @PostMapping(value = BaseRequestMapping.PatientMedicareCard.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    patientMedicareCardService.delete(ids.split(","));
    return success("删除成功");
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        patientMedicareCardService.delete(ids.split(","));
        return success("删除成功");
    }
    @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");
    }
    @PostMapping(value = BaseRequestMapping.PatientMedicareCard.unBindCard)
    @ApiOperation(value = "解除绑定卡")
    public Envelop unBindCard(
            @ApiParam(name = "cardId", value = "卡片id", required = true) @RequestParam String cardId) throws Exception {
        patientMedicareCardService.unBindCard(cardId);
        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()));
    }
    @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);
        }
        @GetMapping(value = BaseRequestMapping.PatientMedicareCard.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<PatientMedicareCardVO> page (
    @GetMapping(value = BaseRequestMapping.PatientMedicareCard.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<PatientMedicareCardVO> page(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -81,23 +108,25 @@ public ObjEnvelop<PatientMedicareCardVO> create (
            @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) throws Exception {
            List<PatientMedicareCardDO> patientMedicareCards = patientMedicareCardService.search(fields, filters, sorts, page, size);
                int count = (int)patientMedicareCardService.getCount(filters);
                return success(patientMedicareCards, count, page, size, PatientMedicareCardVO.class);
         }
         @GetMapping(value = BaseRequestMapping.PatientMedicareCard.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<PatientMedicareCardVO> 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<PatientMedicareCardDO> patientMedicareCards = patientMedicareCardService.search(fields, filters, sorts);
                  return success(patientMedicareCards, PatientMedicareCardVO.class);
         }
 }
            @RequestParam(value = "size") int
                    size) throws Exception {
        List<PatientMedicareCardDO> patientMedicareCards = patientMedicareCardService.search(fields, filters, sorts, page, size);
        int count = (int) patientMedicareCardService.getCount(filters);
        return success(patientMedicareCards, count, page, size, PatientMedicareCardVO.class);
    }
    @GetMapping(value = BaseRequestMapping.PatientMedicareCard.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<PatientMedicareCardVO> 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<PatientMedicareCardDO> patientMedicareCards = patientMedicareCardService.search(fields, filters, sorts);
        return success(patientMedicareCards, PatientMedicareCardVO.class);
    }
}

svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/sericePackage/PackageServiceEndpoint.java → svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/servicepackage/PackageServiceEndpoint.java


+ 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);
    }
 }
}

+ 52 - 47
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,67 @@ 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.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 +87,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);
    }
 }
}

+ 2 - 2
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/myFamily/MyFamilyService.java

@ -257,7 +257,7 @@ public class MyFamilyService {
        if(!StringUtils.isEmpty(basePatientDO.getPrincipalCode())){
            PatientMedicareCardDO patientMedicareCard = patientMedicareCardService.findByCode(basePatientDO.getPrincipalCode());
            map.put("principalNum",patientMedicareCard.getMedicareNumber());//社保卡号
            map.put("principalNum",patientMedicareCard.getCode());//社保卡号
        }else{
            map.put("principalNum","");//社保卡号
        }
@ -280,7 +280,7 @@ public class MyFamilyService {
            if(!StringUtils.isEmpty(basePatientDO.getPrincipalCode())){
                PatientMedicareCardDO patientMedicareCard = patientMedicareCardService.findByCode(basePatientDO.getPrincipalCode());
                map2.put("principalNum",patientMedicareCard.getMedicareNumber());//社保卡号
                map2.put("principalNum",patientMedicareCard.getCode());//社保卡号
            }else{
                map2.put("principalNum","");//社保卡号
            }

+ 140 - 1
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientMedicareCardService.java

@ -1,13 +1,152 @@
package com.yihu.jw.patient.service.personal_Info;
import com.yihu.jw.entity.base.patient.BasePatientDO;
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.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.patient.dao.personal_info.PatientMedicareCardDao;
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;
/**
 * 居民卡包信息服务
 *
 * @author litaohong on  2018年11月28日
 */
@Service
public class PatientMedicareCardService extends BasePatientMedicardCardService {
public class PatientMedicareCardService extends BasePatientMedicardCardService<PatientMedicareCardDO, BasePatientMedicareCardDao> {
    @Autowired
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private PatientService patientService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 绑定医保卡,需要密码
     *
     * @param patientCode
     * @param idcard
     * @param medicareCardNumber
     */
    @Transactional(rollbackFor = Exception.class)
    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 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;
    }
}

+ 175 - 32
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java

@ -1,21 +1,33 @@
package com.yihu.jw.patient.service.personal_Info;
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.NotFoundPatientException;
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.CommonUtils;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.patient.util.RSAService;
import com.yihu.jw.sms.service.BaseSmsService;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang3.StringUtils;
import org.csource.common.MyException;
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.web.multipart.MultipartFile;
import java.util.UUID;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.*;
/**
 * 居民信息服务
@ -25,33 +37,83 @@ import java.util.UUID;
public class PatientService extends BasePatientService<BasePatientDO, BasePatientDao> {
    @Autowired
    private PatientDao patientDao;
    private BasePatientDao basePatientDao;
    @Autowired
    private BaseSmsService baseSmsService;
    /**
     * 设置登录密码
     * @param id
     * @param password
     */
    public String setPassword(String id, String password){
        Preconditions.checkNotNull(id);
        Preconditions.checkNotNull(password);
        BasePatientDO patient = patientDao.findOne(id);
        if(null == patient){
            throw new NotFoundPatientException("当前居民不存在:【 " + id + "】");
    @Autowired
    private FileUploadService fileUploadService;
    @Value("fastDFS.fastdfs_file_url")
    private String fastdfsUrl;
    @Autowired
    private RSAService rsaService;
    public Map<String,Object> regis(String mobile, String captcha, String password, String openid){
        Map<String, Object> map = new HashMap<>();
        boolean b = CommonUtils.isMobile(mobile);
        if(!b){
            map.put("code",-1);
            map.put("message","手机号码格式不正确");
            return map;
        }
        String salt = UUID.randomUUID().toString().replace("-", "");
        patient.setSalt(salt);
        password = patient.getIdcard().substring(0, 5);
        patient.setPassword(MD5.md5Hex(password + patient.getSalt()));
        return ConstantUtils.SUCCESS;
    }
        //验证手机是否被注册
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile,"1");
        if(list!=null && list.size()> 0){
            map.put("code",-1);
            map.put("message","该手机号已经注册!");
            return map;
        }
        // 对验证码进行校验
        int res = baseSmsService.check(mobile, 0, captcha);
        if(-2 == res){
            map.put("code",-1);
            map.put("message","验证码已过期!");
            return map;
        }else if(-1 == res){
            map.put("code",-1);
            map.put("message","请输入正确的验证码!");
            return map;
        }else if(0 == res){
            map.put("code",-1);
            map.put("message","验证码无效!");
            return map;
        } else{
            BasePatientDO patient = new BasePatientDO();
            patient.setMobile(mobile);
            if(org.apache.commons.lang.StringUtils.isNotBlank(password)){
                //增加密码
                String salt = UUID.randomUUID().toString().replace("-", "");
                patient.setSalt(salt);
                password = rsaService.decryptString(password);
                password = org.apache.commons.lang.StringUtils.reverse(password);
                if(password.length()<6 || password.length()>20){
                    map.put("code",-1);
                    map.put("message","密码长度需为6-20位");
                    return map;
                }
                patient.setPassword(com.yihu.jw.util.security.MD5.GetMD5Code(password + salt));
            }
            if(!"undefined".equals(openid) && org.apache.commons.lang.StringUtils.isNotBlank(openid)){
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            }
            patient.setDel("1");
            patient.setPatientStatus("1");
            this.save(patient);
            map.put("code",1);
            map.put("message","注册成功");
            return map;
        }
    }
    /**
     * 修改密码
     * 设置登录密码/修改密码
     * @param id
     * @param newPassword
     * @return
@ -60,12 +122,12 @@ 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 NotFoundPatientException("当前居民不存在:【 " + id + "】");
            throw new PatientNotFoundException("当前居民不存在:【 " + id + "】");
        }
        patient.setSalt(randomString(5));
        patient.setPassword(MD5.md5Hex(newPassword + patient.getSalt() ));
        patient.setPassword(MD5.md5Hex(newPassword + "{" + patient.getSalt() + "}"));
        return ConstantUtils.SUCCESS;
    }
@ -73,16 +135,18 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
     * 修改手机号
     * @param id
     * @param newMobile
     * @param captcha
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public BasePatientDO updateMobile(String id,String newMobile,String captcha){
        Preconditions.checkNotNull(id);
        Preconditions.checkNotNull(newMobile);
        Preconditions.checkNotNull(captcha);
        BasePatientDO patient = patientDao.findOne(id);
    public BasePatientDO updateMobile(@NotNull String id, @NotNull String newMobile, @NotNull String captcha){
        Preconditions.checkNotNull(id,"id不可为空");
        Preconditions.checkNotNull(newMobile,"手机号不可为空");
        Preconditions.checkNotNull(captcha,"验证码不可为空");
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
            throw new NotFoundPatientException("当前居民不存在:【 " + id + "】");
            throw new PatientNotFoundException("当前居民不存在:【 " + id + "】");
        }
        if(StringUtils.endsWithIgnoreCase(patient.getMobile(),newMobile)){
            return patient;
@ -96,15 +160,94 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
        return patient;
    }
    public BasePatientDO completePatientDetails(BasePatientDO patientDO){
    /**
     * 完善居民基本信息
     * @param headPortrait 头像
     * @param json
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public BasePatientDO completePatientDetails(MultipartFile headPortrait, String json){
        BasePatientDO patientDO = JSONObject.parseObject(json,BasePatientDO.class);
        //如果未上传头像,使用默认头像
        if(null == headPortrait){
            patientDO.setPhoto("default");
        }else{
            UploadVO uploadedFile = null;
            try {
                uploadedFile = fileUploadService.uploadImg(headPortrait.getInputStream(),headPortrait.getOriginalFilename(),headPortrait.getSize(),fastdfsUrl);
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (MyException e) {
                e.printStackTrace();
            }
            patientDO.setPhoto(uploadedFile.getFullUrl());
        }
        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;
    }
    /**
     * 验证身份证是否存在,剔除当前用户自身id
     * @param idcard
     * @param id
     * @return
     */
    public boolean existsByIdcard(String idcard,String id) {
        Preconditions.checkNotNull(idcard, "身份证不可为空");
        Preconditions.checkNotNull(id, "id不可为空");
        return basePatientDao.existsByIdcardAndIdNot(idcard,id);
    }
    /**
     * 验证身份证是否存在
     * @param idcard
     * @return
     */
    public boolean existsByIdcard(String idcard) {
        Preconditions.checkNotNull(idcard, "身份证不可为空");
        return basePatientDao.existsByIdcard(idcard);
    }
    @Transactional(rollbackFor = Exception.class)
    public int updateOpenId(String id, String openId){
        return patientDao.updateOpenId(id,openId);
        return basePatientDao.updateOpenId(id,openId);
    }
    /**
     *  判断是否需要完善信息,身份证未填则需要完善
     * @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;
    }
}

+ 18 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/service_package/PackageService.java

@ -1,6 +1,8 @@
package com.yihu.jw.patient.service.service_package;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageDO;
@ -53,6 +55,9 @@ public class PackageService {
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    public MixEnvelop findPackageService(String city,String labelCode,String labelType,Integer page,Integer size){
        String totalSql ="SELECT " +
@ -226,6 +231,19 @@ public class PackageService {
        return baseOrgDao.findByCode(orgCode);
    }
    public List<DictHospitalDeptDO> findDeptByOrgCode(String orgCode){
       return dictHospitalDeptDao.findByOrgCode(orgCode);
    }
    public Boolean findPatientSignExist(String patient,String packageId){
        List<ServicePackageSignRecordDO> list = servicePackageSignRecordDao.findByPatientRecord(patient,packageId);
        if(list!=null&&list.size()>0){
            return true;
        }else{
            return false;
        }
    }
//    public MixEnvelop findSignPackage(){
//
//    }

+ 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;
    }
}

+ 14 - 5
svr/svr-patient/src/main/resources/application.yml

@ -99,10 +99,15 @@ spring:
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
sms:
  clientId: EwC0iRSrcP
# 短信发送地址
jw:
  smsUrl: http://svr-base:10020/sms_gateway/send
myFamily:
  qrCodeFailurTime: 2
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
---
spring:
  profiles: jwtest
@ -130,6 +135,8 @@ spring:
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
myFamily:
@ -158,7 +165,9 @@ spring:
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
myFamily:
  qrCodeFailurTime: 2
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP # todo 待确认
  clientId: EwC0iRSrcP
myFamily:
  qrCodeFailurTime: 2