Browse Source

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

Conflicts:
	svr/svr-patient/src/main/resources/application.yml
liuwenbin 6 years ago
parent
commit
e2af066f7c
32 changed files with 850 additions and 623 deletions
  1. 3 3
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientDao.java
  2. 51 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatService.java
  3. 1 1
      business/sms-service/src/main/java/com/yihu/jw/sms/dao/BaseSmsDao.java
  4. 1 1
      business/sms-service/src/main/java/com/yihu/jw/sms/service/BaseSmsService.java
  5. 14 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java
  6. 3 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/AccountAppealDO.java
  7. 136 149
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  8. 0 13
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/FeedbackDO.java
  9. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDO.java
  10. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java
  11. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/patient/PatientRequestMapping.java
  12. 16 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/org/BaseOrgVO.java
  13. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/BasePatientVO.java
  14. 0 13
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/FeedbackVO.java
  15. 209 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/patient/signPackage/ServicePackageRecordVO.java
  16. 9 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/patient/signPackage/ServicePackageVO.java
  17. 3 6
      server/svr-authentication/src/main/resources/application.yml
  18. 1 1
      server/svr-authentication/src/main/resources/bootstrap.yml
  19. BIN
      svr/svr-base/src/main/template/基础人口信息导入模板.xls
  20. 13 2
      svr/svr-patient/sql/sql
  21. 0 11
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientDao.java
  22. 21 152
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientEndpoint.java
  23. 14 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/servicepackage/PackageServiceEndpoint.java
  24. 7 3
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/settings/AccountAppealEndpoint.java
  25. 2 2
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/settings/FeedbackEndpoint.java
  26. 19 1
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/wechat/WechatEndPoint.java
  27. 133 65
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java
  28. 131 4
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/servicepackage/PackageService.java
  29. 13 4
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/settings/AccountAppealService.java
  30. 8 3
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/settings/FeedbackService.java
  31. 0 182
      svr/svr-patient/src/main/java/com/yihu/jw/patient/util/RSAService.java
  32. 9 4
      svr/svr-patient/src/main/resources/application.yml

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

@ -17,13 +17,13 @@ public interface BasePatientDao extends PagingAndSortingRepository<BasePatientDO
    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")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,mobile 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);
    @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 name like ?1")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,mobile as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where name like ?1")
    List<Map<String,Object>> findByName(String name, Pageable pageable);
    @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")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,mobile 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);

+ 51 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatService.java

@ -0,0 +1,51 @@
package com.yihu.jw.wechat.service;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.dao.WechatDao;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class WechatService {
    @Autowired
    private WechatDao wechatDao;
    /**
     * 通过code获取判断openid
     *
     * @param code
     * @return
     */
    public String getOpenidByCode(String code,String appId,String appSecret) {
        try {
            String token_url = "https://api.weixin.qq.com/sns/oauth2/access_token";
            String params = "appid=" + appId + "&secret=" +appSecret+ "&code=" + code + "&grant_type=authorization_code";
            String result = HttpUtil.sendGet(token_url, params);
            System.out.println("getOpenidByCode:"+result);
            JSONObject json = new JSONObject(result);
            if (json.has("openid")) {
                return json.get("openid").toString();
            } else {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 通过code获取判断openid
     *
     * @param code
     * @return
     */
    public String getOpenidByCode(String code,String wxId) {
        //通过wxId获取appId和appSecret
        WxWechatDO wxWechatDO = wechatDao.findById(wxId);
        return getOpenidByCode(code,wxWechatDO.getAppId(),wxWechatDO.getAppSecret());
    }
}

+ 1 - 1
business/sms-service/src/main/java/com/yihu/jw/sms/dao/BaseSmsDao.java

@ -16,7 +16,7 @@ import java.util.Date;
 */
public interface BaseSmsDao extends PagingAndSortingRepository<SmsDO, String>, JpaSpecificationExecutor<SmsDO> {
    boolean existsByCaptchaAndDeadlineBefore(String captcha, Date now);
    boolean existsByCaptchaAndDeadlineAfter(String captcha, Date now);
    @Query("select a from SmsDO a where a.mobile = ?1 and a.captcha = ?2 and a.type = ?3")
    Page<SmsDO> findByCaptcha(String mobile, String captcha, SmsTemplateDO.Type type, Pageable pageRequest);

+ 1 - 1
business/sms-service/src/main/java/com/yihu/jw/sms/service/BaseSmsService.java

@ -28,7 +28,7 @@ public class BaseSmsService extends BaseJpaService<SmsDO, BaseSmsDao>{
     * @return
     */
    public Boolean verifyCaptcha(String captcha){
        return baseSmsDao.existsByCaptchaAndDeadlineBefore(captcha,new Date());
        return baseSmsDao.existsByCaptchaAndDeadlineAfter(captcha,new Date());
    }
    /**

+ 14 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java

@ -145,6 +145,13 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
	 */
	private String del;
    /**
     * 11一级甲等 12一级乙等 13一级丙等
     * 21二级甲等 22二级乙等 23二级丙等
     * 31三级特等 32三级甲等 33三级乙等 34三级丙级
     */
    private Integer level;
    public BaseOrgDO() {
    }
@ -360,6 +367,12 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
        this.del = del;
    }
    @Column(name = "level")
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
}

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

@ -21,8 +21,9 @@ public class AccountAppealDO extends IntegerIdentityEntity {
     */
    public enum Type{
        mobileCannotUse(0),
        passwordCannotfound(1),
        idcardOccupied(2);
        passwordCannotFound(1),
        idcardOccupied(2),
        other(3);
        private int value;

+ 136 - 149
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -14,69 +14,65 @@ import java.util.Date;
/**
* 居民信息(居民就是患者)实体
*
* @author Administrator on  2018年09月05日
*
*/
 * 居民信息(居民就是患者)实体
 *
 * @author Administrator on  2018年09月05日
 *
 */
@Entity
@Table(name = "base_patient")
public class BasePatientDO extends UuidIdentityEntityWithOperator {
    /**
	 * saas配置id
	 */
     * saas配置id
     */
//    @NotNull(message = "saasid不可为空")
	private String saasId;
    private String saasId;
    /**
	 * 身份证号
	 */
     * 身份证号
     */
//    @NotNull(message = "身份证号不可为空")
	private String idcard;
    private String idcard;
    /**
	 * 登录密码
	 */
	private String password;
     * 登录密码
     */
    private String password;
    /**
	 *
	 */
	private String salt;
     *
     */
    private String salt;
    /**
	 * 姓名
	 */
	private String name;
     * 姓名
     */
    private String name;
    /**
	 * 生日
	 */
     * 生日
     */
//	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date birthday;
    private Date birthday;
    /**
	 * 性别,1男,2女
	 */
     * 性别,1男,2女
     */
//    @Range(min = 1, max = 2, message = "1-男,2-女")
	private Integer sex;
    private Integer sex;
    /**
	 * 手机号
	 */
     * 手机号
     */
//    @Length(min = 11,max = 11,message = "手机号长度为11位")
	private String mobile;
    private String mobile;
    /**
	 * 联系电话
	 */
	private String phone;
    /**
	 * 头像http地址
	 */
	private String photo;
     * 头像http地址
     */
    private String photo;
    /**
     * 省代码
@ -175,84 +171,83 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String committeeName;
    /**
	 * 总积分
	 */
	private String points;
     * 总积分
     */
    private String points;
    /**
	 * 病历总数
	 */
	private String recordAmount;
     * 病历总数
     */
    private String recordAmount;
    /**
	 * 微信编号
	 */
	private String openid;
     * 微信编号
     */
    private String openid;
    /**
	 * 用户状态:1正常,0禁用,-1恶意注册,2审核中
	 */
	private String patientStatus;
     * 用户状态:1正常,0禁用,-1恶意注册,2审核中
     */
    private String patientStatus;
    /**
	 * 联系方式备注【基卫】
	 */
	private String mobileRemarks;
     * 联系方式备注【基卫】
     */
    private String mobileRemarks;
    /**
	 * 第一次添加open的时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date openidTime;
     * 第一次添加open的时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date openidTime;
    /**
	 * 绑定电子社保卡主体(共济为操作人code,医社保关联patient_medicare_card)
	 */
	private String principalCode;
     * 居民预警状态:0为标准,1为预警状态
     */
    private Integer standardStatus;
    /**
	 * 是否绑定电子社保卡 (0否 1是)
	 */
	private String sicardStatus;
     * unionId 开发平台唯一标识
     */
    private String unionid;
    /**
	 * 电子社保卡绑定时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date sicardTime;
     * 作废标识,1正常,0作废
     */
    private String del;
    /**
	 * 是否分配过微信标签
	 */
	private Integer isWxtag;
     * 备注
     */
    private String remark;
    /**
	 * 微信tagId
	 */
	private String wxtagid;
     * 账号是否被锁定
     */
    private int locked;
    /**
	 * 居民预警状态:0为标准,1为预警状态
	 */
	private Integer standardStatus;
     * 是否可以登录
     */
    private int enabled;
    /**
	 * unionId 开发平台唯一标识
	 */
	private String unionid;
     * 登录失败次数
     */
    private int loginFailureCount;
    /**
	 * 作废标识,1正常,0作废
	 */
	private String del;
     * 锁定日期
     */
    private Date lockedDate;
	/**
	 * 备注
	 */
	private String remark;
    /**
     * 登录日期
     */
    private Date loginDate;
	@Column(name = "saas_id")
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
@ -260,7 +255,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.saasId = saasId;
    }
	@Column(name = "idcard")
    @Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
@ -268,7 +263,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.idcard = idcard;
    }
	@Column(name = "password")
    @Column(name = "password")
    public String getPassword() {
        return password;
    }
@ -276,7 +271,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.password = password;
    }
	@Column(name = "salt")
    @Column(name = "salt")
    public String getSalt() {
        return salt;
    }
@ -284,7 +279,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.salt = salt;
    }
	@Column(name = "name")
    @Column(name = "name")
    public String getName() {
        return name;
    }
@ -292,7 +287,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.name = name;
    }
	@Column(name = "birthday")
    @Column(name = "birthday")
    public Date getBirthday() {
        return birthday;
    }
@ -300,7 +295,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.birthday = birthday;
    }
	@Column(name = "sex")
    @Column(name = "sex")
    public Integer getSex() {
        return sex;
    }
@ -308,7 +303,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.sex = sex;
    }
	@Column(name = "mobile")
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }
@ -316,15 +311,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.mobile = mobile;
    }
	@Column(name = "phone")
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
	@Column(name = "photo")
    @Column(name = "photo")
    public String getPhoto() {
        return photo;
    }
@ -431,7 +418,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.points = points;
    }
	@Column(name = "record_amount")
    @Column(name = "record_amount")
    public String getRecordAmount() {
        return recordAmount;
    }
@ -439,7 +426,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.recordAmount = recordAmount;
    }
	@Column(name = "openid")
    @Column(name = "openid")
    public String getOpenid() {
        return openid;
    }
@ -447,7 +434,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.openid = openid;
    }
	@Column(name = "patient_status")
    @Column(name = "patient_status")
    public String getPatientStatus() {
        return patientStatus;
    }
@ -455,7 +442,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.patientStatus = patientStatus;
    }
	@Column(name = "mobile_remarks")
    @Column(name = "mobile_remarks")
    public String getMobileRemarks() {
        return mobileRemarks;
    }
@ -463,7 +450,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.mobileRemarks = mobileRemarks;
    }
	@Column(name = "openid_time")
    @Column(name = "openid_time")
    public Date getOpenidTime() {
        return openidTime;
    }
@ -471,47 +458,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.openidTime = openidTime;
    }
	@Column(name = "principal_code")
    public String getPrincipalCode() {
        return principalCode;
    }
    public void setPrincipalCode(String principalCode) {
        this.principalCode = principalCode;
    }
	@Column(name = "sicard_status")
    public String getSicardStatus() {
        return sicardStatus;
    }
    public void setSicardStatus(String sicardStatus) {
        this.sicardStatus = sicardStatus;
    }
	@Column(name = "sicard_time")
    public Date getSicardTime() {
        return sicardTime;
    }
    public void setSicardTime(Date sicardTime) {
        this.sicardTime = sicardTime;
    }
	@Column(name = "is_wxtag")
    public Integer getIsWxtag() {
        return isWxtag;
    }
    public void setIsWxtag(Integer isWxtag) {
        this.isWxtag = isWxtag;
    }
	@Column(name = "wxtagid")
    public String getWxtagid() {
        return wxtagid;
    }
    public void setWxtagid(String wxtagid) {
        this.wxtagid = wxtagid;
    }
	@Column(name = "standard_status")
    @Column(name = "standard_status")
    public Integer getStandardStatus() {
        return standardStatus;
    }
@ -519,7 +466,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.standardStatus = standardStatus;
    }
	@Column(name = "unionid")
    @Column(name = "unionid")
    public String getUnionid() {
        return unionid;
    }
@ -527,7 +474,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.unionid = unionid;
    }
	@Column(name = "del")
    @Column(name = "del")
    public String getDel() {
        return del;
    }
@ -607,4 +554,44 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setLiveStreetName(String liveStreetName) {
        this.liveStreetName = liveStreetName;
    }
    public int getLocked() {
        return locked;
    }
    public void setLocked(int locked) {
        this.locked = locked;
    }
    public int getEnabled() {
        return enabled;
    }
    public void setEnabled(int enabled) {
        this.enabled = enabled;
    }
    public int getLoginFailureCount() {
        return loginFailureCount;
    }
    public void setLoginFailureCount(int loginFailureCount) {
        this.loginFailureCount = loginFailureCount;
    }
    public Date getLockedDate() {
        return lockedDate;
    }
    public void setLockedDate(Date lockedDate) {
        this.lockedDate = lockedDate;
    }
    public Date getLoginDate() {
        return loginDate;
    }
    public void setLoginDate(Date loginDate) {
        this.loginDate = loginDate;
    }
}

+ 0 - 13
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/FeedbackDO.java

@ -50,11 +50,6 @@ public class FeedbackDO extends IntegerIdentityEntity {
	 */
	private String feedbackContent;
    /**
	 * 问题回答
	 */
	private String answer;
    /**
	 * 图片,存图片地址,逗号分割
	 */
@ -81,14 +76,6 @@ public class FeedbackDO extends IntegerIdentityEntity {
        this.feedbackContent = feedbackContent;
    }
	@Column(name = "answer")
    public String getAnswer() {
        return answer;
    }
    public void setAnswer(String answer) {
        this.answer = answer;
    }
	@Column(name = "img")
    public String getImg() {
        return img;

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDO.java

@ -92,6 +92,7 @@ public class ServicePackageDO extends UuidIdentityEntity implements Serializable
    private String introduce;//服务介绍
    private String endIntroduce;//过期时间说明
    private String status;//审核状态(预留字段0待审核,1审核通过,2审核不通过)
    private Date endTime;//结束时间
    private Integer del;//是否有效(1有效,0失效)
    private Integer sort;//排序
@ -240,4 +241,12 @@ public class ServicePackageDO extends UuidIdentityEntity implements Serializable
    public void setOrganizationName(String organizationName) {
        this.organizationName = organizationName;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
}

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java

@ -35,6 +35,7 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
    private String doctorTeamCode;//医生服务团队code
    private String operator;//签约申请人处理人
    private Date createTime;//创建时间
    private Integer sort;//排序:0 待支付,1未通过,2未通过,3待审核,4.生效
    @Column(name = "saas_id")
    public String getSaasId() {
@ -198,4 +199,12 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
    public void setOperator(String operator) {
        this.operator = operator;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
}

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

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

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

@ -144,6 +144,14 @@ public class BaseOrgVO extends UuidIdentityVOWithOperator {
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
    private String del;
    /**
     * 11一级甲等 12一级乙等 13一级丙等
     * 21二级甲等 22二级乙等 23二级丙等
     * 31三级特等 32三级甲等 33三级乙等 34三级丙级
     */
    @ApiModelProperty(value = "11一级甲等 12一级乙等 13一级丙等二级甲等 22二级乙等 23二级丙等31三级特等 32三级甲等 33三级乙等 34三级丙级", example = "1")
    private Integer level;
    private List<DictHospitalDeptVO> depts;
    public String getCode() {
@ -291,6 +299,14 @@ public class BaseOrgVO extends UuidIdentityVOWithOperator {
        return depts;
    }
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
    public void setDepts(List<DictHospitalDeptVO> depts) {
        this.depts = depts;
    }

+ 14 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/BasePatientVO.java

@ -137,6 +137,12 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "街道名称", example = "某某街道")
    private String streetName;
   /**
     * 具体地址
     */
    @ApiModelProperty(value = "具体地址", example = "某某地址")
    private String address;
    /**
     * 居住省代码
     */
@ -651,4 +657,12 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
    public void setLiveStreetName(String liveStreetName) {
        this.liveStreetName = liveStreetName;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
}

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

@ -33,12 +33,6 @@ public class FeedbackVO extends IntegerIdentityVO{
	@ApiModelProperty(value = "反馈内容,问题和建议", example = "模块1")
    private String feedbackContent;
    /**
	 * 问题回答
	 */
	@ApiModelProperty(value = "问题回答", example = "模块1")
    private String answer;
    /**
	 * 图片,存图片地址,逗号分割
	 */
@ -65,13 +59,6 @@ public class FeedbackVO extends IntegerIdentityVO{
        this.feedbackContent = feedbackContent;
    }
    public String getAnswer() {
        return answer;
    }
    public void setAnswer(String answer) {
        this.answer = answer;
    }
    public String getImg() {
        return img;
    }

+ 209 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/patient/signPackage/ServicePackageRecordVO.java

@ -0,0 +1,209 @@
package com.yihu.jw.restmodel.patient.signPackage;
import java.util.Date;
/**
 * Created by Trick on 2018/12/6.
 */
public class ServicePackageRecordVO {
    private String saasId;
    private String servicePackageId;//服务包id
    private String servicePackageName;//服务包名称
    private String patient;//居民code
    private String name;//居民姓名
    private String idcard;//居民身份证
    private String ssc;//社保卡号
    private String signDoctor;//签约医生code
    private String signDoctorName;//签约医生名称
    private String hospital;//医院code
    private String hospitalName;//医院名称
    private Long adminTeamCode;//行政团队id
    private Long price;//服务总价
    private Date startTime;//服务开始时间
    private Date endTime;//服务结束时间
    private Integer status;//状态(0待审核,1已同意,待支付,2.支付成功,已生效,-1未通过,-2已取消,-3已过期)
    private String doctorTeamCode;//医生服务团队code
    private String operator;//签约申请人处理人
    private Date createTime;//创建时间
    private Integer sort;//排序:0 待支付,1未通过,2未通过,3待审核,4.生效
    private String introduce;//服务介绍
    private String endIntroduce;//过期时间说明
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    public String getServicePackageName() {
        return servicePackageName;
    }
    public void setServicePackageName(String servicePackageName) {
        this.servicePackageName = servicePackageName;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    public String getSignDoctor() {
        return signDoctor;
    }
    public void setSignDoctor(String signDoctor) {
        this.signDoctor = signDoctor;
    }
    public String getSignDoctorName() {
        return signDoctorName;
    }
    public void setSignDoctorName(String signDoctorName) {
        this.signDoctorName = signDoctorName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    public Long getPrice() {
        return price;
    }
    public void setPrice(Long price) {
        this.price = price;
    }
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getDoctorTeamCode() {
        return doctorTeamCode;
    }
    public void setDoctorTeamCode(String doctorTeamCode) {
        this.doctorTeamCode = doctorTeamCode;
    }
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public String getEndIntroduce() {
        return endIntroduce;
    }
    public void setEndIntroduce(String endIntroduce) {
        this.endIntroduce = endIntroduce;
    }
}

+ 9 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/patient/signPackage/ServicePackageVO.java

@ -28,6 +28,7 @@ public class ServicePackageVO {
    private String endIntroduce;//过期描述
    private String status;//审核状态(预留字段0待审核,1审核通过,2审核不通过)
    private Integer del;//是否有效(1有效,0失效)
    private Date endTime;
    private List<SerivePackageItemVO> items;//服务项描述
@ -182,4 +183,12 @@ public class ServicePackageVO {
    public void setOrganizationName(String organizationName) {
        this.organizationName = organizationName;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
}

+ 3 - 6
server/svr-authentication/src/main/resources/application.yml

@ -39,12 +39,9 @@ spring:
spring:
  profiles: jwtest
  datasource:
#    url: jdbc:mysql://172.17.110.160/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#    username: ssgg
#    password: ssgg
    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
    url: jdbc:mysql://172.17.110.160/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.

+ 1 - 1
server/svr-authentication/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-authentication
    name: svr-authentication-lyx
  cloud:
    config:
      failFast: true

BIN
svr/svr-base/src/main/template/基础人口信息导入模板.xls


+ 13 - 2
svr/svr-patient/sql/sql

@ -40,7 +40,6 @@ create table `feedback`
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长',
  `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 '联系手机号码',
  primary key (id)
@ -97,4 +96,16 @@ CREATE TABLE `base_patient_family_member` (
  `create_user_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fmaily_member_patient` (`patient`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='居民家庭成员表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='居民家庭成员表';
-- 居民表多余字段删除
alter table base_patient drop column ssc;
alter table base_patient drop column disease;
alter table base_patient drop column disease_condition;
alter table base_patient drop column principal_code;
alter table base_patient drop column sicard_status;
alter table base_patient drop column sicard_time;
alter table base_patient drop column is_wxtag;
alter table base_patient drop column wxtagid;
alter table base_patient drop column medicare_number;

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

@ -16,15 +16,4 @@ import java.util.Map;
public interface PatientDao extends PagingAndSortingRepository<BasePatientDO, String>, JpaSpecificationExecutor<BasePatientDO> {
    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);
    @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 name like ?1")
    List<Map<String,Object>> findByName(String name, Pageable pageable);
    @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);
}

+ 21 - 152
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientEndpoint.java

@ -1,14 +1,10 @@
package com.yihu.jw.patient.endpoint.personal_info;
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.BasePatientDao;
import com.yihu.jw.patient.service.personal_Info.PatientService;
import com.yihu.jw.patient.util.CommonUtils;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.patient.util.RSAService;
import com.yihu.jw.restmodel.base.patient.BasePatientVO;
import com.yihu.jw.restmodel.base.sms.SmsVO;
import com.yihu.jw.restmodel.web.Envelop;
@ -17,17 +13,13 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.security.service.TokenService;
import com.yihu.jw.sms.service.BaseSmsGatewayService;
import com.yihu.jw.sms.service.BaseSmsService;
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.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;
@ -51,41 +43,12 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private PatientService patientService;
    @Value("sms.clientId")
    @Value("${sms.clientId}")
    private String clientId;
    @Autowired
    private BaseSmsGatewayService baseSmsGatewayService;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private RSAService rsaService;
    @Autowired
    private TokenService tokenService;
    @Autowired
    private BaseSmsService baseSmsService;
    /**
     * 公钥生成并返回接口
     *
     * @return
     */
    @RequestMapping(value = BaseRequestMapping.BasePatient.GetKey, method = RequestMethod.GET)
    @ApiOperation("获取公钥")
    public Envelop publicKey() {
        String modulus = rsaService.getModulus();
        String exponent = rsaService.getExponent();
        Map<String, String> map = new HashMap<>();
        map.put("modulus", modulus); //加密指数
        map.put("exponent", exponent);//加密系数
        return success(map);
    }
    @ApiOperation("居民注册接口")
    @RequestMapping(value = BaseRequestMapping.BasePatient.Regist, method = RequestMethod.POST)
@ -95,126 +58,17 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                          @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) {
            envelop.setMessage("手机号码格式不正确");
            envelop.setStatus(-1);
            return envelop;
        }
        //验证手机是否被注册
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile, "1");
        if (list != null && list.size() > 0) {
            envelop.setMessage("该手机号已经注册!");
            Map<String, Object> result = patientService.regist(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") + "");
            }
        }
        return envelop;
    }
    /**
     * 患者微信登录接口
     *
     * @param captcha  短信号
     * @param mobile   电话号码
     * @param password 登录密码
     * @return
     */
    @RequestMapping(value = BaseRequestMapping.BasePatient.Login, method = RequestMethod.POST)
    @ResponseBody
    public Envelop login(
            @RequestParam(required = true) String mobile,
            @RequestParam(required = false) String captcha,
            @RequestParam(required = false) String password,
            @RequestParam(required = false) String openId) throws Exception {
        Envelop envelop = new Envelop();
        boolean b = CommonUtils.isMobile(mobile);
        if (!b) {
            envelop.setMessage("手机号码格式不正确");
            envelop.setStatus(-1);
            return envelop;
        }
        //验证手机是否被注册
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile, "1");
        if (CollectionUtils.isEmpty(list)) {
            envelop.setMessage("该手机未注册");
        Map<String, Object> result = patientService.regist(mobile, captcha, password, openid);
        if ("-1".equals(result.get("code"))) {
            envelop.setStatus(-1);
            return envelop;
        }
        if (list.size() > 1) {
            envelop.setMessage("该手机号存在多个账号,请联系管理员");
            envelop.setStatus(-1);
            return envelop;
        }
        BasePatientDO p = list.get(0);
        //用于判断是否登陆成功,若登陆成功,且openId不为空,则更新openId
        boolean isLogin = false;
        if (org.apache.commons.lang3.StringUtils.isNotBlank(password)) {
            password = rsaService.decryptString(password);
            password = org.apache.commons.lang3.StringUtils.reverse(password);
            //生成MD5
            String loginPassword = MD5.GetMD5Code(password + p.getSalt());
            if (loginPassword.equals(p.getPassword())) {
                //使用密码登录成功
                isLogin = true;
            } else {
                //使用密码登录失败
                envelop.setMessage("密码错误");
                envelop.setStatus(-1);
                return envelop;
            }
            envelop.setMessage(result.get("message") + "");
        } else {
            //验证码登陆
            int res = baseSmsService.check(mobile, 4, 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 {
                //使用密码登录成功
                isLogin = true;
            }
        }
        if (isLogin) {
            if (StringUtils.isNotBlank(openId) && !"undefined".equals(openId)) {
                //更新openId
                if (!openId.equals(p.getOpenid())) {
                    patientService.updateOpenId(p.getId(), openId);
                }
            }
            // 用户校验通过,生成token
            Token token = tokenService.newTxToken(p.getId(), p.getOpenid());
            Map<Object, Object> map = new HashMap<Object, Object>();
            map.put("id", p.getId());
            map.put("uid", p.getId());
            map.put("name", p.getName());
            map.put("token", token.getToken());
            map.put("photo", p.getPhoto());
            envelop.setMessage("登陆成功");
            envelop.setStatus(200);
            envelop.setMessage(result.get("message") + "");
        }
        return envelop;
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.CREATE)
    @ApiOperation(value = "创建")
    public Envelop create(
@ -304,7 +158,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    @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 {
                                @ApiParam(name = "photo", value = "头像") @RequestParam( required = false) MultipartFile photo) throws Exception {
        return success(patientService.completePatientDetails(photo, jsonData));
    }
@ -343,4 +197,19 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        return success(smsDO, SmsVO.class);
    }
    @GetMapping(value = "bespeakRegist")
    @ApiOperation(value = "发送验证码")
    public Envelop bespeakRegist(
            @ApiParam(name = "mobile", value = "手机号")
            @RequestParam(value = "mobile", required = true) String mobile) throws Exception {
        Map<String, Object> map = patientService.bespeakRegist(mobile, 2L);
        Envelop envelop = new Envelop();
        String code = map.get("code").toString();
        String message = map.get("message").toString();
        System.out.println("code====>>"+code);
        System.out.println("message====>>"+message);
        return envelop;
    }
}

+ 14 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/servicepackage/PackageServiceEndpoint.java

@ -132,5 +132,19 @@ public class PackageServiceEndpoint extends EnvelopRestEndpoint {
        return success(PatientRequestMapping.SignPackage.api_success,packageService.findPatientSignExist(patient,packageId));
    }
    @GetMapping(value = PatientRequestMapping.SignPackage.findPatientSignPackage)
    @ApiOperation(value = "签约记录", notes = "签约记录")
    public MixEnvelop findPatientSignPackage(@ApiParam(name = "label", value = "标签code") @RequestParam(value = "label", required = false)String label,
                                             @ApiParam(name = "labelType", value = "标签类型") @RequestParam(value = "labelType", required = false)String labelType,
                                             @ApiParam(name = "patient", value = "签约人") @RequestParam(value = "patient", required = false)String patient,
                                             @ApiParam(name = "operator", value = "创建人") @RequestParam(value = "operator", required = false)String operator,
                                             @ApiParam(name = "familyModel", value = "关系模式,1:查询自己;2:查询家人(未经授权);3:查询家人且授权") @RequestParam(value = "familyModel", required = true)String familyModel,
                                             @ApiParam(name = "status", value = "状态:0待审核,1已同意,待支付,2.支付成功,已生效,-1未通过,-2已取消,-3已过期") @RequestParam(value = "status", required = false)Integer status,
                                             @ApiParam(name = "isHos", value = "是否查询历史记录,1为查询历史,不传为当前记录") @RequestParam(value = "isHos", required = false)String isHos,
                                             @ApiParam(name = "page", value = "第几页") @RequestParam(value = "page", required = true)Integer page,
                                             @ApiParam(name = "size", value = "每页大小") @RequestParam(value = "size", required = true)Integer size) {
        return packageService.findPatientSignPackage( label, labelType, patient, operator, familyModel, status, isHos,  page, size);
    }
//=================================
}

+ 7 - 3
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/settings/AccountAppealEndpoint.java

@ -42,13 +42,17 @@ public class AccountAppealEndpoint extends EnvelopRestEndpoint {
    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 = "images", value = "申诉证件照", required = false)
            @RequestParam(required = false) List<MultipartFile> images,
            @ApiParam(name = "mobile", value = "申诉手机号", required = true)
            @RequestParam String mobile,
            @ApiParam(name = "name", value = "申诉人姓名", required = true)
            @RequestParam String name,
            @ApiParam(name = "idcard", value = "申诉人身份证号", required = true)
            @RequestParam String idcard,
            @ApiParam(name = "content", value = "申诉内容", required = true)
            @RequestParam String content ) throws Exception {
        return success(accountAppealService.create(type,content,mobile,images), AccountAppealVO.class);
        return success(accountAppealService.create(type,name,idcard,content,mobile,images), AccountAppealVO.class);
    }

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

@ -44,8 +44,8 @@ public class FeedbackEndpoint extends EnvelopRestEndpoint {
    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 = "images", value = "反馈图片", required = false)
            @RequestParam(required = false) List<MultipartFile> images,
            @ApiParam(name = "mobile", value = "反馈手机号", required = true)
            @RequestParam String mobile,
            @ApiParam(name = "content", value = "反馈内容", required = true)

+ 19 - 1
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/wechat/WechatEndPoint.java

@ -3,16 +3,17 @@ package com.yihu.jw.patient.endpoint.wechat;
import com.yihu.jw.entity.base.wx.JsApiTicket;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.service.WechatService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import io.swagger.annotations.Api;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -35,6 +36,10 @@ public class WechatEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Autowired
    private WechatService wechatService;
    @Value("${wechat.id}")
    private String wxId;
    /**
     * 获取签名signature
     *
@ -64,6 +69,19 @@ public class WechatEndPoint extends EnvelopRestEndpoint {
        return failed(PatientRequestMapping.Wechat.api_error);
    }
    /**
     * 获取微信openid
     *
     * @param code
     * @return
     */
    @RequestMapping(value = "getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public String getOpenidByCode(String code) {
        return wechatService.getOpenidByCode(code,wxId);
    }
    /**
     * 获取微信的jsapi_ticket
     *

+ 133 - 65
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java

@ -7,18 +7,17 @@ import com.yihu.jw.exception.business.patient.CapthcaInvalidException;
import com.yihu.jw.exception.business.patient.PatientNotFoundException;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.personal_info.PatientDao;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.patient.util.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.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@ -28,9 +27,11 @@ import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
 * 居民信息服务
 *
 * @author litaohong on  2018年11月28日
 */
@Service
@ -45,78 +46,116 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
    @Autowired
    private FileUploadService fileUploadService;
    @Value("fastDFS.fastdfs_file_url")
    @Autowired
    private StringRedisTemplate redisTemplate;
    private static String BespeakRegist = "bespeakRegist:";
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfsUrl;
    public Map<String,Object> regist(String mobile, String captcha, String password, String openid){
    public Map<String, Object> regist(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","手机号码格式不正确");
        if (!b) {
            map.put("code", -1);
            map.put("message", "手机号码格式不正确");
            return map;
        }
        //验证手机是否被注册
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile,"1");
        if(list!=null && list.size()> 0){
            map.put("code",-1);
            map.put("message","该手机号已经注册!");
        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","验证码已过期!");
        if (-2 == res) {
            map.put("code", -1);
            map.put("message", "验证码已过期!");
            return map;
        }else if(-1 == res){
            map.put("code",-1);
            map.put("message","请输入正确的验证码!");
        } else if (-1 == res) {
            map.put("code", -1);
            map.put("message", "请输入正确的验证码!");
            return map;
        }else if(0 == res){
            map.put("code",-1);
            map.put("message","验证码无效!");
        } else if (0 == res) {
            map.put("code", -1);
            map.put("message", "验证码无效!");
            return map;
        } else{
        } else {
            BasePatientDO patient = new BasePatientDO();
            patient.setMobile(mobile);
            if(StringUtils.isNotBlank(password)){
            if (StringUtils.isNotBlank(password)) {
                //增加密码
                if(password.length()<6 || password.length()>20){
                    map.put("code",-1);
                    map.put("message","密码长度需为6-20位");
                if (password.length() < 6 || password.length() > 20) {
                    map.put("code", -1);
                    map.put("message", "密码长度需为6-20位");
                    return map;
                }
                patient.setSalt(randomString(5));
                patient.setPassword(MD5.md5Hex(password + "{" + patient.getSalt() + "}"));
            }
            if(!"undefined".equals(openid) && StringUtils.isNotBlank(openid)){
            if (!"undefined".equals(openid) && StringUtils.isNotBlank(openid)) {
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            }
            patient.setMobile(mobile);
            patient.setLocked(0);
            patient.setEnabled(0);
            patient.setDel("1");
            patient.setPatientStatus("1");
            this.save(patient);
            map.put("code", 1);
            map.put("message", "注册成功");
            return map;
        }
    }
    /**
     * 预注册功能接口
     * @param mobile
     * @param time 预注册过期时间 例如: 2 , 则2分钟过期
     * @return
     */
    public Map<String,Object> bespeakRegist(String mobile,long time){
        Map<String, Object> map = new HashMap<>();
            map.put("code",1);
            map.put("message","注册成功");
        boolean b = CommonUtils.isMobile(mobile);
        if(!b){
            map.put("code",-1);
            map.put("message","手机号码格式不正确");
            return map;
        }
        //验证手机是否被注册
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile,"1");
        if(list!=null && list.size()> 0){
            map.put("code",-1);
            map.put("message","该手机号已经注册!");
            return map;
        }
        //将预注册信息存到redis中
        redisTemplate.opsForValue().set(BespeakRegist+mobile , mobile, time, TimeUnit.MINUTES);
        map.put("code",1);
        map.put("message","预注册成功");
        return map;
    }
    /**
     * 设置登录密码/修改密码
     *
     * @param id
     * @param newPassword
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String resetPassword(String id,String newPassword){
    public String resetPassword(String id, String newPassword) {
        Preconditions.checkNotNull(id);
        Preconditions.checkNotNull(newPassword);
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
        if (null == patient) {
            throw new PatientNotFoundException("当前居民不存在:【 " + id + "】");
        }
        patient.setSalt(randomString(5));
@ -126,28 +165,29 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
    /**
     * 修改手机号
     *
     * @param id
     * @param newMobile
     * @param captcha
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public BasePatientDO updateMobile(@NotNull String id, @NotNull String newMobile, @NotNull String captcha){
    public BasePatientDO updateMobile(@NotNull String id, @NotNull String newMobile, @NotNull String captcha) {
        Preconditions.checkNotNull(id,"id不可为空");
        Preconditions.checkNotNull(newMobile,"手机号不可为空");
        Preconditions.checkNotNull(captcha,"验证码不可为空");
        Preconditions.checkNotNull(id, "id不可为空");
        Preconditions.checkNotNull(newMobile, "手机号不可为空");
        Preconditions.checkNotNull(captcha, "验证码不可为空");
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
        if (null == patient) {
            throw new PatientNotFoundException("当前居民不存在:【 " + id + "】");
        }
        if(StringUtils.endsWithIgnoreCase(patient.getMobile(),newMobile)){
        if (StringUtils.endsWithIgnoreCase(patient.getMobile(), newMobile)) {
            return patient;
        }
        if(baseSmsService.verifyCaptcha(captcha)){
        if (baseSmsService.verifyCaptcha(captcha)) {
            patient.setMobile(newMobile);
            this.save(patient);
        }else{
        } else {
            throw new CapthcaInvalidException("验证码不正确或过期!");
        }
        return patient;
@ -155,20 +195,30 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
    /**
     * 完善居民基本信息
     *
     * @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{
    public BasePatientDO completePatientDetails(MultipartFile headPortrait, String json) {
        BasePatientDO patientDetail = JSONObject.parseObject(json, BasePatientDO.class);
        Assert.notNull(patientDetail.getName(), "姓名不可为空!");
        Assert.notNull(patientDetail.getSex(), "性别不可为空!");
        Assert.notNull(patientDetail.getIdcard(), "身份证不可为空!");
        Assert.notNull(patientDetail.getCommitteeCode(), "居委会不可为空!");
        Assert.notNull(patientDetail.getCommitteeName(), "居委会不可为空!");
        BasePatientDO patientBrief = basePatientDao.findOne(patientDetail.getId());
        if (null == patientBrief) {
            throw new PatientNotFoundException("未找到该居民!");
        }
        //如果未上传头像,使用默认头像,默认头像由客户端来处理,后台默认存null
        if (null != headPortrait) {
            UploadVO uploadedFile = null;
            try {
                uploadedFile = fileUploadService.uploadImg(headPortrait.getInputStream(),headPortrait.getOriginalFilename(),headPortrait.getSize(),fastdfsUrl);
                uploadedFile = fileUploadService.uploadImg(headPortrait.getInputStream(), headPortrait.getOriginalFilename(), headPortrait.getSize(), fastdfsUrl);
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
            } catch (IOException e) {
@ -176,32 +226,48 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
            } catch (MyException e) {
                e.printStackTrace();
            }
            patientDO.setPhoto(uploadedFile.getFullUrl());
            patientBrief.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;
        patientBrief.setName(patientDetail.getName());
        patientBrief.setSex(patientDetail.getSex());
        patientBrief.setIdcard(patientDetail.getIdcard());
        patientBrief.setProvinceCode(patientDetail.getProvinceCode());
        patientBrief.setProvinceName(patientDetail.getProvinceName());
        patientBrief.setCityCode(patientDetail.getCityCode());
        patientBrief.setCityName(patientDetail.getCityName());
        patientBrief.setTownCode(patientDetail.getTownCode());
        patientBrief.setTownName(patientDetail.getTownName());
        patientBrief.setLiveProvinceCode(patientDetail.getLiveProvinceCode());
        patientBrief.setLiveProvinceName(patientDetail.getLiveProvinceName());
        patientBrief.setLiveCityCode(patientDetail.getLiveCityCode());
        patientBrief.setLiveCityName(patientDetail.getLiveCityName());
        patientBrief.setLiveTownCode(patientDetail.getLiveTownName());
        patientBrief.setLiveStreetCode(patientDetail.getLiveStreetCode());
        patientBrief.setLiveStreetName(patientDetail.getLiveStreetName());
        patientBrief.setAddress(patientDetail.getAddress());
        patientBrief.setCommitteeCode(patientDetail.getCommitteeCode());
        patientBrief.setCommitteeName(patientDetail.getCommitteeName());
        this.save(patientBrief);
        return patientDetail;
    }
    /**
     * 验证身份证是否存在,剔除当前用户自身id
     *
     * @param idcard
     * @param id
     * @return
     */
    public boolean existsByIdcard(String idcard,String id) {
    public boolean existsByIdcard(String idcard, String id) {
        Preconditions.checkNotNull(idcard, "身份证不可为空");
        Preconditions.checkNotNull(id, "id不可为空");
        return basePatientDao.existsByIdcardAndIdNot(idcard,id);
        return basePatientDao.existsByIdcardAndIdNot(idcard, id);
    }
    /**
     * 验证身份证是否存在
     *
     * @param idcard
     * @return
     */
@ -212,33 +278,35 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
    @Transactional(rollbackFor = Exception.class)
    public int updateOpenId(String id, String openId){
        return basePatientDao.updateOpenId(id,openId);
    public int updateOpenId(String id, String openId) {
        return basePatientDao.updateOpenId(id, openId);
    }
    /**
     *  判断是否需要完善信息,身份证未填则需要完善
     * 判断是否需要完善信息,身份证未填则需要完善
     *
     * @param id
     * @return
     */
    public boolean isCompleted(String id) {
        Assert.notNull(id,"id不可为空");
        Assert.notNull(id, "id不可为空");
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
        if (null == patient) {
            throw new PatientNotFoundException("居民不存在!");
        }
       return !StringUtils.isEmpty(patient.getIdcard());
        return !StringUtils.isEmpty(patient.getIdcard());
    }
    /**
     * 查询居民完善后的基本信息
     *
     * @return
     */
    public BasePatientDO getCompletedDetails(String id){
        Assert.notNull(id,"居民id不可为空!");
    public BasePatientDO getCompletedDetails(String id) {
        Assert.notNull(id, "居民id不可为空!");
        BasePatientDO patient = basePatientDao.findOne(id);
        if(null == patient){
        if (null == patient) {
            throw new PatientNotFoundException("居民不存在!");
        }
        return patient;

+ 131 - 4
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/servicepackage/PackageService.java

@ -12,9 +12,11 @@ import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.servicepackage.ServicePackageDao;
import com.yihu.jw.patient.dao.servicepackage.ServicePackageItemDao;
import com.yihu.jw.patient.dao.servicepackage.ServicePackageSignRecordDao;
import com.yihu.jw.patient.service.myFamily.MyFamilyService;
import com.yihu.jw.patient.useragent.UserAgent;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorOrgVO;
import com.yihu.jw.restmodel.base.org.OrgDistanceVO;
import com.yihu.jw.restmodel.patient.signPackage.ServicePackageRecordVO;
import com.yihu.jw.restmodel.patient.signPackage.ServicePackageVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -25,6 +27,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@ -58,6 +61,9 @@ public class PackageService {
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private MyFamilyService myFamilyService;
    public MixEnvelop findPackageService(String city,String labelCode,String labelType,Integer page,Integer size){
        String totalSql ="SELECT " +
@ -218,8 +224,10 @@ public class PackageService {
        return MixEnvelop.getSuccessListWithPage(PatientRequestMapping.SignPackage.api_success, list, page, size, count);
    }
    public Envelop signPackage(ServicePackageSignRecordDO recordDO){
    public Envelop signPackage(ServicePackageSignRecordDO recordDO) throws Exception{
        servicePackageSignRecordDao.save(recordDO);
        return Envelop.getSuccess(PatientRequestMapping.SignPackage.api_success);
    }
@ -244,7 +252,126 @@ public class PackageService {
        }
    }
//    public MixEnvelop findSignPackage(){
//
//    }
    public MixEnvelop findPatientSignPackage(String label,String labelType,String patient,String operator,String familyModel,Integer status,String isHos, Integer page,Integer size){
        String totalSql="SELECT DISTINCT " +
                " r.id " +
                " FROM " +
                " base_service_package_sign_record r  " +
                " JOIN base_service_package p ON r.service_package_id = p.id ";
        if(StringUtils.isNotBlank(label)&&StringUtils.isNotBlank(labelType)){
            totalSql += " JOIN base_package_label_info l ON r.service_package_id = l.service_package_id ";
        }
        totalSql +=" WHERE 1=1 ";
        if("1".equals(familyModel)){
            //自己
            if(StringUtils.isNotBlank(patient)){
                totalSql +=" AND r.patient = '"+patient+"'";
            }
        }else if("2".equals(familyModel)){
            //未经授权查询家人,只查自己创建的
            if(StringUtils.isNotBlank(patient)&&StringUtils.isNotBlank(operator)){
                totalSql +=" AND r.operator = '"+operator+"' " +
                        " AND r.patient = '"+patient+"' ";
            }
        }else if("3".equals(familyModel)){
            //查询已经授权,自己创建和家人相关记录
            if(StringUtils.isNotBlank(patient)&&StringUtils.isNotBlank(operator)){
                totalSql +=" AND (r.operator = '"+operator+"' " +
                        " OR r.patient = '"+patient+"' )";
            }
        }
        if(status != null){
            totalSql +=" AND r.`status` ="+status;
        }
        if(StringUtils.isNotBlank(isHos)){
            totalSql +=" AND r.`status` < 0 ";
        }else{
            totalSql +=" AND r.`status` >= 0 ";
        }
        if(StringUtils.isNotBlank(label)&&StringUtils.isNotBlank(labelType)){
            totalSql +=" AND l.label ='"+label+"'" +
                    " AND l.label_type ='"+labelType+"'";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count =(long)rstotal.size();
        }
        String sql="SELECT DISTINCT " +
                " r.id, " +
                " r.saas_id AS saasId," +
                " p.id AS servicePackageId, " +
                " p.name AS servicePackageName, " +
                " r.patient," +
                " r.name," +
                " r.idcard," +
                " r.sign_doctor AS signDoctor, " +
                " r.sign_doctor_name AS signDoctorName, " +
                " r.ssc," +
                " r.hospital," +
                " r.hospital_name AS hospitalName," +
                " r.admin_team_code AS adminTeamCode," +
                " r.price," +
                " r.start_time AS startTime," +
                " r.end_time AS endTime," +
                " r.status," +
                " r.doctor_team_code AS doctorTeamCode," +
                " r.operator," +
                " r.create_time AS createTime," +
                " r.sort," +
                " p.introduce, " +
                " p.end_introduce AS endIntroduce " +
                " FROM " +
                " base_service_package_sign_record r  " +
                " JOIN base_service_package p ON r.service_package_id = p.id ";
                if(StringUtils.isNotBlank(label)&&StringUtils.isNotBlank(labelType)){
                    sql += " JOIN base_package_label_info l ON r.service_package_id = l.service_package_id ";
                }
                sql +=" WHERE 1=1 ";
                if("1".equals(familyModel)){
                    //自己
                    if(StringUtils.isNotBlank(patient)){
                        sql +=" AND r.patient = '"+patient+"'";
                    }
                }else if("2".equals(familyModel)){
                    //未经授权查询家人,只查自己创建的
                    if(StringUtils.isNotBlank(patient)&&StringUtils.isNotBlank(operator)){
                        sql +=" AND r.operator = '"+operator+"' " +
                              " AND r.patient = '"+patient+"' ";
                    }
                }else if("3".equals(familyModel)){
                    //查询已经授权,自己创建和家人相关记录
                    if(StringUtils.isNotBlank(patient)&&StringUtils.isNotBlank(operator)){
                        sql +=" AND (r.operator = '"+operator+"' " +
                                " OR r.patient = '"+patient+"' )";
                    }
                }
                if(status != null){
                    sql +=" AND r.`status` ="+status;
                }
                if(StringUtils.isNotBlank(isHos)){
                    sql +=" AND r.`status` < 0 ";
                }else{
                    sql +=" AND r.`status` >= 0 ";
                }
                if(StringUtils.isNotBlank(label)&&StringUtils.isNotBlank(labelType)){
                    sql +=" AND l.label ='"+label+"'" +
                          " AND l.label_type ='"+labelType+"'";
                }
                sql +=" ORDER BY r.sort ASC  "+
                      " LIMIT " + (page - 1) * size + "," + size + "";
        List<ServicePackageRecordVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ServicePackageRecordVO.class));
        return MixEnvelop.getSuccessListWithPage(PatientRequestMapping.SignPackage.api_success, list, page, size, count);
    }
}

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

@ -6,6 +6,7 @@ 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.jw.restmodel.iot.common.UploadVO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -35,14 +36,18 @@ public class AccountAppealService extends BaseJpaService<AccountAppealDO, Accoun
    @Autowired
    private FileUploadService fileUploadService;
    @Value("fastDFS.fastdfs_file_url")
    @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) {
    public AccountAppealDO create(AccountAppealDO.Type type, String name,String idcard,String content, String mobile, List<MultipartFile> images) {
        Assert.notNull(type, "申诉类型不可为空");
        Assert.notNull(mobile, "申诉手机号不可为空");
        Assert.notNull(name, "申诉姓名不可为空");
        Assert.notNull(idcard, "申诉证件号不可为空");
        AccountAppealDO accoutAppeal = new AccountAppealDO();
        if (!CollectionUtils.isEmpty(images)) {
            StringBuilder img = new StringBuilder();
            images.forEach(one -> {
                InputStream inputStream = null;
                try {
@ -52,16 +57,20 @@ public class AccountAppealService extends BaseJpaService<AccountAppealDO, Accoun
                }
                String fileName = one.getOriginalFilename();
                try {
                    fileUploadService.uploadStream(inputStream, fileName, fastdfsUrl);
                  UploadVO uploadVO = fileUploadService.uploadStream(inputStream, fileName, fastdfsUrl);
                    img.append(uploadVO.getFullUrl()).append(",");
                } catch (Exception e) {
                    throw new FailedUploadFileException("账号申诉证件图片上传失败");
                }
            });
            accoutAppeal.setImg(img.toString());
        }
        AccountAppealDO accoutAppeal = new AccountAppealDO();
        accoutAppeal.setType(type.getValue());
        accoutAppeal.setName(name);
        accoutAppeal.setIdcard(idcard);
        accoutAppeal.setContent(content);
        accoutAppeal.setMobile(mobile);
        this.save(accoutAppeal);
        return accoutAppeal;
    }
}

+ 8 - 3
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/settings/FeedbackService.java

@ -5,6 +5,7 @@ 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.jw.restmodel.iot.common.UploadVO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -36,7 +37,7 @@ public class FeedbackService extends BaseJpaService<FeedbackDO, FeedbackDao> {
    @Autowired
    private FileUploadService fileUploadService;
    @Value("fastDFS.fastdfs_file_url")
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfsUrl;
    /**
@ -51,7 +52,9 @@ public class FeedbackService extends BaseJpaService<FeedbackDO, FeedbackDao> {
        Assert.notNull(type,"反馈类型不可为空");
        Assert.notNull(feedbackContent,"反馈类型不可为空");
        Assert.notNull(mobile,"手机号不可为空");
        FeedbackDO feedback = new FeedbackDO();
        if(!CollectionUtils.isEmpty(images)){
            StringBuilder img = new StringBuilder();
            images.forEach( one -> {
                InputStream inputStream = null;
                try {
@ -61,16 +64,18 @@ public class FeedbackService extends BaseJpaService<FeedbackDO, FeedbackDao> {
                }
                String fileName = one.getOriginalFilename();
                try {
                    fileUploadService.uploadStream(inputStream,fileName,fastdfsUrl);
                    UploadVO uploadVO = fileUploadService.uploadStream(inputStream, fileName, fastdfsUrl);
                    img.append(uploadVO.getFullUrl()).append(",");
                } catch (Exception e) {
                    throw new FailedUploadFileException("上传反馈图片失败");
                }
            });
            feedback.setImg(img.toString());
        }
        FeedbackDO feedback = new FeedbackDO();
        feedback.setType(type.getValue());
        feedback.setFeedbackContent(feedbackContent);
        feedback.setMobile(mobile);
        this.save(feedback);
        return feedback;
    }
}

+ 0 - 182
svr/svr-patient/src/main/java/com/yihu/jw/patient/util/RSAService.java

@ -1,182 +0,0 @@
package com.yihu.jw.patient.util;
import java.io.*;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.util.Iterator;
import com.yihu.jw.entity.base.security.RSA;
import com.yihu.jw.patient.dao.security.RSADao;
import com.yihu.jw.util.common.RSAUtils;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class RSAService {
    @Autowired
    private RSADao rsaDao;
    /**
     * 缓存的密钥对。
     */
    private KeyPair oneKeyPair = null;
    /**
     * 读取RSA加密信息
     * @return
     */
    public RSA loadRSA() {
        Iterable<RSA> iterable = rsaDao.findAll();
        if (iterable != null) {
            Iterator<RSA> it = iterable.iterator();
            if (it != null && it.hasNext()) {
                return it.next();
            }
        }
        return null;
    }
    public KeyPair getKeyPair() {
        if (oneKeyPair == null) {
            // 从数据库加载
            RSA rsa = loadRSA();
            if (rsa == null) {
                // 生成密钥
                generateKeyPair();
            } else {
                // 由数据库取出来
                Object obj = toObject(rsa.getData());
                oneKeyPair = (KeyPair) obj;
            }
        }
        return oneKeyPair;
    }
    /**
     * 生成并返回RSA密钥对。
     */
    private synchronized KeyPair generateKeyPair() {
        try {
            oneKeyPair = RSAUtils.initKey();
            // 保存到数据库
            saveRSA(oneKeyPair);
            return oneKeyPair;
        } catch (InvalidParameterException ex) {
            ex.printStackTrace();
        } catch (NullPointerException ex) {
            ex.printStackTrace();
        }
        return null;
    }
    /**
     * 保存RSA加密信息
     * @return
     */
    public RSA saveRSA(KeyPair keyPair) {
        RSA rsa = new RSA();
        rsa.setData(toByteArray(keyPair));
        // 先清空
        rsaDao.deleteAll();
        // 再添加
        return rsaDao.save(rsa);
    }
    /**
     * 返回已初始化的默认的公钥。
     */
    public RSAPublicKey getDefaultPublicKey() {
        KeyPair keyPair = getKeyPair();
        if (keyPair != null) {
            return (RSAPublicKey) keyPair.getPublic();
        }
        return null;
    }
    public String getModulus() {
        return new String(Hex.encodeHex(getDefaultPublicKey().getModulus().toByteArray()));
    }
    public String getExponent() {
        return new String(Hex.encodeHex(getDefaultPublicKey().getPublicExponent().toByteArray()));
    }
    /**
     * 对象转数组
     *
     * @param obj
     * @return
     */
    public byte[] toByteArray(Object obj) {
        byte[] bytes = null;
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            ObjectOutputStream oos = new ObjectOutputStream(bos);
            oos.writeObject(obj);
            oos.flush();
            bytes = bos.toByteArray();
            oos.close();
            bos.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return bytes;
    }
    /**
     * 数组转对象
     *
     * @param bytes
     * @return
     */
    public Object toObject(byte[] bytes) {
        Object obj = null;
        try {
            ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
            ObjectInputStream ois = new ObjectInputStream(bis);
            obj = ois.readObject();
            ois.close();
            bis.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        return obj;
    }
    /**
     * 使用默认的私钥解密给定的字符串。
     * <p>
     * 若{@code encrypttext} 为 {@code null}或空字符串则返回 {@code null}。
     * 私钥不匹配时,返回 {@code null}。
     *
     * @param encrypttext 密文。
     * @return 原文字符串。
     */
    public String decryptString(String encrypttext) {
        if (StringUtils.isBlank(encrypttext)) {
            return null;
        }
        try {
            byte[] en_data = Hex.decodeHex(encrypttext.toCharArray());
            byte[] data =   RSAUtils.decrypt((RSAPrivateKey) getKeyPair().getPrivate(), en_data);
            return new String(data);
        } catch (NullPointerException ex) {
            ex.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return null;
    }
}

+ 9 - 4
svr/svr-patient/src/main/resources/application.yml

@ -24,6 +24,8 @@ spring:
  http:
    multipart:
      max-file-size: 5MB
      location: D:/work/soft_dev/IdeaWorkSpace/wlyy2.0/svr/svr-patient/temp_file/
      resolve-lazily: true
  redis:
    database: 0 # Database index used by the connection factory.
@ -106,7 +108,8 @@ jw:
  smsUrl: http://svr-base:10020/sms_gateway/send
myFamily:
  qrCodeFailurTime: 7
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
@ -137,7 +140,8 @@ spring:
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
@ -167,9 +171,10 @@ spring:
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
  clientId: EwC0iRSrcP #todo 待配置
myFamily:
  qrCodeFailurTime: 7