Преглед изворни кода

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

yeshijie пре 6 година
родитељ
комит
22ddb8e52a
72 измењених фајлова са 1703 додато и 305 уклоњено
  1. 7 7
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java
  2. 6 6
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  3. 12 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java
  4. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java
  5. 91 28
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  6. 93 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java
  7. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasModuleFunctionDO.java
  8. 25 13
      common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamDO.java
  9. 16 16
      common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamMemberDO.java
  10. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java
  11. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java
  12. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java
  13. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java
  14. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java
  15. 3 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  16. 7 7
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictHospitalDeptVO.java
  17. 16 4
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorHospitalVO.java
  18. 8 8
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorVO.java
  19. 97 26
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/BasePatientVO.java
  20. 2 2
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasModuleFunctionVO.java
  21. 21 7
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/team/BaseTeamVO.java
  22. 9 0
      common/common-util/src/main/java/com/yihu/jw/util/excel/ExcelUtil.java
  23. 16 4
      sql/init.sql
  24. 2 2
      svr/svr-base/doc/es/服务包执行日志记录索引.txt
  25. 5 3
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/dict/DictHospitalDeptDao.java
  26. 25 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java
  27. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorHospitalDao.java
  28. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java
  29. 9 4
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/OrgTreeDao.java
  30. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/BasePatientDao.java
  31. 15 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/PatientMedicareCardDao.java
  32. 8 1
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamDao.java
  33. 8 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamMemberDao.java
  34. 10 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/populationBatchImport/PopulationMsg.java
  35. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/populationBatchImport/PopulationMsgReader.java
  36. 8 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictHospitalDeptEndpoint.java
  37. 59 11
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java
  38. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java
  39. 24 23
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java
  40. 12 5
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/population/BasePopulationEndpoint.java
  41. 22 6
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/team/BaseTeamEndpoint.java
  42. 44 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java
  43. 124 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  44. 46 9
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  45. 32 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTree.java
  46. 155 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTreeService.java
  47. 96 17
      svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/BasePatientService.java
  48. 39 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientMedicardCardService.java
  49. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/service/population/BasePopulationService.java
  50. 3 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasBusinessCardService.java
  51. 5 4
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java
  52. 81 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java
  53. 63 7
      svr/svr-base/src/main/java/com/yihu/jw/base/util/JavaBeanUtils.java
  54. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/business/login/service/BaseLoginAccountService.java
  55. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/business/login/service/LoginService.java
  56. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/service/SmsService.java
  57. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseMenuController.java
  58. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseRoleController.java
  59. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseMenuService.java
  60. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseRoleService.java
  61. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/EmployService.java
  62. 21 2
      svr/svr-base/src/main/resources/application.yml
  63. 222 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/analyzer/IotAnalyzerController.java
  64. 14 10
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/controller/DataInputController.java
  65. 63 19
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java
  66. 3 0
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataSearchService.java
  67. 6 0
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/util/ConstantUtils.java
  68. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java
  69. 1 1
      svr/svr-iot/src/main/resources/bootstrap.yml
  70. 2 2
      svr/svr-manage/src/main/resources/webapp/html/login/login.html
  71. 1 1
      svr/svr-manage/src/main/resources/webapp/html/system/role/html/userRole.html
  72. 2 2
      svr/svr-manage/src/main/resources/webapp/html/version/server/html/userVersion.html

+ 7 - 7
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java

@ -19,9 +19,9 @@ import java.util.Date;
public class DictHospitalDeptDO extends IntegerIdentityEntity {
    /**
	 * saas配置id,null标识公共字典
	 * 机构code,每个机构的科室不完全一样
	 */
	private String saasId;
	private String orgCode;
    /**
	 * 科室标识
@ -40,12 +40,12 @@ public class DictHospitalDeptDO extends IntegerIdentityEntity {
	private Date createTime;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
	@Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
	@Column(name = "code")

+ 6 - 6
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -39,7 +39,7 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    /**
	 * 性别(1男,2女) 用国家标准字典
	 */
	private String sex;
	private Integer sex;
    /**
	 * 医生专长
@ -125,7 +125,7 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    /**
	 * 是否是名医,1是,0否
	 */
	private String isFamous;
	private Integer isFamous;
    /**
	 * 是否提示设置密码  1 提示过 0未提示
@ -183,10 +183,10 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    }
	@Column(name = "sex")
    public String getSex() {
    public Integer getSex() {
        return sex;
    }
    public void setSex(String sex) {
    public void setSex(Integer sex) {
        this.sex = sex;
    }
@ -319,10 +319,10 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    }
	@Column(name = "is_famous")
    public String getIsFamous() {
    public Integer getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(String isFamous) {
    public void setIsFamous(Integer isFamous) {
        this.isFamous = isFamous;
    }

+ 12 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java

@ -53,6 +53,12 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
	 */
	private String jobTitleName;
    /**
     * 医生所在机构部门标识
     */
    private String deptCode;
    /**
	 * 作废标识,1正常,0作废
	 */
@ -138,6 +144,11 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
        this.createTime = createTime;
    }
    public String getDeptCode() {
        return deptCode;
    }
    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }
}

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

@ -1,10 +1,10 @@
package com.yihu.jw.entity.base.org;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**

+ 91 - 28
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -115,12 +115,43 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String streetName;
    /**
     * 居委会代码
     * 居住省代码
     */
    private String liveProvinceCode;
    /**
     * 居住省名称
     */
    private String liveProvinceName;
    /**
     * 居住市代码
     */
    private String liveCityCode;
    /**
     * 居住市名称
     */
    private String liveCityName;
    /**
     * 居住区县代码
     */
    private String liveTownCode;
    /**
     * 居住区县名称
     */
    private String liveTownName;
    /**
     * 居住居委会代码
     */
    private String committeeCode;
    /**
     * 居委会名称
     * 居住居委会名称
     */
    private String committeeName;
@ -166,16 +197,6 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date openidTime;
    /**
	 * 居委会代码
	 */
	private String sickVillage;
    /**
	 *
	 */
	private String sickVillageName;
    /**
	 * 绑定电子社保卡主体(共济为操作人code)
	 */
@ -222,6 +243,11 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
	 */
	private String del;
	/**
	 * 备注
	 */
	private String remark;
	@Column(name = "saas_id")
    public String getSaasId() {
@ -455,22 +481,6 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.openidTime = openidTime;
    }
	@Column(name = "sick_village")
    public String getSickVillage() {
        return sickVillage;
    }
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
	@Column(name = "sick_village_name")
    public String getSickVillageName() {
        return sickVillageName;
    }
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
	@Column(name = "principal_code")
    public String getPrincipalCode() {
        return principalCode;
@ -543,6 +553,59 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.del = del;
    }
    public String getRemark() {
        return remark;
    }
    @Column(name = "remark")
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getLiveProvinceCode() {
        return liveProvinceCode;
    }
    public void setLiveProvinceCode(String liveProvinceCode) {
        this.liveProvinceCode = liveProvinceCode;
    }
    public String getLiveProvinceName() {
        return liveProvinceName;
    }
    public void setLiveProvinceName(String liveProvinceName) {
        this.liveProvinceName = liveProvinceName;
    }
    public String getLiveCityCode() {
        return liveCityCode;
    }
    public void setLiveCityCode(String liveCityCode) {
        this.liveCityCode = liveCityCode;
    }
    public String getLiveCityName() {
        return liveCityName;
    }
    public void setLiveCityName(String liveCityName) {
        this.liveCityName = liveCityName;
    }
    public String getLiveTownCode() {
        return liveTownCode;
    }
    public void setLiveTownCode(String liveTownCode) {
        this.liveTownCode = liveTownCode;
    }
    public String getLiveTownName() {
        return liveTownName;
    }
    public void setLiveTownName(String liveTownName) {
        this.liveTownName = liveTownName;
    }
}

+ 93 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java

@ -0,0 +1,93 @@
package com.yihu.jw.entity.base.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* 居民信息(居民就是患者)实体
*
* @author Administrator on  2018年09月05日
*
*/
@Entity
@Table(name = "patient_medicare_card")
public class PatientMedicareCardDO extends IntegerIdentityEntity {
    public enum Type{
        medicareCard(0),
        healthCard(1);
        private int value;
        Type(int value){
            this.value = value;
        }
        public int getValue() {
            return value;
        }
    }
    /**
	 * 卡标识
	 */
	private String code;
    /**
	 * 卡类型,1-医保卡,2-电子健康卡
	 */
	private String type;
    /**
     * 医疗保险号
     */
	private String medicareNumber;
    /**
	 * 居民标识
	 */
	private String patientCode;
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "medicare_number")
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
    @Column(name = "patient_code")
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
}

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasModuleFunctionDO.java

@ -22,11 +22,11 @@
//    private String functionId;
//
//    @Column(name = "saas_id", nullable = false, length = 50)
//    public String getSaasId() {
//    public String getOrgCode() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//    public void setOrgCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 25 - 13
common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamDO.java

@ -18,9 +18,14 @@ import java.util.Date;
public class BaseTeamDO extends UuidIdentityEntityWithOperator {
    /**
     * 机构id
     * 机构代码
     */
    private String orgId;
    private String orgCode;
    /**
     * 机构名称
     */
    private String orgName;
    /**
     * 团队名称
@ -30,7 +35,7 @@ public class BaseTeamDO extends UuidIdentityEntityWithOperator {
    /**
     * 领导医生标识
     */
    private String leaderId;
    private String leaderCode;
    /**
     * 团队人数
@ -47,14 +52,21 @@ public class BaseTeamDO extends UuidIdentityEntityWithOperator {
     */
    private String del;
    public String getOrgCode() {
        return orgCode;
    }
    @Column(name = "org_id")
    public String getOrgId() {
        return orgId;
    @Column(name = "org_code")
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    @Column(name = "name")
@ -66,13 +78,13 @@ public class BaseTeamDO extends UuidIdentityEntityWithOperator {
        this.name = name;
    }
    @Column(name = "leader_id")
    public String getLeaderId() {
        return leaderId;
    @Column(name = "leader_code")
    public String getLeaderCode() {
        return leaderCode;
    }
    public void setLeaderId(String leaderId) {
        this.leaderId = leaderId;
    public void setLeaderCode(String leaderId) {
        this.leaderCode = leaderCode;
    }
    @Column(name = "team_num")

+ 16 - 16
common/common-entity/src/main/java/com/yihu/jw/entity/base/team/BaseTeamMemberDO.java

@ -20,17 +20,17 @@ public class BaseTeamMemberDO extends UuidIdentityEntityWithOperator {
    /**
	* 团队ID
	*/
    private String teamId;
    private String teamCode;
    /**
	* 机构标识
	*/
    private String orgId;
    private String orgCode;
    /**
	* 医生标识,多个医生以逗号分开
	*/
    private String doctorId;
    private String doctorCode;
    /**
	* 作废标识,1正常,0作废
@ -39,27 +39,27 @@ public class BaseTeamMemberDO extends UuidIdentityEntityWithOperator {
	@Column(name = "team_id")
    public String getTeamId() {
        return teamId;
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamId(String teamId) {
        this.teamId = teamId;
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
	@Column(name = "org_id")
    public String getOrgId() {
        return orgId;
	@Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
	@Column(name = "doctor_id")
    public String getDoctorId() {
        return doctorId;
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
	@Column(name = "del")

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java

@ -30,11 +30,11 @@
//    private String del;//1:有效;0:删除',
//
//
//    public String getSaasId() {
//    public String getOrgCode() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//    public void setOrgCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java

@ -28,11 +28,11 @@
//    private String teamCode;//团队code',
//
//
//    public String getSaasId() {
//    public String getOrgCode() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//    public void setOrgCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java

@ -28,11 +28,11 @@
//    private String article;//文章
//
//
//    public String getSaasId() {
//    public String getOrgCode() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//    public void setOrgCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java

@ -35,11 +35,11 @@
//    private String content;//咨询内容
//
//
//    public String getSaasId() {
//    public String getOrgCode() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//    public void setOrgCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java

@ -34,11 +34,11 @@
//    private String del;//1:有效;0:删除
//
//
//    public String getSaasId() {
//    public String getOrgCode() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//    public void setOrgCode(String saasId) {
//        this.saasId = saasId;
//    }
//

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

@ -377,6 +377,8 @@ public class BaseRequestMapping {
    public static class BaseDoctor extends Basic {
        public static final String PREFIX  = "/baseDoctor";
        public static final String DOCINFO  = "/docInfo";
        public static final String docFullInfo  = "/docFullInfo";
        public static final String docOrgTreeInfo  = "/docOrgTreeInfo";
    }
@ -495,6 +497,7 @@ public class BaseRequestMapping {
     */
    public static class DictHospitalDept extends Basic {
        public static final String PREFIX  = "/dictHospitalDept";
        public static final String queryDeptByOrg  = "/queryDeptByOrg";
    }

+ 7 - 7
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictHospitalDeptVO.java

@ -23,10 +23,10 @@ import java.util.Date;
public class DictHospitalDeptVO extends IntegerIdentityVO{
    /**
	 * saas配置id,null标识公共字典
	 * 机构code,每个机构的科室不完全一样
	 */
	@ApiModelProperty(value = "saas配置id,null标识公共字典", example = "402803ee656498890165649ad2da1112")
    private String saasId;
	@ApiModelProperty(value = "机构code", example = "402803ee656498890165649ad2da1112")
    private String orgCode;
    /**
	 * 科室标识
@ -48,11 +48,11 @@ public class DictHospitalDeptVO extends IntegerIdentityVO{
    private Date createTime;
    public String getSaasId() {
        return saasId;
    public String getOrgCode() {
        return orgCode;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getCode() {

+ 16 - 4
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorHospitalVO.java

@ -31,19 +31,19 @@ public class BaseDoctorHospitalVO extends IntegerIdentityVO{
    /**
	 * 医院名称
	 */
	@ApiModelProperty(value = "医院名称", example = "")
	@ApiModelProperty(value = "医院名称", example = "厦门市中医院")
    private String hospName;
    /**
	 * 医生角色标识
	 */
	@ApiModelProperty(value = "医生角色标识", example = "")
	@ApiModelProperty(value = "医生角色标识", example = "专科医生")
    private String roleCode;
    /**
	 * 医院角色名称
	 */
	@ApiModelProperty(value = "医院角色名称", example = "")
	@ApiModelProperty(value = "医生角色名称", example = "")
    private String roleName;
    /**
@ -55,9 +55,21 @@ public class BaseDoctorHospitalVO extends IntegerIdentityVO{
    /**
	 * 职称名称
	 */
	@ApiModelProperty(value = "职称名称", example = "")
	@ApiModelProperty(value = "职称名称", example = "副主任医师")
    private String jobTitleName;
    /**
     * 部门标识
     */
    @ApiModelProperty(value = "部门标识", example = "")
    private String deptCode;
    /**
     * 部门名称
     */
    @ApiModelProperty(value = "部门名称", example = "骨科专业")
    private String deptName;
    /**
	 * 作废标识,1正常,0作废
	 */

+ 8 - 8
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorVO.java

@ -43,8 +43,8 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
    /**
	 * 性别(1男,2女) 用国家标准字典
	 */
	@ApiModelProperty(value = "性别(1男,2女) 用国家标准字典", example = "1")
    private String sex;
	@ApiModelProperty(value = "性别(1男,2女,整型 用国家标准字典", example = "1")
    private Integer sex;
    /**
	 * 医生专长
@ -146,8 +146,8 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
    /**
	 * 是否是名医,1是,0否
	 */
	@ApiModelProperty(value = "是否是名医,1是,0否", example = "0")
    private String isFamous;
	@ApiModelProperty(value = "是否是名医,1是,0否,整型", example = "0")
    private Integer isFamous;
    /**
	 * 是否提示设置密码  1 提示过 0未提示
@ -207,10 +207,10 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
        this.name = name;
    }
    public String getSex() {
    public Integer getSex() {
        return sex;
    }
    public void setSex(String sex) {
    public void setSex(Integer sex) {
        this.sex = sex;
    }
@ -326,10 +326,10 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
        this.iscertified = iscertified;
    }
    public String getIsFamous() {
    public Integer getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(String isFamous) {
    public void setIsFamous(Integer isFamous) {
        this.isFamous = isFamous;
    }

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

@ -137,6 +137,43 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "街道名称", example = "某某街道")
    private String streetName;
    /**
     * 居住省代码
     */
    @ApiModelProperty(value = "居住省名称", example = "参考省代码")
    private String liveProvinceCode;
    /**
     * 居住省名称
     */
    @ApiModelProperty(value = "居住省名称", example = "参考省名称")
    private String liveProvinceName;
    /**
     * 居住市代码
     */
    @ApiModelProperty(value = "居住市代码", example = "参考市代码")
    private String liveCityCode;
    /**
     * 居住市名称
     */
    @ApiModelProperty(value = "居住市名称", example = "参考市名称")
    private String liveCityName;
    /**
     * 居住区县代码
     */
    @ApiModelProperty(value = "居住区县代码", example = "参考区县代码")
    private String liveTownCode;
    /**
     * 居住区县名称
     */
    @ApiModelProperty(value = "居住区县名称", example = "参考区县名称")
    private String liveTownName;
    /**
     * 居委会代码
     */
@ -198,18 +235,6 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
	@ApiModelProperty(value = "第一次添加open的时间", example = "yyyy-MM-dd HH:mm:ss")
    private Date openidTime;
    /**
	 * 居委会代码
	 */
	@ApiModelProperty(value = "居委会代码", example = "")
    private String sickVillage;
    /**
	 * 
	 */
	@ApiModelProperty(value = "", example = "")
    private String sickVillageName;
    /**
	 * 绑定电子社保卡主体(共济为操作人code)
	 */
@ -265,6 +290,12 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
    private String del;
    /**
     * 备注
     */
    @ApiModelProperty(value = "备注", example = "某某备注")
    private String remark;
    public String getSaasId() {
        return saasId;
@ -475,20 +506,6 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
        this.openidTime = openidTime;
    }
    public String getSickVillage() {
        return sickVillage;
    }
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
    public String getSickVillageName() {
        return sickVillageName;
    }
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
    public String getPrincipalCode() {
        return principalCode;
    }
@ -552,5 +569,59 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
        this.del = del;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getLiveProvinceCode() {
        return liveProvinceCode;
    }
    public void setLiveProvinceCode(String liveProvinceCode) {
        this.liveProvinceCode = liveProvinceCode;
    }
    public String getLiveProvinceName() {
        return liveProvinceName;
    }
    public void setLiveProvinceName(String liveProvinceName) {
        this.liveProvinceName = liveProvinceName;
    }
    public String getLiveCityCode() {
        return liveCityCode;
    }
    public void setLiveCityCode(String liveCityCode) {
        this.liveCityCode = liveCityCode;
    }
    public String getLiveCityName() {
        return liveCityName;
    }
    public void setLiveCityName(String liveCityName) {
        this.liveCityName = liveCityName;
    }
    public String getLiveTownCode() {
        return liveTownCode;
    }
    public void setLiveTownCode(String liveTownCode) {
        this.liveTownCode = liveTownCode;
    }
    public String getLiveTownName() {
        return liveTownName;
    }
    public void setLiveTownName(String liveTownName) {
        this.liveTownName = liveTownName;
    }
}

+ 2 - 2
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasModuleFunctionVO.java

@ -22,11 +22,11 @@
//    @ApiModelProperty(value = "功能ID", example = "402303ee656498890sd24s9ad2wa00sd")
//    private String functionId;
//
//    public String getSaasId() {
//    public String getOrgCode() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//    public void setOrgCode(String saasId) {
//        this.saasId = saasId;
//    }
//

+ 21 - 7
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/team/BaseTeamVO.java

@ -22,10 +22,16 @@ import java.util.Date;
public class BaseTeamVO extends UuidIdentityVOWithOperator {
    /**
	 * 机构id
	 * 机构代码
	 */
	@ApiModelProperty(value = "机构id", example = "")
    private String orgId;
	@ApiModelProperty(value = "机构代码", example = "")
    private String orgCode;
    /**
     * 机构名称
     */
    @ApiModelProperty(value = "机构名称", example = "")
    private String orgName;
    /**
	 * 团队名称
@ -57,12 +63,20 @@ public class BaseTeamVO extends UuidIdentityVOWithOperator {
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
    private String del;
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getOrgId() {
        return orgId;
    public String getOrgName() {
        return orgName;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getName() {

+ 9 - 0
common/common-util/src/main/java/com/yihu/jw/util/excel/ExcelUtil.java

@ -36,4 +36,13 @@ public abstract class ExcelUtil implements Serializable {
    public boolean equals(Object obj) {
        return getExcelSeq() == ((ExcelUtil) obj).getExcelSeq();
    }
    public String getAllErrorMsg(int seq){
        StringBuffer stringBuffer=new StringBuffer();
        stringBuffer.append("第"+seq+"行:");
        for(String str:errorMsg.keySet()){
            stringBuffer.append(errorMsg.get(str)+";");
        }
        return stringBuffer.toString();
    };
}

+ 16 - 4
sql/init.sql

@ -155,8 +155,6 @@ CREATE TABLE `base_patient` (
  `patient_status` varchar(100) DEFAULT NULL COMMENT '用户状态:1正常,0禁用,-1恶意注册,2审核中',
  `mobile_remarks` varchar(200) DEFAULT NULL COMMENT '联系方式备注【基卫】',
  `openid_time` datetime DEFAULT NULL COMMENT '第一次添加open的时间',
  `sick_village` varchar(50) DEFAULT NULL COMMENT '居委会代码',
  `sick_village_name` varchar(100) DEFAULT NULL,
  `principal_code` varchar(50) DEFAULT NULL COMMENT '绑定电子社保卡主体(共济为操作人code)',
  `sicard_status` varchar(100) DEFAULT NULL COMMENT '是否绑定电子社保卡 (0否 1是)',
  `sicard_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '电子社保卡绑定时间',
@ -185,7 +183,8 @@ CREATE TABLE `base_patient` (
drop table IF EXISTS `base_team`;
CREATE TABLE `base_team` (
  `id` varchar(50) NOT NULL   COMMENT '主键,团队uuid标识',
  `org_id` varchar(50) DEFAULT NULL COMMENT '机构id',
  `org_code` varchar(50) DEFAULT NULL COMMENT '机构代码',
  `org_name` varchar(30) DEFAULT NULL COMMENT '机构名称',
  `name` varchar(50) DEFAULT NULL COMMENT '团队名称',
  `leader_id` varchar(50) NOT NULL COMMENT '领导医生标识',
  `team_num` varchar(50) NOT NULL COMMENT '团队人数',
@ -762,6 +761,19 @@ create table `org_tree`
  `parent_code` varchar(50) not null COMMENT '父级行政区域code',
  `code` varchar(100) DEFAULT NULL COMMENT '行政区域code',
  `name` varchar(50) not null COMMENT '行政区域名称',
  `level` varchar(50) not null COMMENT '节点所在层级(即有几个父亲)',
  primary key (id)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构区域树形结构';
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构区域树形结构';
-- 居民医保卡电子卡等信息
drop table IF EXISTS `patient_medicare_card`;
create table `patient_medicare_card`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长',
  `code` varchar(50) not null COMMENT '卡标识',
  `type` varchar(1) DEFAULT NULL COMMENT '卡类型,1-医保卡,2-电子健康卡',
  `patient_code` varchar(50) not null COMMENT '居民标识',
  primary key (id)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='居民医保关联卡';

+ 2 - 2
svr/svr-base/doc/es/服务包执行日志记录索引.txt

@ -15,7 +15,7 @@ POST http://172.19.103.68:9200/base_service_package_log/base_service_package_log
                "type": "string",
                "index": "not_analyzed"
            },
			"saasId": {
			"orgCode": {
				"type": "string",
				"index": "not_analyzed"
			},"sevicePackageId": {
@ -57,7 +57,7 @@ POST http://172.19.103.68:9200/base_service_package_log/base_service_package_log
字段说明:
"id": code
"createTime": 时间
"saasId": saasid
"orgCode": saasid
"sevicePackageId": 服务包id
"sevicePackageDetailId": 服务包明细id
"userCode": 医生或者患者code

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

@ -25,11 +25,13 @@ import java.util.Map;
 */
public interface DictHospitalDeptDao extends PagingAndSortingRepository<DictHospitalDeptDO, Integer>, JpaSpecificationExecutor<DictHospitalDeptDO>  {
    @Query("select code as code,name as name from DictHospitalDeptDO where saasId = :saasId")
    List<Map<String,Object>> findCodeAndNameBySaasId(@Param("saasId") String saasId, Pageable pageable);
    @Query("select code as code,name as name from DictHospitalDeptDO where orgCode in ?1")
    List<Map<String,Object>> findByOrgCodeIn( String orgCode, Pageable pageable);
    @Query("select code as code,name as name from DictHospitalDeptDO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictHospitalDeptDO> findBySaasId(String saasId);
    List<DictHospitalDeptDO> findByOrgCode(String orgCode);
    List<DictHospitalDeptDO> findByOrgCodeIn(String orgCode);
}

+ 25 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java

@ -1,10 +1,15 @@
package com.yihu.jw.base.dao.doctor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import java.util.List;
import java.util.Map;
/**
 * 
 * 医生基础信息 数据库访问层
@ -18,4 +23,24 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 * @since 1.
 */
public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO, String>, JpaSpecificationExecutor<BaseDoctorDO>  {
    /*@Query("select doc.id,doc.name,doc.idcard,case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex,doc.del as status,hos.hospName,hos.deptName,hos.roleName,hos.jobTitleName from BaseDoctorDO doc,BaseDoctorHospitalDO hos where doc.id = hos.doctorCode and hos.del = 1 and name like ?1")
    List<Map<String,Object>> queryDoctorFullInfoByName(String name, Pageable pageable);
    @Query("select doc.id,doc.name,doc.idcard,case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex,doc.del as status,hos.hospName,hos.deptName,hos.roleName,hos.jobTitleName from BaseDoctorDO doc,BaseDoctorHospitalDO hos where doc.id = hos.doctorCode and hos.del = 1 and name like ?1")
    List<Map<String,Object>> queryDoctorFullInfoByNameAndOrgCode(String name, String orgCode,Pageable pageable);
    @Query("select doc.id,doc.name,doc.idcard,case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex,doc.del as status,hos.hospName,hos.deptName,hos.roleName,hos.jobTitleName from BaseDoctorDO doc,BaseDoctorHospitalDO hos where doc.id = hos.doctorCode and hos.del = 1 and name like ?1")
    List<Map<String,Object>> queryDoctorFullInfoByNameAndDocDel(String name, String docStatus,Pageable pageable);
    @Query("select doc.id,doc.name,doc.idcard,case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex,doc.del as status,hos.hospName,hos.deptName,hos.roleName,hos.jobTitleName from BaseDoctorDO doc,BaseDoctorHospitalDO hos where doc.id = hos.doctorCode and hos.del = 1 and name like ?1 and orgCode = ?2")
    List<Map<String,Object>> queryDoctorFullInfoByNameAndOrgCodeAndDocDel(String name, String orgCode,String docStatus,Pageable pageable);
    @Query("select doc.id,doc.name,doc.idcard,case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex,doc.del as status,hos.hospName,hos.deptName,hos.roleName,hos.jobTitleName from BaseDoctorDO doc,BaseDoctorHospitalDO hos where doc.id = hos.doctorCode and hos.del = 1 and idcard like ?1")
    List<Map<String,Object>> queryDoctorFullInfoByIdcard(String idcard, Pageable pageable);
    @Query("select doc.id,doc.name,doc.idcard,case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex,doc.del as status,hos.hospName,hos.deptName,hos.roleName,hos.jobTitleName from BaseDoctorDO doc,BaseDoctorHospitalDO hos where doc.id = hos.doctorCode and hos.del = 1 and idcard like ?1 and orgCode = ?2")
    List<Map<String,Object>> queryDoctorFullInfoByIdcardAndOrgCode(String idcard,String orgCode,Pageable pageable);*/
}

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorHospitalDao.java

@ -18,4 +18,5 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 * @since 1.
 */
public interface BaseDoctorHospitalDao extends PagingAndSortingRepository<BaseDoctorHospitalDO, Integer>, JpaSpecificationExecutor<BaseDoctorHospitalDO>  {
}

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java

@ -53,4 +53,7 @@ public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String
    @Modifying
    @Query("delete from BaseOrgDO p where p.saasid=?1 ")
    void deleteBySaasId(String saasId);
    @Query("select id from BaseOrgDO where saasid = ?1")
    List findOrgCodeBySaasId(String saasId);
}

+ 9 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/OrgTreeDao.java

@ -25,10 +25,15 @@ import java.util.Map;
 */
public interface OrgTreeDao extends PagingAndSortingRepository<OrgTree, Integer>, JpaSpecificationExecutor<OrgTree>  {
    @Query("select id as id,code as code,name as name,case del when 1 then '有效' else '失效' end as status,concat(provinceName,cityName,townName,streetName) as address from BaseOrgDO where code like ?1")
    List<Map<String,Object>> findByCode(String code, Pageable pageable);
    List<OrgTree> findByLevel(Integer level);
    @Override
    List<OrgTree> findAll();
    List<OrgTree> findByLevelLessThanEqual(Integer level);
    OrgTree findByCodeAndLevel(String code,Integer level);
    OrgTree findByCodeAndParentCode(String code,String parentCode);
    OrgTree findByCode(String code);
    boolean existsByCode(String code);
}

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

@ -20,13 +20,13 @@ public interface BasePatientDao extends PagingAndSortingRepository<BasePatientDO
    BasePatientDO findByIdAndDel(String id,String del);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where idcard like ?1")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where idcard like ?1")
    List<Map<String,Object>> findByIdcard(String idcard, Pageable pageable);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName from BasePatientDO where name like ?1")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where name like ?1")
    List<Map<String,Object>> findByName(String name, Pageable pageable);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO")
    List<Map<String,Object>> findBaseInfo(Pageable pageable);
}

+ 15 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/PatientMedicareCardDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.base.dao.patient;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/8/31.
 */
public interface PatientMedicareCardDao extends PagingAndSortingRepository<PatientMedicareCardDO, String>, JpaSpecificationExecutor<PatientMedicareCardDO> {
    List<PatientMedicareCardDO> findByPatientCode(String patientCode);
}

+ 8 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamDao.java

@ -1,10 +1,14 @@
package com.yihu.jw.base.dao.team;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.team.BaseTeamDO;
import java.util.List;
import java.util.Map;
/**
 * 
 * 团队信息 数据库访问层
@ -18,4 +22,7 @@ import com.yihu.jw.entity.base.team.BaseTeamDO;
 * @since 1.
 */
public interface BaseTeamDao extends PagingAndSortingRepository<BaseTeamDO, String>, JpaSpecificationExecutor<BaseTeamDO>  {
}
    @Query("select orgCode as code,orgName as name from BaseTeamDO")
    List<Map<String,Object>> getTeamOrgList();
 }

+ 8 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/team/BaseTeamMemberDao.java

@ -1,10 +1,14 @@
package com.yihu.jw.base.dao.team;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import java.util.List;
import java.util.Map;
/**
 * 
 * 团队成员 数据库访问层
@ -18,4 +22,8 @@ import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
 * @since 1.
 */
public interface BaseTeamMemberDao extends PagingAndSortingRepository<BaseTeamMemberDO, String>, JpaSpecificationExecutor<BaseTeamMemberDO>  {
    @Query("select doc.name,doc.idcard,doc.id from BaseDoctorDO doc where doc.id in (select team.doctorCode from BaseTeamMemberDO team where team.orgCode = ?1 and team.teamCode = ?2)")
    List<Map<String,Object>> getTeamMemberList();
}

+ 10 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/populationBatchImport/PopulationMsg.java

@ -1,12 +1,14 @@
package com.yihu.jw.base.endpoint.common.populationBatchImport;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.excel.ExcelUtil;
import com.yihu.jw.util.excel.Validation;
import com.yihu.jw.util.excel.annotation.Location;
import com.yihu.jw.util.excel.annotation.Row;
import com.yihu.jw.util.excel.annotation.Title;
import com.yihu.jw.util.excel.annotation.ValidRepeat;
import org.apache.commons.lang3.StringUtils;
import javax.persistence.Column;
import java.util.Date;
@ -62,7 +64,7 @@ public class PopulationMsg extends ExcelUtil implements Validation {
    private String  districtName;
    //慢病人数
    private Integer ncdNum;
    int yearNow = DateUtil.getNowYear();
    @Override
    public int validate(Map<String, Set> repeatMap) {
@ -71,6 +73,13 @@ public class PopulationMsg extends ExcelUtil implements Validation {
            rs = 0;
            addErrorMsg("saasName", "已添加"+year+saasName+"的基础人口信息,请直接修改即可");
        }
        if(StringUtils.isBlank(year)){
            rs = 0;
            addErrorMsg("year", "年份不能为空!");
        }else if(year.compareTo(String.valueOf(yearNow))>0){
            rs = 0;
            addErrorMsg("year", "年份不能大于当前年份!");
        }
        if(populationNum<0){
            rs = 0;
            addErrorMsg("populationNum", "常住人口数不能小于0!");

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/populationBatchImport/PopulationMsgReader.java

@ -43,6 +43,7 @@ public class PopulationMsgReader extends AExcelReader {
                    populationMsg.setDmNum(null == getCellCont(sheet, i, 4) ? 0 : Integer.valueOf(getCellCont(sheet, i, 4).trim()));
                    populationMsg.setHbpNum(null == getCellCont(sheet, i, 5) ? 0 : Integer.valueOf(getCellCont(sheet, i, 5).trim()));
                    populationMsg.setTaskNum(null == getCellCont(sheet, i, 6) ? 0 : Integer.valueOf(getCellCont(sheet, i, 6).trim()));
                    populationMsg.setExcelSeq(i);
                    int rs = populationMsg.validate(repeat);
                    if (rs == 0) {
                        errorLs.add(populationMsg);

+ 8 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/DictHospitalDeptEndpoint.java

@ -100,4 +100,12 @@ public class DictHospitalDeptEndpoint extends EnvelopRestEndpoint {
        return success(dictHospitalDepts, DictHospitalDeptVO.class);
    }
    @GetMapping(value = BaseRequestMapping.DictHospitalDept.queryDeptByOrg)
    @ApiOperation(value = "根据机构获取科室")
    public ListEnvelop<DictHospitalDeptVO> queryDeptByOrg(
            @ApiParam(name = "orgCode", value = "机构标识")
            @RequestParam(value = "orgCode", required = true) String orgCode) throws Exception {
        List<DictHospitalDeptDO> dictHospitalDepts = dictHospitalDeptService.findDeptByOrgCode(orgCode);
        return success(dictHospitalDepts, DictHospitalDeptVO.class);
    }
}

+ 59 - 11
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java

@ -1,6 +1,8 @@
package com.yihu.jw.base.endpoint.doctor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.service.doctor.BaseDoctorService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -39,13 +41,17 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    private BaseDoctorService baseDoctorService;
    @PostMapping(value = BaseRequestMapping.BaseDoctor.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<BaseDoctorVO> create(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        BaseDoctorDO baseDoctor = toEntity(jsonData, BaseDoctorDO.class);
        baseDoctor = baseDoctorService.save(baseDoctor);
        return success(baseDoctor, BaseDoctorVO.class);
    @ApiOperation(value = "新增医生")
    public Envelop create(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        JSONObject jsonObject = null;
        String str = baseDoctorService.createDoctor(jsonData);
        jsonObject = JSONObject.parseObject(str);
        if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
            return failed(jsonObject.getString("msg"));
        }
        return success(jsonObject.getString("msg"));
    }
    @PostMapping(value = BaseRequestMapping.BaseDoctor.DELETE)
@ -60,8 +66,8 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.BaseDoctor.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseDoctorVO> update(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        BaseDoctorDO baseDoctor = toEntity(jsonData, BaseDoctorDO.class);
        if (null == baseDoctor.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
@ -102,14 +108,14 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    }
    /**
     * 医生信息(基本信息 + 医院执业信息)
     * 单个医生信息(基本信息 + 医院执业信息)
     * @param orgId
     * @param doctorId
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.BaseDoctor.DOCINFO)
    @ApiOperation(value = "获取列表")
    @ApiOperation(value = "获取单个医生及其执业信息")
    public Envelop doctorHosplist(
            @ApiParam(name = "orgId", value = "医院id")
            @RequestParam(value = "orgId", required = true) String orgId,
@ -119,6 +125,48 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
        return success(map.toString());
    }
    /*
     * 医生信息(基本信息 + 医院执业信息)列表
     * @param name
     * @param idcard
     * @param orgCode
     * @param doctorStatus
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseRequestMapping.BaseDoctor.docFullInfo)
    @ApiOperation(value = "获取医生基础信息列表")
    public Envelop getDoctorFullInfolist(
            @ApiParam(name = "name", value = "医生姓名")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "idcard", value = "医生身份证号")
            @RequestParam(value = "idcard", required = false) String idcard,
            @ApiParam(name = "orgCode", value = "医院代码")
            @RequestParam(value = "orgCode", required = false) String orgCode,
            @ApiParam(name = "doctorStatus", value = "医生是否生效")
            @RequestParam(value = "doctorStatus", required = false) String doctorStatus,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<Map<String,Object>> map = baseDoctorService.getDoctorFullInfo(name, idcard,orgCode,doctorStatus);
        return success(map.toString());
    }
   /* *//**
     * 获取医生 所属机构/部门/职称/职务 树形结构数据
     * @return
     * @throws Exception
     *//*
    @PostMapping(value = BaseRequestMapping.BaseDoctor.docOrgTreeInfo)
    @ApiOperation(value = "获取医生所属机构树形结构数据")
    public Envelop getDoctorOrgTree() throws Exception {
        String data = baseDoctorService.getOrgTree();
        return success(data);
    }
*/
}

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/org/BaseOrgEndpoint.java

@ -44,7 +44,7 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建")
    public Envelop create(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        BaseOrgDO baseOrg = toEntity(jsonObject.getJSONObject("org").toJSONString(), BaseOrgDO.class);
        String  msg = baseOrgService.createOrUpdateOrg(baseOrg,jsonObject.getJSONObject("admin"));
@ -67,7 +67,7 @@ public class BaseOrgEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseOrgVO> update(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
            @RequestParam String jsonData) throws Exception {
        BaseOrgDO baseOrg = toEntity(jsonData, BaseOrgDO.class);
        if (null == baseOrg.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);

+ 24 - 23
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java

@ -1,6 +1,7 @@
package com.yihu.jw.base.endpoint.patient;
import com.yihu.jw.base.service.patient.BasePatientService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.restmodel.base.patient.BasePatientVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -11,6 +12,7 @@ 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.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -38,14 +40,16 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BasePatientService basePatientService;
    @PostMapping(value = BaseRequestMapping.BasePatient.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.BasePatient.CREATE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<BasePatientVO> create(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        BasePatientDO basePatient = toEntity(jsonData, BasePatientDO.class);
        basePatient = basePatientService.save(basePatient);
        return success(basePatient, BasePatientVO.class);
    public Envelop create(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
       String msg = basePatientService.createPatient(jsonData);
       if(!StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS,msg)){
           return success(msg);
       }
        return failed(msg);
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.DELETE)
@ -57,17 +61,16 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseRequestMapping.BasePatient.UPDATE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BasePatientVO> update(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        BasePatientDO basePatient = toEntity(jsonData, BasePatientDO.class);
        if (null == basePatient.getId()) {
            return failed("ID不能为空", ObjEnvelop.class);
    public Envelop update(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        String msg = basePatientService.updatePatient(jsonData);
        if(!StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS,msg)){
            return failed(msg);
        }
        basePatient = basePatientService.save(basePatient);
        return success(basePatient, BasePatientVO.class);
        return success(msg);
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.getPatientById)
@ -75,8 +78,8 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
    public Envelop getPatientById(
            @ApiParam(name = "id", value = "居民id")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        Map<String,Object> basePatients = basePatientService.getPatientInfo(id);
        return success(basePatients.toString());
        String result = basePatientService.getPatientInfo(id);
        return success(result);
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.PAGE)
@ -113,10 +116,8 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.BasePatient.getBaseInfo)
    @ApiOperation(value = "获取居民基础信息列表")
    public ListEnvelop queryPatientBaseInfo(
            @ApiParam(name = "idcard", value = "居民身份证")
            @RequestParam(value = "idcard", required = false) String idcard,
            @ApiParam(name = "name", value = "居民姓名")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "nameOrIdcard", value = "居民姓名或身份证")
            @RequestParam(value = "nameOrIdcard", required = false) String nameOrIdcard,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
@ -124,7 +125,7 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<Map<String,Object>> basePatients = basePatientService.queryPatientBaseInfo(idcard, name, page,size,sorts);
        List<Map<String,Object>> basePatients = basePatientService.queryPatientBaseInfo(nameOrIdcard, page,size,sorts);
        return success(basePatients);
    }
}

+ 12 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/population/BasePopulationEndpoint.java

@ -211,6 +211,9 @@ public class BasePopulationEndpoint extends EnvelopRestEndpoint {
        }
        basePopulation.setDmNum(null == basePopulation.getDmNum() ? 0 : basePopulation.getDmNum());
        basePopulation.setHbpNum(null == basePopulation.getHbpNum() ? 0 : basePopulation.getHbpNum());
        basePopulation.setPopulationNum(null == basePopulation.getPopulationNum() ? 0 : basePopulation.getPopulationNum());
        basePopulation.setRegisPopulationNum(null == basePopulation.getRegisPopulationNum() ? 0 : basePopulation.getRegisPopulationNum());
        basePopulation.setTaskNum(null == basePopulation.getTaskNum() ? 0 : basePopulation.getTaskNum());
        //更新慢病总人数
        basePopulation.setNcdNum(basePopulation.getHbpNum() + basePopulation.getDmNum());
        return basePopulation;
@ -261,7 +264,7 @@ public class BasePopulationEndpoint extends EnvelopRestEndpoint {
        return (null != basePopulationDOList && basePopulationDOList.size() > 0) ? true : false;
    }
    @PostMapping(value = BaseRequestMapping.BasePopulation.POPULATION_BATCH_IMPORT)
    @PostMapping(value = BaseRequestMapping.BasePopulation.POPULATION_BODY_BATCH_IMPORT)
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation(value = "基础人口信息列表导入")
    public Envelop importData(
@ -275,8 +278,12 @@ public class BasePopulationEndpoint extends EnvelopRestEndpoint {
            //验证未通过
            List<PopulationMsg> errorLs = excelReader.getErrorLs();
            List<PopulationMsg> correctLs = excelReader.getCorrectLs();
            if(errorLs.size()>0){
                return failed("格式有误,导入失败!");
            if (errorLs.size() > 0) {
               /* StringBuffer str = new StringBuffer();
                errorLs.forEach(item -> {
                    str.append(item.getAllErrorMsg(item.getExcelSeq()));
                });*/
                return failed("未通过数据验证(年份+租户名称不能重复;统计数不能小于0),导入失败!" /*+ str.toString()*/);
            }
            //获取所有租户+年份的基础人口信息
            Set<String> populationNameAndYear = new HashSet<String>(basePopulationService.getFacilityCodeByServerType());
@ -287,8 +294,8 @@ public class BasePopulationEndpoint extends EnvelopRestEndpoint {
                    model = correctLs.get(i);
                    Map<Boolean, PopulationMsg> map = validate(model, populationNameAndYear);
                    if (null == map.get(true)) {
//                        errorLs.add(model);
                        return failed("格式有误,导入失败!");
                        /*PopulationMsg populationMsg=map.get(false);*/
                        return failed("未通过数据验证(年份+租户名称不能重复;统计数不能小于0),导入失败!"/*+populationMsg.getAllErrorMsg(populationMsg.getExcelSeq())*/);
                    } else {
                        saveLs.add(model);
                    }

+ 22 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/team/BaseTeamEndpoint.java

@ -1,6 +1,7 @@
package com.yihu.jw.base.endpoint.team;
import com.yihu.jw.base.service.team.BaseTeamService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.team.BaseTeamDO;
import com.yihu.jw.restmodel.base.team.BaseTeamVO;
import com.yihu.jw.restmodel.web.Envelop;
@ -12,6 +13,7 @@ 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.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -40,12 +42,14 @@ private BaseTeamService baseTeamService;
@PostMapping(value = BaseRequestMapping.BaseTeam.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public ObjEnvelop<BaseTeamVO> create (
public Envelop create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
    @RequestBody String jsonData) throws Exception {
    BaseTeamDO baseTeam = toEntity(jsonData, BaseTeamDO.class);
    baseTeam = baseTeamService.save(baseTeam);
    return success(baseTeam, BaseTeamVO.class);
    @RequestParam String jsonData) throws Exception {
    String msg = baseTeamService.createTeam(jsonData);
    if(StringUtils.equalsIgnoreCase(ConstantUtils.SUCCESS,msg)){
        return success(msg);
    }
    return failed(msg);
    }
    @PostMapping(value = BaseRequestMapping.BaseTeam.DELETE)
@ -61,7 +65,7 @@ public ObjEnvelop<BaseTeamVO> create (
    @ApiOperation(value = "更新")
    public ObjEnvelop<BaseTeamVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)
        @RequestBody String jsonData) throws Exception {
        @RequestParam String jsonData) throws Exception {
        BaseTeamDO baseTeam = toEntity(jsonData, BaseTeamDO.class);
        if (null == baseTeam.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
@ -101,4 +105,16 @@ public ObjEnvelop<BaseTeamVO> create (
                  return success(baseTeams, BaseTeamVO.class);
         }
       /*  @GetMapping(value = BaseRequestMapping.BaseTeam.LIST)
         @ApiOperation(value = "查看团队成员列表")
         public Envelop getTeamMemberList (
             @ApiParam(name = "orgCode", value = "返回的字段,为空返回全部字段")
             @RequestParam(value = "orgCode", required = true) String orgCode,
             @ApiParam(name = "teamCode", value = "过滤器,为空检索所有条件")
             @RequestParam(value = "teamCode", required = true) String teamCode) throws Exception {
             List<BaseTeamDO> baseTeams = baseTeamService.getTeamMemberList(orgCode, teamCode);
                  return success(baseTeams, BaseTeamVO.class);
         }*/
 }

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

@ -1,9 +1,12 @@
package com.yihu.jw.base.service.dict;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.discovery.converters.Auto;
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
import com.yihu.jw.base.enums.SystemDictEnum;
import com.yihu.jw.base.service.org.BaseOrgService;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
@ -33,21 +36,60 @@ public class DictHospitalDeptService extends BaseJpaService<DictHospitalDeptDO,
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private BaseOrgService baseOrgService;
    /**
     * 查询某一租户下的医院科室字典信息,如果saadId为空表示当前用户角色为超级管理员,超级管理员可以看到所有数据
     * @param saasId
     * @return
     */
    public JSONObject queryAll(String saasId, Pageable pageable){
    public JSONObject queryAll(String saasId, Pageable pageable) throws Exception{
        JSONObject jsonObject = new JSONObject();
        List<Map<String,Object>> list = new ArrayList<>();
        if(StringUtils.isEmpty(saasId)){
            list = dictHospitalDeptDao.findCodeAndName(pageable);
        }else{
            list = dictHospitalDeptDao.findCodeAndNameBySaasId(saasId,pageable);
            List orgCodeList = baseOrgService.findOrgCodeBySaasId(saasId);
            list = dictHospitalDeptDao.findByOrgCodeIn(objectMapper.writeValueAsString(orgCodeList),pageable);
        }
        jsonObject.put(SystemDictEnum.HospitalDeptDict.toString(),list);
        return jsonObject;
    }
    /**
     * 获取租户的所有机构科室
     * @param saasId
     * @return
     */
    public List<DictHospitalDeptDO> findBySaasId(String saasId){
        List<DictHospitalDeptDO>  list = new ArrayList<>();
        if(StringUtils.isEmpty(saasId)){
            list = (List<DictHospitalDeptDO>)dictHospitalDeptDao.findAll();
            return list;
        }
        List orgCodeList = baseOrgService.findOrgCodeBySaasId(saasId);
        try {
            list = dictHospitalDeptDao.findByOrgCodeIn(objectMapper.writeValueAsString(orgCodeList));
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return list;
    }
    /**
     * 根据机构标识获取科室
     * @param orgCode
     * @return
     */
    public List<DictHospitalDeptDO> findDeptByOrgCode(String orgCode){
        List<DictHospitalDeptDO>  list = new ArrayList<>();
       if(StringUtils.isEmpty(orgCode)){
           return list;
       }
       return dictHospitalDeptDao.findByOrgCode(orgCode);
    }
}

+ 124 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -1,16 +1,30 @@
package com.yihu.jw.base.service.doctor;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.doctor.BaseDoctorDao;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.service.org.tree.SimpleTree;
import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -36,6 +50,15 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    @Autowired
    private BaseDoctorRoleDictService baseDoctorRoleDictService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private OrgTreeService orgTreeService;
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 获取医生信息
@ -55,7 +78,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        if(CollectionUtils.isEmpty(doctors)){
            return resultMap;
        }
        resultMap = JavaBeanUtils.bean2Map(doctors.get(0));
        resultMap = JavaBeanUtils.getInstance().bean2Map(doctors.get(0));
        //医生执业信息
        String[] paramNames = {"hospCode","doctorCode"};
@ -64,9 +87,108 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        if(CollectionUtils.isEmpty(baseDoctorHospitalDOS)){
            return resultMap;
        }
        Map<String,Object> doctorHospMap = JavaBeanUtils.bean2Map(baseDoctorHospitalDOS.get(0));
        Map<String,Object> doctorHospMap = JavaBeanUtils.getInstance().bean2Map(baseDoctorHospitalDOS.get(0));
        resultMap.putAll(doctorHospMap);
        return resultMap;
    }
    /**
     * 获取医生信息(包括医生任职的医院相关信息)
     * @param name
     * @param idcard
     * @param orgCode
     * @param docStatus
     * @return
     */
    public List<Map<String,Object>> getDoctorFullInfo(String name,String idcard,String orgCode,String docStatus){
        List<Map<String,Object>> result = new ArrayList<>();
        StringBuilder sql = new StringBuilder();
        sql.append("select doc.id,doc.name,doc.idcard,case doc.sex when 1 then '男' when 2 then '女' else '未知' end as sex,doc.del as status,hos.hosp_name as hosptialName,dept.name as deptName,hos.role_name as roleName,hos.job_title_name jobTitleName from base_doctor doc,base_doctor_hospital hos,dict_hospital_dept dept where doc.id = hos.doctor_code and hos.dept_code = dept.code and hos.del = 1");
        if(StringUtils.isEmpty(name) && StringUtils.isEmpty(idcard) && StringUtils.isEmpty(orgCode) && StringUtils.isEmpty(docStatus)){
           result = jdbcTemplate.queryForList(sql.toString());
        }else if(StringUtils.isEmpty(name) || StringUtils.isEmpty(idcard)){
            if (!StringUtils.isEmpty(name)) {
                sql.append(" and doc.name = '").append(idcard).append("'");
            }else{
                sql.append(" and doc.idcard = '").append(name).append("'");
            }
            if(StringUtils.isEmpty(orgCode) && !StringUtils.isEmpty(docStatus)){
                sql.append(" and doc.del = '").append(docStatus).append("'");
            }else if(!StringUtils.isEmpty(orgCode) && StringUtils.isEmpty(docStatus)){
                sql.append(" and hos.hosp_code = '").append(orgCode).append("'");
            }else{
                sql.append(" and hos.hosp_code = '").append(orgCode).append("'");
                sql.append(" and doc.del = '").append(docStatus).append("'");
            }
            result = jdbcTemplate.queryForList(sql.toString());
        }else if(StringUtils.isEmpty(orgCode)){
            sql.append(" and doc.hosp_code = '").append(orgCode).append("'");
            result = jdbcTemplate.queryForList(sql.toString());
        }else{
            sql.append(" and doc.del = '").append(docStatus).append("'");
            result = jdbcTemplate.queryForList(sql.toString());
        }
        return result;
    }
    /**
     * 新增医生
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String createDoctor(String jsonData){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(jsonData)){
            result.put("msg","jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONObject hospital = jsonObject.getJSONObject("hospital");
        if(null == doctor || null == hospital){
            result.put("msg","parameter doctor or hospital of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        BaseDoctorDO baseDoctorDO = null;
        BaseDoctorHospitalDO baseDoctorHospitalDO = null;
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
        } catch (IOException e) {
           result.put("msg","convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
           result.put("response",ConstantUtils.FAIL);
           return result.toJSONString();
        }
        this.save(baseDoctorDO);
        try {
            baseDoctorHospitalDO = objectMapper.readValue(hospital.toJSONString(),BaseDoctorHospitalDO.class);
            baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
        } catch (IOException e) {
            result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
        }
        baseDoctorHospitalService.save(baseDoctorHospitalDO);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",baseDoctorDO);
        return result.toJSONString();
    }
    /**
     * 构建区域树形结构()
     * @Param level 参考OrgTree的Level枚举类型
     * @return
     */
    public String getOrgTree(OrgTree.Level level){
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeService.findListByLevel(level.getLevelValue()));
        SimpleTree tree = new SimpleTree(treeNodes);
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
        filter.getExcludes().add("allChildren");
        return JSONObject.toJSONString(treeNode, filter);
    }
}

+ 46 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -1,28 +1,34 @@
package com.yihu.jw.base.service.org;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.google.gson.JsonObject;
import com.yihu.jw.base.dao.org.BaseOrgDao;
import com.yihu.jw.base.dao.org.OrgTreeDao;
import com.yihu.jw.base.dao.user.UserDao;
import com.yihu.jw.base.dao.user.UserRoleDao;
import com.yihu.jw.base.service.org.tree.SimpleTree;
import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
import com.yihu.jw.base.service.org.tree.Tree;
import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.base.service.user.UserRoleService;
import com.yihu.jw.base.service.user.UserService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.base.user.UserRoleDO;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * 
@ -43,7 +49,7 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    private BaseOrgDao baseOrgDao;
    @Autowired
    private OrgTreeDao orgTreeDao;
    private OrgTreeService orgTreeService;
    @Autowired
    private UserService userService;
@ -111,12 +117,25 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
            userRoleDO.setUserId("");
            userRoleService.save(userRoleDO);
        }else{
            String id = orgAdminJson.getString("id");
            if(StringUtils.isEmpty(id)){
            String adminId = orgAdminJson.getString("id");
            if(StringUtils.isEmpty(adminId)){
                return "paramter id for admin is null when update";
            }
            BaseOrgDO oldBaseOrgDO = baseOrgDao.findOne(baseOrgDO.getId());
            if(null == oldBaseOrgDO){
                return "no exist this org";
            }
            baseOrgDao.save(baseOrgDO);
            userDO = userService.findById(id);
            if(!baseOrgDO.getTownCode().equalsIgnoreCase(oldBaseOrgDO.getTownCode())){
                orgTreeService.updateOrgTreeNode(oldBaseOrgDO,baseOrgDO,OrgTree.Level.town.getLevelValue());
            }
            if(!baseOrgDO.getCityCode().equalsIgnoreCase(oldBaseOrgDO.getCityCode())){
                orgTreeService.updateOrgTreeNode(oldBaseOrgDO,baseOrgDO,OrgTree.Level.city.getLevelValue());
            }
            if(!baseOrgDO.getProvinceCode().equalsIgnoreCase(oldBaseOrgDO.getProvinceCode())){
                orgTreeService.updateOrgTreeNode(oldBaseOrgDO,baseOrgDO,OrgTree.Level.province.getLevelValue());
            }
            userDO = userService.findById(adminId);
            //没有修改就不保存
            if(StringUtils.endsWithIgnoreCase(adminName,userDO.getUsername()) && StringUtils.endsWithIgnoreCase(mobile,userDO.getMobile())){
                return ConstantUtils.SUCCESS;
@ -148,12 +167,15 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    public String getOrgAreaTree(){
        List<TreeNode> treeNodes = new ArrayList<>();
        treeNodes.addAll(orgTreeDao.findAll());
        treeNodes.addAll(orgTreeService.findListByLevel(OrgTree.Level.org.getLevelValue()));
        SimpleTree tree = new SimpleTree(treeNodes);
        List<SimpleTreeNode> treeNode = tree.getRoot();
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
        filter.getExcludes().add("allChildren");
        filter.getExcludes().add("parentNodeId");
        filter.getExcludes().add("orderNum");
        filter.getExcludes().add("level");
        return JSONObject.toJSONString(treeNode, filter);
    }
@ -170,8 +192,23 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
        filter.getExcludes().add("parent");
        filter.getExcludes().add("allChildren");
        filter.getExcludes().add("parentNodeId");
        filter.getExcludes().add("orderNum");
        filter.getExcludes().add("level");
        return JSONObject.toJSONString(treeNode, filter);
    }
    /**
     * 查找某一saasId下的所有机构code
     * @param saasId
     * @return
     */
    public List findOrgCodeBySaasId(String saasId){
        List result = new ArrayList();
        if(StringUtils.isEmpty(saasId)){
            return result;
        }
        return baseOrgDao.findOrgCodeBySaasId(saasId);
    }
}

+ 32 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTree.java

@ -13,14 +13,36 @@ public class OrgTree extends IntegerIdentityEntity implements TreeNode {
    private String code;
    private String parentCode;
    private String name;
    //当前树节点所在层级,例如省在第一级,用0表示
    private Integer level;
    public enum Level{
        province(0),
        city(1),
        town(2),
        org(3),
        dept(4),
        role(4);
        private int levelValue;
         Level(int levelValue){
            this.levelValue = levelValue;
        }
        public int getLevelValue() {
            return levelValue;
        }
    }
    public OrgTree(){}
    public OrgTree(String code, String parentCode, String name){
    public OrgTree(String code, String parentCode, String name,Integer level){
        this.code = code;
        this.parentCode = parentCode;
        this.name = name;
        this.level = level;
    }
    @Override
    public String extractNodeId() {
        return this.code;
@ -68,4 +90,13 @@ public class OrgTree extends IntegerIdentityEntity implements TreeNode {
        this.name = name;
    }
    @Column(name = "level",nullable = false)
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
}

+ 155 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/OrgTreeService.java

@ -0,0 +1,155 @@
package com.yihu.jw.base.service.org;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.yihu.jw.base.dao.org.OrgTreeDao;
import com.yihu.jw.base.service.org.tree.SimpleTree;
import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * 
 * 机构信息服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年10月15日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class OrgTreeService extends BaseJpaService<OrgTree, OrgTreeDao> {
    @Autowired
    private OrgTreeDao orgTreeDao;
    /**
     * 添加机构和区域的关系
     * @param baseOrgDO
     */
    public void addOrgTreeNode(BaseOrgDO baseOrgDO){
        List<OrgTree> treeNodes = new ArrayList<>();
        if(!orgTreeDao.existsByCode(baseOrgDO.getCode())){
            OrgTree orgNode = new OrgTree(baseOrgDO.getCode(),baseOrgDO.getTownCode(),baseOrgDO.getName(), OrgTree.Level.org.getLevelValue());
            treeNodes.add(orgNode);
        }
        if(!orgTreeDao.existsByCode(baseOrgDO.getTownCode())){
            OrgTree townTree = new OrgTree(baseOrgDO.getTownCode(),baseOrgDO.getCityCode(),baseOrgDO.getTownName(), OrgTree.Level.town.getLevelValue());
            treeNodes.add(townTree);
        }
        if(!orgTreeDao.existsByCode(baseOrgDO.getCityCode())){
            OrgTree cityTree = new OrgTree(baseOrgDO.getCityCode(),baseOrgDO.getProvinceCode(),baseOrgDO.getCityName(), OrgTree.Level.city.getLevelValue());
            treeNodes.add(cityTree);
        }
        if(!orgTreeDao.existsByCode(baseOrgDO.getProvinceCode())){
            OrgTree provinceTree = new OrgTree(baseOrgDO.getProvinceCode(),"",baseOrgDO.getProvinceName(), OrgTree.Level.province.getLevelValue());
            treeNodes.add(provinceTree);
        }
        /*if(orgTreeDao.existsByCode(baseOrgDO.getTownCode())){
            OrgTree orgNode = new OrgTree(baseOrgDO.getCode(),baseOrgDO.getTownCode(),baseOrgDO.getName(), OrgTree.Level.org.getLevelValue());
            treeNodes.add(orgNode);
        }
        else if(orgTreeDao.existsByCode(baseOrgDO.getCityCode())){
            OrgTree townNode = new OrgTree(baseOrgDO.getTownCode(),baseOrgDO.getCityCode(),baseOrgDO.getTownName(), OrgTree.Level.town.getLevelValue());
            treeNodes.add(townNode);
        }
        else if(orgTreeDao.existsByCode(baseOrgDO.getProvinceCode())){
            OrgTree cityNode = new OrgTree(baseOrgDO.getCityCode(),baseOrgDO.getProvinceCode(),baseOrgDO.getCityName(), OrgTree.Level.city.getLevelValue());
            treeNodes.add(cityNode);
        }
        else{
            OrgTree provinceNode = new OrgTree(baseOrgDO.getProvinceCode(),"",baseOrgDO.getProvinceName(), OrgTree.Level.province.getLevelValue());
            treeNodes.add(provinceNode);
        }*/
        this.batchInsert(treeNodes);
    }
    /**
     * 修改机构和区域的关系
     * @param oldBaseOrgDO
     * @param newBaseOrgDO
     */
    public void updateOrgTreeNode(BaseOrgDO oldBaseOrgDO,BaseOrgDO newBaseOrgDO,int level){
        if( level == OrgTree.Level.town.getLevelValue() ){
            OrgTree orgTree = orgTreeDao.findByCodeAndParentCode(oldBaseOrgDO.getCode(),oldBaseOrgDO.getTownCode());
            if(null == orgTree){
                return;
            }
            orgTree.setParentCode(newBaseOrgDO.getTownCode());
            this.save(orgTree);
           /* List<OrgTree> treeNodes = new ArrayList<>();
            //新修改的区代码不存在,表示未添加过,应把相应的父类关联关系存储起来(城市,省份等)
            if(!orgTreeDao.existsByCode(newBaseOrgDO.getTownCode())){
                OrgTree townTree = new OrgTree(newBaseOrgDO.getTownCode(),newBaseOrgDO.getCityCode(),newBaseOrgDO.getTownName(), OrgTree.Level.town.getLevelValue());
                treeNodes.add(townTree);
            }
            if(!orgTreeDao.existsByCode(newBaseOrgDO.getCityCode())){
                OrgTree cityTree = new OrgTree(newBaseOrgDO.getCityCode(),newBaseOrgDO.getProvinceCode(),newBaseOrgDO.getCityName(), OrgTree.Level.city.getLevelValue());
                treeNodes.add(cityTree);
            }
            if(!orgTreeDao.existsByCode(newBaseOrgDO.getProvinceCode())){
                OrgTree provinceTree = new OrgTree(newBaseOrgDO.getProvinceCode(),"",newBaseOrgDO.getProvinceName(), OrgTree.Level.province.getLevelValue());
                treeNodes.add(provinceTree);
            }
            this.batchInsert(treeNodes);*/
            addOrgTreeNode(newBaseOrgDO);
        }
       else if( level == OrgTree.Level.city.getLevelValue() ){
            OrgTree orgTree = orgTreeDao.findByCodeAndParentCode(oldBaseOrgDO.getTownCode(),oldBaseOrgDO.getCityCode());
            if(null == orgTree){
                return;
            }
            orgTree.setParentCode(newBaseOrgDO.getCityCode());
            this.save(orgTree);
            addOrgTreeNode(newBaseOrgDO);
            /*List<OrgTree> treeNodes = new ArrayList<>();
            if(!orgTreeDao.existsByCode(newBaseOrgDO.getCityCode())){
                OrgTree cityTree = new OrgTree(newBaseOrgDO.getCityCode(),newBaseOrgDO.getProvinceCode(),newBaseOrgDO.getCityName(), OrgTree.Level.city.getLevelValue());
                treeNodes.add(cityTree);
            }
            if(!orgTreeDao.existsByCode(newBaseOrgDO.getProvinceCode())){
                OrgTree provinceTree = new OrgTree(newBaseOrgDO.getProvinceCode(),"",newBaseOrgDO.getProvinceName(), OrgTree.Level.province.getLevelValue());
                treeNodes.add(provinceTree);
            }
            this.batchInsert(treeNodes);*/
        }
        else if( level == OrgTree.Level.province.getLevelValue() ){
            OrgTree orgTree = orgTreeDao.findByCodeAndParentCode(oldBaseOrgDO.getCityCode(),oldBaseOrgDO.getProvinceCode());
            if(null == orgTree){
                return;
            }
            orgTree.setParentCode(newBaseOrgDO.getProvinceCode());
            this.save(orgTree);
            addOrgTreeNode(newBaseOrgDO);
            /*List<OrgTree> treeNodes = new ArrayList<>();
            if(!orgTreeDao.existsByCode(newBaseOrgDO.getProvinceCode())){
                OrgTree provinceTree = new OrgTree(newBaseOrgDO.getProvinceCode(),"",newBaseOrgDO.getProvinceName(), OrgTree.Level.province.getLevelValue());
                treeNodes.add(provinceTree);
            }
            this.batchInsert(treeNodes);*/
        }
    }
    /**
     * 根据树的节点层级查询
     * @param level
     * @return
     */
    public List<OrgTree> findListByLevel(Integer level){
        List<OrgTree> result = new ArrayList<>();
        if(null == level){
            return result;
        }
        return orgTreeDao.findByLevelLessThanEqual(level);
    }
}

+ 96 - 17
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/BasePatientService.java

@ -1,16 +1,24 @@
package com.yihu.jw.base.service.patient;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.patient.BasePatientDao;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.*;
import java.util.regex.Pattern;
/**
 * 
@ -30,44 +38,115 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private PatientMedicardCardService patientMedicardCardService;
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 居民id
     * @param patientId
     * @return
     */
    public Map<String,Object> getPatientInfo(String patientId) throws Exception{
        Map<String,Object> resultMap = new HashMap<>();
    public String getPatientInfo(String patientId) throws Exception{
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(patientId)){
            return resultMap;
            result.put("result","parameter patientId is null");
            return result.toString();
        }
        List<BasePatientDO> patientDOList = this.findByField("id",patientId);
        if(CollectionUtils.isEmpty(patientDOList)){
            return resultMap;
            result.put("result","not exist patient for id:"+patientId);
            return result.toString();
        }
        resultMap = JavaBeanUtils.bean2Map(patientDOList.get(0));
        return resultMap;
        result.put("patient",patientDOList.get(0));
        List<PatientMedicareCardDO> cards = patientMedicardCardService.findPatientCardByCode(patientId);
        result.put("medicareCard",cards);
        return result.toJSONString();
    }
    /**
     * 获取用户基础信息,参数为空查全部
     * @param idcard
     * @param name
     * @param nameOrIdcard
     * @param page
     * @param size
     * @param sorts
     * @return
     */
    public List<Map<String,Object>> queryPatientBaseInfo(String idcard,String name,int page,int size,String sorts)throws Exception{
    public List<Map<String,Object>> queryPatientBaseInfo(String nameOrIdcard,int page,int size,String sorts)throws Exception{
        List<Map<String,Object>> result = new ArrayList<>();
        if(!StringUtils.isEmpty(idcard)){
            result = basePatientDao.findByIdcard("%"+idcard+"%",createPage(page,size,sorts));
            return result;
        }
        if(!StringUtils.isEmpty(name)){
            result = basePatientDao.findByName(idcard,createPage(page,size,sorts));
            return result;
        if(StringUtils.isEmpty(nameOrIdcard)){
            result = basePatientDao.findBaseInfo(createPage(page,size,sorts));
        }else{
            String pattern = "^\\d+";
            boolean isMatch = Pattern.matches(pattern, nameOrIdcard);
            if(isMatch){
                result = basePatientDao.findByIdcard("%"+nameOrIdcard+"%",createPage(page,size,sorts));
                return result;
            }else{
                result = basePatientDao.findByName("%"+nameOrIdcard+"%",createPage(page,size,sorts));
                return result;
            }
        }
        result = basePatientDao.findBaseInfo(createPage(page,size,sorts));
        return result;
    }
    /**
     * 新增居民
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String createPatient(String jsonData) throws Exception {
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject patient = jsonObject.getJSONObject("patient");
        JSONArray patientMedicareCards = jsonObject.getJSONArray("medicareCard");
        if(null == patient || CollectionUtils.isEmpty(patientMedicareCards)){
            return ConstantUtils.FAIL;
        }
        BasePatientDO basePatientDO = objectMapper.readValue(patient.toJSONString(),BasePatientDO.class);
        List<PatientMedicareCardDO> list = new ArrayList<>();
        patientMedicareCards.forEach((card)->{
            try {
                list.add(objectMapper.readValue(card.toString(),PatientMedicareCardDO.class));
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
        this.save(basePatientDO);
        patientMedicardCardService.batchInsert(list);
        return ConstantUtils.SUCCESS;
    }
    /**
     * 修改居民
     * @param jsonData
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String updatePatient(String jsonData) throws Exception {
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject patient = jsonObject.getJSONObject("patient");
        JSONArray patientMedicareCards = jsonObject.getJSONArray("medicareCard");
        if(null == patient || CollectionUtils.isEmpty(patientMedicareCards)){
            return ConstantUtils.FAIL;
        }
        BasePatientDO basePatientDO = objectMapper.readValue(patient.toJSONString(),BasePatientDO.class);
        if(StringUtils.isEmpty(basePatientDO.getId())){
            return ConstantUtils.FAIL;
        }
        // 保存修改的居民信息
        this.save(basePatientDO);
        // 一条一条修改居民相关的卡的信息
        for (Object obj: patientMedicareCards){
            PatientMedicareCardDO card = objectMapper.readValue(obj.toString(),PatientMedicareCardDO.class);
            card.setPatientCode(basePatientDO.getId());
            if(StringUtils.isEmpty(basePatientDO.getId())){
                return ConstantUtils.FAIL;
            }
            patientMedicardCardService.save(card);
        }
        return ConstantUtils.SUCCESS;
    }
}

+ 39 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientMedicardCardService.java

@ -0,0 +1,39 @@
package com.yihu.jw.base.service.patient;
import com.yihu.jw.base.dao.patient.PatientMedicareCardDao;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * 
 * 居民信息服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class PatientMedicardCardService extends BaseJpaService<PatientMedicareCardDO, PatientMedicareCardDao> {
    @Autowired
    private PatientMedicareCardDao patientMedicareCardDao;
    public List<PatientMedicareCardDO> findPatientCardByCode(String patientCode){
        List<PatientMedicareCardDO> result = new ArrayList<>();
        if(StringUtils.isEmpty(patientCode)){
            return result;
        }
        return patientMedicareCardDao.findByPatientCode(patientCode);
    }
}

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/population/BasePopulationService.java

@ -61,13 +61,13 @@ public class BasePopulationService extends BaseJpaService<BasePopulationDO, Base
            basePopulationDO.setCityName(populationMsg.getCityName());
            basePopulationDO.setDistrictCode(populationMsg.getDistrictCode());
            basePopulationDO.setDistrictName(populationMsg.getDistrictName());
            basePopulationDO.setRegisPopulationNum(populationMsg.getRegisPopulationNum());
            basePopulationDO.setPopulationNum(populationMsg.getPopulationNum());
            basePopulationDO.setRegisPopulationNum(null == populationMsg.getRegisPopulationNum() ? 0 : populationMsg.getRegisPopulationNum());
            basePopulationDO.setPopulationNum(null == populationMsg.getPopulationNum() ? 0 : populationMsg.getPopulationNum());
            //糖尿病人数
            basePopulationDO.setDmNum(null == populationMsg.getDmNum() ? 0 : populationMsg.getDmNum());
            //高血压人数
            basePopulationDO.setHbpNum(null == populationMsg.getHbpNum() ? 0 : populationMsg.getHbpNum());
            basePopulationDO.setTaskNum(populationMsg.getTaskNum());
            basePopulationDO.setTaskNum(null == populationMsg.getTaskNum() ? 0 : populationMsg.getTaskNum());
            //慢病人数
            basePopulationDO.setNcdNum(basePopulationDO.getHbpNum() + basePopulationDO.getDmNum());
            corrects.add(basePopulationDO);

+ 3 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasBusinessCardService.java

@ -37,7 +37,7 @@ public class SaasBusinessCardService extends BaseJpaService<SaasBusinessCardDO,
     */
    public Map<String, Object> generateBusinessCard(SaasBusinessCardDO.Type type, String saasId, String sourceId, String orgId) throws Exception {
        List<SaasBusinessCardDO> saasBusinessCardDO = search("type=" + type  + ";saasId=" + saasId);
        Map<String, Object> card = new HashMap<>();
        /*Map<String, Object> card = new HashMap<>();
        if (type == SaasBusinessCardDO.Type.doctor) {
            //模拟加载医生数据
            Map<String, Object> source = doctorService.getDoctorInfo(orgId, sourceId);
@ -49,7 +49,8 @@ public class SaasBusinessCardService extends BaseJpaService<SaasBusinessCardDO,
            saasBusinessCardDO.forEach(item -> card.put(item.getField(), source.get(item.getField())));
            return card;
        }
        return card;
        return card;*/
        return null;
    }
}

+ 5 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java

@ -12,6 +12,7 @@ import com.yihu.jw.base.dao.system.SystemDictDao;
import com.yihu.jw.base.dao.system.SystemDictEntryDao;
import com.yihu.jw.base.dao.user.UserDao;
import com.yihu.jw.base.dao.user.UserRoleDao;
import com.yihu.jw.base.service.dict.DictHospitalDeptService;
import com.yihu.jw.entity.base.dict.*;
import com.yihu.jw.entity.base.module.ModuleDO;
import com.yihu.jw.entity.base.module.SaasModuleDO;
@ -75,7 +76,7 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
    @Autowired
    private DictDiseaseDao dictDiseaseDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    private DictHospitalDeptService dictHospitalDeptService;
    @Autowired
    private SaasModuleDao saasModuleDao;
    @Autowired
@ -471,11 +472,11 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
            diseaseDOList.add(diseaseDO);
        });
        //科室字典
        List<DictHospitalDeptDO> dictHospitalDeptDOList = dictHospitalDeptDao.findBySaasId(defaultSaasId);
        List<DictHospitalDeptDO> dictHospitalDeptDOList = dictHospitalDeptService.findBySaasId(defaultSaasId);
        List<DictHospitalDeptDO> hospitalDeptDOList = new ArrayList<>(dictHospitalDeptDOList.size());
        dictHospitalDeptDOList.forEach(dict->{
            DictHospitalDeptDO deptDO = new DictHospitalDeptDO();
            deptDO.setSaasId(saasId);
            deptDO.setOrgCode(saasId);
            deptDO.setName(dict.getName());
            deptDO.setCode(dict.getCode());
            deptDO.setCreateTime(new Date());
@ -490,7 +491,7 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        dictIcd10Dao.save(icd10DOList);
        dictHealthProblemDao.save(healthProblemDOList);
        dictDiseaseDao.save(diseaseDOList);
        dictHospitalDeptDao.save(hospitalDeptDOList);
        dictHospitalDeptService.batchInsert(hospitalDeptDOList);
        return saas;
    }

+ 81 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java

@ -1,9 +1,24 @@
package com.yihu.jw.base.service.team;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.team.BaseTeamDao;
import com.yihu.jw.base.dao.team.BaseTeamMemberDao;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.team.BaseTeamDO;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 
@ -19,4 +34,70 @@ import com.yihu.jw.entity.base.team.BaseTeamDO;
 */
@Service
public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
    @Autowired
    private BaseTeamMemberService baseTeamMemberService;
    @Autowired
    private BaseTeamMemberDao baseTeamMemberDao;
    @Autowired
    private BaseTeamDao baseTeamDao;
    @Autowired
    private ObjectMapper objectMapper;
    public String createTeam(String jsonData) throws Exception {
        JSONObject jsonObject = JSONObject.parseObject(jsonData);
        JSONObject teamJSONObject = jsonObject.getJSONObject("team");
        JSONArray teamMemberArray = jsonObject.getJSONArray("teamMember");
        if(null == teamJSONObject || CollectionUtils.isEmpty(teamMemberArray) ){
            return ConstantUtils.FAIL;
        }
        BaseTeamDO baseTeamDO = objectMapper.readValue(teamJSONObject.toJSONString(),BaseTeamDO.class);
        List<BaseTeamMemberDO> memberList = new ArrayList<>();
        teamMemberArray.forEach((teamMember)->{
            try {
                BaseTeamMemberDO baseTeamMemberDO = objectMapper.readValue(teamMember.toString(),BaseTeamMemberDO.class);
                memberList.add(baseTeamMemberDO);
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
        this.save(baseTeamDO);
        baseTeamMemberService.batchInsert(memberList);
        return ConstantUtils.SUCCESS;
    }
    /**
     * 获取团队机构列表
     * @return
     */
    public List<Map<String,Object>> getTeamOrgList(){
        List<Map<String,Object>> result = new ArrayList<>();
        result = baseTeamDao.getTeamOrgList();
        return result;
    }
    /**
     * 查看团队成员
     * @param orgCode
     * @param teamCode
     * @return
     */
    public String getTeamMemberList(String orgCode,String teamCode){
        List<Map<String,Object>> result = new ArrayList<>();
        if( StringUtils.isEmpty(orgCode) || StringUtils.isEmpty(orgCode) ){
            return null;
        }
        JSONArray list = new JSONArray();
        result = baseTeamMemberDao.getTeamMemberList();
        for(Map<String,Object> map : result){
            JSONObject jsonObject = JSONObject.parseObject(map.toString());
            list.add(jsonObject);
        }
        return list.toJSONString();
    }
}

+ 63 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/util/JavaBeanUtils.java

@ -3,7 +3,12 @@ package com.yihu.jw.base.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
@ -18,6 +23,24 @@ import java.util.*;
 * @project jw2.0
 */
public class JavaBeanUtils {
    private static JavaBeanUtils javaBeanUtils = null;
    private JavaBeanUtils(){}
    public static JavaBeanUtils getInstance(){
        if (javaBeanUtils == null) {
            synchronized (JavaBeanUtils.class) {
                if (javaBeanUtils == null) {
                    javaBeanUtils = new JavaBeanUtils();
                }
            }
        }
        return javaBeanUtils;
    }
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 将一个 Map 对象转化为一个 JavaBean
     *
@ -36,7 +59,7 @@ public class JavaBeanUtils {
     *             如果调用属性的 setter 方法失败
     */
    @SuppressWarnings("unchecked")
    public static Object map2Bean(Class type, Map map)
    public  Object map2Bean(Class type, Map map)
            throws IntrospectionException, IllegalAccessException,
            InstantiationException, InvocationTargetException {
        Object obj = type.newInstance(); // 创建 JavaBean 对象
@ -58,7 +81,7 @@ public class JavaBeanUtils {
     *             如果调用属性的 setter 方法失败
     */
    @SuppressWarnings("unchecked")
    public static Map bean2Map(Object bean) throws IntrospectionException,
    public  Map bean2Map(Object bean) throws IntrospectionException,
            IllegalAccessException, InvocationTargetException {
        Class type = bean.getClass();
        Map returnMap = new HashMap();
@ -94,7 +117,7 @@ public class JavaBeanUtils {
     * @time:2014年9月3日上午10:37:32
     */
    @SuppressWarnings("unchecked")
    public static List<Map> beans2Maps(List<Object> beans)
    public  List<Map> beans2Maps(List<Object> beans)
            throws IllegalAccessException, InvocationTargetException,
            IntrospectionException {
        List<Map> maps = new ArrayList<Map>();
@ -119,7 +142,7 @@ public class JavaBeanUtils {
     * @time:2014年9月3日上午10:40:00
     */
    @SuppressWarnings("unchecked")
    public static List<Object> mapstoBeans(Class type, List<Map> maps)
    public  List<Object> mapstoBeans(Class type, List<Map> maps)
            throws IntrospectionException, IllegalAccessException,
            InstantiationException, InvocationTargetException {
        List<Object> beans = new ArrayList<Object>();
@ -142,7 +165,7 @@ public class JavaBeanUtils {
     * @throws InvocationTargetException
     * @time:2014年9月3日上午11:47:45
     */
    public static Object copyProperties(Object toBean, Object fromBean)
    public  Object copyProperties(Object toBean, Object fromBean)
            throws IllegalAccessException, InvocationTargetException {
        if (fromBean == null) {
            return null;
@ -164,7 +187,7 @@ public class JavaBeanUtils {
     * @throws ClassNotFoundException
     * @time:2014年9月3日下午12:05:23
     */
    public static Object copyProperties(Class toClassBean, Object fromBean)
    public  Object copyProperties(Class toClassBean, Object fromBean)
            throws IllegalAccessException, InvocationTargetException,
            InstantiationException, ClassNotFoundException {
        if (fromBean == null) {
@ -190,7 +213,7 @@ public class JavaBeanUtils {
     * @throws ClassNotFoundException
     * @time:2014年9月3日下午12:33:24
     */
    public static List copyProperties(Class toClassBean, List beans)
    public List copyProperties(Class toClassBean, List beans)
            throws IllegalAccessException, InvocationTargetException,
            InstantiationException, ClassNotFoundException {
        List list = new ArrayList();
@ -200,4 +223,37 @@ public class JavaBeanUtils {
        }
        return list;
    }
    /**
     * map转为json
     * @return
     */
    public String mapJson(Map<String, Object> map) throws Exception {
        if (CollectionUtils.isEmpty(map)) {
            return "paramter is null";
        }
        List<Map<String, Object>> result = new ArrayList<>();
        JSONArray jsonArray = new JSONArray();
        JSONObject jsonObject = JSONObject.parseObject(objectMapper.writeValueAsString(map));
        return jsonArray.toJSONString();
    }
    /**
     * map转为json
     * @return
     */
    public String mapListJson(List<Map<String, Object>> mapList) throws Exception {
        if (CollectionUtils.isEmpty(mapList)) {
            return "paramter is null";
        }
        List<Map<String, Object>> result = new ArrayList<>();
        JSONArray jsonArray = new JSONArray();
        for(Map<String, Object> map : mapList){
            JSONObject jsonObject = JSONObject.parseObject(objectMapper.writeValueAsString(map));
            jsonArray.add(jsonObject);
        }
        return jsonArray.toJSONString();
    }
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/business/login/service/BaseLoginAccountService.java

@ -31,7 +31,7 @@
//        if (StringUtils.isEmpty(baseLoginAccountDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseLoginAccountDO.getSaasId())) {
//        if (StringUtils.isEmpty(baseLoginAccountDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseLoginAccountDao.save(baseLoginAccountDO);

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/business/login/service/LoginService.java

@ -62,7 +62,7 @@
//        //保存账户基础信息
//        BaseEmployDO employeeDO = new BaseEmployDO();
//        employeeDO.setId(UUID.randomUUID().toString().replaceAll("-", ""));
//        employeeDO.setSaasId(saasId);
//        employeeDO.setOrgCode(saasId);
//        employeeDO.setName(name);
//        employeeDO.setPyCode(ConvertToSpellUtils.changeToInitialPinYin(name));
//        employeeDO.setIdcard(idcard);

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/business/sms/service/SmsService.java

@ -106,7 +106,7 @@
//        SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
//        sms.setDeadline(s.parse(vc.getCreateTimeString()));
//        sms.setStatus(1);
//        sms.setSaasId(saasId);
//        sms.setOrgCode(saasId);
//        //5、 调用发送信息的接口
////        String result = httpClientUtil.post(smsHttpVo.getUrl(), buildSmsParams(sms.getContent(), mobile), "GBK");
////        JSONObject json = toJson(result);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseMenuController.java

@ -74,7 +74,7 @@
//    public Envelop getMenuListBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseMenuDO baseMenuDO = toEntity(jsonData,BaseMenuDO.class);
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_find,baseMenuService.findAllBySaasId(baseMenuDO.getSaasId()));
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_find,baseMenuService.findAllBySaasId(baseMenuDO.getOrgCode()));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
@ -85,7 +85,7 @@
//    public Envelop deleteMenusBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseMenuDO baseMenuDO = toEntity(jsonData,BaseMenuDO.class);
//            baseMenuService.deleteBaseMenusBySaasId(baseMenuDO.getSaasId());
//            baseMenuService.deleteBaseMenusBySaasId(baseMenuDO.getOrgCode());
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_delete);
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseRoleController.java

@ -78,7 +78,7 @@
////    public Envelop getOneRoleBySaasIdAndName(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findBySaasIdAndName(baseRoleDO.getName(),baseRoleDO.getSaasId()));
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findBySaasIdAndName(baseRoleDO.getName(),baseRoleDO.getOrgCode()));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
@ -89,7 +89,7 @@
////    public Envelop getRoleListBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            return Envelop.getSuccessList(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findAllBySaasId(baseRoleDO.getSaasId()));
////            return Envelop.getSuccessList(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findAllBySaasId(baseRoleDO.getOrgCode()));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
@ -143,7 +143,7 @@
////    public Envelop deleteRolesBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            baseRoleService.deleteBaseRolesBySaasId(baseRoleDO.getSaasId());
////            baseRoleService.deleteBaseRolesBySaasId(baseRoleDO.getOrgCode());
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_delete);
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseMenuService.java

@ -33,7 +33,7 @@
//        if (StringUtils.isEmpty(baseMenuDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseMenuDO.getSaasId())) {
//        if (StringUtils.isEmpty(baseMenuDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseMenuDao.save(baseMenuDO);
@ -49,7 +49,7 @@
//        if (StringUtils.isEmpty(baseMenuDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseMenuDO.getSaasId())) {
//        if (StringUtils.isEmpty(baseMenuDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseMenuDao.save(baseMenuDO);
@ -96,7 +96,7 @@
//        if (StringUtils.isEmpty(baseMenuDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseMenuDO.getSaasId())) {
//        if (StringUtils.isEmpty(baseMenuDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        baseMenuDO.setStatus(-1);

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseRoleService.java

@ -32,7 +32,7 @@
//        if (StringUtils.isEmpty(baseRoleDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getSaasId())) {
//        if (StringUtils.isEmpty(baseRoleDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getName())) {
@ -51,7 +51,7 @@
//        if (StringUtils.isEmpty(baseRoleDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getSaasId())) {
//        if (StringUtils.isEmpty(baseRoleDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseRoleDao.save(baseRoleDO);
@ -135,7 +135,7 @@
//        if (StringUtils.isEmpty(baseRoleDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getSaasId())) {
//        if (StringUtils.isEmpty(baseRoleDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        baseRoleDO.setStatus(-1);

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/EmployService.java

@ -44,7 +44,7 @@
//        if (StringUtils.isEmpty(employeeDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(employeeDO.getSaasId())) {
//        if (StringUtils.isEmpty(employeeDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.employDao.save(employeeDO);
@ -61,7 +61,7 @@
//        if (StringUtils.isEmpty(employeeDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(employeeDO.getSaasId())) {
//        if (StringUtils.isEmpty(employeeDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.employDao.save(employeeDO);
@ -144,7 +144,7 @@
//        if (StringUtils.isEmpty(employDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(employDO.getSaasId())) {
//        if (StringUtils.isEmpty(employDO.getOrgCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        employDO.setStatus(-1);

+ 21 - 2
svr/svr-base/src/main/resources/application.yml

@ -131,6 +131,15 @@ spring:
#    password: jkzl_ehr
#  zipkin:
#    base-url: http://localhost:9411 #日志追踪的地址
#  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
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
@ -158,12 +167,22 @@ spring:
    port: 6379 # Redis server port.
  mail:
    host: smtp.163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#发送者的邮箱账号
    username: i_jiankang@163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#    password: jkzl_ehr
#  zipkin:
#    base-url: http://localhost:9411 #日志追踪的地址
#  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
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/

+ 222 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/analyzer/IotAnalyzerController.java

@ -0,0 +1,222 @@
package com.yihu.iot.controller.analyzer;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.iot.datainput.service.DataInputService;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.service.company.IotCompanyCertificateService;
import com.yihu.iot.service.company.IotCompanyService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.DataRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
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.util.StringUtils;
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.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
 * @author cws on 2018/1/16.
 */
@RestController
@RequestMapping("svr-iot/analyze" )
@Api(tags = "设备数据解析入库", description = "基于不同厂商的设备的采集数据,进行解析适配,并入库。")
public class IotAnalyzerController extends EnvelopRestEndpoint {
    @Autowired
    private DataInputService dataInputService;
    @Autowired
    ObjectMapper objectMapper;
    /**
     * 基于奕拓小屋上传的体征数据,进行解析入库
     * @param dataJson
     * @return
     */
    @GetMapping(value = "/yitouxiaowu")
    @ApiOperation(value = "基于传入的JSON串采集数据,进行解析并入库", notes = "JSON串采集数据解析入库")
    public String findCompanyPage(
            @ApiParam(name = "dataJson", value = "采集数据JSON串", defaultValue = "")
            @RequestParam(value = "dataJson", required = false) String dataJson){
        Envelop envelop = new Envelop();
        String str = "";
        String strResult = "";
        //1. 基础数据初始化
        String accessToken  = "yitouxiaowu";  // 奕拓小屋
        try {
            //JSON数据解析
            Map dataDetail = objectMapper.readValue(dataJson, HashMap.class);
            // 用户信息
            LinkedHashMap memberMap = (LinkedHashMap)dataDetail.get("Member");
            // 身高体重
            LinkedHashMap heightMap = (LinkedHashMap)dataDetail.get("Height");
            // 血压
            LinkedHashMap bloodPressureMap = (LinkedHashMap)dataDetail.get("BloodPressure");
            // 血氧
            LinkedHashMap boMap = (LinkedHashMap)dataDetail.get("Bo");
            // 单导心电
            LinkedHashMap ecgMap = (LinkedHashMap)dataDetail.get("Ecg");
            // 体温
            LinkedHashMap temperatureMap = (LinkedHashMap)dataDetail.get("Temperature");
            // 腰臀比
            LinkedHashMap whrMap = (LinkedHashMap)dataDetail.get("Whr");
            // 血糖
            LinkedHashMap bloodSugarMap = (LinkedHashMap)dataDetail.get("BloodSugar");
            // 血尿酸
            LinkedHashMap uaMap = (LinkedHashMap)dataDetail.get("Ua");
            // 总胆固醇
            LinkedHashMap cholMap = (LinkedHashMap)dataDetail.get("Chol");
            // 血脂
            LinkedHashMap bloodFatMap = (LinkedHashMap)dataDetail.get("BloodFat");
            // 血红蛋白
            LinkedHashMap hbMap = (LinkedHashMap)dataDetail.get("Hb");
            // 尿液分析
            LinkedHashMap urinalysisMap = (LinkedHashMap)dataDetail.get("Urinalysis");
            String sn = dataDetail.get("MachineId").toString();
            String deviceName = "弈拓健康小站测量仪";
            String deviceModel = dataDetail.get("DeviceType").toString();
            String extCode = "";
            String idCard = memberMap.get("IdCode").toString();
            String username = memberMap.get("Name").toString();
            JSONArray jsonArray = new JSONArray();
            JSONObject params = new JSONObject();
            params.put("access_token", accessToken);
            params.put("sn", sn);
            params.put("ext_code","未知");
            params.put("device_name", deviceName);
            params.put("device_model", deviceModel);
            params.put("idcard", idCard);
            params.put("username", username);
            JSONObject data = new JSONObject();
            data.put("measure_time",dataDetail.get("MeasureTime") == null? "":dataDetail.get("MeasureTime").toString());
            if (bloodPressureMap != null) {
                data.put("diastolic",bloodPressureMap.get("LowPressure") == null? "": bloodPressureMap.get("LowPressure").toString());
                data.put("diastolic_unit","mmHg");
                data.put("pulse",bloodPressureMap.get("Pulse") == null? "": bloodPressureMap.get("Pulse").toString());
                data.put("pulse_unit","次/分");
            }
            if (bloodSugarMap != null) {
                data.put("blood_sugar",bloodSugarMap.get("BloodSugar") == null? "": bloodSugarMap.get("BloodSugar").toString());
                data.put("blood_sugar_unit","mmol/L");
            }
            if (boMap != null) {
                data.put("blood_oxygen",boMap.get("Oxygen") == null? "": boMap.get("Oxygen").toString());
                data.put("blood_oxygen_unit","%");
            }
            if (temperatureMap != null) {
                data.put("bbt",temperatureMap.get("Temperature") == null? "": temperatureMap.get("Temperature").toString());
                data.put("bbt_unit","℃");
            }
            if (urinalysisMap != null) {
                data.put("ket",urinalysisMap.get("KET") == null? "": urinalysisMap.get("KET").toString());
                data.put("ket_unit"," ");
                data.put("uro",urinalysisMap.get("URO") == null? "": urinalysisMap.get("URO").toString());
                data.put("uro_unit"," ");
                data.put("ph",urinalysisMap.get("PH") == null? "": urinalysisMap.get("PH").toString());
                data.put("ph_unit","");
                data.put("nit",urinalysisMap.get("NIT") == null? "": urinalysisMap.get("NIT").toString());
                data.put("nit_unit","");
                data.put("pro",urinalysisMap.get("PRO") == null? "": urinalysisMap.get("PRO").toString());
                data.put("pro_unit","");
                data.put("glu",urinalysisMap.get("GLU") == null? "": urinalysisMap.get("GLU").toString());
                data.put("glu_unit","");
                data.put("bil",urinalysisMap.get("BIL") == null? "": urinalysisMap.get("BIL").toString());
                data.put("bil_unit","");
                data.put("sg",urinalysisMap.get("SG") == null? "": urinalysisMap.get("SG").toString());
                data.put("sg_unit","");
                data.put("wbc",urinalysisMap.get("LEU") == null? "": urinalysisMap.get("LEU").toString());
                data.put("wbc_unit","");
                data.put("vc",urinalysisMap.get("VC") == null? "": urinalysisMap.get("VC").toString());
                data.put("vc_unit","");
                data.put("bld",urinalysisMap.get("BLD") == null? "": urinalysisMap.get("BLD").toString());
                data.put("bld_unit","");
            }
            if (uaMap != null) {
                data.put("uric_acid",uaMap.get("Ua") == null? "": uaMap.get("Ua").toString());
                data.put("uric_acid_unit","mmol/L");
            }
            if (cholMap != null) {
                data.put("t-chol",cholMap.get("Chol") == null? "": cholMap.get("Chol").toString());
                data.put("t-chol_unit","mmol/L");
            }
            if (bloodFatMap != null) {
                data.put("hdl",bloodFatMap.get("HdlChol") == null? "": bloodFatMap.get("HdlChol").toString());
                data.put("hdl_unit","mmol/L");
                data.put("tg",bloodFatMap.get("Trig") == null? "": bloodFatMap.get("Trig").toString());
                data.put("tg_unit","mmol/L");
                data.put("ldl",bloodFatMap.get("CalcLdl") == null? "": bloodFatMap.get("CalcLdl").toString());
                data.put("ldl_unit","mmol/L");
            }
            if (heightMap != null) {
                data.put("height", heightMap.get("Height") == null ? "" : heightMap.get("Height").toString());
                data.put("height_unit", "cm");
                data.put("weight", heightMap.get("Weight") == null ? "" : heightMap.get("Weight").toString());
                data.put("weight_unit", "kg");
                data.put("bmi",heightMap.get("BMI") == null? "": heightMap.get("BMI").toString());
                data.put("bmi_unit"," ");
            }
            if (whrMap != null) {
                data.put("waist",whrMap.get("Waistline") == null? "": whrMap.get("Waistline").toString());
                data.put("waist_unit","cm");
            }
            if (hbMap != null) {
                data.put("hgb",hbMap.get("Hb") == null? "": hbMap.get("Hb").toString());
                data.put("hgb_unit","mmol/L");
            }
            if (ecgMap != null) {
                data.put("ecg",ecgMap.get("Hr") == null? "": ecgMap.get("Hr").toString());
                data.put("ecg_unit","次/分");
            }
            data.put("hbalc","");
            data.put("hbalc_unit","");
            data.put("left_eye","");
            data.put("left_eye_unit","");
            data.put("right_eye","");
            data.put("right_eye_unit","");
            jsonArray.add(data);
            params.put("data", jsonArray);
            str = dataInputService.inputBodySignsData(params.toString());
            JSONObject result = JSONObject.parseObject(str);
            if (StringUtils.endsWithIgnoreCase(ConstantUtils.FAIL,result.getString("response"))) {
                Map res = new HashMap();
                res.put("success", "false");
                res.put("message", result.getString("msg"));
                strResult = objectMapper.writeValueAsString(res);
                return strResult;
            }else{
                Map res = new HashMap();
                res.put("success", "true");
                res.put("message", "体征信息上传成功。");
                strResult = objectMapper.writeValueAsString(res);
                return strResult;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return "体征信息上传失败!";
        }
    }
}

+ 14 - 10
svr/svr-iot/src/main/java/com/yihu/iot/datainput/controller/DataInputController.java

@ -1,6 +1,8 @@
package com.yihu.iot.datainput.controller;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.datainput.service.DataInputService;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.DataRequestMapping;
@ -40,31 +42,33 @@ public class DataInputController {
    public MixEnvelop uploadData(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws IOException  {
        String str = "";
        JSONObject result = null;
        try {
            str = dataInputService.inputBodySignsData(jsonData);
            if (!str.equals("success")) {
                return MixEnvelop.getSuccess(DataRequestMapping.DataInput.message_fail, str);
          String str = dataInputService.inputBodySignsData(jsonData);
            result = JSONObject.parseObject(str);
            if (StringUtils.endsWithIgnoreCase(ConstantUtils.FAIL,result.getString("response"))) {
                return MixEnvelop.getError(result.getString("msg"));
            }
        } catch (ApiException e) {
            return MixEnvelop.getError(e.getMessage(), e.getErrorCode());
        }
        return MixEnvelop.getSuccess(DataRequestMapping.DataInput.message_success, str);
        return MixEnvelop.getSuccess(DataRequestMapping.DataInput.message_success, result);
    }
    @PostMapping(value = DataRequestMapping.DataInput.api_weRunData_input, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "微信运动数据上传", notes = "微信运动数据上传入库")
    public MixEnvelop uploadWeRunData(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData) {
        String str = "";
        JSONObject result = null;
        try {
            str = dataInputService.inputWeRunData(jsonData);
            if (!StringUtils.endsWithIgnoreCase("success",str)) {
                return MixEnvelop.getError(DataRequestMapping.DataInput.message_fail, 0);
            String str = dataInputService.inputWeRunData(jsonData);
            result = JSONObject.parseObject(str);
            if (StringUtils.endsWithIgnoreCase(ConstantUtils.FAIL,result.getString("response"))) {
                return MixEnvelop.getError(result.getString("msg"));
            }
        } catch (ApiException e) {
            return MixEnvelop.getError(e.getMessage(), e.getErrorCode());
        }
        return MixEnvelop.getSuccess(DataRequestMapping.DataInput.message_success, str);
        return MixEnvelop.getSuccess(DataRequestMapping.DataInput.message_success, result.getString("msg"));
    }
}

+ 63 - 19
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java

@ -218,11 +218,27 @@ public class DataInputService {
     * @return
     */
    public String inputBodySignsData(String json) throws IOException {
        JSONObject result = new JSONObject();
        result.put("upload_time",DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss));
        if(StringUtils.isEmpty(json)){
            result.put("response",ConstantUtils.FAIL);
            result.put("msg","parameter json is null");
            return result.toString();
        }
        String fileName = "";
        String fileAbsPath = "";
        String rowkey = "";
        //提取json某些项值
        DataBodySignsDO dataBodySignsDO = JSONObject.parseObject(json,DataBodySignsDO.class);
        DataBodySignsDO dataBodySignsDO = null;
        try {
            dataBodySignsDO  = JSONObject.parseObject(json,DataBodySignsDO.class);
        }catch (Exception e){
            logger.error("json parse error,invalid json string");
            result.put("msg","json parse error,invalid json string");
            result.put("response",ConstantUtils.FAIL);
            return result.toString();
        }
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
@ -238,7 +254,9 @@ public class DataInputService {
        JSONArray jsonArray = jsonObject.getJSONArray("data");
        if(null == jsonArray || jsonArray.size() == 0){
            return "json no data";
            result.put("response",ConstantUtils.FAIL);
            result.put("msg","parameter 'data' of json no exist");
            return result.toString();
        }
        List<String> rowkeyList = new ArrayList<>();
@ -258,7 +276,10 @@ public class DataInputService {
                data.put("rid",rowkey);//hbase的rowkey
                rowkeyList.add(rowkey);
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("make rowkey error");
                result.put("msg","make rowkey error");
                result.put("response",ConstantUtils.FAIL);
                return result.toString();
            }
            //组装B列
            Map<String, Map<String, String>> family = new HashMap<>();
@ -276,11 +297,25 @@ public class DataInputService {
            family.put(ConstantUtils.familyB,columnsB);
            familyList.add(family);
        }
        DataBodySignsDO bodySignsDO = JSONObject.parseObject(jsonObject.toJSONString(),DataBodySignsDO.class);
        JSONArray saveArray = new JSONArray();
        saveArray.add(bodySignsDO);
        List<String> saveList = new ArrayList<>();
        saveList.add(jsonObject.toJSONString());
        //将数据存入es
        elasticSearchHelper.save(ConstantUtils.esIndex, ConstantUtils.esType, saveArray.toJSONString());
        boolean success = false;
        try {
            success = elasticSearchHelper.save(ConstantUtils.esIndex, ConstantUtils.esType, saveList);
        }catch (Exception e){
            logger.error("upload signBodyData to elasticsearch failed," + e.getMessage());
            result.put("msg","upload signBodyData to elasticsearch failed," + e.getMessage());
        }
        if(success){
            dataProcessLogService.saveLog(fileName, fileAbsPath, dataSource, "", DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss), "1", "4", "com.yihu.iot.datainput.service.DataInputService.uploadData", DataOperationTypeEnum.upload1.getName(), 0);
            JSONArray rids = new JSONArray();
            rids.addAll(rowkeyList);
            result.put("rid",rids);
            result.put("response",ConstantUtils.SUCCESS);
        }else{
            result.put("response",ConstantUtils.FAIL);
        }
        /*try {
            boolean tableExists = hBaseAdmin.isTableExists(ConstantUtils.tableName);
@ -295,13 +330,7 @@ public class DataInputService {
            return "fail";
        }*/
        //保存日志
        dataProcessLogService.saveLog(fileName, fileAbsPath, dataSource, "", DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss), "1", "4", "com.yihu.iot.datainput.service.DataInputService.uploadData", DataOperationTypeEnum.upload1.getName(), 0);
        JSONObject result = new JSONObject();
        JSONArray rids = new JSONArray();
        rids.addAll(rowkeyList);
        result.put("rid",rids);
        result.put("upload_time",DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss));
        return result.toJSONString();
    }
@ -313,23 +342,38 @@ public class DataInputService {
     * @return
     */
    public String inputWeRunData(String json){
        JSONObject result = new JSONObject();
        result.put("upload_time",DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss));
        if(StringUtils.isEmpty(json)){
            result.put("response",ConstantUtils.FAIL);
            result.put("msg","parameter json is null");
            return result.toString();
        }
        WeRunDataDO weRunData = JSONObject.parseObject(json,WeRunDataDO.class);
        boolean bool = false;
        //用户code不能为空
        if(StringUtils.isEmpty(weRunData.getUsercode())){
            return "invalid usercode";
            result.put("response",ConstantUtils.FAIL);
            result.put("msg","invalid usercode");
            return result.toString();
        }
        //步数数据不能为空
        if(CollectionUtils.isEmpty(weRunData.getStepInfoList())){
            return "invalid stepinfolist";
            result.put("response",ConstantUtils.FAIL);
            result.put("msg","invalid stepinfolist");
            return result.toString();
        }
        try{
            bool = elasticSearchHelper.save(ConstantUtils.weRunDataIndex,ConstantUtils.weRunDataType,json);
        }catch (Exception e){
            logger.error("upload weRunData to elasticsearch failed," + e.getMessage());
            return e.getMessage();
            logger.error("upload weRunData to elasticsearch failed");
            result.put("msg","upload weRunData to elasticsearch failed");
        }
        if(bool){
                result.put("response",ConstantUtils.SUCCESS);
            }else{
                result.put("response",ConstantUtils.FAIL);
        }
       return String.valueOf(bool);
       return result.toString();
    }
}

+ 3 - 0
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataSearchService.java

@ -195,6 +195,9 @@ public class DataSearchService {
     */
    public List<DataBodySignsVO> getDataToBean(String jsonData) throws IOException {
        List<DataBodySignsVO> result = new ArrayList<>();
        if(StringUtils.isEmpty(jsonData)){
            return result;
        }
        logger.info("load data from elasticsearch start:" + org.apache.http.client.utils.DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss));
        SearchSourceBuilder query = elasticSearchQueryGenerator.getQueryBuilder("data",jsonData);
        SearchResult esResult = elasticSearchHelper.search(ConstantUtils.esIndex,ConstantUtils.esType,query.toString());

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/datainput/util/ConstantUtils.java

@ -25,4 +25,10 @@ public class ConstantUtils {
    public static String figureLabelIndex = "figure_label_index";
    //居民标签es类型
    public static String figureLabelType = "figure_label_type";
    //数据返回结果标识
    public static final String SUCCESS = "success";
    public static final String FAIL = "fail";
}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java

@ -104,7 +104,7 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
//            planDO.setPurchaseNum(purchase.getPurchaseNum());
//            planDO.setOrderNo(orderNo);
//            planDO.setOrderId(orderId);
//            planDO.setSaasId(getCode());
//            planDO.setOrgCode(getCode());
//            planDO.setStatus(IotDeviceQualityInspectionPlanDO.QualityPlanStatus.create.getValue());
//            planDO.setDeviceName(purchase.getDeviceName());
//            planDO.setPurchaseId(purchase.getId());

+ 1 - 1
svr/svr-iot/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-iot
    name: svr-iot-lith
  cloud:
    config:
      failFast: true

+ 2 - 2
svr/svr-manage/src/main/resources/webapp/html/login/login.html

@ -67,8 +67,8 @@
            success: function (data) {
                //保存用户信息到缓存中
                setUserCode(data.obj.code);
                if(data.obj.saasId!=undefined){
                    setSaasId(data.obj.saasId)
                if(data.obj.orgCode!=undefined){
                    setSaasId(data.obj.orgCode)
                }
                window.location.href = server+'/index/index.html';
            },

+ 1 - 1
svr/svr-manage/src/main/resources/webapp/html/system/role/html/userRole.html

@ -54,7 +54,7 @@
            "data": function (d) {
                d.name = $("#userName").val();
                d.userCode = userCode;
                d.saasId = saasId;
                d.orgCode = orgCode;
            }
        },
        "aoColumns": [{

+ 2 - 2
svr/svr-manage/src/main/resources/webapp/html/version/server/html/userVersion.html

@ -44,7 +44,7 @@
<script>
    var table;
    var userCode = window.localStorage.getItem("userCode");
    var saasId = window.localStorage.getItem("saasId");
    var orgCode = window.localStorage.getItem("orgCode");
    var serverCode = $("#myModal-add-info").attr("data-code");
    var user_codes = [];//记录当前版本已有的用户
    getUserCodes();
@ -70,7 +70,7 @@
                        "dataSrc": "detailModelList",
                        "data": function (d) {
                            d.userCode = userCode;
                            d.saasId = saasId;
                            d.orgCode = orgCode;
                            d.name =$("#userName").val();
                            d.mobile=$("#mobile").val();
                        }