Browse Source

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

Conflicts:
	common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationTemplateDetailDO.java
yeshijie 4 years ago
parent
commit
25f20b3462
46 changed files with 3517 additions and 157 deletions
  1. 26 1
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  2. 50 0
      common/common-entity/sql记录
  3. 33 0
      common/common-entity/src/main/java/com/yihu/jw/entity/UuidIdentityEntityWithCreateTime.java
  4. 68 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  5. 12 15
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDO.java
  6. 53 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageRecordDO.java
  7. 18 141
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java
  8. 90 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/archive/ArchiveDO.java
  9. 310 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityAssessmentRecordDO.java
  10. 7 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/PageEnvelop.java
  11. 6 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageService.java
  12. 280 0
      svr/svr-cloud-care/pom.xml
  13. 4 0
      svr/svr-cloud-care/readme.MD
  14. 0 0
      svr/svr-cloud-care/sql/sql
  15. 24 0
      svr/svr-cloud-care/src/main/java/com/yihu/SvrCloudCareApplication.java
  16. 27 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/BeanConfig.java
  17. 18 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SpringSecurityAuditorAware.java
  18. 44 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerDocs.java
  19. 15 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ArchiveDao.java
  20. 14 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityAssessmentRecordDao.java
  21. 14 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageDao.java
  22. 25 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageItemDao.java
  23. 14 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageRecordDao.java
  24. 17 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageSignRecordDao.java
  25. 122 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/dict/DictEndpoint.java
  26. 207 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/file_upload/FileUploadEndpoint.java
  27. 42 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java
  28. 269 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java
  29. 59 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/version/VersionEndpoint.java
  30. 261 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/wechat/WechatCoreController.java
  31. 79 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/wechat/WechatMenuController.java
  32. 138 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ArchiveService.java
  33. 125 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java
  34. 21 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageItemService.java
  35. 24 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageRecordService.java
  36. 235 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java
  37. 15 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageSignRecordService.java
  38. 105 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinCoreService.java
  39. 126 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinEventProcess.java
  40. 90 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/useragent/UserAgent.java
  41. 333 0
      svr/svr-cloud-care/src/main/resources/application.yml
  42. 6 0
      svr/svr-cloud-care/src/main/resources/banner.txt
  43. 31 0
      svr/svr-cloud-care/src/main/resources/bootstrap.yml
  44. BIN
      svr/svr-cloud-care/src/main/resources/image/d-male.png
  45. BIN
      svr/svr-cloud-care/src/main/resources/image/p-female.png
  46. 60 0
      svr/svr-cloud-care/src/main/resources/wechat/weixin_menu.txt

+ 26 - 1
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -9,7 +9,6 @@ import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
@ -82,6 +81,32 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        result.put("medicareCard",cards);
        return result.toJSONString();
    }
    /**
     * 居民id
     * @param patientId
     * @return
     */
    public String findPatientById(String patientId) throws Exception{
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(patientId)){
            result.put("result","parameter patientId is null");
            return result.toString();
        }
        BasePatientDO patientDO = basePatientDao.findById(patientId);
        if(patientDO == null){
            result.put("result","not exist patient for id:"+patientId);
            return result.toString();
        }
        PatientMedicareCardDO card = basePatientMedicardCardService.findByTypeAndPatientCodeAndDel("A_01",patientId,"1");
        if(card != null){
            patientDO.setSsc(card.getCode());
        }
        result.put("patient",patientDO);
        return result.toJSONString();
    }
    /**
     * 获取用户基础信息,参数为空查全部
     * @param nameOrIdcard

+ 50 - 0
common/common-entity/sql记录

@ -76,3 +76,53 @@ alter table base.wlyy_door_service_order add `nursing_staff` varchar(50) DEFAULT
alter table base.wlyy_door_service_order add `nursing_staff_name` varchar(50) DEFAULT NULL COMMENT '护理人员name';
alter table base.wlyy_door_service_order add `nursing_staff_type` varchar(50) DEFAULT NULL COMMENT '接单的医生类型:医生,健管师,护士等';
-- 2021-02-24 ysj 医养云照护相关
CREATE TABLE `wlyy_archive` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL COMMENT '居民code',
  `sick_name` varchar(50) DEFAULT NULL COMMENT '姓名',
  `archive_operator_name` varchar(50) DEFAULT NULL COMMENT '建档人姓名',
  `doctor_code` varchar(50) DEFAULT NULL COMMENT '医生code',
  `archive_status` int(11) DEFAULT NULL COMMENT '档案状态【1.未管理 2.死亡 3.正常 4.高危】【必填】',
  `archive_time` datetime DEFAULT NULL COMMENT '建档时间',
  `sign_status` tinyint(1) DEFAULT NULL COMMENT '签约状态【0未签约,1已签约】',
  `idcard` varchar(32) DEFAULT NULL COMMENT '身份证',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `index_1` (`patient`,`doctor_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='建档表';
CREATE TABLE `base_capacity_assessment_record` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL,
  `sex` tinyint(1) DEFAULT NULL,
  `birthday` datetime DEFAULT NULL,
  `idcard` varchar(20) DEFAULT NULL,
  `mobile` varchar(20) DEFAULT NULL,
  `registered_residence` varchar(100) DEFAULT NULL COMMENT '户籍地',
  `live_address` varchar(100) DEFAULT NULL COMMENT '居住地',
  `assessment_time` datetime DEFAULT NULL COMMENT '评估时间',
  `assessment_address` varchar(100) DEFAULT NULL COMMENT '评估地点',
  `living_ability` tinyint(1) DEFAULT NULL COMMENT '日常生活活动能力等级',
  `cognitive_ability` tinyint(1) DEFAULT NULL COMMENT '认知能力',
  `social_ability` tinyint(1) DEFAULT NULL COMMENT '精神状态与社会交流能力',
  `comprehensive_ability` tinyint(1) DEFAULT NULL COMMENT '能力总体评价',
  `level_conclusion` tinyint(1) DEFAULT NULL COMMENT '等级结论',
  `doctor` varchar(50) DEFAULT NULL,
  `doctor_name` varchar(50) DEFAULT NULL,
  `org_code` varchar(50) DEFAULT NULL,
  `org_name` varchar(50) DEFAULT NULL,
  `status` tinyint(1) DEFAULT NULL COMMENT '认可结果(0未认可,1已认可,2不认可)',
  `sign_url` varchar(255) DEFAULT NULL COMMENT '签字结果图片url',
  `service_package_status` tinyint(1) DEFAULT NULL COMMENT '是否分配服务包(0未分配,1已分配)',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力评估记录';
alter table base_patient add `marriage` int(11) DEFAULT NULL COMMENT '婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】';
alter table base_patient add `national` int(11) DEFAULT NULL COMMENT '民族';
alter table base_patient add `blood` int(11) DEFAULT NULL COMMENT '血型【1.A型 2.B型 3.O型 4.AB型 5.不详】';
alter table base_patient add `national_name` varchar(20) DEFAULT NULL COMMENT '民族名称';

+ 33 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/UuidIdentityEntityWithCreateTime.java

@ -0,0 +1,33 @@
package com.yihu.jw.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.util.Date;
/**
 * Created by yeshijie on 2021/2/25.
 */
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class UuidIdentityEntityWithCreateTime extends UuidIdentityEntity {
    //创建时间
    @CreatedDate
    protected Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 68 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
@ -247,6 +248,28 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String cardType;
    private String alipayId;//支付宝id
    /**
     * 婚姻状况【10.未婚 20.已婚 30.丧偶 40.离婚 90.未说明的婚姻状况】
     */
    private Integer marriage;
    /**
     * '民族'
     */
    private Integer national;
    /**
     * 血型【1.A型 2.B型 3.O型 4.AB型 5.不详】
     */
    private Integer blood;
    /**
     * '民族名称'
     */
    private String nationalName;
    /**
     * 医保卡号
     */
    private String ssc;
    public String getCardType() {
        return cardType;
    }
@ -698,4 +721,49 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setAlipayId(String alipayId) {
        this.alipayId = alipayId;
    }
    @Column(name = "marriage")
    public Integer getMarriage() {
        return marriage;
    }
    public void setMarriage(Integer marriage) {
        this.marriage = marriage;
    }
    @Column(name = "national")
    public Integer getNational() {
        return national;
    }
    public void setNational(Integer national) {
        this.national = national;
    }
    @Column(name = "blood")
    public Integer getBlood() {
        return blood;
    }
    public void setBlood(Integer blood) {
        this.blood = blood;
    }
    @Column(name = "national_name")
    public String getNationalName() {
        return nationalName;
    }
    public void setNationalName(String nationalName) {
        this.nationalName = nationalName;
    }
    @Transient
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
}

+ 12 - 15
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDO.java

@ -1,7 +1,6 @@
package com.yihu.jw.entity.base.servicePackage;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.team.BaseTeamDO;
@ -11,7 +10,6 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
@ -20,14 +18,14 @@ import java.util.List;
 */
@Entity
@Table(name = "base_service_package")
public class ServicePackageDO extends UuidIdentityEntity implements Serializable {
public class ServicePackageDO extends UuidIdentityEntityWithCreateTime implements Serializable {
    private String name;//'服务包名称'
    private String type;//服务类型(1养老服务、2医疗服务、3安防监护、4慢病管理)
    private BigDecimal price;//价格
    private Integer num;//服务项数量
    private String introduce;//'服务介绍'
    private String del;//'是否有效(1生效,0失效)'
    private Date createTime;//'创建时间'
    private List<ServicePackageItemDO> packageItemDOList;//服务项
    private List<BaseOrgDO> orgDOList;//提供机构
@ -71,6 +69,15 @@ public class ServicePackageDO extends UuidIdentityEntity implements Serializable
        this.introduce = introduce;
    }
    @Column(name = "num")
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
@ -80,16 +87,6 @@ public class ServicePackageDO extends UuidIdentityEntity implements Serializable
        this.del = del;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Transient
    public List<ServicePackageItemDO> getPackageItemDOList() {
        return packageItemDOList;

+ 53 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageRecordDO.java

@ -0,0 +1,53 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * 签约的服务包记录表
 * Created by yeshijie on 2021/2/25.
 */
@Entity
@Table(name = "base_service_package_record")
public class ServicePackageRecordDO extends UuidIdentityEntityWithCreateTime implements Serializable {
    /**
     * '签约id'
     */
    private String signId;
    /**
     * '服务包id'
     */
    private String servicePackageId;
    /**
     * 居民id
     */
    private String patient;
    public String getSignId() {
        return signId;
    }
    public void setSignId(String signId) {
        this.signId = signId;
    }
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
}

+ 18 - 141
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java

@ -1,70 +1,36 @@
package com.yihu.jw.entity.base.servicePackage;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * 服务包签约记录表
 * 签约记录表
 * @author yeshijie on 2018/8/17.
 */
@Entity
@Table(name = "base_service_package_sign_record")
public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Serializable {
public class ServicePackageSignRecordDO extends UuidIdentityEntityWithCreateTime implements Serializable {
    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 cancelReason;//取消原因
    private String reviewReason;//审核原因
    private Integer status;//状态 0新增,1生效,-1已过期
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "service_package_id")
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    @Column(name = "service_package_name")
    public String getServicePackageName() {
        return servicePackageName;
    }
    public void setServicePackageName(String servicePackageName) {
        this.servicePackageName = servicePackageName;
    }
    /**
     * 签约的服务包
     */
    private List<ServicePackageRecordDO> recordDOList;
    public String getPatient() {
        return patient;
@ -82,22 +48,6 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
        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;
    }
    @Column(name = "sign_doctor")
    public String getSignDoctor() {
        return signDoctor;
@ -116,41 +66,8 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
        this.signDoctorName = signDoctorName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "admin_team_code")
    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;
    }
    @Column(name = "start_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getStartTime() {
        return startTime;
    }
@ -160,6 +77,7 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
    }
    @Column(name = "end_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getEndTime() {
        return endTime;
    }
@ -176,53 +94,12 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
        this.status = status;
    }
    @Column(name = "doctor_team_code")
    public String getDoctorTeamCode() {
        return doctorTeamCode;
    }
    public void setDoctorTeamCode(String doctorTeamCode) {
        this.doctorTeamCode = doctorTeamCode;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public String getCancelReason() {
        return cancelReason;
    }
    public void setCancelReason(String cancelReason) {
        this.cancelReason = cancelReason;
    }
    public String getReviewReason() {
        return reviewReason;
    @Transient
    public List<ServicePackageRecordDO> getRecordDOList() {
        return recordDOList;
    }
    public void setReviewReason(String reviewReason) {
        this.reviewReason = reviewReason;
    public void setRecordDOList(List<ServicePackageRecordDO> recordDOList) {
        this.recordDOList = recordDOList;
    }
}

+ 90 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/archive/ArchiveDO.java

@ -0,0 +1,90 @@
package com.yihu.jw.entity.care.archive;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by yeshijie on 2021/2/25.
 */
@Entity
@Table(name = "wlyy_archive")
public class ArchiveDO extends UuidIdentityEntity {
    private String patient;//唯一标识code
    private String sickName;//姓名
    private String archiveOperatorName;// 建档人姓名
    private String doctorCode;// 医生code
    private int archiveStatus;//档案状态【1.未管理 2.死亡 3.正常 4.高危】【必填】
    private Date archiveTime;//建档时间
    private int signStatus;// 签约状态【0未签约,1已签约】
    private String idcard;//身份证
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public int getSignStatus() {
        return signStatus;
    }
    public void setSignStatus(int signStatus) {
        this.signStatus = signStatus;
    }
    public String getSickName() {
        return sickName;
    }
    public void setSickName(String sickName) {
        this.sickName = sickName;
    }
    public String getArchiveOperatorName() {
        return archiveOperatorName;
    }
    public void setArchiveOperatorName(String archiveOperatorName) {
        this.archiveOperatorName = archiveOperatorName;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public int getArchiveStatus() {
        return archiveStatus;
    }
    public void setArchiveStatus(int archiveStatus) {
        this.archiveStatus = archiveStatus;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getArchiveTime() {
        return archiveTime;
    }
    public void setArchiveTime(Date archiveTime) {
        this.archiveTime = archiveTime;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
}

+ 310 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityAssessmentRecordDO.java

@ -0,0 +1,310 @@
package com.yihu.jw.entity.care.sign;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * Created by yeshijie on 2021/2/25.
 */
@Entity
@Table(name = "base_capacity_assessment_record")
public class CapacityAssessmentRecordDO extends UuidIdentityEntityWithCreateTime {
    private String patient;
    /**
     * 姓名
     */
    private String name;
    /**
     * 生日
     */
    private Date birthday;
    /**
     * 性别,1男,2女
     */
    private Integer sex;
    /**
     * 手机号
     */
    private String mobile;
    /**
     * 身份证
     */
    private String idcard;
    /**
     * 户籍地
     */
    private String registeredResidence;
    /**
     * 居住地
     */
    private String liveAddress;
    /**
     * 评估时间
     */
    private Date assessmentTime;
    /**
     * 评估地点
     */
    private String assessmentAddress;
    /**
     * 日常生活活动能力等级
     * 能力完好(0级) 轻度受损(1级) 中度受损(2级) 重度受损(3级)
     */
    private Integer livingAbility;
    /**
     * 认知能力
     * 能力完好(0级) 轻度受损(1级) 中度受损(2级) 重度受损(3级)
     */
    private Integer cognitiveAbility;
    /**
     *精神状态与社会交流能力
     * 能力完好(0级) 轻度受损(1级) 中度受损(2级) 重度受损(3级)
     */
    private Integer socialAbility;
    /**
     * 能力总体评价
     * 能力完好(0级) 轻度失能(1级) 中度失能(2级) 重度失能(3级)
     */
    private Integer comprehensiveAbility;
    /**
     * 等级结论
     * 能力完好(0级) 轻度失能(1级) 中度失能(2级) 重度失能(3级)
     */
    private Integer levelConclusion;
    private String doctor;
    private String doctorName;
    private String orgCode;
    private String orgName;
    /**
     * 认可结果(0未认可,1已认可,2不认可)
     */
    private Integer status;
    /**
     * 签字结果图片url
     */
    private String signUrl;
    /**
     * 居民签字时间
     */
    private Date signTime;
    /**
     * 是否分配服务包(0未分配,1已分配)
     */
    private Integer servicePackageStatus;
    /**
     * 年纪
     */
    private Integer age;
    private String photo;
    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 Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getRegisteredResidence() {
        return registeredResidence;
    }
    public void setRegisteredResidence(String registeredResidence) {
        this.registeredResidence = registeredResidence;
    }
    public String getLiveAddress() {
        return liveAddress;
    }
    public void setLiveAddress(String liveAddress) {
        this.liveAddress = liveAddress;
    }
    public Date getAssessmentTime() {
        return assessmentTime;
    }
    public void setAssessmentTime(Date assessmentTime) {
        this.assessmentTime = assessmentTime;
    }
    public String getAssessmentAddress() {
        return assessmentAddress;
    }
    public void setAssessmentAddress(String assessmentAddress) {
        this.assessmentAddress = assessmentAddress;
    }
    public Integer getLivingAbility() {
        return livingAbility;
    }
    public void setLivingAbility(Integer livingAbility) {
        this.livingAbility = livingAbility;
    }
    public Integer getCognitiveAbility() {
        return cognitiveAbility;
    }
    public void setCognitiveAbility(Integer cognitiveAbility) {
        this.cognitiveAbility = cognitiveAbility;
    }
    public Integer getSocialAbility() {
        return socialAbility;
    }
    public void setSocialAbility(Integer socialAbility) {
        this.socialAbility = socialAbility;
    }
    public Integer getComprehensiveAbility() {
        return comprehensiveAbility;
    }
    public void setComprehensiveAbility(Integer comprehensiveAbility) {
        this.comprehensiveAbility = comprehensiveAbility;
    }
    public Integer getLevelConclusion() {
        return levelConclusion;
    }
    public void setLevelConclusion(Integer levelConclusion) {
        this.levelConclusion = levelConclusion;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getSignUrl() {
        return signUrl;
    }
    public void setSignUrl(String signUrl) {
        this.signUrl = signUrl;
    }
    public Integer getServicePackageStatus() {
        return servicePackageStatus;
    }
    public void setServicePackageStatus(Integer servicePackageStatus) {
        this.servicePackageStatus = servicePackageStatus;
    }
    public Date getSignTime() {
        return signTime;
    }
    public void setSignTime(Date signTime) {
        this.signTime = signTime;
    }
    @Transient
    public Integer getAge() {
        return age;
    }
    public void setAge(Integer age) {
        this.age = age;
    }
    @Transient
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
}

+ 7 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/PageEnvelop.java

@ -111,6 +111,13 @@ public class PageEnvelop<T> extends Envelop implements Serializable {
        return envelop;
    }
    public static PageEnvelop getError(String message) {
        PageEnvelop envelop = new PageEnvelop();
        envelop.setMessage(message);
        envelop.setStatus(-1);
        return envelop;
    }
    public static PageEnvelop getSuccessList(String message, List objList) {
        PageEnvelop envelop = new PageEnvelop();
        envelop.setMessage(message);

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageService.java

@ -44,6 +44,12 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        JSONObject result = new JSONObject();
        List<ServicePackageItemDO> itemDOList = servicePackageDO.getPackageItemDOList();
        if(itemDOList==null){
            servicePackageDO.setNum(0);
        }else {
            servicePackageDO.setNum(itemDOList.size());
        }
        if(StringUtil.isEmpty(servicePackageDO.getId())){
            //新增
            servicePackageDO.setCreateTime(new Date());

+ 280 - 0
svr/svr-cloud-care/pom.xml

@ -0,0 +1,280 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>wlyy-parent-pom</artifactId>
        <version>2.0.0</version>
        <relativePath>../../wlyy-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-cloud-care</artifactId>
    <packaging>jar</packaging>
    <version>${parent.version}</version>
    <dependencies>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
        <!--注释掉就不会读取git的配置,只会读取yml中的配置-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-activemq</artifactId>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>com.ylz.loginsdk</groupId>-->
            <!--<artifactId>ehcsdk</artifactId>-->
            <!--<version>1.0</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>com.ylz.dmrh</groupId>
            <artifactId>ehcsdk-java-sdk-base</artifactId>
            <version>1.0.3</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>wxpay-sdk</artifactId>
            <version>3.0.9</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-web</artifactId>
        </dependency>
        <!-- 文件服务器 -->
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>fastdfs-starter</artifactId>
        </dependency>
        <!-- Jzkl Starter -->
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>swagger-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <!-- <scope>runtime</scope> -->
        </dependency>
        <!--<dependency>-->
            <!--<groupId>com.yihu</groupId>-->
            <!--<artifactId>elasticsearch-starter</artifactId>-->
            <!--<version>2.0.0</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>io.github.swagger2markup</groupId>
            <artifactId>swagger2markup</artifactId>
            <version>1.3.2</version>
            <exclusions>
                <exclusion>
                    <artifactId>mailapi</artifactId>
                    <groupId>javax.mail</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- 发送邮件 -->
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.4.7</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 start-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.yihu.ehr</groupId>
                    <artifactId>commons-util</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-collections4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <!-- xlsx  依赖这个包 -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <!--   poi xml导入导出工具 end -->
        <!--基础业务组件-->
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>base-service</artifactId>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-commons</artifactId>
            <version>1.3.2</version>
        </dependency>
        <!--缩略图-->
        <dependency>
            <groupId>net.coobird</groupId>
            <artifactId>thumbnailator</artifactId>
            <version>0.4.8</version>
        </dependency>
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>im-service</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>sms-service</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>es-service</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!--oracle驱动-->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>svr-cloud-care</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>com.yihu.SvrCloudCareApplication</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

+ 4 - 0
svr/svr-cloud-care/readme.MD

@ -0,0 +1,4 @@
基础微服务
    每个模块有自己独立的文件夹,这样做的好处是以后如果哪个模块需要独立成微服务,代码直接剪切到新的微服务即可。
    每个模块下面有独立的Endpoint,service,model和dao
  

+ 0 - 0
svr/svr-cloud-care/sql/sql


+ 24 - 0
svr/svr-cloud-care/src/main/java/com/yihu/SvrCloudCareApplication.java

@ -0,0 +1,24 @@
package com.yihu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
/**
 * Created by Trick on 2019/5/13.
 */
@SpringBootApplication
@EnableJpaAuditing
public class SvrCloudCareApplication extends SpringBootServletInitializer {
    public static void main(String[] args)  {
        SpringApplication.run(SvrCloudCareApplication.class, args);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(SvrCloudCareApplication.class);
    }
}

+ 27 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/BeanConfig.java

@ -0,0 +1,27 @@
package com.yihu.jw.care.config;
import com.yihu.jw.hospital.prescription.service.PrescriptionExpressageService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class BeanConfig {
    //顺丰快递接口请求地址
    @Value("${express.sf_url}")
    private String sf_url;
    //顺丰快递接口接入编码
    @Value("${express.sf_code}")
    private String sf_code;
    //顺丰快递接口checkword
    @Value("${express.sf_check_word}")
    private String sf_check_word;
    @Bean(name = "prescriptionExpressageService")
    PrescriptionExpressageService prescriptionExpressageService(){
        return new PrescriptionExpressageService(sf_url,sf_code,sf_check_word);
    }
}

+ 18 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SpringSecurityAuditorAware.java

@ -0,0 +1,18 @@
package com.yihu.jw.care.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
@Configuration
public class SpringSecurityAuditorAware implements AuditorAware {
    @Override
    public Object getCurrentAuditor() {
//        return Optional.ofNullable(SecurityContextHolder.getContext())
//                .map(SecurityContext::getAuthentication)
//                .filter(Authentication::isAuthenticated)
//                .map(Authentication::getPrincipal);
////                .map(Authentication::getDetails);
        return "123";
    }
}

+ 44 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/SwaggerDocs.java

@ -0,0 +1,44 @@
package com.yihu.jw.care.config;
import io.github.swagger2markup.GroupBy;
import io.github.swagger2markup.Language;
import io.github.swagger2markup.Swagger2MarkupConfig;
import io.github.swagger2markup.Swagger2MarkupConverter;
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
import io.github.swagger2markup.markup.builder.MarkupLanguage;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
 * Created by lith on 2018/11/23
 */
public class SwaggerDocs {
    public static void main(String[] args) throws Exception {
        //1.请求 http://ip:port/swagger-resources获取group
        String group = "Default";
        //2.定义请求地址 new URL("http://ip:port/v2/api-docs?group=" + groupName)
        //项目的swagger-ui地址
        URL remoteSwaggerFile = new URL("http://127.0.0.1:10022/v2/api-docs?group=" + group);
        //3.定义文件输出路径
        String prefix = Thread.currentThread().getContextClassLoader().getResource("").getPath();
        //文档输出地址
        Path outputFile = Paths.get(prefix.substring(prefix.lastIndexOf(":") + 1, prefix.indexOf("target") - 1) + "/build/" + group);
        Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
                .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
                .withOutputLanguage(Language.ZH)
                .withPathsGroupedBy(GroupBy.TAGS)
                .withGeneratedExamples()
                .withoutInlineSchema()
                //.withBasePathPrefix()
                .build();
        Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(remoteSwaggerFile)
                .withConfig(config)
                .build();
        converter.toFile(outputFile);
    }
}

+ 15 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ArchiveDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/2/24.
 */
public interface ArchiveDao extends PagingAndSortingRepository<ArchiveDO, String>, JpaSpecificationExecutor<ArchiveDO> {
    ArchiveDO findByIdcardAndDoctorCode(String idcard, String doctorCode);
    ArchiveDO findByPatientAndDoctorCode(String patient, String doctorCode);
}

+ 14 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityAssessmentRecordDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/2/25.
 */
public interface CapacityAssessmentRecordDao extends PagingAndSortingRepository<CapacityAssessmentRecordDO, String>,
        JpaSpecificationExecutor<CapacityAssessmentRecordDO> {
}

+ 14 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.base.servicePackage.ServicePackageDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 *
 * @author yeshijie on 2018/8/17.
 */
public interface ServicePackageDao extends PagingAndSortingRepository<ServicePackageDO, String>, JpaSpecificationExecutor<ServicePackageDO> {
}

+ 25 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageItemDao.java

@ -0,0 +1,25 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2021/2/23.
 */
public interface ServicePackageItemDao extends PagingAndSortingRepository<ServicePackageItemDO, String>, JpaSpecificationExecutor<ServicePackageItemDO> {
    @Query("from ServicePackageItemDO w where w.teamCode =?1 and w.code=?2")
    List<ServicePackageItemDO> findByTeamCode(String teamCode, String code);
    @Query("from ServicePackageItemDO w where w.servicePackageId =?1 and w.del='1'")
    List<ServicePackageItemDO> findByServicePackageId(String servicePackageId);
    @Modifying
    @Query("delete from ServicePackageItemDO p where p.servicePackageId=?1")
    void deleteByServicePackageId(String servicePackageId);
}

+ 14 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageRecordDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/2/25.
 */
public interface ServicePackageRecordDao extends PagingAndSortingRepository<ServicePackageRecordDO, String>, JpaSpecificationExecutor<ServicePackageRecordDO> {
}

+ 17 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/ServicePackageSignRecordDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 *
 * @author yeshijie on 2018/8/17.
 */
public interface ServicePackageSignRecordDao extends PagingAndSortingRepository<ServicePackageSignRecordDO, String>, JpaSpecificationExecutor<ServicePackageSignRecordDO> {
    List<ServicePackageSignRecordDO> findByStatusAndPatient(Integer status, String patient);
}

+ 122 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/dict/DictEndpoint.java

@ -0,0 +1,122 @@
package com.yihu.jw.care.endpoint.dict;
import com.yihu.jw.area.service.*;
import com.yihu.jw.entity.base.area.*;
import com.yihu.jw.restmodel.base.area.*;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/2/24.
 */
@RestController
@RequestMapping("dict" )
@Api(tags = "字典信息", description = "字典信息")
public class DictEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseCommitteeService baseCommitteeService;
    @Autowired
    private BaseTownService baseTownService;
    @Autowired
    private BaseProvinceService baseProvinceService;
    @Autowired
    private BaseCityService baseCityService;
    @Autowired
    private BaseStreetService baseStreetService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @GetMapping(value = "getNationDict")
    @ApiOperation("获取民族信息列表")
    public ListEnvelop<Map<String,Object>> getNationDict(){
        try {
            String sql = "SELECT t.NATION_CODE code,t.NATION_NAME name FROM zy_nation_dict t";
            List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
            return success(rs);
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("获取字典信息失败!");
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCommity)
    @ApiOperation(value = "获取居委会列表")
    public ListEnvelop<BaseCommitteeVO> findCommity (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseCommitteeDO> baseProvinces = baseCommitteeService.search(fields, filters, sorts);
        return success(baseProvinces, BaseCommitteeVO.class);
    }
    @GetMapping(value = "findStreet")
    @ApiOperation(value = "获取街道列表")
    public ListEnvelop<BaseStreetVO> findStreet (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseStreetDO> baseProvinces = baseStreetService.search(fields, filters, sorts);
        return success(baseProvinces, BaseStreetVO.class);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findTown)
    @ApiOperation(value = "获取区列表")
    public ListEnvelop<BaseTownVO> list (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseTownDO> baseTowns = baseTownService.search(fields, filters, sorts);
        return success(baseTowns, BaseTownVO.class);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findProvince)
    @ApiOperation(value = "获取省列表")
    public ListEnvelop<BaseProvinceVO> findProvince (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseProvinceDO> baseProvinces = baseProvinceService.search(fields, filters, sorts);
        return success(baseProvinces, BaseProvinceVO.class);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCity)
    @ApiOperation(value = "获取市列表")
    public ListEnvelop<BaseCityVO> findCity (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseCityDO> baseCitys = baseCityService.search(fields, filters, sorts);
        return success(baseCitys, BaseCityVO.class);
    }
}

+ 207 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/file_upload/FileUploadEndpoint.java

@ -0,0 +1,207 @@
package com.yihu.jw.care.endpoint.file_upload;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.file_upload.FileManageService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.MutilFileInfo;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
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.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Map;
/**
 * 文件上传公共类
 */
@RestController
@RequestMapping(BaseRequestMapping.FileUpload.PREFIX)
@Api(tags = "文件上传相关操作", description = "文件上传相关操作")
public class FileUploadEndpoint extends EnvelopRestEndpoint {
    private static final Logger logger = LoggerFactory.getLogger(EnvelopRestEndpoint.class);
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Autowired
    FileUploadService fileUploadService;
    @Value("${testPattern.sign}")
    private String isClose;
    @Value("${testPattern.remote_inner_url}")
    private String remote_inner_url;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private FileManageService fileManageService;
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_IMG)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
    public ObjEnvelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("0")){
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
        }
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_ATTACHMENT)
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("0")){
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
        }
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public ObjEnvelop<UploadVO> uploadStream(@ApiParam(value = "文件", required = true)
                                                 @RequestParam(value = "file", required = true) MultipartFile file,
                                             @ApiParam(value = "文件", required = true)
                                             @RequestParam(value = "filename", required = false) String filename) throws Exception{
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else {
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            
            //判断文件名称是否有包含后缀,及前端是否有传后缀名称,有的话拼接图片后缀
            if(originalFilename.lastIndexOf(".") == 0 && StringUtils.isNotEmpty(filename)){
                originalFilename = originalFilename +"."+filename;
            }
            
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
        }
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_video)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public ObjEnvelop<UploadVO> uploadStreamVideo(@ApiParam(value = "文件", required = true)
                                             @RequestParam(value = "file", required = true) MultipartFile file,
                                                  @ApiParam(value = "文件", required = false)
                                                  @RequestParam(value = "filename", required = false) String filename,
                                                  @ApiParam(value = "taskId", required = false)
                                                      @RequestParam(value = "taskId", required = false) String taskId,
                                                  @ApiParam(value = "chunk", required = false)
                                                      @RequestParam(value = "chunk", required = false) Integer chunk,
                                                  @ApiParam(value = "文件", required = false)
                                                      @RequestParam(value = "sizesize", required = false) Long size,
                                                  @ApiParam(value = "chunkTotal", required = false)
                                                      @RequestParam(value = "chunkTotal", required = false) Integer chunkTotal,
                                                  @ApiParam(value = "objectType", required = false)
                                                      @RequestParam(value = "objectType", required = false) Integer objectType
                                             ) throws Exception{
        UploadVO uploadVO = new UploadVO();
        MutilFileInfo files = new MutilFileInfo();
        files.setChunk(chunk);
        files.setChunkTotal(chunkTotal);
        files.setFile(file);
        files.setObjectType(objectType);
        files.setSize(file.getSize());
        files.setTaskId(taskId);
        String taskid = fileManageService.chunkUploadByMappedByteBuffer(files);
        if ("unCompelete".equalsIgnoreCase(taskid)){
            System.out.println("第"+files.getChunk());
            return success("未传完",uploadVO);
        }else {
            File file1 = new File(taskid);
            FileInputStream input = new FileInputStream(file1);
            MultipartFile multipartFile = new MockMultipartFile("file", file1.getName(), "text/plain", IOUtils.toByteArray(input));
            if (isClose.equalsIgnoreCase("1")){
                Map<String, Object> map = fileUploadService.uploadImg(multipartFile);
                uploadVO.setFullUri(map.get("accessory").toString());
            }else if(isClose.equals("2")){
                //内网上传
                String rs = fileUploadService.request(remote_inner_url,multipartFile,null);
                logger.info(rs);
                JSONObject json = JSON.parseObject(rs);
                uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
            }else {
                // 得到文件的完整名称  xxx.txt
                String originalFilename = multipartFile.getOriginalFilename();
                //判断文件名称是否有包含后缀,及前端是否有传后缀名称,有的话拼接图片后缀
                if(originalFilename.lastIndexOf(".") == 0 && StringUtils.isNotEmpty(filename)){
                    originalFilename = originalFilename +"."+filename;
                }
                InputStream inputStream = multipartFile.getInputStream();
                uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
                file1.delete();
            }
            return success("上传成功", uploadVO);
        }
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STRING)
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
    public ObjEnvelop<UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流")
                                             @RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
        UploadVO uploadVO = fileUploadService.uploadImages(jsonData,fastdfs_file_url);
        return success("上传成功", uploadVO);
    }
}

+ 42 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java

@ -0,0 +1,42 @@
package com.yihu.jw.care.endpoint.patient;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by yeshijie on 2021/2/24.
 */
@RestController
@RequestMapping("patient" )
@Api(tags = "用户基础信息", description = "用户基础信息")
public class PatientEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BasePatientService basePatientService;
    @GetMapping(value = BaseRequestMapping.BasePatient.getPatientById)
    @ApiOperation(value = "获取居民信息")
    public Envelop getPatientById(
            @ApiParam(name = "id", value = "居民id")
            @RequestParam(value = "id", required = true) String id) {
        try{
            String result = basePatientService.findPatientById(id);
            return success(result);
        }catch (Exception e){
            e.printStackTrace();
            return failed("获取失败");
        }
    }
}

+ 269 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -0,0 +1,269 @@
package com.yihu.jw.care.endpoint.sign;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.sign.ArchiveDao;
import com.yihu.jw.care.dao.sign.CapacityAssessmentRecordDao;
import com.yihu.jw.care.service.sign.ArchiveService;
import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
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.util.common.IdCardUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/2/24.
 */
@RestController
@RequestMapping(value = "sign")
@Api(value = "签约相关", description = "签约相关", tags = {"签约相关"})
public class SignEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ArchiveService archiveService;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private ArchiveDao archiveDao;
    @Autowired
    private CapacityAssessmentRecordService capacityAssessmentRecordService;
    @Autowired
    private CapacityAssessmentRecordDao capacityAssessmentRecordDao;
    @Autowired
    private ServicePackageService servicePackageService;
    @GetMapping(value = "signRecordPage")
    @ApiOperation(value = "获取签约记录分页")
    public PageEnvelop<List<Map<String,Object>>> signRecordPage (
            @ApiParam(name = "name", value = "居民姓名", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "doctorId", value = "医生code", required = true)
            @RequestParam(value = "doctorId",required = true) String doctorId,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        try{
            return servicePackageService.signRecordPage(name, doctorId, page, size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "servicePackageSign" )
    @ApiOperation(value = "签约管理-获取签约/未签约总数")
    public ObjEnvelop servicePackageSign(
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam String doctoId) {
        try{
            int signTotal = servicePackageService.getSignTotal(doctoId);
            int unSignTotal = archiveService.getUnSignTotal(doctoId);
            JSONObject json = new JSONObject();
            json.put("signTotal",signTotal);
            json.put("unSignTotal",unSignTotal);
            return ObjEnvelop.getSuccess("查询成功",json);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @PostMapping(value = "servicePackageSign" )
    @ApiOperation(value = "分配服务包-签约")
    public Envelop servicePackageSign(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData,
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam String doctoId) {
        try{
            servicePackageService.servicePackageSign(jsonData,doctoId);
            return success("分配成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("分配失败",-1);
        }
    }
    @GetMapping(value = "servicePackagePage")
    @ApiOperation(value = "获取服务包分页")
    public PageEnvelop<List<Map<String,Object>>> servicePackagePage (
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        try{
            return servicePackageService.servicePackagePage(page, size);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "isCapacityAssessment" )
    @ApiOperation(value = "查询今年是否进行过能力评估")
    public ObjEnvelop isCapacityAssessment(
            @ApiParam(name = "patientId", value = "居民id", required = true)
            @RequestParam String patientId)  {
        try{
            return ObjEnvelop.getSuccess("查询成功",capacityAssessmentRecordService.isCapacityAssessment(patientId));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findAssessmentById" )
    @ApiOperation(value = "按id查找评估明细")
    public ObjEnvelop findAssessmentById(
            @ApiParam(name = "id", value = "评估id", required = true)
            @RequestParam String id)  {
        try{
            CapacityAssessmentRecordDO recordDO = capacityAssessmentRecordDao.findOne(id);
            BasePatientDO basePatientDO = patientDao.findById(recordDO.getPatient());
            recordDO.setAge(IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
            recordDO.setPhoto(basePatientDO.getPhoto());
            return ObjEnvelop.getSuccess("查询成功",recordDO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "assessmentPage")
    @ApiOperation(value = "获取能力评估分页")
    public PageEnvelop<List<Map<String,Object>>> assessmentPage (
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam(value = "doctorId") String doctorId,
            @ApiParam(name = "name", value = "居民姓名或身份证", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "status", value = "认可结果(0未认可,1已认可,2不认可)", required = false)
            @RequestParam(value = "status",required = false) Integer status,
            @ApiParam(name = "levelConclusion", value = "评估结果/等级结论", required = false)
            @RequestParam(value = "levelConclusion",required = false) Integer levelConclusion,
            @ApiParam(name = "servicePackageStatus", value = "服务包分配(0未分配,1已分配)", required = false)
            @RequestParam(value = "servicePackageStatus",required = false) Integer servicePackageStatus,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        try{
            return capacityAssessmentRecordService.assessmentPage(doctorId, name, page, size, status, levelConclusion, servicePackageStatus);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
    @PostMapping(value = "capacityAssessment" )
    @ApiOperation(value = "生成能力评估报告")
    public Envelop capacityAssessment(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData,
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam String doctoId) {
        try{
            capacityAssessmentRecordService.capacityAssessment(jsonData,doctoId);
            return success("生成成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("生成失败",-1);
        }
    }
    @PostMapping(value = "confirmAssessment" )
    @ApiOperation(value = "确认评估结果")
    public Envelop confirmAssessment(
            @ApiParam(name = "signUrl", value = "签字结果图片url", required = true)
            @RequestParam String signUrl,
            @ApiParam(name = "status", value = "认可结果(0未认可,1已认可,2不认可)", required = true)
            @RequestParam Integer status,
            @ApiParam(name = "id", value = "评估id", required = true)
            @RequestParam String id) {
        try{
            capacityAssessmentRecordService.confirmAssessment(signUrl, status, id);
            return success("确认成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("确认失败",-1);
        }
    }
    @PostMapping(value = "createArchive" )
    @ApiOperation(value = "建档")
    public Envelop createArchive(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData,
            @ApiParam(name = "doctorId", value = "医生id", required = true)
         @RequestParam String doctorId) {
        try{
            JSONObject jsonObject = JSONObject.parseObject(jsonData);
            BasePatientDO patientDO = toEntity(jsonObject.getJSONObject("patient").toJSONString(), BasePatientDO.class);
            String idcard = patientDO.getIdcard();
            if(patientDao.existsByIdcardAndDel(idcard,"1")){
                ArchiveDO archiveDO = archiveDao.findByIdcardAndDoctorCode(idcard,doctorId);
                if(archiveDO!=null){
                    return success(archiveDO);
                }else {
                    return failed("您所提交的居民信息已存在,请勿重复建档");
                }
            }
            archiveService.createArchive(patientDO,doctorId);
            return success("建档成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("建档失败",-1);
        }
    }
    @PostMapping(value = "sysArchive" )
    @ApiOperation(value = "同步档案")
    public Envelop sysArchive(
            @ApiParam(name = "idcard", value = "居民身份证", required = true)
            @RequestParam String idcard,
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam String doctorId)  {
        try{
            archiveService.sysArchive(doctorId,idcard);
            return success("同步成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("同步失败",-1);
        }
    }
    @GetMapping(value = "archiveList")
    @ApiOperation(value = "获取档案分页")
    public PageEnvelop<List<Map<String,Object>>> archiveList (
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam(value = "doctorId") String doctorId,
            @ApiParam(name = "signStatus", value = "签约状态", required = false)
            @RequestParam(value = "signStatus",required = false) Integer signStatus,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        try{
            return archiveService.archiveList(doctorId,page,size,signStatus);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
}

+ 59 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/version/VersionEndpoint.java

@ -0,0 +1,59 @@
package com.yihu.jw.care.endpoint.version;
import com.yihu.jw.entity.base.version.AppVersionDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.version.service.AppVersionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
 * Created by Trick on 2020/2/24.
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.Version.PREFIX)
@Api(value = "app升级", description = "app升级", tags = {"app升级"})
public class VersionEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private AppVersionService versionsService;
    /**
     * 校验APP版本号
     * @param code 版本类型编码
     * @param version 当前版本号
     * @return
     */
    @GetMapping(value = BaseHospitalRequestMapping.Version.app)
    @ApiOperation(value = "app升级")
    public Envelop appVersion(String code, double version) {
            AppVersionDO temp = versionsService.findVersionByCode(code);
            if (temp == null) {
                return Envelop.getError( "无效的APP类型失败!");
            }
            if (version > 0) {
                if (temp.getVersionInt() > version) {
                    // 有新的版本号
                    return success("发现新版本!", temp.getUrl());
                } else {
                    // 已是最新版本
                    return success("已是最新版本!");
                }
            } else {
                Map<String,Object> map = new HashedMap();
                map.put("version_int", temp.getVersionInt());
                map.put("version_str", temp.getVersionStr());
                map.put("url", temp.getUrl());
                map.put("info", temp.getInfo());
                map.put("size", temp.getSize());
                return success("读取版本号成功!", map);
            }
    }
}

+ 261 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/wechat/WechatCoreController.java

@ -0,0 +1,261 @@
package com.yihu.jw.care.endpoint.wechat;
import com.yihu.jw.care.service.wechat.WeiXinCoreService;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
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.http.MediaType;
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.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
/*
 * Created by lyr on 2016/08/11.
*/
@Controller
@RequestMapping(value = "/weixin", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(value = "微信", description = "微信", tags = {"微信"})
public class WechatCoreController extends EnvelopRestEndpoint {
    private Logger logger= LoggerFactory.getLogger(WechatCoreController.class);
    @Autowired
    private WeiXinCoreService weiXinCoreService;
    @Autowired
    private WeixinMessagePushUtils weixinMessagePushUtils;
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Value("${wechat.id}")
    private String wechatId;
    private static String wechat_token ="xAeQrX7uOD0OusIZ5JUQzrLPYIQBlqbS" ;
    @Autowired
    private WxPushLogDao wxPushLogDao;
    /**
     * 微信接口验证
     *
     * @param request
     * @param response
     */
    @RequestMapping(method = RequestMethod.GET)
    @ResponseBody
    public void checkSignature(HttpServletRequest request, HttpServletResponse response) {
        try {
            String signature = request.getParameter("signature").toString();
            String timestamp = request.getParameter("timestamp").toString();
            String nonce = request.getParameter("nonce").toString();
            String echostr = request.getParameter("echostr").toString();
            logger.info("echostr"+echostr+"===nonce"+nonce+"====signature"+signature+"====timestamp"+timestamp);
            if (validate(signature, timestamp, nonce)) {
                // 验证成功,返回验证码
                response.getWriter().print(echostr);
            } else {
                // 验证失败
                response.setStatus(401);
            }
        } catch (Exception e) {
            // 服务器错误
            response.setStatus(500);
        }
    }
  /* *//*
     * 接收居民微信回复的消息
     *
     * @return
    *//*
    @RequestMapping(method = RequestMethod.POST)
    @ResponseBody
    public void receiveMessages(HttpServletRequest request, HttpServletResponse response) {
        try {
            String signature = request.getParameter("signature").toString();
            String timestamp = request.getParameter("timestamp").toString();
            String nonce = request.getParameter("nonce").toString();
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (validate(signature, timestamp, nonce)) {
                String xmlStr = weiXinCoreService.messageProcess(request, wxAccessTokenDO.getAccessToken());
                // 判断返回值是xml、json格式(取关是空串)
                Boolean flag = weiXinCoreService.isXML(xmlStr);
                if (xmlStr == "error") {
                    // 服务器错误
                    response.setStatus(500);
                } else if (!flag && StringUtils.isNotEmpty(xmlStr)) {
                    JSONObject json = new JSONObject(xmlStr);
                    if (json.has("openId")) {
                        if (StringUtils.isNotEmpty(json.getString("openId")) && !("undefined".equals(json.getString("openId")))) {
                                try {
                                    logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+json.getString(""));
                                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), json.getString("openId"), json);
                                    logger.info("发送成功");
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    logger.info("发送失败,error="+e.getMessage());
                                }
                                //保存发送模板记录,
                                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                wxPushLogDO.setCreateTime(new Date());
                                wxPushLogDO.setOpenid(json.getString("openId"));
                                wxPushLogDO.setReceiver(null);
                                wxPushLogDO.setWechatId(wechatId);
                                wxPushLogDO.setReceiverName(null);
                                wxPushLogDO.setScene(null);
                                wxPushLogDao.save(wxPushLogDO);
                            }
                        }
                    }
                } else {
                    // 返回消息(图文消息)
                    response.setHeader("Content-type", "text/html;charset=UTF-8");
                    //这句话的意思,是告诉servlet用UTF-8转码,而不是用默认的ISO8859
                    response.setCharacterEncoding("UTF-8");
                    response.getWriter().print(null);
                }
            } else {
                // 验证失败
                response.setStatus(401);
            }
        } catch (Exception e) {
            e.printStackTrace();
            // 服务器错误
            response.setStatus(500);
        }
    }*/
    /**
     * 接收居民微信回复的消息
     *
     * @return
     */
    @RequestMapping(method = RequestMethod.POST)
    @ResponseBody
    public void receiveMessages(HttpServletRequest request, HttpServletResponse response) {
        try {
            String signature = request.getParameter("signature").toString();
            String timestamp = request.getParameter("timestamp").toString();
            String nonce = request.getParameter("nonce").toString();
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (validate(signature, timestamp, nonce)) {
                String xmlStr = weiXinCoreService.messageProcess(request, wxAccessTokenDO.getAccessToken());
                // 判断返回值是xml、json格式(取关是空串)
                Boolean flag = weiXinCoreService.isXML(xmlStr);
                if (xmlStr == "error") {
                    // 服务器错误
                    response.setStatus(500);
                } else if (!flag && StringUtils.isNotEmpty(xmlStr)) {
                    JSONObject json = new JSONObject(xmlStr);
                    if (json.has("openId")) {
                        if (StringUtils.isNotEmpty(json.getString("openId")) && !("undefined".equals(json.getString("openId")))) {
                            logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+json.getString(""));
                            WxTemplateConfigDO wxTemplateConfigDO = new WxTemplateConfigDO();
                            wxTemplateConfigDO.setRemark(json.toString());
                            weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), json.getString("openId"), wxTemplateConfigDO);
                            logger.info("发送成功");
                        }
                    }
                } else {
                    // 返回消息(图文消息)
                    response.setHeader("Content-type", "text/html;charset=UTF-8");
                    //这句话的意思,是告诉servlet用UTF-8转码,而不是用默认的ISO8859
                    response.setCharacterEncoding("UTF-8");
                    logger.info(xmlStr);
                    response.getWriter().print(xmlStr);
                }
            } else {
                // 验证失败
                response.setStatus(401);
            }
        } catch (Exception e) {
            e.printStackTrace();
            // 服务器错误
            response.setStatus(500);
        }
    }
     /*
     * 微信推送消息验证
     *
     * @param signature
     * @param timestamp
     * @param nonce
     * @return
     * @throws NoSuchAlgorithmException
     */
    private boolean validate(String signature, String timestamp, String nonce) throws NoSuchAlgorithmException {
        String token = this.wechat_token;
        // 字典序排序
        String[] array = new String[]{token, timestamp, nonce};
        Arrays.sort(array);
        //连接字典序排序后字符串
        String content = "";
        for (String str : array) {
            content += str;
        }
        // 解析
        MessageDigest md = MessageDigest.getInstance("SHA-1");
        String decodeStr = "";
        byte[] bytes = md.digest(content.getBytes());
        decodeStr = byteToStr(bytes);
        if (StringUtils.isNotEmpty(decodeStr) && decodeStr.equals(signature.toUpperCase())) {
            return true;
        } else {
            return false;
        }
    }
    /*
     * 将字节数组转换为字符串
     *
     * @param byteArray
     * @return
    */
    private static String byteToStr(byte[] byteArray) {
        String strDigest = "";
        for (int i = 0; i < byteArray.length; i++) {
            strDigest += byteToHexStr(byteArray[i]);
        }
        return strDigest;
    }
    /*
     * 将字节转换为字符
     *
     * @param mByte
     * @return
     */
    private static String byteToHexStr(byte mByte) {
        char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
        char[] tempArr = new char[2];
        tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
        tempArr[1] = Digit[mByte & 0X0F];
        String s = new String(tempArr);
        return s;
    }
}

+ 79 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/wechat/WechatMenuController.java

@ -0,0 +1,79 @@
package com.yihu.jw.care.endpoint.wechat;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
/**
 * Created by chenweida on 2017/8/4.
 */
@Controller
@RequestMapping(value = "/wechat/menu", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "微信菜单相关管理")
public class WechatMenuController extends EnvelopRestEndpoint {
    private Logger logger= LoggerFactory.getLogger(WechatMenuController.class);
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Value("${wechat.id}")
    private String wechatId;
    /**
     * 微信菜单创建
     *
     * @return
     */
    @ApiOperation(value = "微信菜单创建")
    @RequestMapping(value = "/menu/create", method = RequestMethod.GET)
    public String createMenuTest() {
        try {
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            String filePath = "/usr/local/hospital/weixin_menu.txt";
            logger.info("filePath"+filePath);
            String url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + wxAccessTokenDO.getAccessToken();
            // 读取微信菜单配置文件
            InputStreamReader reader = new InputStreamReader(new FileInputStream(filePath), "utf-8");
            BufferedReader bufferedReader = new BufferedReader(reader);
            String params = "";
            String readTxt = "";
            // 读取微信菜单
            while ((readTxt = bufferedReader.readLine()) != null) {
                System.out.println(readTxt);
                params += readTxt;
            }
            bufferedReader.close();
            reader.close();
            // 请求微信接口创建菜单
            String jsonStr = HttpUtil.sendPost(url, params);
            logger.info("日志"+jsonStr);
            JSONObject result = new JSONObject(jsonStr);
            if (result != null && result.get("errcode").toString().equals("0") && result.getString("errmsg").equals("ok")) {
                return  "创建成功!";
            } else {
                return "创建失败!";
            }
        } catch (Exception e) {
            return  "创建失败";
        }
    }
}

+ 138 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ArchiveService.java

@ -0,0 +1,138 @@
package com.yihu.jw.care.service.sign;
import com.yihu.jw.care.dao.sign.ArchiveDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * Created by yeshijie on 2021/2/24.
 */
@Service
public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
    @Autowired
    private ArchiveDao archiveDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 获取医生未签约总数
     * @param doctorId
     * @return
     */
    public int getUnSignTotal(String doctorId){
        String sql = "SELECT COUNT(*) from wlyy_archive WHERE doctor_code = '"+doctorId+"' and sign_status = 0 " ;
        return jdbcTemplate.queryForObject(sql,Integer.class);
    }
    public PageEnvelop<List<Map<String,Object>>> archiveList(String doctorId, int page, int size,Integer signStatus){
        String sql = "SELECT a.archive_time,p.idcard,p.mobile,p.name,p.sex,p.id ";
        String countSql = "SELECT count(*) ";
        String filters = "from wlyy_archive a,base_patient p " +
                "WHERE a.doctor_code = '"+doctorId+"' and a.patient = p.id";
        if(signStatus!=null){
            filters += " and a.sign_status = "+signStatus;
        }
        String orderBy = " ORDER BY a.archive_time DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map :list){
            String idcard = map.get("idcard").toString();
            map.put("archiveTime", map.get("archive_time").toString().substring(0,19));
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
        }
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
    /**
     * 建档,生成居民账户
     * @param patientDO
     * @param doctorId
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public int createArchive(BasePatientDO patientDO,String doctorId){
        String idcard = patientDO.getIdcard();
        String salt = UUID.randomUUID().toString().substring(0,5);
        String pw = idcard.substring(idcard.length()-6);
        patientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
        patientDO.setSalt(salt);
        patientDO.setDel("1");
        patientDO.setEnabled(1);
        patientDO.setLocked(0);
        patientDO.setCreateTime(new Date());
        patientDO.setUpdateTime(new Date());
        patientDO.setPatientStatus("1");
        patientDao.save(patientDO);
        PatientMedicareCardDO cardDO = new PatientMedicareCardDO();
        cardDO.setCode(patientDO.getSsc());
        cardDO.setDel("1");
        cardDO.setPatientCode(patientDO.getId());
        cardDO.setType("A_01");
        cardDO.setParentType("A");
        patientMedicareCardDao.save(cardDO);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        ArchiveDO archiveDO = new ArchiveDO();
        archiveDO.setArchiveOperatorName(doctorDO.getName());
        archiveDO.setArchiveTime(new Date());
        archiveDO.setDoctorCode(doctorId);
        archiveDO.setPatient(patientDO.getId());
        archiveDO.setSickName(patientDO.getName());
        archiveDO.setSignStatus(0);
        archiveDO.setIdcard(patientDO.getIdcard());
        archiveDao.save(archiveDO);
        return 0;
    }
    /**
     * 同步档案
     */
    public void sysArchive(String doctorId,String idcard){
        BasePatientDO patientDO = patientDao.findByIdcardAndDel(idcard,"1");
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        ArchiveDO archiveDO = new ArchiveDO();
        archiveDO.setArchiveOperatorName(doctorDO.getName());
        archiveDO.setArchiveTime(new Date());
        archiveDO.setDoctorCode(doctorId);
        archiveDO.setPatient(patientDO.getId());
        archiveDO.setSickName(patientDO.getName());
        archiveDO.setSignStatus(0);
        archiveDO.setIdcard(patientDO.getIdcard());
        archiveDao.save(archiveDO);
    }
}

+ 125 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -0,0 +1,125 @@
package com.yihu.jw.care.service.sign;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.sign.CapacityAssessmentRecordDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/2/25.
 */
@Service
public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAssessmentRecordDO, CapacityAssessmentRecordDao> {
    @Autowired
    private CapacityAssessmentRecordDao capacityAssessmentRecordDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    public PageEnvelop<List<Map<String,Object>>> assessmentPage(String doctorId,String name, int page, int size,
                    Integer status,Integer levelConclusion,Integer servicePackageStatus){
        String sql = "SELECT c.id,c.patient,c.assessment_time,c.service_package_status servicePackageStatus, " +
                "c.`status`,c.level_conclusion levelConclusion,p.name,p.phone,p.sex,p.idcard  ";
        String countSql = "SELECT count(*) ";
        String filters = "from base_capacity_assessment_record c,base_patient p " +
                "WHERE c.doctor = '"+doctorId+"' c.patient = p.id " +
                " and c.assessment_time>='" + DateUtil.getNowYear() + "-01-01'";
        if(status!=null){
            filters += " and c.status = "+status;
        }
        if(levelConclusion!=null){
            filters += " and c.level_conclusion = "+levelConclusion;
        }
        if(servicePackageStatus!=null){
            filters += " and c.service_package_status = "+servicePackageStatus;
        }
        if(!StringUtil.isEmpty(name)){
            filters += " and (c.name like '%"+name+"%' or c.idcard like '%"+name+"%'";
        }
        String orderBy = " ORDER BY c.assessment_time DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map :list){
            String idcard = map.get("idcard").toString();
            map.put("assessmentTime", map.get("assessment_time").toString().substring(0,19));
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
        }
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
    /**
     * 查询居民今年是否进行过能力评估
     * @param patient
     * @return
     */
    public Integer isCapacityAssessment(String patient){
        String sql = "select count(*) from base_capacity_assessment_record where patient = '"+patient+"' and ";
        sql += " assessment_time>= '" + DateUtil.getNowYear() + "-01-01'";
        Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
        return count;
    }
    /**
     * 生成评估报告
     * @param jsonData
     * @param doctorId
     * @throws Exception
     */
    public void capacityAssessment(String jsonData,String doctorId) throws Exception{
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        CapacityAssessmentRecordDO recordDO = objectMapper.readValue(jsonObject.getJSONObject("assessment").toJSONString(), CapacityAssessmentRecordDO.class);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctorId);
        recordDO.setOrgCode(doctorHospitalDOs.get(0).getOrgCode());
        recordDO.setOrgName(doctorHospitalDOs.get(0).getOrgName());
        recordDO.setDoctorName(doctorDO.getName());
        recordDO.setDoctor(doctorId);
        recordDO.setServicePackageStatus(0);
        recordDO.setStatus(0);
        capacityAssessmentRecordDao.save(recordDO);
    }
    /**
     * 确认评估结果
     * @param signUrl
     * @param status
     * @param id
     */
    public void confirmAssessment(String signUrl,Integer status,String id){
        CapacityAssessmentRecordDO recordDO = capacityAssessmentRecordDao.findOne(id);
        recordDO.setStatus(status);
        recordDO.setSignUrl(signUrl);
        recordDO.setSignTime(new Date());
        capacityAssessmentRecordDao.save(recordDO);
    }
}

+ 21 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageItemService.java

@ -0,0 +1,21 @@
package com.yihu.jw.care.service.sign;
import com.yihu.jw.care.dao.sign.ServicePackageItemDao;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by yeshijie on 2021/2/23.
 */
@Service
public class ServicePackageItemService extends BaseJpaService<ServicePackageItemDO, ServicePackageItemDao> {
    @Autowired
    private ServicePackageItemDao servicePackageItemDao;
}

+ 24 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageRecordService.java

@ -0,0 +1,24 @@
package com.yihu.jw.care.service.sign;
import com.yihu.jw.care.dao.sign.ServicePackageRecordDao;
import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
/**
 * Created by yeshijie on 2021/2/25.
 */
@Service
public class ServicePackageRecordService extends BaseJpaService<ServicePackageRecordDO, ServicePackageRecordDao> {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ServicePackageRecordDao servicePackageRecordDao;
}

+ 235 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -0,0 +1,235 @@
package com.yihu.jw.care.service.sign;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.sign.*;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 *
 * @author yeshijie on 2018/8/17.
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class ServicePackageService extends BaseJpaService<ServicePackageDO, ServicePackageDao> {
    private Logger logger = LoggerFactory.getLogger(ServicePackageService.class);
    @Autowired
    private ServicePackageDao servicePackageDao;
    @Autowired
    private ServicePackageItemDao servicePackageItemDao;
    @Autowired
    private ServicePackageSignRecordDao servicePackageSignRecordDao;
    @Autowired
    private ServicePackageRecordDao servicePackageRecordDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private ArchiveDao archiveDao;
    /**
     * 获取签约明细
     * @param id
     */
    public JSONObject signDetail(String id){
        JSONObject json = new JSONObject();
        ServicePackageSignRecordDO signRecordDO = servicePackageSignRecordDao.findOne(id);
        BasePatientDO patientDO = patientDao.findById(signRecordDO.getPatient());
        List<Map<String,Object>> packageList = fingdBySignId(id);
        json.put("patient",patientDO);
        json.put("signRecordDO",signRecordDO);
        List<Map<String,Object>> doctorList = fingdDoctorBySignId(id,"generalDoctor");
        List<Map<String,Object>> helperList = fingdDoctorBySignId(id,"helper");
        String doctorInfo = "";
        String helperInfo = "";
        if(doctorList.size()>0){
            doctorInfo = doctorList.get(0).get("name").toString()+"等"+doctorList.size()+"名";
        }
        if(helperList.size()>0){
            helperInfo = doctorList.get(0).get("name").toString()+"等"+helperList.size()+"名";
        }
        json.put("doctorInfo",doctorInfo);
        json.put("helperInfo",helperInfo);
        return json;
    }
    /**
     * 根据签约记录查找医生/助老员
     * @param signId
     */
    public List<Map<String,Object>> fingdDoctorBySignId(String signId,String role){
        String sql = "SELECT DISTINCT d.id,d.name from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m,base_doctor d,base_doctor_role dr " +
                "WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code " +
                "and m.del = '1' and d.id = dr.doctor_code and dr.role_code = '"+role+"' " +
                "and sr.id = '"+signId+"' ";
        return jdbcTemplate.queryForList(sql);
    }
    /**
     * 根据签约记录查找服务包
     * @param signId
     */
    public List<Map<String,Object>> fingdBySignId(String signId){
        String sql = "SELECT DISTINCT p.id,p.`name` from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package p " +
                "WHERE sr.id = r.sign_id and  p.id = r.service_package_id and p.del = 1 " +
                "and sr.id = '"+signId+"' ";
        return jdbcTemplate.queryForList(sql);
    }
    /**
     * 签约记录
     * @param name
     * @param doctorId
     * @param page
     * @param size
     * @return
     */
    public PageEnvelop<List<Map<String,Object>>> signRecordPage(String name,String doctorId,int page, int size){
        String sql = "SELECT DISTINCT sr.patient,sr.id,sr.start_time,p.name,p.sex,p.idcard,p.openid,p.photo ";
        String countSql = "SELECT count(DISTINCT sr.patient) ";
        String filters = " from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m,base_patient p " +
                "WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code and p.id = sr.patient " +
                "and m.doctor_code = '"+doctorId+"' and m.del = '1' ";
        if(!StringUtil.isEmpty(name)){
            filters += " sr.name like '%"+name+"%' ";
        }
        String orderBy = " ORDER BY sr.start_time DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map :list){
            String id = map.get("id").toString();
            List<Map<String,Object>> servicePackageList = fingdBySignId(id);
            map.put("servicePackageList",servicePackageList);
            String idcard = map.get("idcard").toString();
            map.put("age", IdCardUtil.getAgeForIdcard(idcard));
        }
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
    /**
     * 获取医生签约总数
     * @param doctorId
     * @return
     */
    public int getSignTotal(String doctorId){
        String sql = "SELECT COUNT(DISTINCT sr.patient) from base_service_package_sign_record sr,base_service_package_record r, " +
                "base_service_package_item i,base_team_member m " +
                "WHERE sr.id = r.sign_id and r.service_package_id = i.service_package_id " +
                "and i.del = 1 and m.team_code = i.team_code " +
                "and m.doctor_code = '"+doctorId+"' and m.del = '1' ";
        return jdbcTemplate.queryForObject(sql,Integer.class);
    }
    /**
     * 签约分配服务包
     * @param jsonData
     * @param doctorId
     */
    @Transactional(rollbackFor = Exception.class)
    public void servicePackageSign(String jsonData,String doctorId) throws Exception{
        ServicePackageSignRecordDO signRecordDO = objectMapper.readValue(jsonData, ServicePackageSignRecordDO.class);
        List<ServicePackageRecordDO> recordDOList = signRecordDO.getRecordDOList();
        String signId = signRecordDO.getId();
        if(StringUtil.isEmpty(signId)){
            List<ServicePackageSignRecordDO> signRecordDOs = servicePackageSignRecordDao.findByStatusAndPatient(1,signRecordDO.getPatient());
            if(signRecordDOs.size()==0){
                BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
                //需要新增签约记录
                signRecordDO.setStatus(1);
                signRecordDO.setStartTime(new Date());
                Calendar cal = Calendar.getInstance();
                cal.add(Calendar.YEAR,1);
                signRecordDO.setEndTime(cal.getTime());
                signRecordDO.setSignDoctor(doctorId);
                signRecordDO.setSignDoctorName(doctorDO.getName());
                servicePackageSignRecordDao.save(signRecordDO);
                signId = signRecordDO.getId();
                //建档状态修改
                ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(signRecordDO.getPatient(),doctorId);
                if(archiveDO!=null){
                    archiveDO.setSignStatus(1);
                    archiveDao.save(archiveDO);
                }
            }else{
                signId = signRecordDOs.get(0).getId();
            }
        }
        for (ServicePackageRecordDO recordDO:recordDOList){
            recordDO.setPatient(signRecordDO.getPatient());
            recordDO.setSignId(signId);
        }
        servicePackageRecordDao.save(recordDOList);
    }
    public PageEnvelop<List<Map<String,Object>>> servicePackagePage(int page, int size){
        String sql = "SELECT p.id,p.`name`,p.type,p.introduce,p.num  ";
        String countSql = "SELECT count(*) ";
        String filters = "from base_service_package p " +
                "WHERE p.del = 1 ";
        String orderBy = " ORDER BY p.create_time DESC " +
                "LIMIT "+ (page - 1) * size + "," + size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
        for (Map<String,Object> map :list){
            String id = map.get("id").toString();
            List<ServicePackageItemDO> itemDOList = servicePackageItemDao.findByServicePackageId(id);
            if(itemDOList.size()>0){
                map.put("detail",itemDOList.get(0).getName()+"等"+itemDOList.size()+"项服务");
            }else{
                map.put("detail","");
            }
        }
        Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
    }
}

+ 15 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageSignRecordService.java

@ -0,0 +1,15 @@
package com.yihu.jw.care.service.sign;
import com.yihu.jw.care.dao.sign.ServicePackageSignRecordDao;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 *
 * @author yeshijie on 2018/8/17.
 */
@Service
public class ServicePackageSignRecordService extends BaseJpaService<ServicePackageSignRecordDO, ServicePackageSignRecordDao> {
}

+ 105 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinCoreService.java

@ -0,0 +1,105 @@
package com.yihu.jw.care.service.wechat;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by lyr on 2016/08/11.
 */
@Service
public class WeiXinCoreService {
    private Logger logger= LoggerFactory.getLogger(WeiXinCoreService.class);
    @Autowired
    private WeiXinEventProcess weiXinEventProcess;
    /**
     * 微信推送消息处理
     *
     * @param request
     * @param accessToken
     */
    public String messageProcess(HttpServletRequest request, String accessToken) {
        try (InputStream inputStream = request.getInputStream()){
            String returnStr = "";
            // 将解析结果存储在HashMap中
            Map<String, String> message = new HashMap();
            // 从request中取得输入流
            // 读取输入流
            SAXReader reader = new SAXReader();
            Document document = reader.read(inputStream);
            // 得到xml根元素
            Element root = document.getRootElement();
            // 得到根元素的所有子节点
            List elementList = root.elements();
            // 遍历所有子节点
            for (Object e : elementList) {
                Element ele = (Element) e;
                message.put(ele.getName(), ele.getText());
            }
//            logger.info("weixin  event:" + message.toString());
            // 添加access_token参数
            message.put("token", accessToken);
            // 消息处理
            returnStr = messageProcess(message);
            return returnStr;
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }
    /**
     * 对接收到的消息进行处理
     *
     * @param message
     * @return
     */
    private String messageProcess(Map<String, String> message) throws Exception {
        String msgType = message.get("MsgType");
        String result = "";
        switch (msgType) {
            case WeiXinMessageUtils.REQ_MESSAGE_TYPE_EVENT:  // 事件消息
                result = weiXinEventProcess.eventProcess(message);
                break;
            case WeiXinMessageUtils.RESP_MESSAGE_TYPE_TEXT:  // 回复文本消息
                String content = message.get("Content");
                break;
            default:
                break;
        }
        return result;
    }
    /**
     * 判断是否是xml结构
     */
    public boolean isXML(String value) {
        try {
            DocumentHelper.parseText(value);
        } catch (DocumentException e) {
            return false;
        }
        return true;
    }
}

+ 126 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinEventProcess.java

@ -0,0 +1,126 @@
package com.yihu.jw.care.service.wechat;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.util.wechat.WeiXinMessageReplyUtils;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import org.apache.commons.lang3.StringUtils;
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.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 微信事件处理
 * <p>
 * Created by lyr on 2016/08/11
 */
@Component
public class WeiXinEventProcess {
    private static Logger logger = LoggerFactory.getLogger(WeiXinEventProcess.class);
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    /**
     * 微信推送事件处理
     *
     * @param message
     * @return
     */
    public String eventProcess(Map<String, String> message) throws Exception {
        String result = "";
        String event = message.get("Event");
        switch (event) {
            case WeiXinMessageUtils.EVENT_TYPE_SCAN: // 扫描二维码事件
                result = scanEventProcess(message);
                break;
            case WeiXinMessageUtils.EVENT_TYPE_SUBSCRIBE: // 订阅事件
                if (message.containsKey("EventKey") && StringUtils.isNotEmpty(message.get("EventKey")) && message.containsKey("Ticket")
                        && StringUtils.isNotEmpty(message.get("Ticket"))) {
                    result = scanEventProcess(message);
                } /*else {
                    result = subscribeEventProcess(message);
                }*/
                break;
            /*case WeiXinMessageUtils.EVENT_TYPE_UNSUBSCRIBE: // 取消订阅事件
                 result = unsubscribeEventProcess(message);
                break;
            case WeiXinMessageUtils.EVENT_TYPE_CLICK: //菜单点击
                result = this.clickProcess(message);*/
            default:
                break;
        }
        return result;
    }
    /**
     * 微信扫码事件处理(封装图文消息体)
     *
     * @param message
     * @return
     * @throws Exception
     */
    private String scanEventProcess(Map<String, String> message) throws Exception {
        String result = "";
        // 场景值
        String eventKey = message.get("EventKey");
        if (StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("doctor_"))) {
            // 图文信息
            List<Map<String, String>> articles = new ArrayList<>();
            Map<String, String> article = new HashMap<>();
            // 二维码参数
            String[] keys = eventKey.replace("doctor_", "").split("_");
            // 图片URL
            String picUrl = "";
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(keys[0]);
            String url = null;
            if (null!=baseDoctorDO){
                picUrl = baseDoctorDO.getPhoto();
            }
            // 医生二维码跳转URL
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                url = "https://intel.yanketong.com/ims-wx/#/doctorInfo?doctorCode="+keys[0];
                picUrl = "https://intel.yanketong.com/"+picUrl;
                article.put("Url", url);
                article.put("Title", keys[1] + "医生个人诊间");
                article.put("Description", "厦门眼科中心医院互联网医院");
                article.put("PicUrl", picUrl);
                articles.add(article);
            }else {
                article.put("Url", url);
                article.put("Title", keys[1] + "医生个人诊间");
                article.put("Description", "海沧医院互联网医院");
                article.put("PicUrl", picUrl);
                articles.add(article);
            }
            // 图文消息URL
            //图片地址
//            picUrl = picUrl.replace("{server}", serverUrl);
            // 消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }
        return result;
    }
}

+ 90 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/useragent/UserAgent.java

@ -0,0 +1,90 @@
package com.yihu.jw.care.useragent;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
 * 用户头部信息获取
 * Created by Trick on 2018/10/30.
 */
@Component
public class UserAgent {
    /**
     * 获取当前登录人ID
     * @return
     */
    public String getUID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("uid");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取登录人姓名
     * @return
     */
    public String getUNAME(){
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            String info = json.getString("uname");
            String uname = java.net.URLDecoder.decode(info,"UTF-8");
            return uname;
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取角色ID
     * @return
     */
    public String getROLEID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("roleid");
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getUserAgent(){
        try{
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            JSONObject user = JSON.parseObject(userAgent);
            return user;
        }catch (Exception e){
            return null;
        }
    }
}

+ 333 - 0
svr/svr-cloud-care/src/main/resources/application.yml

@ -0,0 +1,333 @@
#通用的配置不用区分环境变量
server:
  port: 10301
spring:
  aop:
    proxy-target-class: true
  datasource:
    max-active: 200
    max-idle: 200 #最大空闲连接
    min-idle: 10 #最小空闲连接
    validation-query-timeout: 20
    log-validation-errors: true
    validation-interval: 60000 #避免过度验证,保证验证不超过这个频率——以毫秒为单位。如果一个连接应该被验证,但上次验证未达到指定间隔,将不再次验证。
    validation-query: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
    test-on-borrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
    test-on-return: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
    idle-timeout: 20000
    connection-test-query: SELECT 1
    num-tests-per-eviction-run: 200 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
    test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  http:
    multipart:
      max-file-size: 30MB
      max-request-size: 100MB
#      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.
    password: # Login password of the redis server.
    timeout: 120000 # 连接超时时间(毫秒) 60秒
    pool:
      max-active: 20 # 连接池最大连接数(使用负值表示没有限制)
      max-wait: -1  # 连接池最大阻塞等待时间(使用负值表示没有限制)
      max-idle: 20  # 连接池中的最大空闲连接
      min-idle: 5  # 连接池中的最小空闲连接
  mail:
    default-encoding: UTF-8
#端口
    port: 25
#协议
    protocol: smtp
    properties.mail.smtp.auth: true
    properties.mail.smtp.starttls.enable: true
    properties.mail.smtp.starttls.required: true
    host: smtp.163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#发送者的邮箱账号
    username: i_jiankang@163.com
es:
  index:
    servicePackLog: base_service_package_log
  type:
    servicePackLog: base_service_package_log
fast-dfs:
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  charset: ISO8859-1 #编码
  http:
    tracker-http-port: 80
    anti-steal-token: no
    secret-key: FastDFS1234567890
  pool: #连接池大小
    init-size: 5
    max-size: 20
    wait-time: 500
configDefault: # 默认配置
  saasId: xmjkzl_saasId
---
spring:
  profiles: jwdev
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.26.0.114/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: root
    password: jkzlehr
#  elasticsearch:
#    cluster-name: jkzl #集群名 默认elasticsearch
#    cluster-nodes: 172.26.0.115:9300,172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#    client-transport-sniff: false
#    jest:
#      uris: http://172.26.0.112:9200,http://172.26.0.112:9200
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.26.0.116:61616
    user: admin
    password: admin
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
#  zipkin:
#    base-url: http://localhost:9411 #日志追踪的地址
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
# 短信发送地址
jw:
  smsUrl: http://svr-base:10020/sms_gateway/send
myFamily:
  qrCodeFailurTime: 2
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
    Statistics: hlw_quota_test
  host:  http://172.26.0.112:9200
  tHost: 172.26.0.112:9300
  clusterName: jkzl
  securityUser: elastic:elastic
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
qywx:
  url: 2
  id: 2
express:
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
  profiles: jwtest
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.26.0.104/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: ssgg
    password: ssgg@jkzl2019
#  elasticsearch:
#    cluster-name: jkzl #集群名 默认elasticsearch
#    cluster-nodes: 172.26.0.115:9300,172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#    client-transport-sniff: false
#    jest:
#      uris: http://172.26.0.112:9200,http://172.26.0.112:9200
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.26.0.116:61616
    user: admin
    password: admin
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
myFamily:
  qrCodeFailurTime: 2
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_test
  type:
    Statistics: hlw_quota_test
  host:  http://172.26.0.55:9000
  tHost: 172.26.0.55:9300
  clusterName: jkzl
  securityUser: lion:jkzlehr
  user: lion
  password: jkzlehr
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wlyy:
  url: http://ehr.yihu.com/wlyy/
qywx:
  url: 2
  id: 1
express:
  sf_url: http://mrds-admin-ci.sit.sf-express.com:45478
  sf_code: HD000001
  sf_check_word: AAAABBBBCCCCDDDD
---
spring:
  profiles: jwprod
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.16.1.42:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: im
    password: 2oEq3Kf7
#  elasticsearch:
#    cluster-name: jkzl #集群名 默认elasticsearch
#    cluster-nodes: 192.0.33.26:9200 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#    client-transport-sniff: false
#    jest:
#      uris: http://192.0.33.26:9300
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://59.61.92.90:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 192.0.33.26 # Redis server host.
    port: 6390 # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: https://hlwyy.xmzsh.com/fastdfs/
fast-dfs:
  tracker-server: 192.0.33.26:22122 #服务器地址
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: false #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP #todo 待配置
myFamily:
  qrCodeFailurTime: 2
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.16.1.42:3000/
  data_base_name: im
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_prod
  type:
    Statistics: hlw_quota_prod
  host:  http://192.0.33.26:9200
  tHost: 192.0.33.26:9300
  clusterName: jkzl
  user: lion
  password: jkzlehr
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
qywx:
  url: https://hlwyy.xmzsh.com/hlwyy
  id: zsyy
express:
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000102
  sf_check_word: TGUQASFNAZyjt9112

+ 6 - 0
svr/svr-cloud-care/src/main/resources/banner.txt

@ -0,0 +1,6 @@
                               .__                   .___
  _________  _________    ____ |  |   ____  __ __  __| _/   ____ _____ _______   ____
 /  ___/\  \/ /\_  __ \ _/ ___\|  |  /  _ \|  |  \/ __ |  _/ ___\\__  \\_  __ \_/ __ \
 \___ \  \   /  |  | \/ \  \___|  |_(  <_> )  |  / /_/ |  \  \___ / __ \|  | \/\  ___/
/____  >  \_/   |__|     \___  >____/\____/|____/\____ |   \___  >____  /__|    \___  >
     \/                      \/                       \/       \/     \/            \/

+ 31 - 0
svr/svr-cloud-care/src/main/resources/bootstrap.yml

@ -0,0 +1,31 @@
spring:
  application:
    name:  svr-cloud-care
  cloud:
    config:
      failFast: true
      username: jw
      password: jkzl
---
spring:
  profiles: jwdev
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwtest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwprod
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}

BIN
svr/svr-cloud-care/src/main/resources/image/d-male.png


BIN
svr/svr-cloud-care/src/main/resources/image/p-female.png


+ 60 - 0
svr/svr-cloud-care/src/main/resources/wechat/weixin_menu.txt

@ -0,0 +1,60 @@
{
"button":[
   {
	  "name":"掌上医院",
	  "type":"view",
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FzsIndex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
   },
   {
	  "name":"就医问诊",
	  "sub_button":[
		 {
         		"type":"view",
         		"name":"预约挂号",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2Fappointment%2FhospitalList&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
            	"type":"view",
         	    "name":"充值缴费",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FmedicalCard%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
                "type":"view",
               	"name":"专家咨询",
               	"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FnDocList%3Fzjzx%3D2&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
                "type":"view",
                "name":"在线复诊",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FnDocList%3FisFz%3D1&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         }
	  ]
   },
   {
	  "name":"我",
	  "sub_button":[
		 {
                "type":"view",
                "name":"个人中心",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2Fpersonal%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
        		"type":"view",
        		"name":"APP下载",
        		"url":"http://www.yanketong.com/app/yk.htm"
         },
         {
                "type":"view",
                "name":"报告查询",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FonlineCheck%2Findex&response_type=code&scope=snsapi_base&state=1#wechat_redirect"
         },
         {
               	"type":"view",
                "name":"家庭成员管理",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FfamilyControl%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         }
	 ]
  }
]
}