Ver código fonte

Merge branch 'dev' of trick9191/wlyy2.0 into dev

trick9191 6 anos atrás
pai
commit
e9f45e7a14
17 arquivos alterados com 447 adições e 100 exclusões
  1. 15 0
      business/base-service/src/main/java/com/yihu/jw/label/PatientLabelDao.java
  2. 13 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxUrlConfigDao.java
  3. 65 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxUrlConfigService.java
  4. 78 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/label/PatientLabelDO.java
  5. 33 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxUrlConfigDO.java
  6. 9 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/patient/PatientRequestMapping.java
  7. 74 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/label/BasePatientLabelVO.java
  8. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/patient/signPackage/ServicePackageVO.java
  9. 1 2
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  10. 0 31
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WechatDao.java
  11. 0 17
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxAccessTokenDao.java
  12. 0 19
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxTemplateConfigDao.java
  13. 0 26
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxTemplateDao.java
  14. 18 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/config/UrlconfigEndPoint.java
  15. 40 1
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/servicepackage/PackageServiceEndpoint.java
  16. 21 2
      svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/wechat/WechatInfoEndPoint.java
  17. 70 1
      svr/svr-patient/src/main/java/com/yihu/jw/patient/service/servicepackage/PackageService.java

+ 15 - 0
business/base-service/src/main/java/com/yihu/jw/label/PatientLabelDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.label;
import com.yihu.jw.entity.base.label.PatientLabelDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/12/7.
 */
public interface PatientLabelDao extends PagingAndSortingRepository<PatientLabelDO, String>, JpaSpecificationExecutor<PatientLabelDO> {
    public List<PatientLabelDO> findByLabelTypeAndStatus(String labelType,Integer status);
}

+ 13 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxUrlConfigDao.java

@ -0,0 +1,13 @@
package com.yihu.jw.wechat.dao;
import com.yihu.jw.entity.base.wx.WxUrlConfigDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2018/12/10.
 */
public interface WxUrlConfigDao extends PagingAndSortingRepository<WxUrlConfigDO, String>, JpaSpecificationExecutor<WxUrlConfigDO> {
    WxUrlConfigDO findByUrl(String url);
}

+ 65 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxUrlConfigService.java

@ -0,0 +1,65 @@
package com.yihu.jw.wechat.service;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.entity.base.wx.WxUrlConfigDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.restmodel.base.wx.WxContants;
import com.yihu.jw.restmodel.base.wx.WxSaasVO;
import com.yihu.jw.restmodel.base.wx.WxWechatVO;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxUrlConfigDao;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2018/12/10.
 */
@Service
public class WxUrlConfigService {
    @Autowired
    private WxUrlConfigDao wxUrlConfigDao;
    @Autowired
    private WechatDao wechatDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public Map<String,Object> getWxWechatConfig(String url){
        WxUrlConfigDO wxUrlConfigDO = wxUrlConfigDao.findByUrl(url);
        if(wxUrlConfigDO!=null){
            WxWechatDO wxWechatDO = wechatDao.findById(wxUrlConfigDO.getWxId());
            List<WxSaasVO> saasVOs = getWxSaasVOs(wxWechatDO.getId());
            Map<String,Object> map = new HashedMap();
            map.put("wxId",wxUrlConfigDO.getWxId());
            map.put("wxAppId",wxWechatDO.getAppId());
            map.put("publicType",wxWechatDO.getPublicType());
            map.put("saasVOs",saasVOs);
            return map;
        }else{
            return null;
        }
    }
    public List<WxSaasVO> getWxSaasVOs(String id){
        String sql ="SELECT " +
                " bs.`name` AS saasName, " +
                " bs.id AS saasid" +
                " FROM " +
                " wx_wechat_saas s " +
                " JOIN base_saas bs ON bs.id = s.saas_id " +
                " WHERE " +
                " s.wechat_id = '"+id+"'";
        List<WxSaasVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WxSaasVO.class));
        return list;
    }
}

+ 78 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/label/PatientLabelDO.java

@ -0,0 +1,78 @@
package com.yihu.jw.entity.base.label;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Trick on 2018/12/7.
 */
@Entity
@Table(name = "base_patient_label")
public class PatientLabelDO extends UuidIdentityEntityWithOperator implements java.io.Serializable{
    private String labelCode;//标签标识',
    private String labelName;//标签名称',
    private String labelType;//标签类型(1:卫计委三大分组 2:健康状况 3:疾病类型 4:自定义标签5.周月标签 6.老年人标识 7.专病类型,8.健康情况)',
    private Integer isSystem;//是否系统标签(0:否 1是)',
    private String teamCode;//团队code',
    private Integer sort;//排序',
    private Integer status;//状态(0:无效 1:有效)',
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
    public String getLabelType() {
        return labelType;
    }
    public void setLabelType(String labelType) {
        this.labelType = labelType;
    }
    public Integer getIsSystem() {
        return isSystem;
    }
    public void setIsSystem(Integer isSystem) {
        this.isSystem = isSystem;
    }
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 33 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/wx/WxUrlConfigDO.java

@ -0,0 +1,33 @@
package com.yihu.jw.entity.base.wx;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Trick on 2018/12/10.
 */
@Entity
@Table(name = "wx_url_config")
public class WxUrlConfigDO extends IntegerIdentityEntity {
    private String url;
    private String wxId;
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getWxId() {
        return wxId;
    }
    public void setWxId(String wxId) {
        this.wxId = wxId;
    }
}

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

@ -17,15 +17,20 @@ public class PatientRequestMapping {
        public static final String LIST = "/list";
    }
    public static class open extends Basic{
        public static final String openUrl = "/open";
        public static final String findwxConfig ="/findwxConfig";
    }
    public abstract static class Wechat extends Basic{
        public static final String wxBase =  "/wxBase";
        public static final String api_success ="success";
        public static final String api_error ="error";
        public static final String getSign ="/getSign";
        public static final String getWxWechatConfig ="/getWxWechatConfig";
    }
    /**
     * signPackage
     */
@ -42,6 +47,9 @@ public class PatientRequestMapping {
        public static final String findOrgByCode  = "/findOrgByCode";
        public static final String findPatientSignExist  = "/findPatientSignExist";
        public static final String findPatientSignPackage  = "/findPatientSignPackage";
        public static final String findLabelByLabelType  = "/findLabelByLabelType";
        public static final String findSingleSignPackageById  = "/findSingleSignPackageById";
        public static final String signPackageAndFamily  = "/signPackageAndFamily";
    }
    /**
     * myFamily

+ 74 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/label/BasePatientLabelVO.java

@ -0,0 +1,74 @@
package com.yihu.jw.restmodel.base.label;
import io.swagger.annotations.ApiModel;
/**
 * Created by Trick on 2018/12/7.
 */
@ApiModel(value = "居民标签", description = "居民标签")
public class BasePatientLabelVO {
    private String labelCode;//标签标识',
    private String labelName;//标签名称',
    private String labelType;//标签类型(1:卫计委三大分组 2:健康状况 3:疾病类型 4:自定义标签5.周月标签 6.老年人标识 7.专病类型,8.健康情况)',
    private Integer isSystem;//是否系统标签(0:否 1是)',
    private String teamCode;//团队code',
    private Integer sort;//排序',
    private Integer status;//状态(0:无效 1:有效)',
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
    public String getLabelType() {
        return labelType;
    }
    public void setLabelType(String labelType) {
        this.labelType = labelType;
    }
    public Integer getIsSystem() {
        return isSystem;
    }
    public void setIsSystem(Integer isSystem) {
        this.isSystem = isSystem;
    }
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

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

@ -32,6 +32,8 @@ public class ServicePackageVO {
    private List<SerivePackageItemVO> items;//服务项描述
    private Integer signType;//判断当前居民是否签约:1为签约,2为未签约
    public String getId() {
        return id;
    }
@ -191,4 +193,12 @@ public class ServicePackageVO {
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public Integer getSignType() {
        return signType;
    }
    public void setSignType(Integer signType) {
        this.signType = signType;
    }
}

+ 1 - 2
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -63,8 +63,7 @@ public class BasicZuulFilter extends ZuulFilter {
        //内部微服务有不需要认证的地址请在URL上追加/open/来进行过滤,如/api/v1.0/open/**,不要在此继续追加!!!
        if (url.contains("/auth/")//验证服务
                || url.contains("/wechat")//微信
                || url.contains("/open/")
                || url.contains("/patient/")) {//开发接口
                || url.contains("/open/")) {//开发接口
            return true;
        }
        return this.authenticate(ctx, request, url);

+ 0 - 31
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WechatDao.java

@ -1,31 +0,0 @@
//package com.yihu.jw.base.dao.wx;
//
//import com.yihu.jw.entity.base.wx.WxWechatDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/20 0020.
// */
//public interface WechatDao extends PagingAndSortingRepository<WxWechatDO, String>, JpaSpecificationExecutor<WxWechatDO> {
//
//    @Query("from WxWechatDO w where w.appId = ?1 and w.status!=-1")
//    WxWechatDO findByAppId(String appId);
//
//    @Query("from WxWechatDO w where w.appId = ?1 and w.id!= ?2 and w.status!=-1")
//    WxWechatDO findByAppIdExcludeId(String appId, String id);
//
//    @Query("from WxWechatDO w where w.id = ?1 and w.status!=-1")
//    WxWechatDO findById(String id);
//
//    @Query("from WxWechatDO w where w.status!=-1")
//    List<WxWechatDO> findAll();
//
//    @Query("from WxWechatDO w where w.appOriginId = ?1 and w.status!=-1")
//    WxWechatDO findByAppOriginId(String appOriginId);
//
//    List<WxWechatDO> findByName(String name);
//}

+ 0 - 17
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxAccessTokenDao.java

@ -1,17 +0,0 @@
//package com.yihu.jw.base.dao.wx;
//
//import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/18 0018.
// */
//public interface WxAccessTokenDao extends PagingAndSortingRepository<WxAccessTokenDO, String>, JpaSpecificationExecutor<WxAccessTokenDO> {
//
//    @Query("from WxAccessTokenDO w where w.wechatId =?1 order by w.addTimestamp desc")
//    List<WxAccessTokenDO> getWxAccessTokenById(String wechatId);
//}

+ 0 - 19
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxTemplateConfigDao.java

@ -1,19 +0,0 @@
//package com.yihu.jw.base.dao.wx;
//
//
//import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Trick on 2018/8/21.
// */
//public interface WxTemplateConfigDao extends PagingAndSortingRepository<WxTemplateConfigDO, String>, JpaSpecificationExecutor<WxTemplateConfigDO> {
//
//    WxTemplateConfigDO findByWechatIdAndTemplateNameAndSceneAndStatus(String wechatId, String templateName, String scene,Integer status);
//    WxTemplateConfigDO findByWechatIdAndTemplateNameAndScene(String wechatId, String templateName, String scene);
//    List<WxTemplateConfigDO> findByWechatIdAndScene(String wechatId,String scene);
//
//}

+ 0 - 26
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxTemplateDao.java

@ -1,26 +0,0 @@
//package com.yihu.jw.base.dao.wx;//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.entity.base.wx.WxTemplateDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/20 0020.
// */
//public interface WxTemplateDao extends PagingAndSortingRepository<WxTemplateDO, String>, JpaSpecificationExecutor<WxTemplateDO> {
//
//
//    @Query("from WxTemplateDO w where w.id = ?1 and w.status =1")
//    WxTemplateDO findById(String id);
//
//    @Query("from WxTemplateDO w where w.wechatId = ?1 and w.status =1")
//    List<WxTemplateDO> findByWxId(String wechatId);
//
//    List<WxTemplateDO> findByTemplateIdAndWechatIdAndStatus(String templateId,String wechatId,Integer status);
//
//    List<WxTemplateDO> findByTemplateNameAndWechatIdAndStatus(String templateId,String wechatId,Integer status);
//
//}

+ 18 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/config/UrlconfigEndPoint.java

@ -0,0 +1,18 @@
package com.yihu.jw.patient.endpoint.config;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Trick on 2018/12/10.
 */
@RestController
@RequestMapping(PatientRequestMapping.open.openUrl)
@Api(tags = "开发接口", description = "开发接口")
public class UrlconfigEndPoint extends EnvelopRestEndpoint {
}

+ 40 - 1
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/servicepackage/PackageServiceEndpoint.java

@ -2,6 +2,7 @@ package com.yihu.jw.patient.endpoint.servicepackage;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.label.PatientLabelDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
@ -9,8 +10,10 @@ import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.patient.service.servicepackage.PackageService;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorSimpleVO;
import com.yihu.jw.restmodel.base.label.BasePatientLabelVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.patient.signPackage.SerivePackageItemVO;
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 +28,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2018/11/27.
@ -45,11 +49,13 @@ public class PackageServiceEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "labelCode", required = false)String labelCode,
                                         @ApiParam(name = "labelType", value = "标签类型")
                                         @RequestParam(value = "labelType", required = false)String labelType,
                                         @ApiParam(name = "patient", value = "居民code(判断居民是否签约,非必传)")
                                         @RequestParam(value = "patient", required = false)String patient,
                                         @ApiParam(name = "page", value = "第几页")
                                         @RequestParam(value = "page", required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = true)Integer size) {
        return packageService.findPackageService(city,labelCode,labelType,page,size);
        return packageService.findPackageService(city,labelCode,labelType,patient,page,size);
    }
@ -101,6 +107,24 @@ public class PackageServiceEndpoint extends EnvelopRestEndpoint {
        return packageService.signPackage(recordDO);
    }
    @PostMapping(value = PatientRequestMapping.SignPackage.signPackageAndFamily)
    @ApiOperation(value = "绑定家人,签约服务包", notes = "绑定家人,签约服务包")
    public Envelop signPackageAndFamily(@ApiParam(name = "recordJson", value = "签约实体")
                                        @RequestParam(value = "recordJson", required = true)String recordJson,
                                        @ApiParam(name = "patient", value = "申请绑定的居民code")
                                        @RequestParam(value = "patient", required = true)String patient,
                                        @ApiParam(name = "familyMobile", value = "家人的手机号码")
                                        @RequestParam(value = "familyMobile", required = true)String familyMobile,
                                        @ApiParam(name = "platform", value = "消息平台,1微信端/患者端,2医生APP端")
                                        @RequestParam(value = "platform", required = true)Integer platform,
                                        @ApiParam(name = "familyBindRole", value = "1\"配偶\",2\"父亲\",3\"母亲\",4\"公公\",5\"婆婆\",6\"岳父\",7\"岳母\",8\"女婿\",9\"儿媳\",10\"子女\"")
                                        @RequestParam(value = "familyBindRole", required = true)Integer familyBindRole,
                                        @ApiParam(name = "isAdult", value = "0未成年人 1成年人")
                                        @RequestParam(value = "isAdult", required = true)Integer isAdult) throws Exception {
        ServicePackageSignRecordDO recordDO = toEntity(recordJson, ServicePackageSignRecordDO.class);
        return packageService.signPackageAndFamily(recordDO,patient,familyMobile,platform,familyBindRole,isAdult);
    }
    @GetMapping(value = PatientRequestMapping.SignPackage.findDoctorById)
    @ApiOperation(value = "获取医生基础信息", notes = "获取医生基础信息")
    public ObjEnvelop<BaseDoctorSimpleVO> findDoctorById(@ApiParam(name = "doctorCode", value = "医生code")
@ -146,5 +170,20 @@ public class PackageServiceEndpoint extends EnvelopRestEndpoint {
        return packageService.findPatientSignPackage( label, labelType, patient, operator, familyModel, status, isHos,  page, size);
    }
    @GetMapping(value = PatientRequestMapping.SignPackage.findLabelByLabelType)
    @ApiOperation(value = "获取标签", notes = "获取标签")
    public MixEnvelop<BasePatientLabelVO,BasePatientLabelVO> findLabelByLabelType(@ApiParam(name = "labelType", value = "标签类型") @RequestParam(value = "labelType", required = false)String labelType) {
        List<PatientLabelDO> list = packageService.findLabelByLabelType(labelType);
        List<BasePatientLabelVO> basePatientLabelVOs = new ArrayList<>();
        convertToModels(list,basePatientLabelVOs,BasePatientLabelVO.class);
        return MixEnvelop.getSuccess(PatientRequestMapping.SignPackage.api_success,basePatientLabelVOs);
    }
    @GetMapping(value = PatientRequestMapping.SignPackage.findSingleSignPackageById)
    @ApiOperation(value = "根据签约id获取签约详情", notes = "根据签约id获取签约详情")
    public ObjEnvelop<ServicePackageRecordVO> findSingleSignPackageById(@ApiParam(name = "signId", value = "签约id") @RequestParam(value = "signId", required = false)String signId) {
        return success(PatientRequestMapping.SignPackage.api_success,packageService.findSingleSignPackageById(signId));
    }
//=================================
}

+ 21 - 2
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/wechat/WechatInfoEndPoint.java

@ -1,14 +1,18 @@
package com.yihu.jw.patient.endpoint.wechat;
import com.sun.net.httpserver.Authenticator;
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.WechatInfoService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.wechat.service.WxUrlConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -17,6 +21,7 @@ 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;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.security.MessageDigest;
@ -40,15 +45,29 @@ public class WechatInfoEndPoint extends EnvelopRestEndpoint {
    private WechatInfoService wechatInfoService;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private WxUrlConfigService wxUrlConfigService;
    @RequestMapping(value =  PatientRequestMapping.Wechat.getWxWechatConfig, method = RequestMethod.GET)
    @ResponseBody
    public ObjEnvelop<Map<String,Object>> getWxWechatConfig(@ApiParam(name = "url", value = "域名地址")
                                                                @RequestParam(value = "url", required = true)String url){
        return success(PatientRequestMapping.Wechat.api_success,wxUrlConfigService.getWxWechatConfig(url));
    }
    /**
     * 获取签名signature
     *
     * @param pageUrl 需要签名的页面全地址(?后的也需要除了#后的不需要)
     * @return
     */
    @RequestMapping(value = "getSign", method = RequestMethod.POST)
    @RequestMapping(value = PatientRequestMapping.Wechat.getSign, method = RequestMethod.POST)
    @ResponseBody
    public Envelop getSign(String pageUrl,String wxId) {
    public Envelop getSign(@ApiParam(name = "pageUrl", value = "授权页面")
                           @RequestParam(value = "pageUrl", required = true)String pageUrl,
                           @ApiParam(name = "wxId", value = "微信id")
                           @RequestParam(value = "wxId", required = true)String wxId) {
        String ticket = getJsapi_ticketByToken(wxId);
            Map<Object, Object> map = new HashMap<Object, Object>();

+ 70 - 1
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/servicepackage/PackageService.java

@ -4,10 +4,12 @@ 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.label.PatientLabelDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.label.PatientLabelDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.servicepackage.ServicePackageDao;
import com.yihu.jw.patient.dao.servicepackage.ServicePackageItemDao;
@ -64,7 +66,10 @@ public class PackageService {
    @Autowired
    private MyFamilyService myFamilyService;
    public MixEnvelop findPackageService(String city,String labelCode,String labelType,Integer page,Integer size){
    @Autowired
    private PatientLabelDao patientLabelDao;
    public MixEnvelop findPackageService(String city,String labelCode,String labelType,String patient,Integer page,Integer size){
        String totalSql ="SELECT " +
                " count(1) as total " +
@ -117,6 +122,20 @@ public class PackageService {
        sql +=  "ORDER BY p.sort ASC LIMIT " + (page - 1) * size + "," + size + "";
        List<ServicePackageVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ServicePackageVO.class));
        //判断是否签约
        if(StringUtils.isNotBlank(patient)){
            if(list!=null&&list.size()>0){
                for(ServicePackageVO servicePackageVO:list){
                    if(findPatientSignExist(patient,servicePackageVO.getId())){
                        servicePackageVO.setSignType(1);
                    }else {
                        servicePackageVO.setSignType(0);
                    }
                }
            }
        }
        return MixEnvelop.getSuccessListWithPage(PatientRequestMapping.SignPackage.api_success, list, page, size, count);
    }
@ -231,6 +250,16 @@ public class PackageService {
        return Envelop.getSuccess(PatientRequestMapping.SignPackage.api_success);
    }
    public Envelop signPackageAndFamily(ServicePackageSignRecordDO recordDO,String patient, String familyMobile, Integer platform, Integer familyBindRole, Integer isAdult) throws Exception{
        //1.绑定家人
        myFamilyService.signBindFamily(patient,familyMobile,platform,familyBindRole,isAdult);
        //2.服务签约
        servicePackageSignRecordDao.save(recordDO);
        return Envelop.getSuccess(PatientRequestMapping.SignPackage.api_success);
    }
    public BaseDoctorDO findDoctorById(String doctorCode){
        return baseDoctorDao.findOne(doctorCode);
    }
@ -374,4 +403,44 @@ public class PackageService {
        return MixEnvelop.getSuccessListWithPage(PatientRequestMapping.SignPackage.api_success, list, page, size, count);
    }
    public ServicePackageRecordVO findSingleSignPackageById(String signId){
        String sql="SELECT " +
                " 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 " +
                " WHERE r.id='"+signId+"'";
        List<ServicePackageRecordVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ServicePackageRecordVO.class));
        if(list!=null&&list.size()>0){
            return list.get(0);
        }
        return null;
    }
    public List<PatientLabelDO> findLabelByLabelType(String labelType){
       return patientLabelDao.findByLabelTypeAndStatus(labelType,1);
    }
}