huangwenjie 7 anni fa
parent
commit
36e0591d4f
96 ha cambiato i file con 3678 aggiunte e 455 eliminazioni
  1. 3 3
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  2. 19 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  3. 79 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionAdjustReason.java
  4. 44 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExplain.java
  5. 10 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressage.java
  6. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionPay.java
  7. 66 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionReasonDict.java
  8. 78 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionReviewedReason.java
  9. 32 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java
  10. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java
  11. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Doctor.java
  12. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/PatientDao.java
  13. 35 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  14. 5 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java
  15. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/patient/AdminPatientService.java
  16. 22 5
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/WebserviceUtil.java
  17. 41 11
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  18. 59 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/ZyDictController.java
  19. 16 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/consult/ConsultTeamDao.java
  20. 13 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyCommonDictDao.java
  21. 13 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvDeptDictDao.java
  22. 11 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvDeptStaffAllotDictDao.java
  23. 11 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvDiagnoseClassDictDao.java
  24. 12 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvDiagnoseDictDao.java
  25. 11 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvOrgPhysicAllotDictDao.java
  26. 11 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvPhysicDictDao.java
  27. 11 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvStaffDictDao.java
  28. 12 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvStaffRegTypeAllotDictDao.java
  29. 12 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvSubjectClassDictDao.java
  30. 3 3
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Message.java
  31. 1 1
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/ZyPushLog.java
  32. 328 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/consult/ConsultTeam.java
  33. 70 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyCommonDict.java
  34. 85 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptDict.java
  35. 65 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptStaffAllotDict.java
  36. 109 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseClassDict.java
  37. 111 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseDict.java
  38. 54 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvOrgPhysicAllotDict.java
  39. 232 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvPhysicDict.java
  40. 146 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffDict.java
  41. 88 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffRegTypeAllotDict.java
  42. 88 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvSubjectClassDict.java
  43. 36 1
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/LogService.java
  44. 553 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZyDictDataService.java
  45. 69 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftApi.java
  46. 8 5
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftBaseService.java
  47. 2 2
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/common/InitiSysProService.java
  48. 120 20
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionCAService.java
  49. 155 20
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  50. 6 1
      patient-co-service/wlyy_service/src/main/resources/application.yml
  51. 1 1
      patient-co-service/wlyy_service/src/main/resources/system.properties
  52. 5 5
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  53. 1 1
      patient-co/patient-co-statistics/src/main/resources/application.yml
  54. 1 1
      patient-co/patient-co-wlyy-job/pom.xml
  55. 13 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionAdjustReasonDao.java
  56. 15 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionReasonDictDao.java
  57. 2 2
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  58. 18 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  59. BIN
      patient-co/patient-co-wlyy/doc/接口文档/对外接口文档/集美健康教育/集美健康教育对外接口文档.docx
  60. 1 1
      patient-co/patient-co-wlyy/pom.xml
  61. 15 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java
  62. 14 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java
  63. 50 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/EncodingFilter.java
  64. 8 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/GateWayInterceptor.java
  65. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/MutableHttpServletRequest.java
  66. 18 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionExplainDao.java
  67. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionInfoDao.java
  68. 31 42
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  69. 6 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  70. 46 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  71. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticleService.java
  72. 168 152
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  73. 5 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  74. 31 30
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  75. 75 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  76. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  77. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  78. 60 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java
  79. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java
  80. 12 12
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/qrcode/QrCodeController.java
  81. 4 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  82. 14 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionAdjustController.java
  83. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  84. 7 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcLoginController.java
  85. 8 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcTokenController.java
  86. 2 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcMessageController.java
  87. 9 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/BaseResultModel.java
  88. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java
  89. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  90. 16 12
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java
  91. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/message/BaseMessage.java
  92. 11 23
      patient-co/patient-co-wlyy/src/main/resources/application.yml
  93. 2 1
      patient-co/patient-co-wlyy/src/main/resources/config/fdfs_client.conf
  94. 4 0
      patient-co/patient-co-wlyy/src/main/resources/system.properties
  95. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/patientQRCode.png
  96. 1 1
      pom.xml

File diff suppressed because it is too large
+ 3 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 19 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -90,6 +90,9 @@ public class Prescription extends IdEntity {
    private String prescribeReason; //开方失败/成功原因
    private String prescribeReason; //开方失败/成功原因
    private Date prescribeTime;//开方失败、成功时间
    private Date prescribeTime;//开方失败、成功时间
    //用于药品用药情况排序
    private Integer minDrugDay; //药品最小用药天数
    private Date presCreateTime; //处方建立时间
    private String dispensaryTypeName; //类型翻译
    private String dispensaryTypeName; //类型翻译
@ -669,4 +672,20 @@ public class Prescription extends IdEntity {
    public void setJwPayStatus(Integer jwPayStatus) {
    public void setJwPayStatus(Integer jwPayStatus) {
        this.jwPayStatus = jwPayStatus;
        this.jwPayStatus = jwPayStatus;
    }
    }
    public Integer getMinDrugDay() {
        return minDrugDay;
    }
    public void setMinDrugDay(Integer minDrugDay) {
        this.minDrugDay = minDrugDay;
    }
    public Date getPresCreateTime() {
        return presCreateTime;
    }
    public void setPresCreateTime(Date presCreateTime) {
        this.presCreateTime = presCreateTime;
    }
}
}

+ 79 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionAdjustReason.java

@ -0,0 +1,79 @@
package com.yihu.wlyy.entity.patient.prescription;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2017/8/26.
 */
@Entity
@Table(name = "wlyy_prescription_adjust_reason")
public class PrescriptionAdjustReason extends IdEntity {
    private String code;//业务CODE
    private String prescriptionCode;//续方code
    private String adjustCode;//调整code
    private String reasonCode;//调整原因code
    private String reasonValue;//调整原因code
    private Date createTime;//创建时间
    private Date updateTime;//更新时间
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    public String getAdjustCode() {
        return adjustCode;
    }
    public void setAdjustCode(String adjustCode) {
        this.adjustCode = adjustCode;
    }
    public String getReasonCode() {
        return reasonCode;
    }
    public void setReasonCode(String reasonCode) {
        this.reasonCode = reasonCode;
    }
    public String getReasonValue() {
        return reasonValue;
    }
    public void setReasonValue(String reasonValue) {
        this.reasonValue = reasonValue;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 44 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExplain.java

@ -0,0 +1,44 @@
package com.yihu.wlyy.entity.patient.prescription;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 续方说明表
 * Created by yeshijie on 2017/8/24.
 */
@Entity
@Table(name = "wlyy_prescription_explain")
public class PrescriptionExplain extends IdEntity {
    private String content;//续方说明
    private String del;//是否有效,1有效,0无效
    private Date createTime;
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressage.java

@ -72,6 +72,7 @@ public class PrescriptionExpressage extends IdEntity{
    private Date createTime;                //创建的时间
    private Date createTime;                //创建的时间
    private Integer del;    //1可用 0删除
    private Integer del;    //1可用 0删除
    private Date deliveryTime; //送达时间
    public String getHospitalCode() {
    public String getHospitalCode() {
        return hospitalCode;
        return hospitalCode;
@ -415,4 +416,13 @@ public class PrescriptionExpressage extends IdEntity{
    public void setFetchingMedicineTime(Date fetchingMedicineTime) {
    public void setFetchingMedicineTime(Date fetchingMedicineTime) {
        this.fetchingMedicineTime = fetchingMedicineTime;
        this.fetchingMedicineTime = fetchingMedicineTime;
    }
    }
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    public Date getDeliveryTime() {
        return deliveryTime;
    }
    public void setDeliveryTime(Date deliveryTime) {
        this.deliveryTime = deliveryTime;
    }
}
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionPay.java

@ -9,7 +9,7 @@ import java.util.Date;
/**
/**
 * Created by chenweida on 2017/7/26.
 * Created by chenweida on 2017/7/26.
 * 处方支付表
 * 处方支付实体
 */
 */
@Entity
@Entity
@Table(name = "wlyy_prescription_pay")
@Table(name = "wlyy_prescription_pay")

+ 66 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionReasonDict.java

@ -0,0 +1,66 @@
package com.yihu.wlyy.entity.patient.prescription;
import com.yihu.wlyy.entity.IdEntity;
import java.util.Date;
/**
 * Created by Trick on 2017/8/26.
 */
public class PrescriptionReasonDict extends IdEntity {
    private String code;//编码code
    private String value;//原因内容
    private String type;//类型:0 审核原因标签;1 调整原因标签
    private String sort;//排序号
    private Date createTime;//创建时间
    private Date updateTime;//修改时间
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getSort() {
        return sort;
    }
    public void setSort(String sort) {
        this.sort = sort;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 78 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionReviewedReason.java

@ -0,0 +1,78 @@
package com.yihu.wlyy.entity.patient.prescription;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2017/8/26.
 */
@Entity
@Table(name = "wlyy_prescription_reviewed_reason")
public class PrescriptionReviewedReason extends IdEntity {
    private String code;//业务CODE
    private String prescriptionCode;//续方code
    private String reviewedCode;//调整code
    private String reasonCode;//审核原因code
    private String reasonValue;//审核原因值
    private Date createTime;//创建时间
    private Date updateTime;//更新时间
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    public String getReviewedCode() {
        return reviewedCode;
    }
    public void setReviewedCode(String reviewedCode) {
        this.reviewedCode = reviewedCode;
    }
    public String getReasonCode() {
        return reasonCode;
    }
    public void setReasonCode(String reasonCode) {
        this.reasonCode = reasonCode;
    }
    public String getReasonValue() {
        return reasonValue;
    }
    public void setReasonValue(String reasonValue) {
        this.reasonValue = reasonValue;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 32 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.WlyyCustomerLog;
import com.yihu.wlyy.entity.WlyyCustomerLog;
import com.yihu.wlyy.repository.ManageDictDao;
import com.yihu.wlyy.repository.ManageDictDao;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.service.manager.account.CustomerService;
import com.yihu.wlyy.service.manager.account.CustomerService;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
import com.yihu.wlyy.service.manager.patient.AdminPatientService;
import com.yihu.wlyy.service.manager.patient.AdminPatientService;
@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map;
/**
/**
@ -47,6 +50,10 @@ public class CustomerController extends BaseController {
    @Autowired
    @Autowired
    private WlyyCustomerLogService wlyyCustomerLogService;
    private WlyyCustomerLogService wlyyCustomerLogService;
    @Autowired
    private PatientDao patientDao;
    @RequestMapping(value = "/login",method = RequestMethod.POST,produces="application/json;charset=UTF-8")
    @RequestMapping(value = "/login",method = RequestMethod.POST,produces="application/json;charset=UTF-8")
    @ResponseBody
    @ResponseBody
    public String login(@ApiParam(name = "userName", value = "账号", required = true)@RequestParam(required = true, name = "userName") String userName,
    public String login(@ApiParam(name = "userName", value = "账号", required = true)@RequestParam(required = true, name = "userName") String userName,
@ -126,6 +133,7 @@ public class CustomerController extends BaseController {
        }
        }
        Map<String, Object> resp = customerService.findServerInfo(patient);
        Map<String, Object> resp = customerService.findServerInfo(patient);
        resp.put("patient",patient);
        resp.put("patient",patient);
        return write(200,"查询成功","data",resp);
        return write(200,"查询成功","data",resp);
    }
    }
@ -137,13 +145,33 @@ public class CustomerController extends BaseController {
    @ResponseBody
    @ResponseBody
    public String findByMobile(@ApiParam(name = "mobile", value = "手机号", required = false)@RequestParam(required = true, name = "mobile") String mobile) throws Exception {
    public String findByMobile(@ApiParam(name = "mobile", value = "手机号", required = false)@RequestParam(required = true, name = "mobile") String mobile) throws Exception {
        Map<String, Object> resp = new HashMap<>();
        //根据条件查询病人信息
        //根据条件查询病人信息
        Patient patient = patientService.findByMobile(mobile);
        if(patient ==null){
        List<Patient> patients = patientService.findByMobile(mobile);
        if(patients ==null || patients.size()==0){
            return write(-1,"未查询到");
            return write(-1,"未查询到");
        }else if(patients.size()==1){
            Patient patient = patients.get(0);
            resp = customerService.findServerInfo(patients.get(0));
            resp.put("patient",patient);
            return write(200,"查询成功","data",resp);
        }
        }
        Map<String, Object> resp = customerService.findServerInfo(patient);
        resp.put("patient",patient);
        resp.put("patients",patients);
        return write(200,"查询成功","data",resp);
        return write(200,"查询成功","data",resp);
    }
    }
    /**
     *通过居民code,查找家庭关系,签约信息,医生等
     * @return
     */
    @RequestMapping(value = "/findByPatient",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String findByPatient(@ApiParam(name = "patientCode", value = "居民code", required = false)@RequestParam(required = true, name = "patientCode") String patientCode) throws Exception {
        Patient patient = patientDao.findByCode(patientCode);
        Map<String, Object> respon = customerService.findServerInfo(patientCode);
        respon.put("patient",patient);
        return write(200,"查询成功","data",respon);
    }
}
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java

@ -104,7 +104,7 @@ public class YueRenController extends BaseController {
        JSONObject params = new JSONObject(jsonString);
        JSONObject params = new JSONObject(jsonString);
        params.put("key",key);
        params.put("key",key);
        String answer = params.get("answer").toString();
        String answer = params.get("answer").toString();
        params.put("answer","/attach/"+key+"/"+answer);
        params.put("answer","/attach/{{key}}/"+answer);
        String postStr = remoteCall("/yueren/dillphoneimgdata", params);
        String postStr = remoteCall("/yueren/dillphoneimgdata", params);
        return postStr;
        return postStr;
    }
    }

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Doctor.java

@ -371,7 +371,7 @@ public class Doctor extends IdEntity {
		}else if(2==level){
		}else if(2==level){
			levelName = "全科医生";
			levelName = "全科医生";
		}else if(level==3){
		}else if(level==3){
			levelName = "健康管理所";
			levelName = "健康管理师";
		}else{
		}else{
			levelName = "";
			levelName = "";
		}
		}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/PatientDao.java

@ -40,7 +40,7 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long>,Jp
	// 根據手机号查詢患者信息
	// 根據手机号查詢患者信息
	@Query("select p from Patient p where p.mobile=?1")
	@Query("select p from Patient p where p.mobile=?1")
	Patient findByMobile(String mobile);
	List<Patient> findByMobile(String mobile);
	// 根據病情等级获取患者信息
	// 根據病情等级获取患者信息
	@Query("select p from Patient p where p.diseaseCondition=?1")
	@Query("select p from Patient p where p.diseaseCondition=?1")

+ 35 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java

@ -58,4 +58,39 @@ public class CustomerService{
		return resp;
		return resp;
	}
	}
	public Map<String,Object> findServerInfo(String patientCode) throws Exception {
		Map<String, Object> resp = new HashMap<>();
		//查找家庭成员关系
		List<Map<String, Object>> familyMembers = familyMemberService.getAllFamilyMembers(patientCode);
		resp.put("family",familyMembers);
		//查询签约信息
		SignFamily signInfo = contractService.findSignInfo(patientCode);
		//查询家庭成员的每个签约信息    以及签约医生
		List doctors = new ArrayList<Doctor>();
		if(signInfo!=null){
			signInfo.setStatusName("已签约");
			//查找全科医生
			String doctorCode = signInfo.getDoctor();
			if(StringUtils.isNotBlank(doctorCode)){
				Doctor doctor = hosDoctorService.getDoctorByCode(doctorCode);
				doctors.add(doctor);
			}
			//查找健康管理师
			String doctorHealthCode = signInfo.getDoctorHealth();
			if(StringUtils.isNotBlank(doctorHealthCode)){
				Doctor doctor = hosDoctorService.getDoctorByCode(doctorHealthCode);
				doctors.add(doctor);
			}
		}
		resp.put("signInfo",signInfo);
		resp.put("doctors",doctors);
		return resp;
	}
}
}

+ 5 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java

@ -86,13 +86,15 @@ public class FamilyMemberService extends BaseService {
                SignFamily sign = contractService.findSignInfo(map.get("code").toString());
                SignFamily sign = contractService.findSignInfo(map.get("code").toString());
                boolean ssSign = false;
                boolean ssSign = false;
                boolean jtSign = false;
                boolean jtSign = false;
                map.put("statusName","未签约");
                map1.put("status","-1");
                map1.put("statusName","未签约");
                if(sign!=null){
                if(sign!=null){
                    if (sign.getType() == 1 ) {
                    if (sign.getType() == 1 ) {
                        ssSign = true;
                        ssSign = true;
                    } else if (sign.getType() == 2 ) {
                    } else if (sign.getType() == 2 ) {
                        jtSign = true;
                        jtSign = true;
                    }
                    }
                    map1.put("status",sign.getStatus());;
                    map1.put("statusName","已签约");
                    map1.put("statusName","已签约");
                    map1.put("expensesStatusName",sign.getExpensesStatusName());
                    map1.put("expensesStatusName",sign.getExpensesStatusName());
                    String doctorCode = sign.getDoctor();
                    String doctorCode = sign.getDoctor();
@ -132,8 +134,10 @@ public class FamilyMemberService extends BaseService {
        boolean ssSign = false;
        boolean ssSign = false;
        boolean jtSign = false;
        boolean jtSign = false;
        map.put("statusName","未签约");
        map.put("statusName","未签约");
        map.put("status",-1);
        if (sign != null) {
        if (sign != null) {
            map.put("statusName","已签约");
            map.put("statusName","已签约");
            map.put("status",sign.getStatus());
            String doctorCode = sign.getDoctor();
            String doctorCode = sign.getDoctor();
            map.put("doctor",doctorCode);
            map.put("doctor",doctorCode);
            map.put("doctorName",sign.getDoctorName());
            map.put("doctorName",sign.getDoctorName());

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/patient/AdminPatientService.java

@ -214,7 +214,7 @@ public class AdminPatientService extends BaseJpaService<Patient,Long> {
    }
    }
    //根据手机号查找
    //根据手机号查找
    public Patient findByMobile(String mobile){
    public List<Patient> findByMobile(String mobile){
        return  patientDao.findByMobile(mobile);
        return  patientDao.findByMobile(mobile);
    }
    }
    //根据身份证号查找
    //根据身份证号查找

+ 22 - 5
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/WebserviceUtil.java

@ -1,7 +1,10 @@
package com.yihu.wlyy.service.common.util;
package com.yihu.wlyy.service.common.util;
import com.yihu.wlyy.service.controller.PrescriptionController;
import org.apache.axis.client.Call;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.client.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.namespace.QName;
import javax.xml.namespace.QName;
import java.util.Map;
import java.util.Map;
@ -13,6 +16,8 @@ import java.util.Map;
 **/
 **/
public class WebserviceUtil {
public class WebserviceUtil {
    private static Logger logger = LoggerFactory.getLogger(WebserviceUtil.class);
    /**
    /**
     * webservice 调用接口
     * webservice 调用接口
@ -20,34 +25,46 @@ public class WebserviceUtil {
    public static String post(String urlString,String namespace,String api, Map<String,String> params) throws Exception {
    public static String post(String urlString,String namespace,String api, Map<String,String> params) throws Exception {
        try {
        try {
            Service service = new Service();
            logger.info("ca_url:"+urlString);
            logger.info("ca_namespace:"+namespace);
            logger.info("api:"+api);
            Service service = new Service();
            logger.info("=======>通过service创建call对象");
            Call call = (Call) service.createCall();// 通过service创建call对象
            Call call = (Call) service.createCall();// 通过service创建call对象
            logger.info("=======>设置service所在URL");
            // 设置service所在URL
            // 设置service所在URL
            call.setTargetEndpointAddress(new java.net.URL(urlString));
            call.setTargetEndpointAddress(new java.net.URL(urlString));
            call.setOperationName(new QName(namespace, api));
            call.setOperationName(new QName(namespace, api));
            call.setUseSOAPAction(true);
            call.setUseSOAPAction(true);
            Object[] objs = null;
            Object[] objs = null;
            logger.info("=======>组装参数:"+params.size());
            if(params!=null && params.size()>0)
            if(params!=null && params.size()>0)
            {
            {
                logger.info("=======>遍历参数");
                objs = new Object[params.size()];
                objs = new Object[params.size()];
                int i=0;
                int i=0;
                for(String key : params.keySet())
                for(String key : params.keySet())
                {
                {
                    logger.info("=======>参数key:"+key);
                    logger.info("=======>接口参数:"+key);
                    call.addParameter(new QName(key), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的参数
                    call.addParameter(new QName(key), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的参数
                    logger.info("=======>参数值:"+params.get(key));
                    objs[i] = params.get(key);
                    objs[i] = params.get(key);
                    i++;
                    i++;
                }
                }
            }
            }
            logger.info("=======>设置返回类型");
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
            String  ret = (String )call.invoke(objs);
            logger.info("=======>开始请求");
            String  ret = (String)call.invoke(objs);
            logger.info("=======>请求结果:"+ret);
            logger.info("=======>请求结果.toString():"+ret.toString());
            return ret.toString();
            return ret.toString();
        } catch (Exception e) {
        } catch (Exception e) {
            System.out.print("urlString:"+urlString +" "+namespace+api);
            logger.info("=======>CA请求报错:"+e.getMessage());
            e.printStackTrace();
            e.printStackTrace();
            throw e;
            throw e;
        }
        }

+ 41 - 11
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.controller;
package com.yihu.wlyy.service.controller;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.service.prescription.PrescriptionCAService;
import com.yihu.wlyy.service.service.prescription.PrescriptionCAService;
import com.yihu.wlyy.service.service.prescription.PrescriptionService;
import com.yihu.wlyy.service.service.prescription.PrescriptionService;
@ -87,7 +88,11 @@ public class PrescriptionController extends BaseController{
	public String readNewsOnline(@ApiParam(name="data",value="json串",defaultValue = "{}")
	public String readNewsOnline(@ApiParam(name="data",value="json串",defaultValue = "{}")
								 @RequestParam(value = "data",required = true) String data){
								 @RequestParam(value = "data",required = true) String data){
		try {
		try {
			return write(200,"success","url","http://www.yihu.com/");
			String url = prescriptionService.getReadNewsOnline(data);
			if("-1".equals(url)){
				error(-1,"未找到对应的续方记录");
			}
			return write(200,"success","url",url);
		}catch (Exception e){
		}catch (Exception e){
			e.printStackTrace();
			e.printStackTrace();
			return error(-1,e.getMessage());
			return error(-1,e.getMessage());
@ -95,6 +100,26 @@ public class PrescriptionController extends BaseController{
	}
	}
	/***************************************获取im消息*****************************************************/
	@RequestMapping(value = "getLoglist",method = RequestMethod.GET)
	@ApiOperation("获取续方消息")
	public String getLoglist(@ApiParam(name = "consult", value = "咨询code", defaultValue = "10")
							 @RequestParam(value = "consult", required = true) String consult,
							 @ApiParam(name = "page", value = "第几页", defaultValue = "0")
							 @RequestParam(value = "page", required = true) Integer page,
							 @ApiParam(name = "pagesize", value = "页面大小", defaultValue = "1")
							 @RequestParam(value = "pagesize", required = true) Integer pagesize){
		try {
			JSONObject json = prescriptionService.getLoglist(consult,page,pagesize);
			return write(200,"success","data",json);
		}catch (Exception e){
			e.printStackTrace();
			return error(-1,"获取续方消息失败");
		}
	}
	/***************************************获取im消息*****************************************************/
	/**************************************提供智业调用的接口 end*******************************************************/
	/**************************************提供智业调用的接口 end*******************************************************/
@ -275,10 +300,11 @@ public class PrescriptionController extends BaseController{
	@ApiOperation("请求实名软证书并进行数字签名")
	@ApiOperation("请求实名软证书并进行数字签名")
	public Result requestRealNameSoftCertAndSign(@ApiParam(name="strUserIdcardNum",value="用户身份证号") @RequestParam String strUserIdcardNum,
	public Result requestRealNameSoftCertAndSign(@ApiParam(name="strUserIdcardNum",value="用户身份证号") @RequestParam String strUserIdcardNum,
												 @ApiParam(name="strRealNameSoftCertCalledPasswd",value="证书被调用保护口令") @RequestParam String strRealNameSoftCertCalledPasswd,
												 @ApiParam(name="strRealNameSoftCertCalledPasswd",value="证书被调用保护口令") @RequestParam String strRealNameSoftCertCalledPasswd,
												 @ApiParam(name="strOriginalData",value="原文(若原文大于 1KB,需先对原文取 MD5摘要值,而后以该 MD5摘要值入参)") @RequestParam String strOriginalData)
												 @ApiParam(name="strOriginalData",value="原文(若原文大于 1KB,需先对原文取 MD5摘要值,而后以该 MD5摘要值入参)") @RequestParam String strOriginalData,
												 @ApiParam(name="prescriptionCode",value="处方code") @RequestParam String prescriptionCode)
	{
	{
		try {
		try {
			String re = caService.requestRealNameSoftCertAndSign(strUserIdcardNum,strRealNameSoftCertCalledPasswd,strOriginalData);
			String re = caService.requestRealNameSoftCertAndSign(strUserIdcardNum,strRealNameSoftCertCalledPasswd,strOriginalData,prescriptionCode);
			return Result.success("请求实名软证书并进行数字签名成功!",re);
			return Result.success("请求实名软证书并进行数字签名成功!",re);
		} catch (Exception ex) {
		} catch (Exception ex) {
@ -290,10 +316,11 @@ public class PrescriptionController extends BaseController{
	@RequestMapping(value = "IsApplied",method = RequestMethod.POST)
	@RequestMapping(value = "IsApplied",method = RequestMethod.POST)
	@ResponseBody
	@ResponseBody
	@ApiOperation("判断是否有实名证书")
	@ApiOperation("判断是否有实名证书")
	public Result isApplied(@ApiParam(name="strUserIdcardNum",value="用户身份证号") @RequestParam String strUserIdcardNum)
	public Result isApplied(@ApiParam(name="strUserIdcardNum",value="用户身份证号") @RequestParam String strUserIdcardNum,
							@ApiParam(name="doctorCode",value="医生code") @RequestParam String doctorCode)
	{
	{
		try {
		try {
			String re = caService.isApplied(strUserIdcardNum);
			String re = caService.isApplied(strUserIdcardNum,doctorCode);
			return Result.success("判断是否有实名证书成功!",re);
			return Result.success("判断是否有实名证书成功!",re);
		} catch (Exception ex) {
		} catch (Exception ex) {
@ -305,10 +332,11 @@ public class PrescriptionController extends BaseController{
	@RequestMapping(value = "GetRealNameSoftCertExpiredDatetime",method = RequestMethod.POST)
	@RequestMapping(value = "GetRealNameSoftCertExpiredDatetime",method = RequestMethod.POST)
	@ResponseBody
	@ResponseBody
	@ApiOperation("获取实名软证书的过期时间")
	@ApiOperation("获取实名软证书的过期时间")
	public Result getRealNameSoftCertExpiredDatetime(@ApiParam(name="strUserIdcardNum",value="用户身份证号") @RequestParam String strUserIdcardNum)
	public Result getRealNameSoftCertExpiredDatetime(@ApiParam(name="strUserIdcardNum",value="用户身份证号") @RequestParam String strUserIdcardNum,
													 @ApiParam(name="doctorCode",value="医生code") @RequestParam String doctorCode)
	{
	{
		try {
		try {
			String re = caService.getRealNameSoftCertExpiredDatetime(strUserIdcardNum);
			String re = caService.getRealNameSoftCertExpiredDatetime(strUserIdcardNum,doctorCode);
			return Result.success("获取实名软证书的过期时间成功!",re);
			return Result.success("获取实名软证书的过期时间成功!",re);
		} catch (Exception ex) {
		} catch (Exception ex) {
@ -322,10 +350,11 @@ public class PrescriptionController extends BaseController{
	@ApiOperation("修改实名软证书调用保护口令")
	@ApiOperation("修改实名软证书调用保护口令")
	public Result modifyRealNameSoftCertCalledPasswd(@ApiParam(name="strUserIdcardNum",value="用户身份证号") @RequestParam String strUserIdcardNum,
	public Result modifyRealNameSoftCertCalledPasswd(@ApiParam(name="strUserIdcardNum",value="用户身份证号") @RequestParam String strUserIdcardNum,
													 @ApiParam(name="strOldCalledPasswd",value="旧证书调用保护口令") @RequestParam String strOldCalledPasswd,
													 @ApiParam(name="strOldCalledPasswd",value="旧证书调用保护口令") @RequestParam String strOldCalledPasswd,
													 @ApiParam(name="strNewCalledPasswd",value="新证书调用保护口令") @RequestParam String strNewCalledPasswd)
													 @ApiParam(name="strNewCalledPasswd",value="新证书调用保护口令") @RequestParam String strNewCalledPasswd,
													 @ApiParam(name="doctorCode",value="医生code") @RequestParam String doctorCode)
	{
	{
		try {
		try {
			String re = caService.modifyRealNameSoftCertCalledPasswd(strUserIdcardNum,strOldCalledPasswd,strNewCalledPasswd);
			String re = caService.modifyRealNameSoftCertCalledPasswd(strUserIdcardNum,strOldCalledPasswd,strNewCalledPasswd,doctorCode);
			return Result.success("修改实名软证书调用保护口令成功!",re);
			return Result.success("修改实名软证书调用保护口令成功!",re);
		} catch (Exception ex) {
		} catch (Exception ex) {
@ -340,10 +369,11 @@ public class PrescriptionController extends BaseController{
	@ApiOperation("验证签名(带多服务器负载均衡)")
	@ApiOperation("验证签名(带多服务器负载均衡)")
	public Result verifySignOnMultiServer(@ApiParam(name="strSignData",value="签名值") @RequestParam String strSignData,
	public Result verifySignOnMultiServer(@ApiParam(name="strSignData",value="签名值") @RequestParam String strSignData,
								   @ApiParam(name="strCertData",value="证书主体数据") @RequestParam String strCertData,
								   @ApiParam(name="strCertData",value="证书主体数据") @RequestParam String strCertData,
								   @ApiParam(name="strOriginalData ",value="原文数据") @RequestParam String strOriginalData)
								   @ApiParam(name="strOriginalData ",value="原文数据") @RequestParam String strOriginalData,
										  @ApiParam(name="prescriptionCode ",value="处方code") @RequestParam String prescriptionCode)
	{
	{
		try {
		try {
			String re = caService.verifySignOnMultiServer(strSignData,strCertData,strOriginalData);
			String re = caService.verifySignOnMultiServer(strSignData,strCertData,strOriginalData,prescriptionCode);
			return Result.success("验证签名成功!",re);
			return Result.success("验证签名成功!",re);
		} catch (Exception ex) {
		} catch (Exception ex) {

+ 59 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/ZyDictController.java

@ -0,0 +1,59 @@
package com.yihu.wlyy.service.controller;
import com.yihu.wlyy.service.service.ZyDictDataService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by chenweida on 2017/8/10.
 * 智业字典同步接口
 */
@RestController
@RequestMapping("/third/dict/")
public class ZyDictController extends BaseController {
    @Autowired
    private ZyDictDataService zyDictDataService;
    @ApiOperation("下载智业所有字典")
    @RequestMapping(value = "/downLoadAllDict", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    public String downLoadAllDict(){
        try {
            zyDictDataService.allDict();
            return write(200, "下载智业所有字典!");
        } catch (Exception e) {
            return invalidUserException(e, -1, "下载智业所有字典");
        }
    }
    /**
     * IV_SUBJECT_CLASS_DICT
     * IV_STAFF_REG_TYPE_ALLOT_DICT
     * IV_STAFF_DICT
     * IV_PHYSIC_DICT
     * IV_ORG_PHYSIC_ALLOT_DICT
     * IV_DIAGNOSE_CLASS_DICT
     * IV_DEPT_STAFF_ALLOT_DICT
     * "commonDict"
     * IV_DEPT_DICT
     * @param dictName
     * @return
     */
    @ApiOperation("下载智业字典")
    @RequestMapping(value = "/downLoadDict", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    public String downLoadDict(@ApiParam(name = "dictName", value = "字典名称", defaultValue = "commonDict")
                               @RequestParam(value = "dictName", required = true) String dictName){
        try {
            zyDictDataService.dictByDictName(dictName);
            return write(200, "下载智业所有字典!");
        } catch (Exception e) {
            return invalidUserException(e, -1, "下载智业所有字典");
        }
    }
}

+ 16 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/consult/ConsultTeamDao.java

@ -0,0 +1,16 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.service.dao.consult;
import com.yihu.wlyy.service.entity.consult.ConsultTeam;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam, Long>, JpaSpecificationExecutor<ConsultTeam> {
	// 根據consult查詢咨询记录
	ConsultTeam findByConsult(String consult);
}

+ 13 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyCommonDictDao.java

@ -0,0 +1,13 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyCommonDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyCommonDictDao extends PagingAndSortingRepository<ZyCommonDict, Long>, JpaSpecificationExecutor<ZyCommonDict> {
}

+ 13 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvDeptDictDao.java

@ -0,0 +1,13 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyIvDeptDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyIvDeptDictDao extends PagingAndSortingRepository<ZyIvDeptDict, Long>, JpaSpecificationExecutor<ZyIvDeptDict> {
}

+ 11 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvDeptStaffAllotDictDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyIvDeptStaffAllotDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyIvDeptStaffAllotDictDao extends PagingAndSortingRepository<ZyIvDeptStaffAllotDict, Long>, JpaSpecificationExecutor<ZyIvDeptStaffAllotDict> {
}

+ 11 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvDiagnoseClassDictDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyIvDiagnoseClassDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyIvDiagnoseClassDictDao extends PagingAndSortingRepository<ZyIvDiagnoseClassDict, Long>, JpaSpecificationExecutor<ZyIvDiagnoseClassDict> {
}

+ 12 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvDiagnoseDictDao.java

@ -0,0 +1,12 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyIvDiagnoseDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyIvDiagnoseDictDao extends PagingAndSortingRepository<ZyIvDiagnoseDict, Long>, JpaSpecificationExecutor<ZyIvDiagnoseDict> {
}

+ 11 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvOrgPhysicAllotDictDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyIvOrgPhysicAllotDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyIvOrgPhysicAllotDictDao extends PagingAndSortingRepository<ZyIvOrgPhysicAllotDict, Long>, JpaSpecificationExecutor<ZyIvOrgPhysicAllotDict> {
}

+ 11 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvPhysicDictDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyIvPhysicDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyIvPhysicDictDao extends PagingAndSortingRepository<ZyIvPhysicDict, Long>, JpaSpecificationExecutor<ZyIvPhysicDict> {
}

+ 11 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvStaffDictDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyIvStaffDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyIvStaffDictDao extends PagingAndSortingRepository<ZyIvStaffDict, Long>, JpaSpecificationExecutor<ZyIvStaffDict> {
}

+ 12 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvStaffRegTypeAllotDictDao.java

@ -0,0 +1,12 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyIvStaffRegTypeAllotDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyIvStaffRegTypeAllotDictDao extends PagingAndSortingRepository<ZyIvStaffRegTypeAllotDict, Long>, JpaSpecificationExecutor<ZyIvStaffRegTypeAllotDict> {
}

+ 12 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/zydict/ZyIvSubjectClassDictDao.java

@ -0,0 +1,12 @@
package com.yihu.wlyy.service.dao.zydict;
import com.yihu.wlyy.service.entity.zydict.ZyIvSubjectClassDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/8/11.
 */
public interface ZyIvSubjectClassDictDao extends PagingAndSortingRepository<ZyIvSubjectClassDict, Long>, JpaSpecificationExecutor<ZyIvSubjectClassDict> {
}

File diff suppressed because it is too large
+ 3 - 3
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Message.java


+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/ZyPushLog.java

@ -14,7 +14,7 @@ import java.util.Date;
@Table(name = "wlyy_zy_push_log")
@Table(name = "wlyy_zy_push_log")
public class ZyPushLog extends IdEntity {
public class ZyPushLog extends IdEntity {
    private String type;//'接口类型 1(推送续方)',
    private String type;//'接口类型 1(推送续方),2续方请求',
    private String content;//'业务内容',
    private String content;//'业务内容',
    private String api;//'调用接口',
    private String api;//'调用接口',
    private String method;//'调用方式',
    private String method;//'调用方式',

+ 328 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/consult/ConsultTeam.java

@ -0,0 +1,328 @@
package com.yihu.wlyy.service.entity.consult;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * 三师咨询
 * @author George
 */
@Entity
@Table(name = "wlyy_consult_team")
public class ConsultTeam extends IdEntity {
	private static final long serialVersionUID = -7644448339473861513L;
	private String consult;         // 咨询标识
	private String doctor;          // 医生标识
	private String team;            // 三师团队标识
	private Integer type;           //  1、三师咨询,2、家庭医生咨询,6、患者名医咨询 7医生名医咨询 8续方咨询
	private String patient;         // 提问者标识
	private String name;            // 患者姓名
	private Integer sex;            // 患者性别
	private Date birthday;          // 患者生日
	private String photo;           // 患者头像
	private String when;            // 发病日期
	private String symptoms;        // 主要症状
	private Integer status;         // 咨询状态(0进行中,1已完成,-1患者取消,-2超时未响应自动关闭)
	private String images;          // 咨询图片URL,多图以逗号分隔
	private String voice;           // 咨询语音URL
	private String comment;         // 用户评价标识
	private String commentContent;  // 用户评价内容
	private Integer commentStar;    // 用户评价星级
	private Integer doctorRead;     // 医生未读数量
	private Integer patientRead;    // 患者未读数量
	private Date czrq;              // 咨询时间
	private String del;             // 作废标识,1正常,0作废
	private Long adminTeamId;//行政团队ID
	private Long guidance;   //关联指导
	private String doctorName;//醫生名字
	//起始消息id
	private String startMsgId;
	//结束消息id
	private String endMsgId;
	// 结束人
	private String endOperator;
	// 结束人类型
	private Integer endType;
	// 结束时间
	private Date endTime;
	//是否评价 1、已评价 0、未评价'
	private Integer evaluate;
	//评价时间
	private Date evaluateTime;
	private String relationCode;//关联业务表的code
	public Integer getEvaluate() {
		return evaluate;
	}
	public void setEvaluate(Integer evaluate) {
		this.evaluate = evaluate;
	}
	public Date getEvaluateTime() {
		return evaluateTime;
	}
	public void setEvaluateTime(Date evaluateTime) {
		this.evaluateTime = evaluateTime;
	}
	@Column(name = "admin_team_code")
	public Long getAdminTeamId() {
		return adminTeamId;
	}
	public void setAdminTeamId(Long adminTeamId) {
		this.adminTeamId = adminTeamId;
	}
	public String getConsult() {
		return consult;
	}
	public void setConsult(String consult) {
		this.consult = consult;
	}
	public ConsultTeam() {
	}
	public String getDoctor() {
		return doctor;
	}
	public void setDoctor(String doctor) {
		this.doctor = doctor;
	}
	public String getTeam() {
		return team;
	}
	public void setTeam(String team) {
		this.team = team;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public String getPatient() {
		return patient;
	}
	public void setPatient(String patient) {
		this.patient = patient;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	@Column(name = "fbsj")
	public String getWhen() {
		return when;
	}
	public void setWhen(String when) {
		this.when = when;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public String getImages() {
		return images;
	}
	public void setImages(String images) {
		this.images = images;
	}
	public String getVoice() {
		return voice;
	}
	public void setVoice(String voice) {
		this.voice = voice;
	}
	public String getComment() {
		return comment;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}
	@Column(name = "comment_content")
	public String getCommentContent() {
		return commentContent;
	}
	public void setCommentContent(String commentContent) {
		this.commentContent = commentContent;
	}
	@Column(name = "comment_star")
	public Integer getCommentStar() {
		return commentStar;
	}
	public void setCommentStar(Integer commentStar) {
		this.commentStar = commentStar;
	}
	@Column(name = "doctor_read")
	public Integer getDoctorRead() {
		return doctorRead;
	}
	public void setDoctorRead(Integer doctorRead) {
		this.doctorRead = doctorRead;
	}
	@Column(name = "patient_read")
	public Integer getPatientRead() {
		return patientRead;
	}
	public void setPatientRead(Integer patientRead) {
		this.patientRead = patientRead;
	}
	// 设定JSON序列化时的日期格式
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCzrq() {
		return czrq;
	}
	public void setCzrq(Date czrq) {
		this.czrq = czrq;
	}
	// 设定JSON序列化时的日期格式
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public String getSymptoms() {
		return symptoms;
	}
	public void setSymptoms(String symptoms) {
		this.symptoms = symptoms;
	}
	public String getDel() {
		return del;
	}
	public void setDel(String del) {
		this.del = del;
	}
	public Integer getSex() {
		return sex;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	@Transient
	public String getDoctorName() {
		return doctorName;
	}
	public void setDoctorName(String doctorName) {
		this.doctorName = doctorName;
	}
	public Long getGuidance() {
		return guidance;
	}
	public void setGuidance(Long guidance) {
		this.guidance = guidance;
	}
	public String getStartMsgId() {
		return startMsgId;
	}
	public void setStartMsgId(String startMsgId) {
		this.startMsgId = startMsgId;
	}
	public String getEndMsgId() {
		return endMsgId;
	}
	public void setEndMsgId(String endMsgId) {
		this.endMsgId = endMsgId;
	}
	public String getEndOperator() {
		return endOperator;
	}
	public void setEndOperator(String endOperator) {
		this.endOperator = endOperator;
	}
	public Integer getEndType() {
		return endType;
	}
	public void setEndType(Integer endType) {
		this.endType = endType;
	}
	public String getRelationCode() {
		return relationCode;
	}
	public void setRelationCode(String relationCode) {
		this.relationCode = relationCode;
	}
}

+ 70 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyCommonDict.java

@ -0,0 +1,70 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyCommonDict entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "zy_common_dict")
public class ZyCommonDict extends IdEntity implements java.io.Serializable {
    /**
     * '计量单位字典、药品剂型字典、科室类别字典、注射地点字典、皮试类型字典、费别字典、频次字典、药品毒理分类字典、用药方法字典、性别字典的字典结构';
     */
    // Fields
    private String dictName;//字典名称
    private String code;//编码
    private String name;//名称
    // Constructors
    /**
     * default constructor
     */
    public ZyCommonDict() {
    }
    /**
     * full constructor
     */
    public ZyCommonDict(String dictName, String code, String name) {
        this.dictName = dictName;
        this.code = code;
        this.name = name;
    }
    @Column(name = "dict_name", length = 200)
    public String getDictName() {
        return this.dictName;
    }
    public void setDictName(String dictName) {
        this.dictName = dictName;
    }
    @Column(name = "code", length = 50)
    public String getCode() {
        return this.code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name", length = 200)
    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

+ 85 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptDict.java

@ -0,0 +1,85 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvDeptDict entity. @author MyEclipse Persistence Tools
 * 科室字典
 */
@Entity
@Table(name = "zy_iv_dept_dict")
public class ZyIvDeptDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String deptCode;//科室代码
	private String deptName;//科室名称
	private String deptClass;//科室类型  详见科室类型字典中定义
	private String upperDept;//上级科室
	// Constructors
	/** default constructor */
	public ZyIvDeptDict() {
	}
	/** full constructor */
	public ZyIvDeptDict(String orgCode, String deptCode, String deptName,
			String deptType, String upperDept) {
		this.orgCode = orgCode;
		this.deptCode = deptCode;
		this.deptName = deptName;
		this.upperDept = upperDept;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "dept_code", length = 50)
	public String getDeptCode() {
		return this.deptCode;
	}
	public void setDeptCode(String deptCode) {
		this.deptCode = deptCode;
	}
	@Column(name = "dept_name", length = 200)
	public String getDeptName() {
		return this.deptName;
	}
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	@Column(name = "dept_class", length = 50)
	public String getDeptClass() {
		return deptClass;
	}
	public void setDeptClass(String deptClass) {
		this.deptClass = deptClass;
	}
	@Column(name = "upper_dept", length = 50)
	public String getUpperDept() {
		return this.upperDept;
	}
	public void setUpperDept(String upperDept) {
		this.upperDept = upperDept;
	}
}

+ 65 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDeptStaffAllotDict.java

@ -0,0 +1,65 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvDeptStaffAllotDict entity. @author MyEclipse Persistence Tools
 * 科室员工配置字典
 */
@Entity
@Table(name = "zy_iv_dept_staff_allot_dict")
public class ZyIvDeptStaffAllotDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String deptCode;//科室编码
	private String staffCode;//员工编码
	// Constructors
	/** default constructor */
	public ZyIvDeptStaffAllotDict() {
	}
	/** full constructor */
	public ZyIvDeptStaffAllotDict(String orgCode, String deptCode,
			String staffCode) {
		this.orgCode = orgCode;
		this.deptCode = deptCode;
		this.staffCode = staffCode;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "dept_code", length = 50)
	public String getDeptCode() {
		return this.deptCode;
	}
	public void setDeptCode(String deptCode) {
		this.deptCode = deptCode;
	}
	@Column(name = "staff_code", length = 50)
	public String getStaffCode() {
		return this.staffCode;
	}
	public void setStaffCode(String staffCode) {
		this.staffCode = staffCode;
	}
}

+ 109 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseClassDict.java

@ -0,0 +1,109 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvDiagnoseClassDict entity. @author MyEclipse Persistence Tools
 * 诊断类别字典
 */
@Entity
@Table(name = "zy_iv_diagnose_class_dict")
public class ZyIvDiagnoseClassDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String classSubNo;//类别子序号
	private String classCode;//类别代码
	private String className;//类别名称
	private String upperClass;//上级类别
	private String validFlag;//有效标志  0 :无效;1:有效
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	// Constructors
	/** default constructor */
	public ZyIvDiagnoseClassDict() {
	}
	/** full constructor */
	public ZyIvDiagnoseClassDict(String classSubNo, String classCode,
			String className, String upperClass, String validFlag,
			String spellCode, String wbzxCode) {
		this.classSubNo = classSubNo;
		this.classCode = classCode;
		this.className = className;
		this.upperClass = upperClass;
		this.validFlag = validFlag;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "class_sub_no", length = 200)
	public String getClassSubNo() {
		return this.classSubNo;
	}
	public void setClassSubNo(String classSubNo) {
		this.classSubNo = classSubNo;
	}
	@Column(name = "class_code", length = 200)
	public String getClassCode() {
		return this.classCode;
	}
	public void setClassCode(String classCode) {
		this.classCode = classCode;
	}
	@Column(name = "class_name", length = 2000)
	public String getClassName() {
		return this.className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	@Column(name = "upper_class", length = 200)
	public String getUpperClass() {
		return this.upperClass;
	}
	public void setUpperClass(String upperClass) {
		this.upperClass = upperClass;
	}
	@Column(name = "valid_flag", length = 50)
	public String getValidFlag() {
		return this.validFlag;
	}
	public void setValidFlag(String validFlag) {
		this.validFlag = validFlag;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
}

+ 111 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvDiagnoseDict.java

@ -0,0 +1,111 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvDiagnoseDict entity. @author MyEclipse Persistence Tools
 * 诊断字典表
 */
@Entity
@Table(name = "zy_iv_diagnose_dict")
public class ZyIvDiagnoseDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String diagnoseCode;//诊断代码
	private String diagnoseName;//诊断名称
	private String diagnoseAlias;//诊断别名
	private String diagnoseClass;//诊断类别  详见诊断类别字典定义
	private String validFlag;//有效标志   0 :无效;1:有效
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	// Constructors
	/** default constructor */
	public ZyIvDiagnoseDict() {
	}
	/** full constructor */
	public ZyIvDiagnoseDict(String diagnoseCode, String diagnoseName,
			String diagnoseAlias, String diagnoseClass, String validFlag,
			String spellCode, String wbzxCode) {
		this.diagnoseCode = diagnoseCode;
		this.diagnoseName = diagnoseName;
		this.diagnoseAlias = diagnoseAlias;
		this.diagnoseClass = diagnoseClass;
		this.validFlag = validFlag;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "diagnose_code", length = 200)
	public String getDiagnoseCode() {
		return this.diagnoseCode;
	}
	public void setDiagnoseCode(String diagnoseCode) {
		this.diagnoseCode = diagnoseCode;
	}
	@Column(name = "diagnose_name", length = 2000)
	public String getDiagnoseName() {
		return this.diagnoseName;
	}
	public void setDiagnoseName(String diagnoseName) {
		this.diagnoseName = diagnoseName;
	}
	@Column(name = "diagnose_alias", length = 2000)
	public String getDiagnoseAlias() {
		return this.diagnoseAlias;
	}
	public void setDiagnoseAlias(String diagnoseAlias) {
		this.diagnoseAlias = diagnoseAlias;
	}
	@Column(name = "diagnose_class", length = 50)
	public String getDiagnoseClass() {
		return this.diagnoseClass;
	}
	public void setDiagnoseClass(String diagnoseClass) {
		this.diagnoseClass = diagnoseClass;
	}
	@Column(name = "valid_flag", length = 50)
	public String getValidFlag() {
		return this.validFlag;
	}
	public void setValidFlag(String validFlag) {
		this.validFlag = validFlag;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
}

+ 54 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvOrgPhysicAllotDict.java

@ -0,0 +1,54 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvOrgPhysicAllotDict entity. @author MyEclipse Persistence Tools
 * 机构药品分发字典
 */
@Entity
@Table(name = "zy_iv_org_physic_allot_dict")
public class ZyIvOrgPhysicAllotDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String physicCode;//药品代码
	// Constructors
	/** default constructor */
	public ZyIvOrgPhysicAllotDict() {
	}
	/** full constructor */
	public ZyIvOrgPhysicAllotDict(String orgCode, String physicCode) {
		this.orgCode = orgCode;
		this.physicCode = physicCode;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "physic_code", length = 50)
	public String getPhysicCode() {
		return this.physicCode;
	}
	public void setPhysicCode(String physicCode) {
		this.physicCode = physicCode;
	}
}

+ 232 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvPhysicDict.java

@ -0,0 +1,232 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvPhysicDict entity. @author MyEclipse Persistence Tools
 * 药品字典
 */
@Entity
@Table(name = "zy_iv_physic_dict")
public class ZyIvPhysicDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String physicCode;//药品代码
	private String physicName;//药品名称
	private String physicSpec;//药品规格
	private String subjectClass;//药品科目  科目类别字典中定义
	private String doseUnit;//剂量单位 计量单位字典中定义
	private String quantityUnit;//数量单位  计量单位字典中定义
	private String packUnit;//包装单位   计量单位字典中定义
	private Double minDose;//最小剂量
	private Double packSpec;
	private Double retailPrice;//零售价
	private String physicForm;//药品剂型  药品剂型字典中定义
	private String toxicologyType;//毒理分类  药品毒理分类字典中定义
	private String basicFlag;//基本药物标志  0:否;1:是
	private String validFlag;//有效标志 0:无效;1:有效
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	private String storageConditions;//2表示需要冷藏,其他表示不需要冷藏
	private Integer sequence;//排序号
	// Constructors
	/** default constructor */
	public ZyIvPhysicDict() {
	}
	/** full constructor */
	public ZyIvPhysicDict(String physicCode, String physicName,
			String physicSpec, String subjectClass, String doseUnit,
			String quantityUnit, String packUnit, Double minDose,
			Double packSpec, Double retailPrice, String physicFrom,
			String toxicologyType, String basicFlag, String validFlag,
			String spellCode, String wbzxCode, Integer sequence) {
		this.physicCode = physicCode;
		this.physicName = physicName;
		this.physicSpec = physicSpec;
		this.subjectClass = subjectClass;
		this.doseUnit = doseUnit;
		this.quantityUnit = quantityUnit;
		this.packUnit = packUnit;
		this.minDose = minDose;
		this.packSpec = packSpec;
		this.retailPrice = retailPrice;
		this.toxicologyType = toxicologyType;
		this.basicFlag = basicFlag;
		this.validFlag = validFlag;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
		this.sequence = sequence;
	}
	@Column(name = "physic_code", length = 50)
	public String getPhysicCode() {
		return this.physicCode;
	}
	public void setPhysicCode(String physicCode) {
		this.physicCode = physicCode;
	}
	@Column(name = "physic_name", length = 2000)
	public String getPhysicName() {
		return this.physicName;
	}
	public void setPhysicName(String physicName) {
		this.physicName = physicName;
	}
	@Column(name = "physic_spec", length = 2000)
	public String getPhysicSpec() {
		return this.physicSpec;
	}
	public void setPhysicSpec(String physicSpec) {
		this.physicSpec = physicSpec;
	}
	@Column(name = "subject_class", length = 200)
	public String getSubjectClass() {
		return this.subjectClass;
	}
	public void setSubjectClass(String subjectClass) {
		this.subjectClass = subjectClass;
	}
	@Column(name = "dose_unit", length = 50)
	public String getDoseUnit() {
		return this.doseUnit;
	}
	public void setDoseUnit(String doseUnit) {
		this.doseUnit = doseUnit;
	}
	@Column(name = "quantity_unit", length = 50)
	public String getQuantityUnit() {
		return this.quantityUnit;
	}
	public void setQuantityUnit(String quantityUnit) {
		this.quantityUnit = quantityUnit;
	}
	@Column(name = "pack_unit", length = 250)
	public String getPackUnit() {
		return this.packUnit;
	}
	public void setPackUnit(String packUnit) {
		this.packUnit = packUnit;
	}
	@Column(name = "min_dose", precision = 20, scale = 6)
	public Double getMinDose() {
		return this.minDose;
	}
	public void setMinDose(Double minDose) {
		this.minDose = minDose;
	}
	@Column(name = "pack_spec", precision = 20, scale = 6)
	public Double getPackSpec() {
		return this.packSpec;
	}
	public void setPackSpec(Double packSpec) {
		this.packSpec = packSpec;
	}
	@Column(name = "retail_price", precision = 20, scale = 6)
	public Double getRetailPrice() {
		return this.retailPrice;
	}
	public void setRetailPrice(Double retailPrice) {
		this.retailPrice = retailPrice;
	}
	@Column(name = "physic_form", length = 50)
	public String getPhysicForm() {
		return physicForm;
	}
	public void setPhysicForm(String physicForm) {
		this.physicForm = physicForm;
	}
	@Column(name = "toxicology_type", length = 250)
	public String getToxicologyType() {
		return this.toxicologyType;
	}
	public void setToxicologyType(String toxicologyType) {
		this.toxicologyType = toxicologyType;
	}
	@Column(name = "basic_flag", length = 50)
	public String getBasicFlag() {
		return this.basicFlag;
	}
	public void setBasicFlag(String basicFlag) {
		this.basicFlag = basicFlag;
	}
	@Column(name = "valid_flag", length = 50)
	public String getValidFlag() {
		return this.validFlag;
	}
	public void setValidFlag(String validFlag) {
		this.validFlag = validFlag;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "sequence")
	public Integer getSequence() {
		return this.sequence;
	}
	public void setSequence(Integer sequence) {
		this.sequence = sequence;
	}
	@Column(name = "storage_conditions")
	public String getStorageConditions() {
		return storageConditions;
	}
	public void setStorageConditions(String storageConditions) {
		this.storageConditions = storageConditions;
	}
}

+ 146 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffDict.java

@ -0,0 +1,146 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;
import java.util.Date;
/**
 * ZyIvStaffDict entity. @author MyEclipse Persistence Tools
 * 员工字典
 */
@Entity
@Table(name = "zy_iv_staff_dict")
public class ZyIvStaffDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String staffCode;//员工编码
	private String staffName;//员工姓名
	private String workCode;//工作牌号
	private Date birthday;//出生日期
	private String sex;//性别  详见基础字典中定义
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	private String identityNo;//证件号
	private String certificateNo;//从业资格证编号
	// Constructors
	/** default constructor */
	public ZyIvStaffDict() {
	}
	/** full constructor */
	public ZyIvStaffDict(String orgCode, String staffCode, String staffName,
			String workCode, Timestamp birthday, String sex, String spellCode,
			String wbzxCode, String identityNo, String certificateNo) {
		this.orgCode = orgCode;
		this.staffCode = staffCode;
		this.staffName = staffName;
		this.workCode = workCode;
		this.birthday = birthday;
		this.sex = sex;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
		this.identityNo = identityNo;
		this.certificateNo = certificateNo;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "staff_code", length = 50)
	public String getStaffCode() {
		return this.staffCode;
	}
	public void setStaffCode(String staffCode) {
		this.staffCode = staffCode;
	}
	@Column(name = "staff_name", length = 50)
	public String getStaffName() {
		return this.staffName;
	}
	public void setStaffName(String staffName) {
		this.staffName = staffName;
	}
	@Column(name = "work_code", length = 50)
	public String getWorkCode() {
		return this.workCode;
	}
	public void setWorkCode(String workCode) {
		this.workCode = workCode;
	}
	@Column(name = "birthday", length = 0)
	public Date getBirthday() {
		return this.birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	@Column(name = "sex", length = 50)
	public String getSex() {
		return this.sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "identity_no", length = 200)
	public String getIdentityNo() {
		return this.identityNo;
	}
	public void setIdentityNo(String identityNo) {
		this.identityNo = identityNo;
	}
	@Column(name = "certificate_no", length = 200)
	public String getCertificateNo() {
		return this.certificateNo;
	}
	public void setCertificateNo(String certificateNo) {
		this.certificateNo = certificateNo;
	}
}

+ 88 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvStaffRegTypeAllotDict.java

@ -0,0 +1,88 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvStaffRegTypeAllotDict entity. @author MyEclipse Persistence Tools
 * 员工挂号类型配置字典
 */
@Entity
@Table(name = "zy_iv_staff_reg_type_allot_dict")
public class ZyIvStaffRegTypeAllotDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String orgCode;//机构编码
	private String staffCode;//员工编码
	private Integer registerType;//挂号类型编码
	private String registerTypeName;//挂号类型名称
	private Double registerFee;//挂号费用  挂号费+诊察费
	// Constructors
	/** default constructor */
	public ZyIvStaffRegTypeAllotDict() {
	}
	/** full constructor */
	public ZyIvStaffRegTypeAllotDict(String orgCode, String staffCode,
			Integer registerType, String registerTypeName, Double registerFee) {
		this.orgCode = orgCode;
		this.staffCode = staffCode;
		this.registerType = registerType;
		this.registerTypeName = registerTypeName;
		this.registerFee = registerFee;
	}
	@Column(name = "org_code", length = 50)
	public String getOrgCode() {
		return this.orgCode;
	}
	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	@Column(name = "staff_code", length = 50)
	public String getStaffCode() {
		return this.staffCode;
	}
	public void setStaffCode(String staffCode) {
		this.staffCode = staffCode;
	}
	@Column(name = "register_type")
	public Integer getRegisterType() {
		return this.registerType;
	}
	public void setRegisterType(Integer registerType) {
		this.registerType = registerType;
	}
	@Column(name = "register_type_name", length = 2000)
	public String getRegisterTypeName() {
		return this.registerTypeName;
	}
	public void setRegisterTypeName(String registerTypeName) {
		this.registerTypeName = registerTypeName;
	}
	@Column(name = "register_fee", precision = 20, scale = 6)
	public Double getRegisterFee() {
		return this.registerFee;
	}
	public void setRegisterFee(Double registerFee) {
		this.registerFee = registerFee;
	}
}

+ 88 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/zydict/ZyIvSubjectClassDict.java

@ -0,0 +1,88 @@
package com.yihu.wlyy.service.entity.zydict;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * ZyIvSubjectClassDict entity. @author MyEclipse Persistence Tools
 * 科目类别字典
 */
@Entity
@Table(name = "zy_iv_subject_class_dict")
public class ZyIvSubjectClassDict extends IdEntity implements java.io.Serializable {
	// Fields
	private String classCode;//类别代码
	private String className;//类别名称
	private String upperClass;//上级类别
	private String spellCode;//拼音首码
	private String wbzxCode;//五笔首码
	// Constructors
	/** default constructor */
	public ZyIvSubjectClassDict() {
	}
	/** full constructor */
	public ZyIvSubjectClassDict(String classCode, String className,
			String upperClass, String spellCode, String wbzxCode) {
		this.classCode = classCode;
		this.className = className;
		this.upperClass = upperClass;
		this.spellCode = spellCode;
		this.wbzxCode = wbzxCode;
	}
	@Column(name = "class_code", length = 200)
	public String getClassCode() {
		return this.classCode;
	}
	public void setClassCode(String classCode) {
		this.classCode = classCode;
	}
	@Column(name = "class_name", length = 2000)
	public String getClassName() {
		return this.className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	@Column(name = "upper_class", length = 200)
	public String getUpperClass() {
		return this.upperClass;
	}
	public void setUpperClass(String upperClass) {
		this.upperClass = upperClass;
	}
	@Column(name = "spell_code", length = 200)
	public String getSpellCode() {
		return this.spellCode;
	}
	public void setSpellCode(String spellCode) {
		this.spellCode = spellCode;
	}
	@Column(name = "wbzx_code", length = 200)
	public String getWbzxCode() {
		return this.wbzxCode;
	}
	public void setWbzxCode(String wbzxCode) {
		this.wbzxCode = wbzxCode;
	}
}

+ 36 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/LogService.java

@ -1,7 +1,12 @@
package com.yihu.wlyy.service.service;
package com.yihu.wlyy.service.service;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.wlyy.service.dao.HttpLogDao;
import com.yihu.wlyy.service.dao.HttpLogDao;
import com.yihu.wlyy.service.dao.ZyPushLogDao;
import com.yihu.wlyy.service.entity.HttpLog;
import com.yihu.wlyy.service.entity.HttpLog;
import com.yihu.wlyy.service.entity.ZyPushLog;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
@ -14,9 +19,12 @@ import java.util.Date;
@Service
@Service
public class LogService {
public class LogService {
    private org.slf4j.Logger logger= LoggerFactory.getLogger(LogService.class);
    @Autowired
    @Autowired
    private HttpLogDao httpLogDao;
    private HttpLogDao httpLogDao;
    @Autowired
    private ZyPushLogDao zyPushLogDao;
    @Autowired
    @Autowired
    private SystemDictService systemDictService;
    private SystemDictService systemDictService;
@ -50,6 +58,33 @@ public class LogService {
        }
        }
    }
    }
    /**
     * 保存长处方日志
     */
    public void saveZyPushLog(String api, String content, String error, String method, String request, String re, String status, String type){
        try{
            ZyPushLog log = new ZyPushLog();
            log.setCreateTime(new Date());
            log.setApi(api);
            log.setContent(content);
            log.setError(error);
            log.setMethod(method);
            log.setRequest(request);
            if(re.length()>10652261){
                log.setResponse("超过longtext限制");
            }else {
                log.setResponse(JSONObject.toJSONString(re, SerializerFeature.WriteMapNullValue));
            }
            log.setRetryTimes(0);
            log.setStatus(status);
            log.setType(type);
            zyPushLogDao.save(log);
        }catch (Exception e){
            e.printStackTrace();
            logger.info("保存数据日志出错");
        }
    }
    /**
    /**
     * 保存http调用日志【基卫接口】
     * 保存http调用日志【基卫接口】

+ 553 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZyDictDataService.java

@ -0,0 +1,553 @@
package com.yihu.wlyy.service.service;
import com.yihu.wlyy.service.dao.zydict.*;
import com.yihu.wlyy.service.entity.zydict.*;
import com.yihu.wlyy.service.service.prescription.PrescriptionService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * Created by chenweida on 2017/8/10.
 * 智业的字典数据
 */
@Service
public class ZyDictDataService extends ZysoftBaseService {
    private Logger logger = LoggerFactory.getLogger(ZyDictDataService.class);
    @Autowired
    private ZyCommonDictDao zyCommonDictDao;
    @Autowired
    private ZyIvDeptDictDao zyIvDeptDictDao;
    @Autowired
    private ZyIvDeptStaffAllotDictDao zyIvDeptStaffAllotDictDao;
    @Autowired
    private ZyIvDiagnoseClassDictDao zyIvDiagnoseClassDictDao;
    @Autowired
    private ZyIvDiagnoseDictDao zyIvDiagnoseDictDao;
    @Autowired
    private ZyIvOrgPhysicAllotDictDao zyIvOrgPhysicAllotDictDao;
    @Autowired
    private ZyIvPhysicDictDao zyIvPhysicDictDao;
    @Autowired
    private ZyIvStaffDictDao zyIvStaffDictDao;
    @Autowired
    private ZyIvStaffRegTypeAllotDictDao zyIvStaffRegTypeAllotDictDao;
    @Autowired
    private ZyIvSubjectClassDictDao zyIvSubjectClassDictDao;
    @Autowired
    private PrescriptionService prescriptionService;
    /**
     * 根据字典名称下载字典
     * @param dictName
     */
    public void dictByDictName(String dictName){
        switch (dictName){
            case IV_SUBJECT_CLASS_DICT:
                synchronizeZy_iv_subject_class_dict();
                break;
            case IV_STAFF_REG_TYPE_ALLOT_DICT:
                synchronizeZy_iv_staff_reg_type_allot_dict();
                break;
            case IV_STAFF_DICT:
                synchronizeZy_iv_staff_dict();
                break;
            case IV_PHYSIC_DICT:
                synchronizeZy_iv_physic_dict();
                break;
            case IV_ORG_PHYSIC_ALLOT_DICT:
                synchronizeZy_iv_org_physic_allot_dict();
                break;
            case IV_DIAGNOSE_CLASS_DICT:
                synchronizeZy_iv_diagnose_class_dict();
                break;
            case IV_DEPT_STAFF_ALLOT_DICT:
                synchronizeZy_iv_dept_staff_allot_dict();
                break;
            case "commonDict":
                synchronizeZyCommonDict();
                break;
            case IV_DEPT_DICT:
                synchronizeZy_iv_dept_dict();
                break;
            default:break;
        }
    }
    public void allDict() {
        try {
            //同步 zy_common_dict
            synchronizeZyCommonDict();
            //同步 zy_iv_dept_dict
            synchronizeZy_iv_dept_dict();
            //同步 zy_iv_dept_staff_allot_dict
            synchronizeZy_iv_dept_staff_allot_dict();
            //同步 zy_iv_diagnose_dict
            synchronizeZy_iv_diagnose_dict();
            //同步 zy_iv_diagnose_class_dict
            synchronizeZy_iv_diagnose_class_dict();
            //同步 zy_iv_org_physic_allot_dict
            synchronizeZy_iv_org_physic_allot_dict();
            //同步 zy_iv_physic_dict
            synchronizeZy_iv_physic_dict();
            //同步 zy_iv_staff_dict
            synchronizeZy_iv_staff_dict();  //birthday    Date(529084800000+0800) 无法解析
            //同步 zy_iv_staff_reg_type_allot_dict
            synchronizeZy_iv_staff_reg_type_allot_dict();
            //同步 zy_iv_subject_class_dict
            synchronizeZy_iv_subject_class_dict();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    private void synchronizeZy_iv_diagnose_dict() {
        logger.info("synchronized zy_iv_diagnose_dict start");
        String dictName = this.IV_DIAGNOSE_DICT;
        List<ZyIvDiagnoseDict> zyIvDiagnoseDicts = new ArrayList<>();
        //得到list
        zyIvDiagnoseDicts = commonGetOneDict(ZyIvDiagnoseDict.class, dictName);
        if (zyIvDiagnoseDicts != null && zyIvDiagnoseDicts.size() > 0) {
            //清空表
            zyIvDiagnoseDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_diagnose_dict  ,size:" + zyIvDiagnoseDicts.size());
            zyIvDiagnoseDictDao.save(zyIvDiagnoseDicts);
        }
        logger.info("synchronized zy_iv_diagnose_dict end");
    }
    @Transactional
    private void synchronizeZy_iv_subject_class_dict() {
        logger.info("synchronized zy_iv_subject_class_dict start");
        String dictName = this.IV_SUBJECT_CLASS_DICT;
        List<ZyIvSubjectClassDict> zyIvSubjectClassDicts = new ArrayList<>();
        //得到list
        zyIvSubjectClassDicts = commonGetOneDict(ZyIvSubjectClassDict.class, dictName);
        if (zyIvSubjectClassDicts.size() > 0) {
            //清空表
            zyIvSubjectClassDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_subject_class_dict  ,size:" + zyIvSubjectClassDicts.size());
            zyIvSubjectClassDictDao.save(zyIvSubjectClassDicts);
            logger.info("synchronized zy_iv_subject_class_dict end");
        }
    }
    @Transactional
    private void synchronizeZy_iv_staff_reg_type_allot_dict() {
        logger.info("synchronized zy_iv_staff_reg_type_allot_dict start");
        String dictName = this.IV_STAFF_REG_TYPE_ALLOT_DICT;
        List<ZyIvStaffRegTypeAllotDict> zyIvStaffRegTypeAllotDicts = new ArrayList<>();
        //得到list
        zyIvStaffRegTypeAllotDicts = commonGetOneDict(ZyIvStaffRegTypeAllotDict.class, dictName);
        if (zyIvStaffRegTypeAllotDicts != null && zyIvStaffRegTypeAllotDicts.size() > 0) {
            //清空表
            zyIvStaffRegTypeAllotDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_staff_reg_type_allot_dict  ,size:" + zyIvStaffRegTypeAllotDicts.size());
            zyIvStaffRegTypeAllotDictDao.save(zyIvStaffRegTypeAllotDicts);
            logger.info("synchronized zy_iv_staff_reg_type_allot_dict end");
        }
    }
    @Transactional
    private void synchronizeZy_iv_staff_dict() {
        logger.info("synchronized zy_iv_staff_dict start");
        String dictName = this.IV_STAFF_DICT;
        List<ZyIvStaffDict> zyIvStaffDicts = new ArrayList<>();
        //得到list
        zyIvStaffDicts = commonGetOneDict(ZyIvStaffDict.class, dictName);
        //清空表
        if (zyIvStaffDicts != null && zyIvStaffDicts.size() > 0) {
            zyIvStaffDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_staff_dict  ,size:" + zyIvStaffDicts.size());
            zyIvStaffDictDao.save(zyIvStaffDicts);
            logger.info("synchronized zy_iv_staff_dict end");
        }
    }
    @Transactional
    private void synchronizeZy_iv_physic_dict() {
        logger.info("synchronized zy_iv_physic_dict start");
        String dictName = this.IV_PHYSIC_DICT;
        List<ZyIvPhysicDict> zyIvPhysicDicts = new ArrayList<>();
        //得到list
        zyIvPhysicDicts = commonGetOneDict(ZyIvPhysicDict.class, dictName);
        if (zyIvPhysicDicts != null && zyIvPhysicDicts.size() > 0) {
            //清空表
            zyIvPhysicDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_physic_dict  ,size:" + zyIvPhysicDicts.size());
            zyIvPhysicDictDao.save(zyIvPhysicDicts);
            logger.info("synchronized zy_iv_physic_dict end");
        }
    }
    @Transactional
    private void synchronizeZy_iv_org_physic_allot_dict() {
        logger.info("synchronized zy_iv_org_physic_allot_dict start");
        String dictName = this.IV_ORG_PHYSIC_ALLOT_DICT;
        List<ZyIvOrgPhysicAllotDict> zyIvOrgPhysicAllotDicts = new ArrayList<>();
        //得到list
        zyIvOrgPhysicAllotDicts = commonGetOneDict(ZyIvOrgPhysicAllotDict.class, dictName);
        if (zyIvOrgPhysicAllotDicts != null && zyIvOrgPhysicAllotDicts.size() > 0) {
            //清空表
            zyIvOrgPhysicAllotDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_org_physic_allot_dict  ,size:" + zyIvOrgPhysicAllotDicts.size());
            zyIvOrgPhysicAllotDictDao.save(zyIvOrgPhysicAllotDicts);
        }
        logger.info("synchronized zy_iv_org_physic_allot_dict end");
    }
    @Transactional
    private void synchronizeZy_iv_diagnose_class_dict() {
        logger.info("synchronized zy_iv_diagnose_class_dict start");
        String dictName = this.IV_DIAGNOSE_CLASS_DICT;
        List<ZyIvDiagnoseClassDict> zIvDiagnoseClassDicts = new ArrayList<>();
        //得到list
        zIvDiagnoseClassDicts = commonGetOneDict(ZyIvDiagnoseClassDict.class, dictName);
        if (zIvDiagnoseClassDicts != null && zIvDiagnoseClassDicts.size() > 0) {
            //清空表
            zyIvDiagnoseClassDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_diagnose_class_dict  ,size:" + zIvDiagnoseClassDicts.size());
            zyIvDiagnoseClassDictDao.save(zIvDiagnoseClassDicts);
        }
        logger.info("synchronized zy_iv_diagnose_class_dict end");
    }
    @Transactional
    private void synchronizeZy_iv_dept_staff_allot_dict() {
        logger.info("synchronized zy_iv_dept_staff_allot_dict start");
        String dictName = this.IV_DEPT_STAFF_ALLOT_DICT;
        List<ZyIvDeptStaffAllotDict> syIvDeptStaffAllotDictz = new ArrayList<>();
        //得到list
        syIvDeptStaffAllotDictz = commonGetOneDict(ZyIvDeptStaffAllotDict.class, dictName);
        if (syIvDeptStaffAllotDictz != null && syIvDeptStaffAllotDictz.size() > 0) {
            //清空表
            zyIvDeptStaffAllotDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_dept_staff_allot_dict  ,size:" + syIvDeptStaffAllotDictz.size());
            zyIvDeptStaffAllotDictDao.save(syIvDeptStaffAllotDictz);
        }
        logger.info("synchronized zy_iv_dept_staff_allot_dict end");
    }
    @Transactional
    private void synchronizeZyCommonDict() {
        logger.info("synchronized zy_common_dict start");
        String[] dictNames = new String[]{
                this.IV_PHYSIC_FORM_DICT, this.IV_PHYSIC_INJECT_PLACE_DICT, this.IV_PHYSIC_SKIN_TEST_DICT,
                this.IV_RATE_TYPE_DICT, this.IV_RECIPE_FREQUENCY_DICT, this.IV_RECIPE_USAGE_DICT,
                this.IV_SEX_DICT, this.IV_PHYSIC_TOXICOLOGY_TYPE_DICT, this.IV_MEASURE_UNIT_DICT,
                this.IV_DEPT_TYPE_DICT};
        List<ZyCommonDict> zyCommonDictz = new ArrayList<>();
        Boolean isFlush = true;
        for (String dictName : dictNames) {
            String json = null;
            try {
                //调用智业的接口得到字典
                json = prescriptionService.getDictForI(dictName);
                JSONObject dataString = JSONObject.fromObject(json);
                JSONArray dataJSONArray = JSONObject.fromObject(dataString).getJSONArray("returnData");
                if (dataJSONArray.size() == 0) {
                    logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
                    continue;
                }
                //下划线转驼峰
                JSONArray newJA = new JSONArray();
                JSONArray jsonArrayTemp = dataJSONArray.getJSONArray(0);
                logger.info("zy dict data size " + jsonArrayTemp.size() + ",dictname:" + dictName);
                for (int i = 0; i < jsonArrayTemp.size(); i++) {
                    JSONObject jo = jsonArrayTemp.getJSONObject(i);
                    JSONObject newJO = new JSONObject();
                    jo.keySet().stream().forEach(key -> {
                        Object value = jo.get(key);
                        String newKey = Tool.lineToHump(key.toString());
                        newJO.put(newKey, value);
                    });
                    newJA.add(newJO);
                }
                ZyCommonDict[] zyCommonDictArrays = (ZyCommonDict[]) JSONArray.toArray(newJA, ZyCommonDict.class);
                zyCommonDictz.addAll(Arrays.asList(zyCommonDictArrays));
            } catch (Exception e) {
                e.printStackTrace();
                isFlush = false; //设置状态不能更新
                logger.error("dictName:" + dictName);
                logger.error("returnJson:" + json);
                logger.error(e.getMessage());
            }
        }
        //判断是否可以更新
        if (isFlush) {
            // 判断返回的数据是否大于0
            if (zyCommonDictz.size() > 0) {
                //清空表
                zyCommonDictDao.deleteAll();
                //新增数据
                logger.info("save table zy_common_dict  ,size:" + zyCommonDictz.size());
                zyCommonDictDao.save(zyCommonDictz);
            }
        }
        logger.info("synchronized zy_common_dict end");
    }
    @Transactional
    private void synchronizeZy_iv_dept_dict() {
        logger.info("synchronized zy_iv_dept_dict start");
        String dictName = this.IV_DEPT_DICT;
        List<ZyIvDeptDict> zyIvDeptDicts = new ArrayList<>();
        //得到list
        zyIvDeptDicts = commonGetOneDict(ZyIvDeptDict.class, dictName);
        if (zyIvDeptDicts != null && zyIvDeptDicts.size() > 0) {
            //清空表
            zyIvDeptDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_dept_dict  ,size:" + zyIvDeptDicts.size());
            zyIvDeptDictDao.save(zyIvDeptDicts);
        }
        logger.info("synchronized zy_iv_dept_dict end");
    }
    /**
     * 得到单个字典
     *
     * @param clazz    class
     * @param dictName 字典名称
     */
    private List commonGetOneDict(Class clazz, String dictName) {
        String json = null;
        try {
            //调用智业的接口得到字典
            json = prescriptionService.getDictForI(dictName);
            JSONObject joTemp = JSONObject.fromObject(json);
            JSONArray dataJSONArray = joTemp.getJSONArray("returnData");
            if (dataJSONArray.size() == 0) {
                logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
                return null;
            } else {
                dataJSONArray = dataJSONArray.getJSONArray(0);
            }
            logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
            //下划线转驼峰
            JSONArray newJA = new JSONArray();
            for (int i = 0; i < dataJSONArray.size(); i++) {
                JSONObject jo = dataJSONArray.getJSONObject(i);
                JSONObject newJO = new JSONObject();
                jo.keySet().stream().forEach(key -> {
                    Object value = jo.get(key);
                    String newKey = Tool.lineToHump(key.toString());
                    newJO.put(newKey, value);
                });
                newJA.add(newJO);
            }
            return (List) JSONArray.toCollection(newJA, clazz);
        } catch (Exception e) {
            logger.error("dictName:" + dictName);
            logger.error("returnJson:" + json);
            logger.error(e.getMessage());
        }
        return null;
    }
    /**
     * 智业的字典
     */
    public static final String IV_MEASURE_UNIT_DICT = "IV_MEASURE_UNIT_DICT";//("计量单位字典", "IV_MEASURE_UNIT_DICT"),
    public static final String IV_PHYSIC_FORM_DICT = "IV_PHYSIC_FORM_DICT";//("药品剂型字典", "IV_PHYSIC_FORM_DICT"),
    public static final String IV_PHYSIC_INJECT_PLACE_DICT = "IV_PHYSIC_INJECT_PLACE_DICT";//"计量单位字典", "IV_PHYSIC_INJECT_PLACE_DICT"),
    public static final String IV_PHYSIC_SKIN_TEST_DICT = "IV_PHYSIC_SKIN_TEST_DICT";//("皮试类型字典", "IV_PHYSIC_SKIN_TEST_DICT"),
    public static final String IV_RATE_TYPE_DICT = "IV_RATE_TYPE_DICT";//("费别字典", "IV_RATE_TYPE_DICT"),
    public static final String IV_RECIPE_FREQUENCY_DICT = "IV_RECIPE_FREQUENCY_DICT";//("频次字典", "IV_RECIPE_FREQUENCY_DICT"),
    public static final String IV_RECIPE_USAGE_DICT = "IV_RECIPE_USAGE_DICT";//("用药方法字典", "IV_RECIPE_USAGE_DICT"),
    public static final String IV_SEX_DICT = "IV_SEX_DICT";//("性别字典", "IV_SEX_DICT"),
    public static final String IV_PHYSIC_DICT = "IV_PHYSIC_DICT";//("药品字典", "IV_PHYSIC_DICT"),
    public static final String IV_ORG_PHYSIC_ALLOT_DICT = "IV_ORG_PHYSIC_ALLOT_DICT";//("机构药品分发字典", "IV_ORG_PHYSIC_ALLOT_DICT "),
    public static final String IV_SUBJECT_CLASS_DICT = "IV_SUBJECT_CLASS_DICT";//("科目类别字典", "IV_SUBJECT_CLASS_DICT"),
    public static final String IV_PHYSIC_TOXICOLOGY_TYPE_DICT = "IV_PHYSIC_TOXICOLOGY_TYPE_DICT";//("药品毒理分类字典", "IV_PHYSIC_TOXICOLOGY_TYPE_DICT"),
    public static final String IV_DEPT_DICT = "IV_DEPT_DICT";//("科室字典", "IV_DEPT_DICT"),
    public static final String IV_DEPT_TYPE_DICT = "IV_DEPT_TYPE_DICT";//("科室类型字典", "IV_DEPT_TYPE_DICT"),
    public static final String IV_DIAGNOSE_DICT = "IV_DIAGNOSE_DICT";//("诊断字典", "IV_DIAGNOSE_DICT"),
    public static final String IV_DIAGNOSE_CLASS_DICT = "IV_DIAGNOSE_CLASS_DICT";//("诊断类别字典", "IV_DIAGNOSE_CLASS_DICT"),
    public static final String IV_STAFF_DICT = "IV_STAFF_DICT";//("员工字典", "IV_STAFF_DICT"),
    public static final String IV_STAFF_REG_TYPE_ALLOT_DICT = "IV_STAFF_REG_TYPE_ALLOT_DICT";//("员工挂号类型配置字典", "IV_STAFF_REG_TYPE_ALLOT_DICT"),
    public static final String IV_DEPT_STAFF_ALLOT_DICT = "IV_DEPT_STAFF_ALLOT_DICT";//("科室员工配置字典", "IV_DEPT_STAFF_ALLOT_DICT");
    /**
     * 字典表的枚举类
     */
    public enum TableName {
        zy_common_dict("通用字典", "zy_common_dict"),
        zy_iv_dept_dict("科室字典", "zy_iv_dept_dict"),
        zy_iv_dept_staff_allot_dict("科室员工配置字典", "zy_iv_dept_staff_allot_dict"),
        zy_iv_diagnose_class_dict("诊断类别字典", "zy_iv_diagnose_class_dict"),
        zy_iv_diagnose_dict("诊断字典表", "zy_iv_diagnose_dict"),
        zy_iv_org_physic_allot_dict("机构药品分发字典", "zy_iv_org_physic_allot_dict"),
        zy_iv_physic_dict("药品字典", "zy_iv_physic_dict"),
        zy_iv_staff_dict("员工字典", "zy_iv_staff_dict"),
        zy_iv_staff_reg_type_allot_dict("员工挂号类型配置字典", "zy_iv_staff_reg_type_allot_dict"),
        zy_iv_subject_class_dict("科目类别字典", "zy_iv_subject_class_dict");
        TableName(String name, String dict) {
            this.name = name;
            this.dict = dict;
        }
        private String name;
        private String dict;
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getDict() {
            return dict;
        }
        public void setDict(String dict) {
            this.dict = dict;
        }
    }
    /**
     * 根据字典获取表名
     *
     * @param dictName
     * @return
     */
    public String getTableName(String dictName) {
        switch (dictName) {
            case IV_PHYSIC_FORM_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_PHYSIC_INJECT_PLACE_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_PHYSIC_SKIN_TEST_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_RATE_TYPE_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_RECIPE_FREQUENCY_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_RECIPE_USAGE_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_SEX_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_PHYSIC_TOXICOLOGY_TYPE_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_MEASURE_UNIT_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_DEPT_TYPE_DICT: {
                return TableName.zy_common_dict.getDict();
            }
            case IV_PHYSIC_DICT: {
                return TableName.zy_iv_physic_dict.getDict();
            }
            case IV_ORG_PHYSIC_ALLOT_DICT: {
                return TableName.zy_iv_org_physic_allot_dict.getDict();
            }
            case IV_SUBJECT_CLASS_DICT: {
                return TableName.zy_iv_subject_class_dict.getDict();
            }
            case IV_DIAGNOSE_DICT: {
                return TableName.zy_iv_diagnose_dict.getDict();
            }
            case IV_DIAGNOSE_CLASS_DICT: {
                return TableName.zy_iv_diagnose_class_dict.getDict();
            }
            case IV_STAFF_DICT: {
                return TableName.zy_iv_staff_dict.getDict();
            }
            case IV_STAFF_REG_TYPE_ALLOT_DICT: {
                return TableName.zy_iv_staff_reg_type_allot_dict.getDict();
            }
            case IV_DEPT_STAFF_ALLOT_DICT: {
                return TableName.zy_iv_dept_staff_allot_dict.getDict();
            }
            case IV_DEPT_DICT: {
                return TableName.zy_iv_dept_dict.getDict();
            }
        }
        return "";
    }
    public static class Tool {
        private static Pattern linePattern = Pattern.compile("_(\\w)");
        /**
         * 下划线转驼峰
         */
        public static String lineToHump(String str) {
            str = str.toLowerCase();
            Matcher matcher = linePattern.matcher(str);
            StringBuffer sb = new StringBuffer();
            while (matcher.find()) {
                matcher.appendReplacement(sb, matcher.group(1).toUpperCase());
            }
            matcher.appendTail(sb);
            return sb.toString();
        }
        /**
         * 驼峰转下划线(简单写法,效率低于{@link #humpToLine2(String)})
         */
        public static String humpToLine(String str) {
            return str.replaceAll("[A-Z]", "_$0").toLowerCase();
        }
        private static Pattern humpPattern = Pattern.compile("[A-Z]");
        /**
         * 驼峰转下划线,效率比上面高
         */
        public static String humpToLine2(String str) {
            Matcher matcher = humpPattern.matcher(str);
            StringBuffer sb = new StringBuffer();
            while (matcher.find()) {
                matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
            }
            matcher.appendTail(sb);
            return sb.toString();
        }
    }
}

+ 69 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftApi.java

@ -199,4 +199,73 @@ public class ZysoftApi extends AbstractApiExecuter {
    {
    {
        return cryptoParameter(key, param);
        return cryptoParameter(key, param);
    }
    }
    /**
     * CA底层Post统一接口
     */
    public String capost(Map<String,String> params, Map<String,String> headers, boolean openCrypto) throws Exception
    {
        List<RequestValue> paramsList = null;
        HeaderValue[] headersList = null;
        if(params!=null)
        {
            paramsList = new ArrayList<>();
            for(String key :params.keySet())
            {
                RequestValue obj = new RequestValue(key,params.get(key));
                paramsList.add(obj);
            }
        }
        if(headers!=null)
        {
            headersList = new HeaderValue[headers.size()];
            int i = 0;
            for(String key :headers.keySet())
            {
                headersList[i] = new HeaderValue(key,headers.get(key));
                i++;
            }
        }
        String ca_url = SystemConfig.sysPropertiesSets.get("ca_url");
        System.out.println("ca_url:"+ca_url);
        String response = doHttpPost(ca_url,licence,openCrypto,paramsList,headersList);
        System.out.print("response:"+response+"\r\n");
        response = response.replace("\r","").replace("\n","").replace("\t","").replace("\f","");
        return response;
    }
    /**
     * CA底层Get统一接口
     */
    public String caget(Map<String,String> params, Map<String,String> headers, boolean openCrypto) throws Exception
    {
        List<RequestValue> paramsList = null;
        HeaderValue[] headersList = null;
        if(params!=null)
        {
            paramsList = new ArrayList<>();
            for(String key :params.keySet())
            {
                RequestValue obj = new RequestValue(key,params.get(key));
                paramsList.add(obj);
            }
        }
        if(headers!=null)
        {
            headersList = new HeaderValue[headers.size()];
            int i = 0;
            for(String key :headers.keySet())
            {
                headersList[i] = new HeaderValue(key,headers.get(key));
                i++;
            }
        }
        String ca_url = SystemConfig.sysPropertiesSets.get("ca_url");
        String response = doHttpGet(ca_url, licence, openCrypto, paramsList, headersList);
        response = response.replace("\r","").replace("\n","").replace("\t","").replace("\f","");
        System.out.print("response:"+response+"\r\n");
        return response;
    }
}
}

+ 8 - 5
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftBaseService.java

@ -146,7 +146,6 @@ public class ZysoftBaseService {
                }
                }
            }
            }
            Map<String,String> map = objectMapper.readValue(re,Map.class);
            Map<String,String> map = objectMapper.readValue(re,Map.class);
            String code = map.get("CODE");
            String code = map.get("CODE");
            String message = map.get("MESSAGE");
            String message = map.get("MESSAGE");
@ -156,7 +155,8 @@ public class ZysoftBaseService {
                throw new HttpApiException(Integer.valueOf(code),message);
                throw new HttpApiException(Integer.valueOf(code),message);
            }
            }
            //保存http日志
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
//            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            logService.saveZyPushLog(api,content,null,"POST",msgHeader+","+msgBody,re,"1","2");
        }
        }
        catch (Exception ex)
        catch (Exception ex)
        {
        {
@ -167,7 +167,8 @@ public class ZysoftBaseService {
            error = sw.toString();
            error = sw.toString();
            isSuccess = false;
            isSuccess = false;
            //保存http日志
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
//            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            logService.saveZyPushLog(api,content,null,"POST",msgHeader+","+msgBody,re,"0","2");
            if(ex instanceof ApiException)
            if(ex instanceof ApiException)
            {
            {
@ -230,7 +231,8 @@ public class ZysoftBaseService {
//            com.alibaba.fastjson.JSONObject j = com.alibaba.fastjson.JSONObject.parseObject(re);
//            com.alibaba.fastjson.JSONObject j = com.alibaba.fastjson.JSONObject.parseObject(re);
            //保存http日志
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
//            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            logService.saveZyPushLog(api,content,null,"POST",msgHeader+","+msgBody,re,"1","2");
        }
        }
        catch (Exception ex)
        catch (Exception ex)
        {
        {
@ -240,7 +242,8 @@ public class ZysoftBaseService {
            error = sw.toString();
            error = sw.toString();
            //保存http日志
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
//            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            logService.saveZyPushLog(api,content,null,"POST",msgHeader+","+msgBody,re,"0","2");
            if(ex instanceof ApiException)
            if(ex instanceof ApiException)
            {
            {

+ 2 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/common/InitiSysProService.java

@ -1,6 +1,5 @@
package com.yihu.wlyy.service.service.common;
package com.yihu.wlyy.service.service.common;
import com.yihu.wlyy.service.common.CommonContent;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.dao.common.SystemPropertiesDao;
import com.yihu.wlyy.service.dao.common.SystemPropertiesDao;
import com.yihu.wlyy.service.entity.common.SystemProperties;
import com.yihu.wlyy.service.entity.common.SystemProperties;
@ -33,9 +32,10 @@ public class InitiSysProService {
        List<SystemProperties> sysvalueList = systemPropertiesDao.findSystemPropertiesByClientAndSpaValue(1);
        List<SystemProperties> sysvalueList = systemPropertiesDao.findSystemPropertiesByClientAndSpaValue(1);
        if(!sysvalueList.isEmpty()){
        if(!sysvalueList.isEmpty()){
            for (SystemProperties systemProperties : sysvalueList) {
            for (SystemProperties systemProperties : sysvalueList) {
                System.out.println("key:"+systemProperties.getKey());
                System.out.println("value:"+systemProperties.getValue());
                sysPropertiesSets.put(systemProperties.getKey(),systemProperties.getValue());
                sysPropertiesSets.put(systemProperties.getKey(),systemProperties.getValue());
            }
            }
            SystemConfig.sysPropertiesSets = sysPropertiesSets;
            SystemConfig.sysPropertiesSets = sysPropertiesSets;
        }
        }
    }
    }

+ 120 - 20
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionCAService.java

@ -1,15 +1,24 @@
package com.yihu.wlyy.service.service.prescription;
package com.yihu.wlyy.service.service.prescription;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.common.http.HttpApiException;
import com.yihu.wlyy.service.common.util.StringUtil;
import com.yihu.wlyy.service.common.util.StringUtil;
import com.yihu.wlyy.service.common.util.WebserviceUtil;
import com.yihu.wlyy.service.common.util.WebserviceUtil;
import com.yihu.wlyy.service.service.LogService;
import com.yihu.wlyy.service.service.LogService;
import com.yihu.wlyy.service.service.ZysoftApi;
import com.yihu.wlyy.service.service.ZysoftBaseService;
import com.zoe.phip.ssp.sdk.ApiException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Map;
import java.util.UUID;
/**
/**
@ -17,7 +26,7 @@ import java.util.Map;
 * 长处方CA认证服务
 * 长处方CA认证服务
 */
 */
@Service
@Service
public class PrescriptionCAService {
public class PrescriptionCAService extends ZysoftBaseService {
    private String IS_APPLIED="XMCAF_SOFT_judgeRealNameSoftCertIsApplied"; //判断实名软证书是否已申请
    private String IS_APPLIED="XMCAF_SOFT_judgeRealNameSoftCertIsApplied"; //判断实名软证书是否已申请
    private String REQUEST_SIGN = "XMCAF_SOFT_requestRealNameSoftCertAndSign";//请求实名软证书并进行数字签名
    private String REQUEST_SIGN = "XMCAF_SOFT_requestRealNameSoftCertAndSign";//请求实名软证书并进行数字签名
@ -32,7 +41,7 @@ public class PrescriptionCAService {
    @Autowired
    @Autowired
    private ObjectMapper objectMapper;
    private ObjectMapper objectMapper;
    private String getHeaderXml(String api)
    private String getHeaderXml(String api,String srcBusinessStreamNO,String srcRequestStreamNO)
    {
    {
        return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
        return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
            "<root>\n" +
            "<root>\n" +
@ -42,21 +51,105 @@ public class PrescriptionCAService {
            "   <certificate></certificate>\n" +
            "   <certificate></certificate>\n" +
            "   <srcIP>10.95.22.10</srcIP >\n" +
            "   <srcIP>10.95.22.10</srcIP >\n" +
            "   <srcUserMac>60-D8-19-57-66-E3</srcUserMac>\n" +
            "   <srcUserMac>00:50:56:85:39:82</srcUserMac>\n" +
            "   <srcSystemCode>1</srcSystemCode>\n" +
            "   <srcSystemCode>1</srcSystemCode>\n" +
            "   <srcSystemName>厦门i健康</srcSystemName>\n" +
            "   <srcSystemName>厦门i健康</srcSystemName>\n" +
            "   <srcBusinessNodeCode>node01</srcBusinessNodeCode>\n" +
            "   <srcBusinessNodeCode>node01</srcBusinessNodeCode>\n" +
            "   <srcBusinessNodeName>审核</srcBusinessNodeName>\n" +
            "   <srcBusinessNodeName>审核</srcBusinessNodeName>\n" +
            "   <srcOperatorAccount>Zhuangsd</srcOperatorAccount>\n" +
            "   <srcBusinessStreamNO>11111</srcBusinessStreamNO>\n" +
            "   <srcOperatorAccount>"+srcBusinessStreamNO+"</srcOperatorAccount>\n" +
            "   <srcBusinessStreamNO>"+srcBusinessStreamNO+"</srcBusinessStreamNO>\n" +
            "   <srcRequestStreamNO>"+srcRequestStreamNO+"</srcRequestStreamNO>\n" +
            "   <srcDataExtProperty></srcDataExtProperty>\n" +
            "   <srcDataExtProperty></srcDataExtProperty>\n" +
            "</root>";
            "</root>";
    }
    }
    /**
    /**
     * CA认证服务二次封装
     * 生产环境 智业CA接口二次封装
     * @param api
     * @param params
     * @param srcBusinessStreamNO
     * @return
     * @throws Exception
     */
     */
    private String postCAServer(String api, Map<String,String> params) throws Exception
    public String postZyCaServer(String api, Map<String,String> params,String srcBusinessStreamNO,String content) throws Exception{
        String msgBody = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                "<root>\n";
        if(params!=null && params.size()>0)
        {
            for(String key : params.keySet())
            {
                msgBody += "    <"+key+">"+params.get(key)+"</"+key+">\n";
            }
        }
        msgBody += "</root>";
        String srcRequestStreamNO = UUID.randomUUID().toString().replace("-", "");
        String msgHeader = getHeaderXml(api,srcBusinessStreamNO,srcRequestStreamNO);
        System.out.println("msgHerder:"+msgHeader);
        System.out.println("msgBody:"+msgBody);
        String re = "";
        Map<String,String> paramsList = new HashMap<>();
        paramsList.put("msgHeader",msgHeader);
        paramsList.put("msgBody",msgBody);
        //新增日志
        String method = "POST";
        Boolean isSuccess = true;
        String error = "";
        int times = 0;
        try {
//            re = ZysoftApi.getSingleton().post(ca_url, paramsList, null,true);
            re = ZysoftApi.getSingleton().capost(paramsList, null,true);
            System.out.println("re=====>:"+re);
//            Map<String,String> map = objectMapper.readValue(re,Map.class);
//            String code = map.get("CODE");
//
//            if(!code.equals("1"))
//            {
//                throw new HttpApiException(Integer.valueOf(code),map.get("MESSAGE"));
//            }
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
        }
        catch (Exception ex)
        {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            System.out.println("error1:"+ex.getMessage());
            error = sw.toString();
            System.out.println("error2:"+error);
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                System.out.println("error3:"+ex.getMessage());
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                System.out.println("error4:"+ex.getMessage());
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
        return re;
    }
    /**
     * 测试环境:CA认证服务二次封装
     */
    private String postCAServer(String api, Map<String,String> params,String srcBusinessStreamNO) throws Exception
    {
    {
        String urlString = SystemConfig.sysPropertiesSets.get("ca_url");
        String urlString = SystemConfig.sysPropertiesSets.get("ca_url");
@ -73,8 +166,8 @@ public class PrescriptionCAService {
        }
        }
        msgBody += "</root>";
        msgBody += "</root>";
        String msgHeader = getHeaderXml(api);
        String srcRequestStreamNO = UUID.randomUUID().toString().replace("-", "");
        String msgHeader = getHeaderXml(api,srcBusinessStreamNO,srcRequestStreamNO);
        Map<String,String> p = new HashMap<>();
        Map<String,String> p = new HashMap<>();
        p.put("msgHeader",msgHeader);
        p.put("msgHeader",msgHeader);
@ -86,7 +179,7 @@ public class PrescriptionCAService {
    /**
    /**
     * 判断是否有实名证书
     * 判断是否有实名证书
     **/
     **/
    public String isApplied(String strUserIdcardNum)  throws Exception
    public String isApplied(String strUserIdcardNum,String srcBusinessStreamNO)  throws Exception
    {
    {
        Boolean isSuccess = true;
        Boolean isSuccess = true;
        String re = "";
        String re = "";
@ -98,7 +191,9 @@ public class PrescriptionCAService {
            params.put("strUserIdcardNum",strUserIdcardNum);
            params.put("strUserIdcardNum",strUserIdcardNum);
            body = objectMapper.writeValueAsString(params);
            body = objectMapper.writeValueAsString(params);
            re = postCAServer(action, params);
//            re = postCAServer(action, params,srcBusinessStreamNO);
            //生产环境,调用智业统一平台接口,rest接口
            re = postZyCaServer(action, params,srcBusinessStreamNO,"判断是否有实名证书");
            if(StringUtil.isEmpty(re))
            if(StringUtil.isEmpty(re))
            {
            {
@ -131,7 +226,7 @@ public class PrescriptionCAService {
    /**
    /**
     * 请求实名软证书并进行数字签名
     * 请求实名软证书并进行数字签名
     **/
     **/
    public String requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData) throws Exception
    public String requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData,String srcBusinessStreamNO) throws Exception
    {
    {
        Boolean isSuccess = true;
        Boolean isSuccess = true;
        String re = "";
        String re = "";
@ -147,7 +242,10 @@ public class PrescriptionCAService {
            body = objectMapper.writeValueAsString(params);
            body = objectMapper.writeValueAsString(params);
            re = postCAServer(action, params);
            //测试环境开启下面这行代码,webservice接口
//            re = postCAServer(action, params,srcBusinessStreamNO);
            //生产环境,调用智业统一平台接口,rest接口
            re = postZyCaServer(action, params,srcBusinessStreamNO,"请求实名软证书并进行数字签名");
            if(StringUtil.isEmpty(re))
            if(StringUtil.isEmpty(re))
            {
            {
@ -183,7 +281,7 @@ public class PrescriptionCAService {
    /**
    /**
     * 获取实名软证书的过期时间
     * 获取实名软证书的过期时间
     **/
     **/
    public String getRealNameSoftCertExpiredDatetime(String strUserIdcardNum)  throws Exception
    public String getRealNameSoftCertExpiredDatetime(String strUserIdcardNum,String srcBusinessStreamNO)  throws Exception
    {
    {
        Boolean isSuccess = true;
        Boolean isSuccess = true;
        String re = "";
        String re = "";
@ -196,8 +294,9 @@ public class PrescriptionCAService {
            body = objectMapper.writeValueAsString(params);
            body = objectMapper.writeValueAsString(params);
            re = postCAServer(action, params);
//            re = postCAServer(action, params,srcBusinessStreamNO);
            re = postZyCaServer(action, params,srcBusinessStreamNO,"获取实名软证书的过期时间");
            if(StringUtil.isEmpty(re))
            if(StringUtil.isEmpty(re))
            {
            {
                throw new Exception("返回为空!");
                throw new Exception("返回为空!");
@ -229,7 +328,7 @@ public class PrescriptionCAService {
    /**
    /**
     * 修改实名软证书调用保护口令
     * 修改实名软证书调用保护口令
     **/
     **/
    public String modifyRealNameSoftCertCalledPasswd(String strUserIdcardNum,String strOldCalledPasswd,String strNewCalledPasswd) throws Exception
    public String modifyRealNameSoftCertCalledPasswd(String strUserIdcardNum,String strOldCalledPasswd,String strNewCalledPasswd,String srcBusinessStreamNO) throws Exception
    {
    {
        Boolean isSuccess = true;
        Boolean isSuccess = true;
        String re = "";
        String re = "";
@ -244,7 +343,8 @@ public class PrescriptionCAService {
            params.put("strNewCalledPasswd",strNewCalledPasswd);
            params.put("strNewCalledPasswd",strNewCalledPasswd);
            body = objectMapper.writeValueAsString(params);
            body = objectMapper.writeValueAsString(params);
            re = postCAServer(action, params);
//            re = postCAServer(action, params,srcBusinessStreamNO);
            re = postZyCaServer(action, params,srcBusinessStreamNO,"修改实名软证书调用保护口令");
            if(StringUtil.isEmpty(re))
            if(StringUtil.isEmpty(re))
            {
            {
@ -283,7 +383,7 @@ public class PrescriptionCAService {
    /**
    /**
     * 验证签名(带多服务器负载均衡)
     * 验证签名(带多服务器负载均衡)
     **/
     **/
    public String verifySignOnMultiServer(String strSignData,String strCertData,String strOriginalData) throws Exception
    public String verifySignOnMultiServer(String strSignData,String strCertData,String strOriginalData,String srcBusinessStreamNO) throws Exception
    {
    {
        Boolean isSuccess = true;
        Boolean isSuccess = true;
        String re = "";
        String re = "";
@ -297,8 +397,8 @@ public class PrescriptionCAService {
            params.put("strOriginalData",strOriginalData);
            params.put("strOriginalData",strOriginalData);
            body = objectMapper.writeValueAsString(params);
            body = objectMapper.writeValueAsString(params);
            re = postCAServer(action, params);
//            re = postCAServer(action, params,srcBusinessStreamNO);
            re = postZyCaServer(action, params,srcBusinessStreamNO,"验证签名(带多服务器负载均衡)");
            if(StringUtil.isEmpty(re))
            if(StringUtil.isEmpty(re))
            {
            {
                throw new Exception("返回为空!");
                throw new Exception("返回为空!");

+ 155 - 20
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -3,16 +3,16 @@ package com.yihu.wlyy.service.service.prescription;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.common.util.AmoutUtils;
import com.yihu.wlyy.service.common.util.AmoutUtils;
import com.yihu.wlyy.service.common.util.CommonUtil;
import com.yihu.wlyy.service.common.util.CommonUtil;
import com.yihu.wlyy.service.common.util.DateUtil;
import com.yihu.wlyy.service.common.util.DateUtil;
import com.yihu.wlyy.service.dao.*;
import com.yihu.wlyy.service.dao.*;
import com.yihu.wlyy.service.dao.consult.ConsultTeamDao;
import com.yihu.wlyy.service.dao.prescription.*;
import com.yihu.wlyy.service.dao.prescription.*;
import com.yihu.wlyy.service.entity.Doctor;
import com.yihu.wlyy.service.entity.Hospital;
import com.yihu.wlyy.service.entity.Patient;
import com.yihu.wlyy.service.entity.SignFamily;
import com.yihu.wlyy.service.entity.*;
import com.yihu.wlyy.service.entity.consult.ConsultTeam;
import com.yihu.wlyy.service.entity.prescription.*;
import com.yihu.wlyy.service.entity.prescription.*;
import com.yihu.wlyy.service.entity.prescription.VO.PrescriptionExpressageVO;
import com.yihu.wlyy.service.entity.prescription.VO.PrescriptionExpressageVO;
import com.yihu.wlyy.service.service.ZysoftBaseService;
import com.yihu.wlyy.service.service.ZysoftBaseService;
@ -65,11 +65,14 @@ public class PrescriptionService extends ZysoftBaseService{
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    @Autowired
    @Autowired
    private PrescriptionReviewedDao prescriptionReviewedDao;
    private PrescriptionReviewedDao prescriptionReviewedDao;
    @Autowired
    private MessageDao messageDao;
    @Value("${im.data_base_name}")
    private String im;
    @Value("${redisChannel.prescription}")
    @Value("${redisChannel.prescription}")
    private String channelTopic;
    private String channelTopic;
//    private String channelTopic = "redisPrescription";
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
    @Autowired
    private AmoutUtils amoutUtils;
    private AmoutUtils amoutUtils;
@ -130,6 +133,19 @@ public class PrescriptionService extends ZysoftBaseService{
                        prescriptionInfo.setDrugName(info.getString("ITEM_NAME"));//药品名称
                        prescriptionInfo.setDrugName(info.getString("ITEM_NAME"));//药品名称
                        prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                        prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                        prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
                        prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
                        String subjectClass = info.getString("SUBJECT_CLASS");
                        if(StringUtils.isBlank(subjectClass)){//处理默认药品的科目类型为空
                            StringBuffer sql = new StringBuffer("SELECT subject_class from zy_iv_physic_dict WHERE physic_code = ?");
                            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql.toString(),info.getString("ITEM_CODE"));
                            if(list!=null&&list.size()>0){
                                Object subject_class = list.get(0).get("subject_class");
                                if(subject_class!=null){
                                    subjectClass = subject_class.toString();
                                }
                            }
                        }
                        prescriptionInfo.setSubjectClass(subjectClass);//科目编码
                        //prescriptionInfo.setSubjectClass(info.getString("SUBJECT_CLASS"));//"科目类别编码",
                        prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
                        prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
                        prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("ITEM_PRICE")));//药品单价
                        prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("ITEM_PRICE")));//药品单价
                        prescriptionInfo.setNum(info.getInteger("ITEM_QUANTITY"));//药品数目
                        prescriptionInfo.setNum(info.getInteger("ITEM_QUANTITY"));//药品数目
@ -166,6 +182,9 @@ public class PrescriptionService extends ZysoftBaseService{
                        }
                        }
                        prescriptionInfo.setIsRefrigerate(isRefrigerate);
                        prescriptionInfo.setIsRefrigerate(isRefrigerate);
                        //用药频率
                        prescriptionInfo.setDrugRateName(getZyCommonDictName(info.getString("drugRate")));
                        infoList.add(prescriptionInfo);
                        infoList.add(prescriptionInfo);
                    }
                    }
@ -175,13 +194,30 @@ public class PrescriptionService extends ZysoftBaseService{
                    //保存新的药品
                    //保存新的药品
                    prescriptionInfoDao.save(infoList);
                    prescriptionInfoDao.save(infoList);
                    //发送系统消息
                    Message message = new Message();
                    message.setCzrq(new Date());
                    message.setCreateTime(new Date());
                    message.setContent("您有1个续方申请已在线下调整完成,请点击进行CA认证。");
                    message.setRead(1);//设置未读
                    message.setReceiver(prescription.getDoctor());//设置接受医生的code
                    message.setSender("系统");//设置发送的用户
                    message.setSenderName("system");
                    message.setCode(getCode());
                    message.setTitle("新增系统消息");
                    message.setType(9);
                    message.setReadonly(1);//是否只读消息
                    message.setOver("1");//未处理
                    message.setRelationCode(prescription.getCode());
                    messageDao.save(message);
                    // redis 的发布 {tilte:redisAddPrescription   state: 1 ,//1:成功,2.失败 mes:'开方成功' prescription : "0001" //续方CODE  }
                    // redis 的发布 {tilte:redisAddPrescription   state: 1 ,//1:成功,2.失败 mes:'开方成功' prescription : "0001" //续方CODE  }
                    JSONObject message = new JSONObject();
                    message.put("title","adjustPrescription");
                    message.put("state",1);
                    message.put("prescription",prescription.getCode());
                    message.put("mes","调整处方完成");
                    redisTemplate.convertAndSend(channelTopic,message.toString());
//                    JSONObject redisMessage = new JSONObject();
//                    redisMessage.put("title","adjustPrescription");
//                    redisMessage.put("state",1);
//                    redisMessage.put("prescription",prescription.getCode());
//                    redisMessage.put("mes","调整处方完成");
//                    redisTemplate.opsForList().leftPush(channelTopic,redisMessage.toString());
                }else {
                }else {
                    //调整失败
                    //调整失败
                    prescription.setStatus(4);
                    prescription.setStatus(4);
@ -206,6 +242,18 @@ public class PrescriptionService extends ZysoftBaseService{
        return addZyPushLog(jsonObject,"prescriptionAdjustCompleted","接收线下处方调整完成消息",error,"POST",status,"1",errMsg);
        return addZyPushLog(jsonObject,"prescriptionAdjustCompleted","接收线下处方调整完成消息",error,"POST",status,"1",errMsg);
    }
    }
    public String getZyCommonDictName(String code){
        try{
            String sql  ="SELECT t.name FROM zy_common_dict t WHERE t.code=? AND t.dict_name='IV_RECIPE_FREQUENCY_DICT'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,new Object[]{code});
            if(list!=null&&list.size()>0){
                return (String)(list.get(0).get("name"));
            }
            return "";
        }catch (Exception e){
            return "";
        }
    }
    /**
    /**
     * 接收预结算完成消息
     * 接收预结算完成消息
@ -353,9 +401,88 @@ public class PrescriptionService extends ZysoftBaseService{
        return addZyPushLog(jsonObject,"pharmacistPrescriptionCompletion","接收药师审方完成及结果消息",error,"POST",status,"1",errMsg);
        return addZyPushLog(jsonObject,"pharmacistPrescriptionCompletion","接收药师审方完成及结果消息",error,"POST",status,"1",errMsg);
    }
    }
    /**
     * 提供在线问诊消息调阅
     * @param jsonObject
     * @return
     */
    public String getReadNewsOnline(String jsonObject){
        String url = "";
        String error = null;
        String status = "1";
        String errMsg = null;
        try{
            JSONObject json = JSONObject.parseObject(jsonObject);
            String orderNo = json.getString("ORDER_NO");//挂号编号
            String recipeNo = json.getString("RECIPE_NO");//处方编号
            Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
            if(prescription==null){
                url = "-1";
            }else{
                url = SystemConfig.sysPropertiesSets.get("readNewsOnline_url")+"?consult="+prescription.getConsult();
            }
        }catch (JSONException ex){
            ex.printStackTrace();
            error = ex.getMessage();
            errMsg = ex.getMessage();
            status = "0";
        }catch (Exception e){
            e.printStackTrace();
            error = e.getMessage();
            status = "0";
        }
        //添加日志
        addZyPushLog(jsonObject,"getReadNewsOnline","提供在线问诊消息调阅",error,"POST",status,"1",errMsg);
        return url;
    }
    /********************************************智业推送数据处理 end**************************************************/
    /********************************************智业推送数据处理 end**************************************************/
    /*********************************************获取im消息 start**************************************************/
    /**
     * 获取续方消息
     * @return
     */
    public JSONObject getLoglist(String consult,Integer page,Integer pagesize){
        JSONObject re = new JSONObject();
        try {
            //获取咨询
            ConsultTeam consultTeam = consultTeamDao.findByConsult(consult);
            String sessionId = consultTeam.getPatient()+"_"+consult+"_8";
            //获取消息记录
            Integer start = (page - 1 < 0 ? 0 : page - 1) * pagesize;
            Integer end = start + pagesize;
            StringBuffer sql = new StringBuffer("select * from ");
            sql.append(im).append(".muc_messages ");
            sql.append(" where session_id = ? ");
            sql.append(" order by timestamp desc ");
            sql.append(" limit ").append(start).append(",").append(end);
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql.toString(),sessionId);
            re.put("list",list);
            //获取参与人的信息
            StringBuffer parts = new StringBuffer("SELECT u.code id, u.name, u.sex, u.birthday birthdate, u.photo avatar, p.participant_role role, false is_patient,p.last_fetch_time,u.level FROM ");
            parts.append(im).append(".sessions s, ").append(im).append(".participants p, wlyy_doctor u ");
            parts.append("WHERE s.id = ? AND s.id = p.session_id AND p.participant_id = u.code union ");
            parts.append("SELECT u.code id, u.name, u.sex, u.birthday birthdate, u.photo avatar, p.participant_role role, true is_patient,p.last_fetch_time,0 as level FROM ");
            parts.append(im).append(".sessions s, ").append(im).append(".participants p, wlyy_patient u ");
            parts.append("WHERE s.id = ? AND s.id = p.session_id AND p.participant_id = u.code ");
            List<Map<String,Object>> partsList = jdbcTemplate.queryForList(parts.toString(),sessionId,sessionId);
            re.put("users",partsList);
        }catch (Exception e){
            e.printStackTrace();
            logger.info("获取续方消息失败");
        }
        return re;
    }
    /*********************************************获取im消息 end******************************************************/
    /*********************************************请求智业接口数据 start**************************************************/
    /*********************************************请求智业接口数据 start**************************************************/
@ -537,8 +664,8 @@ public class PrescriptionService extends ZysoftBaseService{
            applyTimeEnd = DateUtil.getStringDateShort();
            applyTimeEnd = DateUtil.getStringDateShort();
            applyTimeFrom = DateUtil.getNextDay(new Date(),-60);
            applyTimeFrom = DateUtil.getNextDay(new Date(),-60);
        }else{
        }else{
            applyTimeEnd = DateUtil.getNextDay(prescription.getCreateTime(),10);
            applyTimeFrom = DateUtil.getNextDay(prescription.getCreateTime(),-10);
            applyTimeEnd = DateUtil.getNextDay(prescription.getCreateTime(),0);
            applyTimeFrom = DateUtil.getNextDay(prescription.getCreateTime(),-60);
        }
        }
        params.put("applyTimeFrom",applyTimeFrom);
        params.put("applyTimeFrom",applyTimeFrom);
        params.put("applyTimeEnd",applyTimeEnd);
        params.put("applyTimeEnd",applyTimeEnd);
@ -670,11 +797,19 @@ public class PrescriptionService extends ZysoftBaseService{
    public String getDispUnSettleFeeInfoList(String cardNo, String visitNo,String recipeNo)  throws Exception
    public String getDispUnSettleFeeInfoList(String cardNo, String visitNo,String recipeNo)  throws Exception
    {
    {
        Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(visitNo,recipeNo);
        Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(visitNo,recipeNo);
        String hos = "";
        if(prescription==null){
            Patient patient = patientDao.findBySsc(cardNo);
            SignFamily signFamily = signFamilyDao.findByPatient(patient.getCode());
            hos = signFamily.getHospital();
        }else {
            hos = prescription.getHospital();
        }
        String[] hospitalMapping = getHospitalMapping(prescription.getHospital()); //获取机构映射
        String[] hospitalMapping = getHospitalMapping(hos); //获取机构映射
        String hospital = hospitalMapping[0];
        String hospital = hospitalMapping[0];
//        String licence = hospitalMapping[1];
        String licence = "5YGl5bq35LmL6Lev";
        String licence = hospitalMapping[1];
//        String licence = "5YGl5bq35LmL6Lev";
        Map<String,String> header = new HashMap<>();
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("ORGCODE",hospital);
@ -703,8 +838,8 @@ public class PrescriptionService extends ZysoftBaseService{
        String[] hospitalMapping = getHospitalMapping(prescription.getHospital()); //获取机构映射
        String[] hospitalMapping = getHospitalMapping(prescription.getHospital()); //获取机构映射
        String hospital = hospitalMapping[0];
        String hospital = hospitalMapping[0];
//        String licence = hospitalMapping[1];
        String licence = "5YGl5bq35LmL6Lev";
        String licence = hospitalMapping[1];
//        String licence = "5YGl5bq35LmL6Lev";
        Map<String,String> header = new HashMap<>();
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("ORGCODE",hospital);

+ 6 - 1
patient-co-service/wlyy_service/src/main/resources/application.yml

@ -71,6 +71,8 @@ spring:
    port: 6379 # Redis server port.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
#    password: jkzl_ehr
im:
  data_base_name: im_new
---
---
spring:
spring:
  profiles: test
  profiles: test
@ -87,7 +89,8 @@ spring:
    host: 172.19.103.88 # Redis server host.
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
#    password: jkzl_ehr
im:
  data_base_name: im_new
---
---
spring:
spring:
  profiles: production
  profiles: production
@ -103,3 +106,5 @@ spring:
    host: 10.95.22.142 # Redis server host.
    host: 10.95.22.142 # Redis server host.
    port: 6380 # Redis server port.
    port: 6380 # Redis server port.
    password: jkzlehr
    password: jkzlehr
im:
  data_base_name: im

+ 1 - 1
patient-co-service/wlyy_service/src/main/resources/system.properties

@ -16,5 +16,5 @@ ca_namespace = http://platfomservice.xmca.com/
#gateway_public_key = PublicGov.key
#gateway_public_key = PublicGov.key
#jw_hospital = 350211B1004
#jw_hospital = 350211B1004
#jw_licence = 5YGl5bq35LmL6LevMzUwMjExQjEwMDQ=
#jw_licence = 5YGl5bq35LmL6LevMzUwMjExQjEwMDQ=
#ca_url = http://10.95.21.21:18280/XMCAService?wsdl
#ca_url = http://10.95.21.21:18280/base/XMCA6_UnifiedCallInterface
#ca_namespace = http://platfomservice.xmca.com/
#ca_namespace = http://platfomservice.xmca.com/

+ 5 - 5
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -164,7 +164,7 @@ public class JobService {
                params.put("yesterday", getYesterday(0 - i));
                params.put("yesterday", getYesterday(0 - i));
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                    Thread.sleep(10000L);
                    Thread.sleep(30000L);
                }
                }
            }
            }
        }
        }
@ -206,7 +206,7 @@ public class JobService {
            params.put("yesterday", yesterday);
            params.put("yesterday", yesterday);
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(40000L);
                Thread.sleep(30000L);
            }
            }
        }
        }
@ -252,7 +252,7 @@ public class JobService {
        params.put("yesterday", yesterday);
        params.put("yesterday", yesterday);
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
            quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
            Thread.sleep(40000L);
            Thread.sleep(30000L);
        }
        }
    }
    }
@ -283,7 +283,7 @@ public class JobService {
            params.put("yesterday", getYesterday(0 - i));
            params.put("yesterday", getYesterday(0 - i));
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(40000L);
                Thread.sleep(30000L);
            }
            }
        }
        }
    }
    }
@ -418,7 +418,7 @@ public class JobService {
        params.put("now", yesterday);
        params.put("now", yesterday);
        params.put("yesterday", day);
        params.put("yesterday", day);
        quartzHelper.startNow(HealthMessageJob.class, HealthMessageJob.jobKey + UUID.randomUUID().toString().replace("-", ""), params);
        quartzHelper.startNow(HealthMessageJob.class, HealthMessageJob.jobKey + UUID.randomUUID().toString().replace("-", ""), params);
        Thread.sleep(40000L);
        Thread.sleep(30000L);
    }
    }
    public void productHealthDataByDayToDay(String start, String end) throws Exception {
    public void productHealthDataByDayToDay(String start, String end) throws Exception {

+ 1 - 1
patient-co/patient-co-statistics/src/main/resources/application.yml

@ -184,7 +184,7 @@ spring:
      username: wlyy
      username: wlyy
      password: jkzlehr@123
      password: jkzlehr@123
    primaryRead:
    primaryRead:
      url: jdbc:mysql://59.61.92.90:8082/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      username: wlyy
      password: jkzlehr@123
      password: jkzlehr@123
    im: #im库:
    im: #im库:

+ 1 - 1
patient-co/patient-co-wlyy-job/pom.xml

@ -450,7 +450,7 @@
                    <target>1.8</target>
                    <target>1.8</target>
                    <compilerArguments>
                    <compilerArguments>
                        <verbose/>
                        <verbose/>
                        <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
                        <bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
                    </compilerArguments>
                    </compilerArguments>
                </configuration>
                </configuration>
                <version>3.1</version>
                <version>3.1</version>

+ 13 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionAdjustReasonDao.java

@ -0,0 +1,13 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionAdjustReason;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2017/8/26.
 */
public interface PrescriptionAdjustReasonDao extends PagingAndSortingRepository<PrescriptionAdjustReason, Long>, JpaSpecificationExecutor<PrescriptionAdjustReason> {
}

+ 15 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionReasonDictDao.java

@ -0,0 +1,15 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionReasonDict;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2017/8/26.
 */
public interface PrescriptionReasonDictDao extends PagingAndSortingRepository<PrescriptionReasonDict, Long>, JpaSpecificationExecutor<PrescriptionReasonDict> {
    List<PrescriptionReasonDict> findByTypeOrderBySortAsc(String type);
}

+ 2 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -131,9 +131,9 @@ public class PrescriptionService extends BaseService {
                    message.setRead(1);//设置未读
                    message.setRead(1);//设置未读
                    message.setOver("1");
                    message.setOver("1");
                    message.setReceiver(expressage.getExpressageCode());
                    message.setReceiver(expressage.getExpressageCode());
                    message.setSender(prescription.getPatient());
                    message.setSender("system");
                    message.setCode(getCode());
                    message.setCode(getCode());
                    message.setSenderName(prescription.getPatientName());
                    message.setSenderName("系统");
                    message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                    message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                    message.setContent("您有一条新的续方订单待取药!");
                    message.setContent("您有一条新的续方订单待取药!");
                    message.setType(7);//续方订单待取药
                    message.setType(7);//续方订单待取药

+ 18 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -255,6 +255,24 @@ public class WeiXinEventProcess {
        articlePrescription.put("PicUrl", prescription_pic);
        articlePrescription.put("PicUrl", prescription_pic);
        articles.add(articlePrescription);
        articles.add(articlePrescription);
//        新增居民取药码图文消息 by wjj 2017.08.25
        Map<String, String> articlePatientQRCode = new HashMap<>();
        // 图文URL
        String patientQRCode = systemConf.getProperty("patient_QRCode_url");
        // 图文消息图片URL
        String patientQRCode_pic = systemConf.getProperty("patient_QRCode_pic");
        // URL设置服务器URL、AppId
        patientQRCode = patientQRCode.replace("{server}", wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        patientQRCode_pic = patientQRCode_pic.replace("{server}", serverUrl);
        articlePatientQRCode.put("Url", patientQRCode);
        articlePatientQRCode.put("Title", "我的取药码");
        articlePatientQRCode.put("Description", "我的取药码");
        articlePatientQRCode.put("PicUrl", patientQRCode_pic);
        articles.add(articlePatientQRCode);
        // 构建回复消息XML
        // 构建回复消息XML
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);

BIN
patient-co/patient-co-wlyy/doc/接口文档/对外接口文档/集美健康教育/集美健康教育对外接口文档.docx


+ 1 - 1
patient-co/patient-co-wlyy/pom.xml

@ -434,7 +434,7 @@
                    <target>1.8</target>
                    <target>1.8</target>
                    <compilerArguments>
                    <compilerArguments>
                        <verbose/>
                        <verbose/>
                        <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
                        <bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
                    </compilerArguments>
                    </compilerArguments>
                </configuration>
                </configuration>
                <version>3.1</version>
                <version>3.1</version>

+ 15 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/adapter/PresModeAdapter.java

@ -39,11 +39,14 @@ public class PresModeAdapter {
    public JSONArray modeTopresInfo(String json){
    public JSONArray modeTopresInfo(String json){
        try{
        try{
            JSONObject oldJson = JSONObject.parseObject(json);
            JSONObject oldJson = JSONObject.parseObject(json);
            if(oldJson.getInteger("status")!=200){
                throw new RuntimeException("智业接口失败:"+oldJson.getString("msg"));
            }
            String dataStr = oldJson.getString("data");
            String dataStr = oldJson.getString("data");
            JSONObject data = JSONObject.parseObject(dataStr);
            JSONObject data = JSONObject.parseObject(dataStr);
            JSONArray returnData = data.getJSONArray("returnData");
            JSONArray returnData = data.getJSONArray("returnData");
            String code = data.getString("CODE");
            String code = data.getString("CODE");
            if(StringUtils.isNotBlank(code)&&"1".equals(code)){
            if(StringUtils.isNotBlank(code)&&"1".equals(code)&&returnData.size()>0){
                JSONArray rs = new JSONArray();
                JSONArray rs = new JSONArray();
                Iterator iterator = returnData.iterator();
                Iterator iterator = returnData.iterator();
                while (iterator.hasNext()){
                while (iterator.hasNext()){
@ -102,7 +105,7 @@ public class PresModeAdapter {
            logger.info("PresModeAdapter:modeTopresInfo:Json:"+json);
            logger.info("PresModeAdapter:modeTopresInfo:Json:"+json);
            throw e;
            throw e;
        }
        }
        return null;
        return new JSONArray();
    }
    }
    /**
    /**
@ -114,10 +117,13 @@ public class PresModeAdapter {
    public JSONArray modeToPrescription(String json){
    public JSONArray modeToPrescription(String json){
        try{
        try{
            JSONObject oldJson = JSONObject.parseObject(json);
            JSONObject oldJson = JSONObject.parseObject(json);
            if(oldJson.getInteger("status")!=200){
                throw new RuntimeException("智业接口失败:"+oldJson.getString("msg"));
            }
            JSONObject data = oldJson.getJSONObject("data");
            JSONObject data = oldJson.getJSONObject("data");
            JSONArray returnData = data.getJSONArray("returnData");
            JSONArray returnData = data.getJSONArray("returnData");
            String code = data.getString("CODE");
            String code = data.getString("CODE");
            if(StringUtils.isNotBlank(code)&&"1".equals(code)){
            if(StringUtils.isNotBlank(code)&&"1".equals(code)&&returnData.size()>0){
                JSONArray rs = new JSONArray();
                JSONArray rs = new JSONArray();
                Iterator iterator = returnData.iterator();
                Iterator iterator = returnData.iterator();
                while (iterator.hasNext()){
                while (iterator.hasNext()){
@ -210,7 +216,7 @@ public class PresModeAdapter {
            logger.info("PresModeAdapter:modeToPrescription:Json:"+json);
            logger.info("PresModeAdapter:modeToPrescription:Json:"+json);
            throw e;
            throw e;
        }
        }
        return null;
        return new JSONArray();
    }
    }
    /**
    /**
@ -221,10 +227,13 @@ public class PresModeAdapter {
    public JSONObject modelToSinglePrescription(String json){
    public JSONObject modelToSinglePrescription(String json){
        try{
        try{
            JSONObject oldJson = JSONObject.parseObject(json);
            JSONObject oldJson = JSONObject.parseObject(json);
            if(oldJson.getInteger("status")!=200){
                throw new RuntimeException("智业接口失败:"+oldJson.getString("msg"));
            }
            JSONObject data = oldJson.getJSONObject("data");
            JSONObject data = oldJson.getJSONObject("data");
            JSONArray returnData = data.getJSONArray("returnData");
            JSONArray returnData = data.getJSONArray("returnData");
            String code = data.getString("CODE");
            String code = data.getString("CODE");
            if(StringUtils.isNotBlank(code)&&"1".equals(code)){
            if(StringUtils.isNotBlank(code)&&"1".equals(code)&&returnData.size()>0){
                JSONArray modeArray = returnData.getJSONArray(0);
                JSONArray modeArray = returnData.getJSONArray(0);
                JSONObject mode = (JSONObject) modeArray.get(0);
                JSONObject mode = (JSONObject) modeArray.get(0);
                JSONObject p  = new JSONObject();
                JSONObject p  = new JSONObject();
@ -308,7 +317,7 @@ public class PresModeAdapter {
            logger.info("PresModeAdapter:modelToSinglePrescription:Json:"+json);
            logger.info("PresModeAdapter:modelToSinglePrescription:Json:"+json);
            throw e;
            throw e;
        }
        }
        return null;
        return new JSONObject();
    }
    }
}
}

+ 14 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java

@ -18,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
 * Created by chenweida on 2017/4/6.
 * Created by chenweida on 2017/4/6.
 */
 */
@Configuration
@Configuration
//@Profile({"test", "prod"})
@Profile({"test", "prod"})
public class MvcConfig extends WebMvcConfigurerAdapter {
public class MvcConfig extends WebMvcConfigurerAdapter {
    private Logger logger = LoggerFactory.getLogger(MvcConfig.class);
    private Logger logger = LoggerFactory.getLogger(MvcConfig.class);
@ -52,6 +52,19 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
        return registration;
        return registration;
    }
    }
//    /**
//     * 编码过滤
//     */
//    @Bean
//    public FilterRegistrationBean testFilterRegistration2() {
//        FilterRegistrationBean registration = new FilterRegistrationBean();
//        registration.setFilter(new UserAgentFilter());
//        registration.addUrlPatterns("/doctor/requestRealNameSoftCertAndSign");
//        registration.setName("EncodingFilter");
//        registration.setOrder(2);
//        return registration;
//    }
//    /**
//    /**
//     * 为null的数据不返回
//     * 为null的数据不返回
//     * @param converters
//     * @param converters

+ 50 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/EncodingFilter.java

@ -0,0 +1,50 @@
package com.yihu.wlyy.interceptors;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.Map;
/**
 * Created by chenweida on 2017/8/22.
 */
@Component
public class EncodingFilter implements Filter {
    private Logger logger= LoggerFactory.getLogger(EncodingFilter.class);
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        Map<String, String[]> params = request.getParameterMap();
        MutableHttpServletRequest newRequest = new MutableHttpServletRequest(request);
        newRequest.getParameterNames();
        for (String key : params.keySet()) {
            String[] values = params.get(key);
            for (int i = 0; i < values.length; i++) {
                String value = values[i];
                newRequest.removeAttribute(key);
                newRequest.addParameter(key, URLDecoder.decode((value),"utf-8"));
            }
        }
        chain.doFilter(newRequest, response);
    }
    @Override
    public void destroy() {
    }
}

+ 8 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/GateWayInterceptor.java

@ -72,28 +72,28 @@ public class GateWayInterceptor implements HandlerInterceptor {
        //********************************判断accesstoken********************************
        //********************************判断accesstoken********************************
        try {
        try {
            if (org.springframework.util.StringUtils.isEmpty(accesstoken)) {
            if (org.springframework.util.StringUtils.isEmpty(accesstoken)) {
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, accesstoken, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.codeEm.token_null.getMessage());
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, accesstoken, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.statusEm.token_null.getMessage());
                //没权限
                //没权限
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.codeEm.token_null.getCode(), BaseResultModel.codeEm.token_null.getMessage());
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.statusEm.token_null.getCode(), BaseResultModel.statusEm.token_null.getMessage());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
            }
            }
            GcToken gcToken = gcTokenDaoDao.findByToken(accesstoken);
            GcToken gcToken = gcTokenDaoDao.findByToken(accesstoken);
            if (gcToken == null) {
            if (gcToken == null) {
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, accesstoken, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.codeEm.token_no_power.getMessage());
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, accesstoken, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.statusEm.token_no_power.getMessage());
                //没权限
                //没权限
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.codeEm.token_no_power.getCode(), BaseResultModel.codeEm.token_no_power.getMessage());
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.statusEm.token_no_power.getCode(), BaseResultModel.statusEm.token_no_power.getMessage());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
            }
            }
            if (gcToken.getDel() == null || gcToken.getDel() == 0) {
            if (gcToken.getDel() == null || gcToken.getDel() == 0) {
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, accesstoken, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.codeEm.token_out_effect.getMessage());
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, accesstoken, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.statusEm.token_out_effect.getMessage());
                //token无效
                //token无效
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.codeEm.token_out_effect.getCode(), BaseResultModel.codeEm.token_out_effect.getMessage());
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.statusEm.token_out_effect.getCode(), BaseResultModel.statusEm.token_out_effect.getMessage());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
            }
            }
            if (System.currentTimeMillis() > gcToken.getOutTime().getTime()) {
            if (System.currentTimeMillis() > gcToken.getOutTime().getTime()) {
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, accesstoken, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.codeEm.token_out_time.getMessage());
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, accesstoken, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.statusEm.token_out_time.getMessage());
                //token过期
                //token过期
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.codeEm.token_out_time.getCode(), BaseResultModel.codeEm.token_out_time.getMessage());
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.statusEm.token_out_time.getCode(), BaseResultModel.statusEm.token_out_time.getMessage());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/MutableHttpServletRequest.java

@ -53,4 +53,10 @@ final class MutableHttpServletRequest extends HttpServletRequestWrapper {
        // create an enumeration from the set and return
        // create an enumeration from the set and return
        return Collections.enumeration(set);
        return Collections.enumeration(set);
    }
    }
    public void addParameter(String name , Object value) {//增加参数
        if(value != null) {
            customHeaders.put(name , String.valueOf(value));
        }
    }
}
}

+ 18 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionExplainDao.java

@ -0,0 +1,18 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExplain;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2017/8/24.
 */
public interface PrescriptionExplainDao extends PagingAndSortingRepository<PrescriptionExplain, Long>, JpaSpecificationExecutor<PrescriptionExplain> {
    @Query("select p from PrescriptionExplain p where p.del='1' ")
    List<PrescriptionExplain> findList();
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionInfoDao.java

@ -18,7 +18,7 @@ public interface PrescriptionInfoDao extends PagingAndSortingRepository<Prescrip
    @Modifying
    @Modifying
    @Query("update PrescriptionInfo p set p.cost=?2 where p.code=?1")
    void updateStatus(String code,Integer cost);
    @Query("update PrescriptionInfo p set p.cost=?2 where p.drugCode=?1 and p.prescriptionCode=?3 and p.del=1")
    void updateStatus(String code,Integer cost,String prescriptionCode);
}
}

+ 31 - 42
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1310,18 +1310,15 @@ public class DoctorInfoService extends BaseService {
        String url = jwUrl+"/third/prescription/IsApplied";
        String url = jwUrl+"/third/prescription/IsApplied";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        params.add(new BasicNameValuePair("doctorCode",doctorCode));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            int status = responseObject.getInt("status");
            if (status == 200) {
            if (status == 200) {
                data = responseObject.getString("data");
                data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                }else{
                    if("0".equals(data)){
                        return true;
                    }
                if("0".equals(data)){
                    return true;
                }
                }
            }
            }
        }else {
        }else {
@ -1374,6 +1371,7 @@ public class DoctorInfoService extends BaseService {
        String url = jwUrl+"/third/prescription/GetRealNameSoftCertExpiredDatetime";
        String url = jwUrl+"/third/prescription/GetRealNameSoftCertExpiredDatetime";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        params.add(new BasicNameValuePair("doctorCode",doctorCode));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
        if (!StringUtils.isEmpty(response)){
@ -1381,26 +1379,22 @@ public class DoctorInfoService extends BaseService {
            int status = responseObject.getInt("status");
            int status = responseObject.getInt("status");
            if (status == 200) {
            if (status == 200) {
                data = responseObject.getString("data");
                data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                } else {
                    //1、线上未认证,有证书,并有效,2、线上未认证,有证书,已过期,3、线上未认证,无证书,4、线上已认证,并有效
                    if(StringUtils.isNotEmpty(data)){
                        Date CertifiedOvertime = simpleDateFormat.parse(data);
                        doctor.setCertifiedOvertime(CertifiedOvertime);
                        doctorDao.save(doctor);
                        long times = CertifiedOvertime.getTime();
                        if(System.currentTimeMillis()<=times){
                            jsonObject.put("type",1);
                        }else{
                            jsonObject.put("type",2);
                        }
                //1、线上未认证,有证书,并有效,2、线上未认证,有证书,已过期,3、线上未认证,无证书,4、线上已认证,并有效
                if(StringUtils.isNotEmpty(data)){
                    Date CertifiedOvertime = simpleDateFormat.parse(data);
                    doctor.setCertifiedOvertime(CertifiedOvertime);
                    doctorDao.save(doctor);
                    long times = CertifiedOvertime.getTime();
                    if(System.currentTimeMillis()<=times){
                        jsonObject.put("type",1);
                    }else{
                    }else{
//                        jsonObject.put("type",3);
                        throw new Exception("null data.");
                        jsonObject.put("type",2);
                    }
                    }
                }else{
//                        jsonObject.put("type",3);
                    throw new Exception("null data.");
                }
                }
            } else {
            } else {
                jsonObject.put("type",3);
                jsonObject.put("type",3);
            }
            }
@ -1421,6 +1415,7 @@ public class DoctorInfoService extends BaseService {
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        params.add(new BasicNameValuePair("strOldCalledPasswd",strOldCalledPasswd));
        params.add(new BasicNameValuePair("strOldCalledPasswd",strOldCalledPasswd));
        params.add(new BasicNameValuePair("strNewCalledPasswd",strNewCalledPasswd));
        params.add(new BasicNameValuePair("strNewCalledPasswd",strNewCalledPasswd));
        params.add(new BasicNameValuePair("doctorCode",doctorCode));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            JSONObject responseObject = new JSONObject(response);
@ -1428,16 +1423,12 @@ public class DoctorInfoService extends BaseService {
            String msg = responseObject.getString("msg");
            String msg = responseObject.getString("msg");
            if (status == 200) {
            if (status == 200) {
                String data = responseObject.getString("data");
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                }else{
                    if("0".equals(data)){
                        Doctor doctor = findDoctorByCode(doctorCode);
                        doctor.setCheckPassword(strNewCalledPasswd);//保存密码,以便忘记密码时候使用
                        doctor.setIscertified(1);//说明已经(线上认证,已修改密码)
                        doctorDao.save(doctor);
                        return true;
                    }
                if("0".equals(data)){
                    Doctor doctor = findDoctorByCode(doctorCode);
                    doctor.setCheckPassword(strNewCalledPasswd);//保存密码,以便忘记密码时候使用
                    doctor.setIscertified(1);//说明已经(线上认证,已修改密码)
                    doctorDao.save(doctor);
                    return true;
                }
                }
            }else{
            }else{
                String error = msg.split(":")[2];
                String error = msg.split(":")[2];
@ -1466,6 +1457,7 @@ public class DoctorInfoService extends BaseService {
        params.add(new BasicNameValuePair("strRealNameSoftCertCalledPasswd",strRealNameSoftCertCalledPasswd));
        params.add(new BasicNameValuePair("strRealNameSoftCertCalledPasswd",strRealNameSoftCertCalledPasswd));
        String originalDataAbstract = MD5.GetMD5Code(strOriginalData);
        String originalDataAbstract = MD5.GetMD5Code(strOriginalData);
        params.add(new BasicNameValuePair("strOriginalData",originalDataAbstract));
        params.add(new BasicNameValuePair("strOriginalData",originalDataAbstract));
        params.add(new BasicNameValuePair("prescriptionCode",prescriptionCode));
//        params.add(new BasicNameValuePair("srcBusinessStreamNO",srcBusinessStreamNO));
//        params.add(new BasicNameValuePair("srcBusinessStreamNO",srcBusinessStreamNO));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
        if (!StringUtils.isEmpty(response)){
@ -1474,8 +1466,8 @@ public class DoctorInfoService extends BaseService {
            String msg = responseObject.getString("msg");
            String msg = responseObject.getString("msg");
            if (status == 200) {
            if (status == 200) {
                String data = responseObject.getString("data");
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                if (StringUtils.isEmpty(data)) {
                    throw new Exception("null data");
                }else{
                }else{
                    String[] str = data.split("\\|\\|");
                    String[] str = data.split("\\|\\|");
//                    String strSignData = str[0];
//                    String strSignData = str[0];
@ -1505,13 +1497,14 @@ public class DoctorInfoService extends BaseService {
    }
    }
    //验证签名( ( 带多服务器负载均衡) )
    //验证签名( ( 带多服务器负载均衡) )
    public boolean verifySignOnMultiServer(String strSignData,String strCertData,String strOriginalData) throws Exception{
    public boolean verifySignOnMultiServer(String strSignData,String strCertData,String strOriginalData,String prescriptionCode) throws Exception{
        String url = jwUrl+"/third/prescription/VerifySignOnMultiServer";
        String url = jwUrl+"/third/prescription/VerifySignOnMultiServer";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSignData",strSignData));
        params.add(new BasicNameValuePair("strSignData",strSignData));
        params.add(new BasicNameValuePair("strCertData",strCertData));
        params.add(new BasicNameValuePair("strCertData",strCertData));
        params.add(new BasicNameValuePair("strOriginalData",MD5.GetMD5Code(strOriginalData)));
        params.add(new BasicNameValuePair("strOriginalData",MD5.GetMD5Code(strOriginalData)));
        params.add(new BasicNameValuePair("prescriptionCode",prescriptionCode));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            JSONObject responseObject = new JSONObject(response);
@ -1519,12 +1512,8 @@ public class DoctorInfoService extends BaseService {
            String msg = responseObject.getString("msg");
            String msg = responseObject.getString("msg");
            if (status == 200) {
            if (status == 200) {
                String data = responseObject.getString("data");
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                }else{
                    if("0".equals(data)){
                        return true;
                    }
                if("0".equals(data)){
                    return true;
                }
                }
            }else{
            }else{
                throw new Exception(responseObject.getString("msg"));
                throw new Exception(responseObject.getString("msg"));

+ 6 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -126,7 +126,7 @@ public class PatientInfoService extends BaseService {
     */
     */
    public int isMobileRegister(String mobile) {
    public int isMobileRegister(String mobile) {
        List<Patient> p = patientDao.findByMobile(mobile);
        List<Patient> p = patientDao.findByMobile(mobile);
        if (p != null&& p.size()>0) {
        if (p != null && p.size() > 0) {
            return 1;
            return 1;
        } else {
        } else {
            return 0;
            return 0;
@ -150,7 +150,7 @@ public class PatientInfoService extends BaseService {
            return result;
            return result;
        }
        }
        if(!patient.equals(family)) {
        if (!patient.equals(family)) {
            PatientFamilyMember member = familyMemberService.getPatientFamilyMember(patient, family);
            PatientFamilyMember member = familyMemberService.getPatientFamilyMember(patient, family);
            // 家庭成员中不存在该人
            // 家庭成员中不存在该人
            if (member == null) {
            if (member == null) {
@ -227,7 +227,9 @@ public class PatientInfoService extends BaseService {
    public Patient updatePatient(Patient patient) {
    public Patient updatePatient(Patient patient) {
        if (StringUtils.isNotEmpty(patient.getStreet())) {
        if (StringUtils.isNotEmpty(patient.getStreet())) {
            Street street = streetDao.findByCode(patient.getStreet());
            Street street = streetDao.findByCode(patient.getStreet());
            patient.setStreetName(street.getName());
            if (street != null) {
                patient.setStreetName(street.getName());
            }
        } else {
        } else {
            patient.setStreetName("");
            patient.setStreetName("");
        }
        }
@ -285,7 +287,7 @@ public class PatientInfoService extends BaseService {
    public void checkMobile(String mobile) throws Exception {
    public void checkMobile(String mobile) throws Exception {
        List<Patient> p = patientDao.findByMobile(mobile);
        List<Patient> p = patientDao.findByMobile(mobile);
        if (p != null&&p.size()>0) {
        if (p != null && p.size() > 0) {
            throw new Exception("手机号已经被注册");
            throw new Exception("手机号已经被注册");
        }
        }
    }
    }

+ 46 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -26,10 +26,7 @@ import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDiagnosisDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.repository.prescription.PrescriptionReviewedDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.app.health.HealthEduArticleService;
import com.yihu.wlyy.service.app.health.HealthEduArticleService;
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
@ -150,6 +147,8 @@ public class ConsultTeamService extends ConsultService {
    private String im_list_get;
    private String im_list_get;
    @Autowired
    @Autowired
    private PushMsgTask pushMsgTask;
    private PushMsgTask pushMsgTask;
    @Autowired
    private PrescriptionExplainDao prescriptionExplainDao;
    @PostConstruct
    @PostConstruct
    public void init() {
    public void init() {
@ -179,7 +178,7 @@ public class ConsultTeamService extends ConsultService {
        //点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
        //点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
        int num = 0;
        int num = 0;
        Patient p = patientDao.findByCode(patient);
        Patient p = patientDao.findByCode(patient);
        String rp= jwPrescriptionService.getLastRecipe(p.getSsc(),null,null,null);
        String rp= jwPrescriptionService.getRecipeList(p.getSsc(),null,null,null);
        com.alibaba.fastjson.JSONArray pres =presModeAdapter.modeToPrescription(rp);
        com.alibaba.fastjson.JSONArray pres =presModeAdapter.modeToPrescription(rp);
        Iterator iterator = pres.iterator();
        Iterator iterator = pres.iterator();
        while (iterator.hasNext()){
        while (iterator.hasNext()){
@ -199,12 +198,20 @@ public class ConsultTeamService extends ConsultService {
            return json;
            return json;
        }
        }
        //续方说明
        List<PrescriptionExplain> list = prescriptionExplainDao.findList();
        JSONArray ja = new JSONArray();
        for (PrescriptionExplain explain:list){
            ja.put(explain.getContent());
        }
        Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
        Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
        json.put("doctor",doctor.getCode());
        json.put("doctor",doctor.getCode());
        json.put("doctorName",doctor.getName());
        json.put("doctorName",doctor.getName());
        json.put("adminTeamId",signFamily.getAdminTeamId());
        json.put("adminTeamId",signFamily.getAdminTeamId());
        json.put("hospital",doctor.getHospital());
        json.put("hospital",doctor.getHospital());
        json.put("hospitalName",doctor.getHospitalName());
        json.put("hospitalName",doctor.getHospitalName());
        json.put("prescriptionExplain",ja);
        return json;
        return json;
    }
    }
@ -1115,6 +1122,7 @@ public class ConsultTeamService extends ConsultService {
        prescription.setType(PrescriptionLog.PrescriptionLogType.create.getValue());
        prescription.setType(PrescriptionLog.PrescriptionLogType.create.getValue());
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.revieweding.getValue());
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.revieweding.getValue());
        prescription.setConsult(ct.getConsult());
        prescription.setConsult(ct.getConsult());
        prescription.setJwPayStatus(0);//处方结算状态,0为未结算,1为结算成功,默认为0
        //保存智业的医生信息
        //保存智业的医生信息
        Map<String,Object> map = zyDictService.findJwDoctorByDoctor(doctor.getCode());
        Map<String,Object> map = zyDictService.findJwDoctorByDoctor(doctor.getCode());
        if(map!=null){
        if(map!=null){
@ -1123,11 +1131,15 @@ public class ConsultTeamService extends ConsultService {
        }
        }
        //设置费别类型
        //设置费别类型
        prescription.setJwRateTypeCode(zyDictService.getRateType());
        prescription.setJwRateTypeCode(zyDictService.getRateType());
        prescription.setPresCreateTime(DateUtil.stringToDate(jsonObject.getString("createTime"),"yyyy-MM-dd "));
        prescriptionDao.save(prescription);
        //保存续方药品(处方)信息
        //保存续方药品(处方)信息
        com.alibaba.fastjson.JSONArray infos = jsonObject.getJSONArray("prescriptionInfo");
        com.alibaba.fastjson.JSONArray infos = jsonObject.getJSONArray("prescriptionInfo");
        int day = 0;
        if(infos!=null&&infos.size()>0){
            day = infos.getJSONObject(0).getInteger("dayCount");
        }
        for(int i=0;i<infos.size();i++){
        for(int i=0;i<infos.size();i++){
            com.alibaba.fastjson.JSONObject info = infos.getJSONObject(i);
            com.alibaba.fastjson.JSONObject info = infos.getJSONObject(i);
            PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
            PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
@ -1138,18 +1150,27 @@ public class ConsultTeamService extends ConsultService {
            prescriptionInfo.setDrugCode(info.getString("drugCode"));//药品code
            prescriptionInfo.setDrugCode(info.getString("drugCode"));//药品code
            prescriptionInfo.setDrugName(info.getString("drugName"));//药品名称
            prescriptionInfo.setDrugName(info.getString("drugName"));//药品名称
            prescriptionInfo.setDrugRate(info.getString("drugRate"));//吃药频率
            prescriptionInfo.setDrugRate(info.getString("drugRate"));//吃药频率
            prescriptionInfo.setDrugRateName(getZyCommonDictName(info.getString("drugRate")));
            prescriptionInfo.setDrugFormat(info.getString("drugFormat"));//药品规格
            prescriptionInfo.setDrugFormat(info.getString("drugFormat"));//药品规格
            prescriptionInfo.setNum(info.getInteger("num"));//药品数目
            prescriptionInfo.setNum(info.getInteger("num"));//药品数目
            prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("price")));//药品单价
            prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("price")));//药品单价
            prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
//            prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
            prescriptionInfo.setJwSubCode(info.getString("jwSubCode"));//智业子处方号
            prescriptionInfo.setJwSubCode(info.getString("jwSubCode"));//智业子处方号
            prescriptionInfo.setSubjectClass(info.getString("subjectClass"));//科目编码
            String subjectClass = info.getString("subjectClass");
            if(StringUtils.isBlank(subjectClass)){//处理默认药品的科目类型为空
                subjectClass = zyDictService.getSubjectClass(info.getString("drugCode"));
            }
            prescriptionInfo.setSubjectClass(subjectClass);//科目编码
            prescriptionInfo.setDrugNumUnit(info.getString("drugNumUnit"));//数量单位编码
            prescriptionInfo.setDrugNumUnit(info.getString("drugNumUnit"));//数量单位编码
            prescriptionInfo.setDrugNumUnitName(info.getString("drugNumUnitName"));//数量单位名称
            prescriptionInfo.setDrugNumUnitName(info.getString("drugNumUnitName"));//数量单位名称
            prescriptionInfo.setCost(CommonUtil.doubleToInt(info.getDouble("cost")));//金额
            prescriptionInfo.setCost(CommonUtil.doubleToInt(info.getDouble("cost")));//金额
            prescriptionInfo.setCharge(CommonUtil.doubleToInt(info.getDouble("charge")));//自付
            prescriptionInfo.setCharge(CommonUtil.doubleToInt(info.getDouble("charge")));//自付
            prescriptionInfo.setBindFlag(info.getString("bindFlag"));//成组标志, 0.非成组,1.成组
            prescriptionInfo.setBindFlag(info.getString("bindFlag"));//成组标志, 0.非成组,1.成组
            prescriptionInfo.setDayCount(info.getInteger("dayCount"));//用药天数
            prescriptionInfo.setDayCount(info.getInteger("dayCount"));//用药天数
            //设置最小用药天数
            if(prescriptionInfo.getDayCount()<day){
                day = prescriptionInfo.getDayCount();
            }
            prescriptionInfo.setDrugUsage(info.getString("drugUsage"));//用药方法编码
            prescriptionInfo.setDrugUsage(info.getString("drugUsage"));//用药方法编码
            prescriptionInfo.setUsageName(info.getString("usageName"));//用药方法名称
            prescriptionInfo.setUsageName(info.getString("usageName"));//用药方法名称
            prescriptionInfo.setPhysicDose(info.getString("physicDose"));//用药剂量
            prescriptionInfo.setPhysicDose(info.getString("physicDose"));//用药剂量
@ -1166,6 +1187,11 @@ public class ConsultTeamService extends ConsultService {
            prescriptionInfo.setIsRefrigerate(zyDictService.getIsRefrigerate(prescriptionInfo.getDrugCode()));
            prescriptionInfo.setIsRefrigerate(zyDictService.getIsRefrigerate(prescriptionInfo.getDrugCode()));
            prescriptionInfoDao.save(prescriptionInfo);
            prescriptionInfoDao.save(prescriptionInfo);
        }
        }
        //设置最小用药天数
        prescription.setMinDrugDay(day);
        //保存续方记录
        prescriptionDao.save(prescription);
        //保存续方疾病类型
        //保存续方疾病类型
        com.alibaba.fastjson.JSONArray jaDiagnosis = jsonObject.getJSONArray("prescriptionDt");
        com.alibaba.fastjson.JSONArray jaDiagnosis = jsonObject.getJSONArray("prescriptionDt");
@ -1199,6 +1225,18 @@ public class ConsultTeamService extends ConsultService {
    }
    }
    public String getZyCommonDictName(String code){
        try{
            String sql  ="SELECT t.name FROM zy_common_dict t WHERE t.code=? AND t.dict_name='IV_RECIPE_FREQUENCY_DICT'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,new Object[]{code});
            if(list!=null&&list.size()>0){
                return (String)(list.get(0).get("name"));
            }
            return "";
        }catch (Exception e){
            return "";
        }
    }
    /**
    /**
     * 发送消息给IM
     * 发送消息给IM

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticleService.java

@ -213,7 +213,7 @@ public class HealthEduArticleService extends BaseService {
        }
        }
        int start = page * pagesize;
        int start = page * pagesize;
        String pageInfo = " limit " + start + "," + pagesize;
        String pageInfo = " limit " + start + "," + pagesize;
        String orderBy = " order by a.czrq,a.id desc";
        String orderBy = " order by a.czrq desc";
        sql.append(where).append(orderBy).append(pageInfo);
        sql.append(where).append(orderBy).append(pageInfo);
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql.toString(), params.toArray());
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql.toString(), params.toArray());
        return result;
        return result;

+ 168 - 152
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -37,6 +37,7 @@ import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -541,9 +542,11 @@ public class PatientPrescriptionPayService extends BaseService {
                            messageDao.save(message);
                            messageDao.save(message);
                        }
                        }
                        //支付成功发起结算
                        //支付成功发起结算
                        LOGGER.debug("=================> start exexuteSickSettle");
                        jwPrescriptionService.executeSickSettle(prescriptionCode);
                        LOGGER.debug("=================> end exexuteSickSettle");
                        try {
                            jwPrescriptionService.executeSickSettle(prescriptionCode);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else if ("1".equals(tradeStatus) || "FAIL".equals(tradeStatus)) {
                    } else if ("1".equals(tradeStatus) || "FAIL".equals(tradeStatus)) {
                        prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
                        prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_error.getValue());////续费状态 30支付成功 21支付失败
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_error.getValue());////续费状态 30支付成功 21支付失败
@ -572,7 +575,7 @@ public class PatientPrescriptionPayService extends BaseService {
     * 长处方支付,成功则返回支付路径
     * 长处方支付,成功则返回支付路径
     */
     */
    @Transactional
    @Transactional
    public Map charge(int type, String addressJson, String orgCode, String prescriptionCode, int totalAmount, String people, String accessToken, String returnUrl) throws Exception {
    public Map charge(int type, String addressJson, String orgCode, String prescriptionCode, int totalAmount, String people, String accessToken, String returnUrl,String deliveryTime) throws Exception {
        Map resultMap = new HashMap();
        Map resultMap = new HashMap();
        Prescription prescription = null;
        Prescription prescription = null;
@ -619,163 +622,176 @@ public class PatientPrescriptionPayService extends BaseService {
            String userIdcard = patient.getIdcard();
            String userIdcard = patient.getIdcard();
//       ***************************  测通流程 ***************************************
//       ***************************  测通流程 ***************************************
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
            OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
//     未真正完成支付以前预存储支付信息到wlyy_prescription_pay表 更改wlyy_prescription表支付时间  wlyy_prescription_expressage 新增物流记录  续方code与物流code--对应
//     未真正完成支付以前预存储支付信息到wlyy_prescription_pay表 更改wlyy_prescription表支付时间  wlyy_prescription_expressage 新增物流记录  续方code与物流code--对应
        PrescriptionExpressage expressage = expressageDao.findByPrescriptionPay(prescriptionCode);
        if (expressage == null) {
            expressage = new PrescriptionExpressage();
            expressage.setCode(getCode());
        }
        expressage.setPrescriptionCode(prescriptionCode);
        prescription = prescriptionDao.findByCode(prescriptionCode);
        // 续方居民信息
        String paySsc = prescription.getSsc();
        String payPatientCode = prescription.getPatient();
        String payName = prescription.getPatientName();
        Patient payPatient = patientDao.findByCode(payPatientCode);
        String payIdcard = payPatient.getIdcard();
            PrescriptionExpressage expressage = expressageDao.findByPrescriptionPay(prescriptionCode);
            if (expressage == null) {
                expressage = new PrescriptionExpressage();
                expressage.setCode(getCode());
            }
            expressage.setPrescriptionCode(prescriptionCode);
            prescription = prescriptionDao.findByCode(prescriptionCode);
            // 续方居民信息.
            String paySsc = prescription.getSsc();
            String payPatientCode = prescription.getPatient();
            String payName = prescription.getPatientName();
            Patient payPatient = patientDao.findByCode(payPatientCode);
            String payIdcard = payPatient.getIdcard();
        prescription.setPayTime(now);
            prescription.setPayTime(now);
        JSONObject addressInfo = JSON.parseObject(addressJson);
            JSONObject addressInfo = JSON.parseObject(addressJson);
        String phone = addressInfo.getString("phone");
        expressage.setMobile(phone);//收货人手机号码
            String phone = addressInfo.getString("phone");
            expressage.setMobile(phone);//收货人手机号码
//        配药机构信息(签约机构)
//        配药机构信息(签约机构)
        expressage.setHospitalCode(orgCode);
        expressage.setHospitalName(hos.getName());
        expressage.setHospitalAddress(signAddress);
        switch (type) {
            case 1:
                prescription.setDispensaryType(1);//取药类型:1 自取 2快递配送 3健管师配送
                //自取保存居民信息
                expressage.setName(userName);//居民姓名
                expressage.setProvinceCode(userProvince);//省代码
                expressage.setProvinceName(userProvinceName);//省名称
                expressage.setCityCode(userCity);//市代码
                expressage.setCityName(userCityName);//市名称
                expressage.setTownCode(userTown);//区code
                expressage.setTownName(userTownName);//区名称
                expressage.setStreetCode(userStreet);//街道code
                expressage.setStreetName(userStreetName);//街道名称
                expressage.setAddress(userAddress);//居民详细地址
                expressage.setCreateTime(now);//创建时间
                expressage.setOneselfPickupFlg(1);//是否自取 1是 0否
                expressage.setDel(1);//有效
                break;
            case 2:
                prescription.setDispensaryType(2);//取药类型:1 自取 2快递配送 3健管师配送
                //快递保存信息
                String name = addressInfo.getString("receiver");
                String proviceCode = addressInfo.getString("provinceCode");
                String proviceName = addressInfo.getString("provinceName");
                String cityCode = addressInfo.getString("cityCode");
                String cityName = addressInfo.getString("cityName");
                String townCode = addressInfo.getString("townCode");
                String townName = addressInfo.getString("townName");
                String streeCode = addressInfo.getString("streeCode");
                String streeName = addressInfo.getString("streeName");
                String address = addressInfo.getString("address");
                expressage.setName(name);//居民姓名
                expressage.setProvinceCode(proviceCode);//省代码
                expressage.setProvinceName(proviceName);//省名称
                expressage.setCityCode(cityCode);//市代码
                expressage.setCityName(cityName);//市名称
                expressage.setTownCode(townCode);//区code
                expressage.setTownName(townName);//区名称
                expressage.setStreetCode(streeCode);//街道code
                expressage.setStreetName(streeName);//街道名称
                expressage.setAddress(address);//居民详细地址
                expressage.setExpressageHospitalName("顺丰快递");
                expressage.setCreateTime(now);//创建时间
                expressage.setOneselfPickupFlg(0);//是否自取 1是 0否
                expressage.setDel(1);//有效
                break;
            case 3:
                prescription.setDispensaryType(3);//取药类型:1 自取 2快递配送 3健管师配送
                //健管师配送
                expressage.setName(userName);//居民姓名
                expressage.setProvinceCode(userProvince);//省代码
                expressage.setProvinceName(userProvinceName);//省名称
                expressage.setCityCode(userCity);//市代码
                expressage.setCityName(userCityName);//市名称
                expressage.setTownCode(userTown);//区code
                expressage.setTownName(userTownName);//区名称
                expressage.setStreetCode(userStreet);//街道code
                expressage.setStreetName(userStreetName);//街道名称
                expressage.setAddress(userAddress);//居民详细地址
                //居民选择的要送达的服务站
                String userOrgCode = addressInfo.getString("code");
                String userOrgName = addressInfo.getString("name");
                String userOrgAddress = addressInfo.getString("address");
                expressage.setPatientHospitalCode(userOrgCode);
                expressage.setPatientHospitalName(userOrgName);
                expressage.setPatientHospitalAddress(userOrgAddress);
                expressage.setCreateTime(now);//创建时间
                expressage.setOneselfPickupFlg(0);//是否自取 1是 0否
                expressage.setDel(1);//有效
                //根据居民code查询团队长及所在团队待处理订单数量
                String sql = "SELECT a.id teamCode,a.leader_code leaderCode,d.`name` leaderName " +
                        " FROM wlyy_sign_family t,wlyy_admin_team a,wlyy_doctor d " +
                        " WHERE t.admin_team_code=a.id AND d.code=a.leader_code " +
                        " AND t.patient=? ";
                Map<String, Object> team = jdbcTemplate.queryForMap(sql, people);
                LOGGER.debug("================> get order amount!");
                String teamCode = team.get("teamCode").toString();
                String leaderCode = team.get("leaderCode").toString();
                String leaderName = team.get("leaderName").toString();
                String count = infoService.getCountExpressage(teamCode).toString();
                JSONObject jsonObject = new JSONObject();
                jsonObject = JSON.parseObject(count);
                int amount = jsonObject.getInteger("count");
                amount+=1;
                //增加wlyy_message 团队长健管师待分配系统消息记录
                Message message = new Message();
                message.setCode(getCode());
                message.setReceiver(leaderCode);//接受者 团队长
                message.setReceiverName(leaderName);
                message.setSender("SYSTEM");//发送者
                message.setSenderName("SYSTEM");//发送者
                message.setTitle("新增系统消息");
                SimpleDateFormat format = new SimpleDateFormat("MM月dd日");
                String content = format.format(new Date()) + "新增1个续方订单待分配配送员,目前共" + amount + "人待处理";
                message.setContent(content);
                message.setType(8);//8.续方支付成功后团队长分配健管师
                message.setPlatform(2);//消息平台,1微信端/患者端,2医生APP端
                message.setState(0);//消息状态,1已发送,0待发送,-1发送失败
                message.setRead(1);//查看状态,1未读,0已读
                message.setReadonly(1);//只读消息:1否,0是
                message.setCzrq(new Date());
                message.setCreateTime(new Date());
                message.setDel("1");//是否作废,1正常,0作废
                message.setOver("0");//是否操作结束 1是 0否
                message.setRelationCode(prescriptionCode);//业务关联code 续方code
                messageDao.save(message);
                break;
        }
            expressage.setHospitalCode(orgCode);
            expressage.setHospitalName(hos.getName());
            expressage.setHospitalAddress(signAddress);
            switch (type) {
                case 1:
                    prescription.setDispensaryType(1);//取药类型:1 自取 2快递配送 3健管师配送
                    //自取保存居民信息
                    expressage.setName(userName);//居民姓名
                    expressage.setProvinceCode(userProvince);//省代码
                    expressage.setProvinceName(userProvinceName);//省名称
                    expressage.setCityCode(userCity);//市代码
                    expressage.setCityName(userCityName);//市名称
                    expressage.setTownCode(userTown);//区code
                    expressage.setTownName(userTownName);//区名称
                    expressage.setStreetCode(userStreet);//街道code
                    expressage.setStreetName(userStreetName);//街道名称
                    expressage.setAddress(userAddress);//居民详细地址
                    expressage.setCreateTime(now);//创建时间
                    expressage.setOneselfPickupFlg(1);//是否自取 1是 0否
                    expressage.setDel(1);//有效
                    if(StringUtils.isNotBlank(deliveryTime)){
                        Date dt = com.yihu.wlyy.util.DateUtil.stringToDate(deliveryTime,"yyyy-MM-dd");
                        expressage.setDeliveryTime(dt);
                    }
                    break;
                case 2:
                    prescription.setDispensaryType(2);//取药类型:1 自取 2快递配送 3健管师配送
                    //快递保存信息
                    String name = addressInfo.getString("receiver");
                    String proviceCode = addressInfo.getString("provinceCode");
                    String proviceName = addressInfo.getString("provinceName");
                    String cityCode = addressInfo.getString("cityCode");
                    String cityName = addressInfo.getString("cityName");
                    String townCode = addressInfo.getString("townCode");
                    String townName = addressInfo.getString("townName");
                    String streeCode = addressInfo.getString("streeCode");
                    String streeName = addressInfo.getString("streeName");
                    String address = addressInfo.getString("address");
                    expressage.setName(name);//居民姓名
                    expressage.setProvinceCode(proviceCode);//省代码
                    expressage.setProvinceName(proviceName);//省名称
                    expressage.setCityCode(cityCode);//市代码
                    expressage.setCityName(cityName);//市名称
                    expressage.setTownCode(townCode);//区code
                    expressage.setTownName(townName);//区名称
                    expressage.setStreetCode(streeCode);//街道code
                    expressage.setStreetName(streeName);//街道名称
                    expressage.setAddress(address);//居民详细地址
                    expressage.setExpressageHospitalName("顺丰快递");
                    expressage.setCreateTime(now);//创建时间
                    expressage.setOneselfPickupFlg(0);//是否自取 1是 0否
                    expressage.setDel(1);//有效
                    //v1.3.6.1 新增deliveryTime
                    if(StringUtils.isNotBlank(deliveryTime)){
                        Date dt = com.yihu.wlyy.util.DateUtil.stringToDate(deliveryTime,"yyyy-MM-dd");
                        expressage.setDeliveryTime(dt);
                    }
                    break;
                case 3:
                    prescription.setDispensaryType(3);//取药类型:1 自取 2快递配送 3健管师配送
                    //健管师配送
                    expressage.setName(userName);//居民姓名
                    expressage.setProvinceCode(userProvince);//省代码
                    expressage.setProvinceName(userProvinceName);//省名称
                    expressage.setCityCode(userCity);//市代码
                    expressage.setCityName(userCityName);//市名称
                    expressage.setTownCode(userTown);//区code
                    expressage.setTownName(userTownName);//区名称
                    expressage.setStreetCode(userStreet);//街道code
                    expressage.setStreetName(userStreetName);//街道名称
                    expressage.setAddress(userAddress);//居民详细地址
                    //居民选择的要送达的服务站
                    String userOrgCode = addressInfo.getString("code");
                    String userOrgName = addressInfo.getString("name");
                    String userOrgAddress = addressInfo.getString("address");
                    expressage.setPatientHospitalCode(userOrgCode);
                    expressage.setPatientHospitalName(userOrgName);
                    expressage.setPatientHospitalAddress(userOrgAddress);
                    expressage.setCreateTime(now);//创建时间
                    expressage.setOneselfPickupFlg(0);//是否自取 1是 0否
                    expressage.setDel(1);//有效
                    //v1.3.6.1 新增deliveryTime
                    if(StringUtils.isNotBlank(deliveryTime)){
                        Date dt = com.yihu.wlyy.util.DateUtil.stringToDate(deliveryTime,"yyyy-MM-dd");
                        expressage.setDeliveryTime(dt);
                    }
                    //根据居民code查询团队长及所在团队待处理订单数量
                    String sql = "SELECT a.id teamCode,a.leader_code leaderCode,d.`name` leaderName " +
                            " FROM wlyy_sign_family t,wlyy_admin_team a,wlyy_doctor d " +
                            " WHERE t.admin_team_code=a.id AND d.code=a.leader_code " +
                            " AND t.patient=? ";
                    Map<String, Object> team = jdbcTemplate.queryForMap(sql, people);
                    LOGGER.debug("================> get order amount!");
                    String teamCode = team.get("teamCode").toString();
                    String leaderCode = team.get("leaderCode").toString();
                    String leaderName = team.get("leaderName").toString();
                    String count = infoService.getCountExpressage(teamCode).toString();
                    JSONObject jsonObject = new JSONObject();
                    jsonObject = JSON.parseObject(count);
                    int amount = jsonObject.getInteger("count");
                    amount+=1;
                    //增加wlyy_message 团队长健管师待分配系统消息记录
                    Message message = new Message();
                    message.setCode(getCode());
                    message.setReceiver(leaderCode);//接受者 团队长
                    message.setReceiverName(leaderName);
                    message.setSender("SYSTEM");//发送者
                    message.setSenderName("SYSTEM");//发送者
                    message.setTitle("新增系统消息");
                    SimpleDateFormat format = new SimpleDateFormat("MM月dd日");
                    String content = format.format(new Date()) + "新增1个续方订单待分配配送员,目前共" + amount + "人待处理";
                    message.setContent(content);
                    message.setType(8);//8.续方支付成功后团队长分配健管师
                    message.setPlatform(2);//消息平台,1微信端/患者端,2医生APP端
                    message.setState(0);//消息状态,1已发送,0待发送,-1发送失败
                    message.setRead(1);//查看状态,1未读,0已读
                    message.setReadonly(1);//只读消息:1否,0是
                    message.setCzrq(new Date());
                    message.setCreateTime(new Date());
                    message.setDel("1");//是否作废,1正常,0作废
                    message.setOver("0");//是否操作结束 1是 0否
                    message.setRelationCode(prescriptionCode);//业务关联code 续方code
                    messageDao.save(message);
                    break;
            }
        PrescriptionPay prescriptionPay = new PrescriptionPay();
            PrescriptionPay prescriptionPay = new PrescriptionPay();
//        居民信息
//        居民信息
        prescriptionPay.setCode(uuid);  //  接入应用支付业务流水号
        prescriptionPay.setPrescriptionCode(prescriptionCode);   //开处方的医生code 关联 wlyy_prescription
        prescriptionPay.setType(1);//支付方式 1 医保支付
        prescriptionPay.setOutChargeTime(new Date());//接入应用时间
        prescriptionPay.setChannel(channel);//支付方式
        prescriptionPay.setChargeTime(new Date());//预支付时间
        prescriptionPay.setOpenid(openid);     //  用戶微信openid
        prescriptionPay.setTotalAmount(totalAmount);//交易总金额
        prescriptionPay.setCreateTime(now);
        prescriptionPay.setCzrq(now);
            prescriptionPay.setCode(uuid);  //  接入应用支付业务流水号
            prescriptionPay.setPrescriptionCode(prescriptionCode);   //开处方的医生code 关联 wlyy_prescription
            prescriptionPay.setType(1);//支付方式 1 医保支付
            prescriptionPay.setOutChargeTime(new Date());//接入应用时间
            prescriptionPay.setChannel(channel);//支付方式
            prescriptionPay.setChargeTime(new Date());//预支付时间
            prescriptionPay.setOpenid(openid);     //  用戶微信openid
            prescriptionPay.setTotalAmount(totalAmount);//交易总金额
            prescriptionPay.setCreateTime(now);
            prescriptionPay.setCzrq(now);
//        try {
//        try {

+ 5 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -259,11 +259,12 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            throw new Exception("编码已使用!");
            throw new Exception("编码已使用!");
        } else if (status == -3) {
        } else if (status == -3) {
            throw new Exception("编码类型错误!");
            throw new Exception("编码类型错误!");
        } else if (status == -4) {
            throw new Exception("未到达服务站!");
        } else if (status == -5) {
            throw new Exception("不可配送!");
        }
        }
//        else if (status == -4) {
//            throw new Exception("未到达服务站!");
//        } else if (status == -5) {
//            throw new Exception("不可配送!");
//        }
        return prescriptionDispensaryCode;
        return prescriptionDispensaryCode;
    }
    }

+ 31 - 30
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -132,7 +132,8 @@ public class PrescriptionExpressageService {
            }
            }
            case 2: {
            case 2: {
                //判断是2 配送员(健管师)取药码
                //判断是2 配送员(健管师)取药码
                returnStatus = dispensaryCode_2(userCode, prescriptionDispensaryCode);
//                returnStatus = dispensaryCode_2(userCode, prescriptionDispensaryCode);
                returnStatus = -3;
                break;
                break;
            }
            }
            case 3: {
            case 3: {
@ -171,20 +172,20 @@ public class PrescriptionExpressageService {
        //修改处方状态为完成
        //修改处方状态为完成
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        if(prescription.getStatus()<=65){
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("该状态不可取药");
            prescriptionLogDao.save(prescriptionLog);
            return -4;
        }
//        if(prescription.getStatus()<=65){
//            PrescriptionLog prescriptionLog = new PrescriptionLog();
//            prescriptionLog.setCode(UUID.randomUUID().toString());
//            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
//            prescriptionLog.setCreateTime(new Date());
//            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
//            prescriptionLog.setFlag(1);
//            prescriptionLog.setUserCode(userCode);
//            prescriptionLog.setUserType(2);
//            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
//            prescriptionLog.setRemark("该状态不可取药");
//            prescriptionLogDao.save(prescriptionLog);
//            return -4;
//        }
        Date finshTime = new Date();
        Date finshTime = new Date();
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        prescription.setFinishTime(finshTime);
        prescription.setFinishTime(finshTime);
@ -226,20 +227,20 @@ public class PrescriptionExpressageService {
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        if(prescription.getStatus()<=50){
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
            prescriptionLog.setRemark("该状态不可配送");
            prescriptionLogDao.save(prescriptionLog);
            return -5;
        }
//        if(prescription.getStatus()<=50){
//            PrescriptionLog prescriptionLog = new PrescriptionLog();
//            prescriptionLog.setCode(UUID.randomUUID().toString());
//            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
//            prescriptionLog.setCreateTime(new Date());
//            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
//            prescriptionLog.setFlag(1);
//            prescriptionLog.setUserCode(userCode);
//            prescriptionLog.setUserType(2);
//            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
//            prescriptionLog.setRemark("该状态不可配送");
//            prescriptionLogDao.save(prescriptionLog);
//            return -5;
//        }
        //修改处方状态为配送中
        //修改处方状态为配送中
        Date expressageing = new Date();
        Date expressageing = new Date();
        prescription.setExpressageTime(expressageing);
        prescription.setExpressageTime(expressageing);
@ -273,7 +274,7 @@ public class PrescriptionExpressageService {
                "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
                "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
        prescriptionNoticesService.sendMessages(userCode, doctor.getName(), DateUtil.dateToStrLong(expressageing), 3, 0, url);
        prescriptionNoticesService.sendMessages(patient.getCode(), doctor.getName(), DateUtil.dateToStrLong(expressageing), 3, 0, url);
        return prescriptionDispensaryCode.getType();
        return prescriptionDispensaryCode.getType();
    }
    }

+ 75 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -35,7 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.*;
/**
/**
 * Created by Trick on 2017/7/25.
 * Created  Trick on 2017/7/25.
 */
 */
@Service
@Service
@Transactional
@Transactional
@ -104,10 +104,18 @@ public class PrescriptionInfoService extends BaseService {
    }
    }
    public JSONObject getPrescriptionFilter() {
    public JSONObject getPrescriptionFilter(Integer teamCode) {
        JSONObject rs = new JSONObject();
        JSONObject rs = new JSONObject();
        List<SystemDict> states = systemDictDao.findByDictName("PRESCRIPTION_STATE");
        List<SystemDict> sdict = systemDictDao.findByDictName("PRESCRIPTION_STATE");
        List<Map<String,Object>> states = new ArrayList<>();
        for(SystemDict sd : sdict){
            Map<String,Object> m = new HashedMap();
            m.put("code",sd.getCode());
            m.put("value",sd.getValue());
            m.put("count",getPresCountByState(teamCode,sd.getCode()));
            states.add(m);
        }
        rs.put("states", states);
        rs.put("states", states);
        List<Map<String, Object>> diseases = new ArrayList<>();
        List<Map<String, Object>> diseases = new ArrayList<>();
        Map<String, Object> dis1 = new HashMap<>();
        Map<String, Object> dis1 = new HashMap<>();
@ -123,6 +131,22 @@ public class PrescriptionInfoService extends BaseService {
        return rs;
        return rs;
    }
    }
    public int getPresCountByState(Integer teamCode,String states){
        String sql = "SELECT " +
                " COUNT(1) AS count " +
                " FROM " +
                " wlyy_prescription p " +
                " WHERE " +
                " p.admin_team_id =" +teamCode+
                " AND p.`status` in ("+states+")";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        if(rs!=null&&rs.size()>0){
            Long r = (Long) rs.get(0).get("count");
            return r.intValue();
        }
        return 0;
    }
    /**
    /**
     * 1:查询处方;2我的续方;3:续方记录
     * 1:查询处方;2我的续方;3:续方记录
     *
     *
@ -135,9 +159,13 @@ public class PrescriptionInfoService extends BaseService {
            if ("1".equals(type)) {
            if ("1".equals(type)) {
                Patient p = patientDao.findByCode(patient);
                Patient p = patientDao.findByCode(patient);
                String rp = jwPrescriptionService.getLastRecipe(p.getSsc(), null, null, null);
                String rp = jwPrescriptionService.getRecipeList(p.getSsc(), null, startDate, endDate);
                com.alibaba.fastjson.JSONArray pres = presModeAdapter.modeToPrescription(rp);
                com.alibaba.fastjson.JSONArray pres = presModeAdapter.modeToPrescription(rp);
                if(pres==null||pres.size()==0){
                    return pres;
                }
                for (int i = 0; i < pres.size(); i++) {
                for (int i = 0; i < pres.size(); i++) {
                    com.alibaba.fastjson.JSONObject r = (com.alibaba.fastjson.JSONObject) pres.get(i);
                    com.alibaba.fastjson.JSONObject r = (com.alibaba.fastjson.JSONObject) pres.get(i);
                    String rState = presCheckStateObj(r.getString("code"));
                    String rState = presCheckStateObj(r.getString("code"));
@ -179,12 +207,41 @@ public class PrescriptionInfoService extends BaseService {
                            }
                            }
                        }
                        }
                    }
                    }
                }
                //过滤病症
                if(StringUtils.isNotBlank(diagnosisCode)&&!"0".equals(diagnosisCode)){
                    Iterator iterator = pres.iterator();
                    while (iterator.hasNext()) {
                        com.alibaba.fastjson.JSONObject r = (com.alibaba.fastjson.JSONObject) iterator.next();
                        String dis = gxy;
                        if("1".equals(diagnosisCode)){
                            dis = gxy;
                        }else if("2".equals(diagnosisCode)){
                            dis = tnb;
                        }
                        com.alibaba.fastjson.JSONArray des = (com.alibaba.fastjson.JSONArray) r.getJSONArray("prescriptionDt");
                        boolean flag = false;
                        for (int i = 0; i < des.size(); i++) {
                            PrescriptionDiagnosis ds = des.getObject(i, PrescriptionDiagnosis.class);
                            //如果含有选择病症,标记为true
                            if (dis.equals(ds.getHealthProblem())) {
                                //含有选择的病症
                                flag = true;
                            }
                        }
                        //如果未含有选择的病症,则删除
                        if (!flag){
                            iterator.remove();
                        }
                    }
                }
                }
                return pres;
                return pres;
            } else {
            } else {
                Patient p = patientDao.findByCode(patient);
                Patient p = patientDao.findByCode(patient);
                StringBuffer sqlBuffer = new StringBuffer("SELECT p.code,p.create_time AS createTime,p.status,p.hospital_name As hospitalName FROM wlyy_prescription p " +
                StringBuffer sqlBuffer = new StringBuffer("SELECT p.code,LEFT(p.create_time,19) AS createTime,p.status,p.hospital_name As hospitalName FROM wlyy_prescription p " +
                        "WHERE p.patient=?");
                        "WHERE p.patient=?");
                List<Object> params = new ArrayList<>();
                List<Object> params = new ArrayList<>();
                params.add(patient);
                params.add(patient);
@ -279,8 +336,9 @@ public class PrescriptionInfoService extends BaseService {
     * @param code
     * @param code
     * @return
     * @return
     */
     */
    public com.alibaba.fastjson.JSONObject getPrescription(String code) {
        String rs = jwPrescriptionService.getRecipe(code, null);
    public com.alibaba.fastjson.JSONObject getPrescription(String code,String patient) {
        Patient p = patientDao.findByCode(patient);
        String rs = jwPrescriptionService.getRecipe(code, p.getSsc());
        com.alibaba.fastjson.JSONObject r = presModeAdapter.modelToSinglePrescription(rs);
        com.alibaba.fastjson.JSONObject r = presModeAdapter.modelToSinglePrescription(rs);
        String rState = presCheckStateObj(code);
        String rState = presCheckStateObj(code);
        if ("1".equals(rState)) {
        if ("1".equals(rState)) {
@ -377,6 +435,9 @@ public class PrescriptionInfoService extends BaseService {
        log.setRemark("患者取消");
        log.setRemark("患者取消");
        prescriptionLogDao.save(log);
        prescriptionLogDao.save(log);
        //修改系统的续方消息的审核状态
        messageDao.updatePreScriptionMessage(p.getConsult(), "3", 6);
        //同步智业接口
        //同步智业接口
        jwPrescriptionService.fadeRecipe(code);
        jwPrescriptionService.fadeRecipe(code);
@ -449,8 +510,10 @@ public class PrescriptionInfoService extends BaseService {
                " p.photo, " +
                " p.photo, " +
                " pr.`status`, " +
                " pr.`status`, " +
                " pr.`code`, " +
                " pr.`code`, " +
                " pr.create_time AS createTime, " +
                " pr.doctor " +
                " LEFT(pr.create_time,19) AS createTime, " +
                " pr.doctor, " +
                " pr.min_drug_day AS minDrugDay," +
                " pr.pres_create_time AS presCreateTime" +
                " FROM " +
                " FROM " +
                " wlyy_prescription pr " +
                " wlyy_prescription pr " +
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` ");
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` ");
@ -504,7 +567,7 @@ public class PrescriptionInfoService extends BaseService {
            pre_sql.append(" AND pr.patient = ?");
            pre_sql.append(" AND pr.patient = ?");
            params.add(patient);
            params.add(patient);
        }
        }
        pre_sql.append(" GROUP BY pr.code ORDER BY pr.create_time DESC");
        pre_sql.append(" GROUP BY pr.code ORDER BY pr.min_drug_day-TIMESTAMPDIFF(DAY, pr.pres_create_time, NOW()) ASC");
        if (page != null && page > 0 && size != null && size > 0) {
        if (page != null && page > 0 && size != null && size > 0) {
            pre_sql.append(" LIMIT " + (page - 1) * size + "," + size);
            pre_sql.append(" LIMIT " + (page - 1) * size + "," + size);
        }
        }
@ -1241,7 +1304,8 @@ public class PrescriptionInfoService extends BaseService {
                " com2.`name` AS quantityUnitName, " +
                " com2.`name` AS quantityUnitName, " +
                " t.pack_unit As packUnit, " +
                " t.pack_unit As packUnit, " +
                " com3.`name` As packUnitName, " +
                " com3.`name` As packUnitName, " +
                " pack_spec AS packSpec" +
                " pack_spec AS packSpec, " +
                " subject_class AS subjectClass" +
                " FROM " +
                " FROM " +
                " zy_iv_physic_dict t, " +
                " zy_iv_physic_dict t, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com1, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com1, " +

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -390,7 +390,7 @@ public class PrescriptionService extends BaseService {
                    for (String infoCode : zyInfoCodeAndCost.keySet()) {
                    for (String infoCode : zyInfoCodeAndCost.keySet()) {
                        Double _cost = Double.parseDouble(zyInfoCodeAndCost.get(infoCode));
                        Double _cost = Double.parseDouble(zyInfoCodeAndCost.get(infoCode));
                        Integer infocost = CommonUtil.doubleToInt(_cost);
                        Integer infocost = CommonUtil.doubleToInt(_cost);
                        prescriptionInfoDao.updateStatus(infoCode,infocost);
                        prescriptionInfoDao.updateStatus(infoCode,infocost,prescriptionCode);
                    }
                    }
                    //事务提交
                    //事务提交
                    transactionManager.commit(status);
                    transactionManager.commit(status);

+ 7 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -20,6 +20,8 @@ import com.yihu.wlyy.util.MapListUtils;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemConf;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
@ -39,6 +41,8 @@ import java.util.*;
 */
 */
@Service
@Service
public class StatisticsService extends BaseService {
public class StatisticsService extends BaseService {
    private Logger logger= LoggerFactory.getLogger(StatisticsService.class);
    @Autowired
    @Autowired
    CityDao cityDao;
    CityDao cityDao;
    @Autowired
    @Autowired
@ -4235,6 +4239,9 @@ public class StatisticsService extends BaseService {
    private int getLevel1NumForRedis(String index, String level, String code, String timeKey) {
    private int getLevel1NumForRedis(String index, String level, String code, String timeKey) {
        String key37 = "quota:" + index + ":" + level + ":" + code + ":" + timeKey;
        String key37 = "quota:" + index + ":" + level + ":" + code + ":" + timeKey;
        JSONObject switchJo = new JSONObject(redisTemplate.opsForValue().get(key37));
        JSONObject switchJo = new JSONObject(redisTemplate.opsForValue().get(key37));
        logger.info(key37);
        logger.info(redisTemplate==null?"true":"false");
        logger.info(switchJo.toString());
        return switchJo.getInt("num");
        return switchJo.getInt("num");
    }
    }

+ 60 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.service.third.jw;
package com.yihu.wlyy.service.third.jw;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
@ -16,7 +17,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.List;
import java.util.Map;
/**
/**
 * 基位长处方接口
 * 基位长处方接口
@ -87,6 +90,7 @@ public class JwPrescriptionService {
        params.add(new BasicNameValuePair("applyTimeEnd", applyTimeEnd));
        params.add(new BasicNameValuePair("applyTimeEnd", applyTimeEnd));
        String response = httpClientUtil.post(url, params, "UTF-8");
        String response = httpClientUtil.post(url, params, "UTF-8");
//        String sql = "SELECT h.response from wlyy_http_log h WHERE h.id = 806287";
//        String sql = "SELECT h.response from wlyy_http_log h WHERE h.id = 806287";
//        List<Map<String ,Object>> list = jdbcTemplate.queryForList(sql);
//        List<Map<String ,Object>> list = jdbcTemplate.queryForList(sql);
//        String response = list.get(0).get("response").toString();
//        String response = list.get(0).get("response").toString();
@ -97,6 +101,62 @@ public class JwPrescriptionService {
        return response;
        return response;
    }
    }
    /**
     * 获取处方列表
     * @param cardNo
     * @param recipeNo
     * @param applyTimeFrom
     * @param applyTimeEnd
     * @return
     */
    public String getRecipeList(String cardNo,String recipeNo,String applyTimeFrom,String applyTimeEnd){
        JSONObject recipeJson = new JSONObject();
        try{
            Map<String,String> map = new HashMap<>();
            JSONArray jsonArray = new JSONArray();
            for (int i=0;i<3;i++){
                if(!map.containsKey(recipeNo)){
                    map.put(recipeNo,recipeNo);
                    String response = getLastRecipe(cardNo,recipeNo,applyTimeFrom,applyTimeEnd);
                    JSONObject json = JSONObject.parseObject(response);
                    if(json.getInteger("status")==200){
                        //智业接口每次返回一条数据,需要遍历请求
                        JSONObject data = json.getJSONObject("data");
                        String code = data.getString("CODE");
                        if("1".equals(code)){
                            JSONArray returnData = data.getJSONArray("returnData");
                            if(returnData.size()>0){
                                JSONObject recipe = returnData.getJSONArray(0).getJSONObject(0);//获取最后一条处方
                                jsonArray.add(recipe);
                                recipeNo = recipe.getString("RECIPE_NO");
                                if(recipeJson.isEmpty()){
                                    recipeJson = json;
                                }else {
                                    recipeJson.getJSONObject("data").getJSONArray("returnData").getJSONArray(0).add(recipe);
                                }
                            }
                        }
                    }
                }
            }
            if(jsonArray.size()>1){
                JSONObject re = new JSONObject();
                re.put("status",200);
                re.put("msg","调阅历史处方接口!");
                JSONObject data = new JSONObject();
                data.put("CODE","1");
                JSONArray returnData = new JSONArray();
                returnData.add(jsonArray);
                data.put("returnData",returnData);
                re.put("data",data);
                return re.toString();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return recipeJson.toString();
    }
    /**
    /**
     * 获取单条历史处方
     * 获取单条历史处方
     * @param recipeNo
     * @param recipeNo

+ 17 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -125,6 +125,23 @@ public class ZyDictService {
        return isRefrigerate;
        return isRefrigerate;
    }
    }
    /**
     * 获取药品科目类型
     * @param physicCodde
     * @return
     */
    public String getSubjectClass(String physicCodde){
        StringBuffer sql = new StringBuffer("SELECT subject_class from zy_iv_physic_dict WHERE physic_code = ?");
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql.toString(),physicCodde);
        if(list!=null&&list.size()>0){
            Object subject_class = list.get(0).get("subject_class");
            if(subject_class!=null){
                return subject_class.toString();
            }
        }
        return "";
    }
    /**
    /**
     * 获取药品字典
     * 获取药品字典

+ 12 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/qrcode/QrCodeController.java

@ -32,7 +32,7 @@ public class QrCodeController extends WeixinBaseController {
    @Autowired
    @Autowired
    private DoctorService doctorService;
    private DoctorService doctorService;
    @RequestMapping(value = "/doctors",method = RequestMethod.POST)
    @RequestMapping(value = "/doctors",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    @ResponseBody
    public String makeDoctorQrcodes(String hospital) {
    public String makeDoctorQrcodes(String hospital) {
        try {
        try {
@ -52,7 +52,7 @@ public class QrCodeController extends WeixinBaseController {
     * @param doctor
     * @param doctor
     * @return
     * @return
     */
     */
    @RequestMapping(value = "/doctor",method = RequestMethod.POST)
    @RequestMapping(value = "/doctor",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    @ResponseBody
    public String makeDoctorQrcode(String doctor) {
    public String makeDoctorQrcode(String doctor) {
        try {
        try {
@ -72,7 +72,7 @@ public class QrCodeController extends WeixinBaseController {
     * @param hospital
     * @param hospital
     * @return
     * @return
     */
     */
    @RequestMapping(value = "/hospital",method = RequestMethod.POST)
    @RequestMapping(value = "/hospital",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    @ResponseBody
    public String makeHospitalQrcode(String hospital) {
    public String makeHospitalQrcode(String hospital) {
        try {
        try {
@ -92,7 +92,7 @@ public class QrCodeController extends WeixinBaseController {
     * @param town
     * @param town
     * @return
     * @return
     */
     */
    @RequestMapping(value = "/town",method = RequestMethod.POST)
    @RequestMapping(value = "/town",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    @ResponseBody
    public String makeTownQrcode(String town) {
    public String makeTownQrcode(String town) {
        try {
        try {
@ -113,7 +113,7 @@ public class QrCodeController extends WeixinBaseController {
     * @param hospital
     * @param hospital
     * @param response
     * @param response
     */
     */
    @RequestMapping(value = "/hospital_img",method = RequestMethod.POST)
    @RequestMapping(value = "/hospital_img",method = {RequestMethod.GET,RequestMethod.POST})
    public void downloadSqQrcode(String hospital, HttpServletResponse response) {
    public void downloadSqQrcode(String hospital, HttpServletResponse response) {
        try {
        try {
            File file = new File(QrCodeController.class.getResource("/").getPath().replace("/WEB-INF/classes/", "") +
            File file = new File(QrCodeController.class.getResource("/").getPath().replace("/WEB-INF/classes/", "") +
@ -155,7 +155,7 @@ public class QrCodeController extends WeixinBaseController {
     * @param town
     * @param town
     * @param response
     * @param response
     */
     */
    @RequestMapping(value = "/town_img",method = RequestMethod.POST)
    @RequestMapping(value = "/town_img",method = {RequestMethod.GET,RequestMethod.POST})
    public void downloadTownQrcode(String town, HttpServletResponse response) {
    public void downloadTownQrcode(String town, HttpServletResponse response) {
        try {
        try {
            File file = new File(QrCodeController.class.getResource("/").getPath().replace("/WEB-INF/classes/", "") +
            File file = new File(QrCodeController.class.getResource("/").getPath().replace("/WEB-INF/classes/", "") +
@ -197,7 +197,7 @@ public class QrCodeController extends WeixinBaseController {
     * @param doctor
     * @param doctor
     * @param response
     * @param response
     */
     */
    @RequestMapping(value = "/download",method = RequestMethod.POST)
    @RequestMapping(value = "/download",method = {RequestMethod.GET,RequestMethod.POST})
    public void downloadQrcode(String doctor, HttpServletResponse response) {
    public void downloadQrcode(String doctor, HttpServletResponse response) {
        try {
        try {
            Doctor doc = doctorService.findDoctorByCode(doctor);
            Doctor doc = doctorService.findDoctorByCode(doctor);
@ -248,7 +248,7 @@ public class QrCodeController extends WeixinBaseController {
     * @param doctor
     * @param doctor
     * @param response
     * @param response
     */
     */
    @RequestMapping(value = "/doctor_img",method = RequestMethod.POST)
    @RequestMapping(value = "/doctor_img",method = {RequestMethod.GET,RequestMethod.POST})
    public void downloadQrcodeImage(String doctor, HttpServletResponse response) {
    public void downloadQrcodeImage(String doctor, HttpServletResponse response) {
        try {
        try {
            System.out.println("------------------doctor:" + doctor);
            System.out.println("------------------doctor:" + doctor);
@ -297,7 +297,7 @@ public class QrCodeController extends WeixinBaseController {
     * @param hospital
     * @param hospital
     * @param response
     * @param response
     */
     */
    @RequestMapping(value = "/download/doctors",method = RequestMethod.POST)
    @RequestMapping(value = "/download/doctors",method = {RequestMethod.GET,RequestMethod.POST})
    public void downloadQrcodes(String hospital, HttpServletResponse response) {
    public void downloadQrcodes(String hospital, HttpServletResponse response) {
        try {
        try {
            File file = qrcodeService.downloadDoctorQrCodes(hospital, getAccessToken());
            File file = qrcodeService.downloadDoctorQrCodes(hospital, getAccessToken());
@ -332,7 +332,7 @@ public class QrCodeController extends WeixinBaseController {
     * @param area
     * @param area
     * @param response
     * @param response
     */
     */
    @RequestMapping(value = "/download/hospitals",method = RequestMethod.POST)
    @RequestMapping(value = "/download/hospitals",method = {RequestMethod.GET,RequestMethod.POST})
    public void downloadSqQrcodes(String area, HttpServletResponse response) {
    public void downloadSqQrcodes(String area, HttpServletResponse response) {
        try {
        try {
            File file = qrcodeService.downloadHospitalQrCodes(area, getAccessToken());
            File file = qrcodeService.downloadHospitalQrCodes(area, getAccessToken());
@ -362,12 +362,12 @@ public class QrCodeController extends WeixinBaseController {
    }
    }
    /**
    /**
     * 下载某个城市的区的二维码图片
     * 下载某个城市的区的二维码图片 t
     *
     *
     * @param city
     * @param city
     * @param response
     * @param response
     */
     */
    @RequestMapping(value = "/download/towns",method = RequestMethod.POST)
    @RequestMapping(value = "/download/towns",method = {RequestMethod.GET,RequestMethod.POST})
    public void downloadTownQrcodes(String city, HttpServletResponse response) {
    public void downloadTownQrcodes(String city, HttpServletResponse response) {
        try {
        try {
            File file = qrcodeService.downLoadTownQrcodes(city, getAccessToken());
            File file = qrcodeService.downLoadTownQrcodes(city, getAccessToken());

+ 4 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -1900,7 +1900,7 @@ public class DoctorController extends BaseController {
    }
    }
    /**
    /**
     * 重置密码
     * 初始设置实名软证书调用保护口令
     */
     */
    @ApiOperation("初始设置实名软证书调用保护口令")
    @ApiOperation("初始设置实名软证书调用保护口令")
    @ObserverRequired
    @ObserverRequired
@ -1909,7 +1909,8 @@ public class DoctorController extends BaseController {
    public String installAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
    public String installAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),"11111111",strNewCalledPasswd,getUID());
            String strOldCalledPasswd = StringUtils.isNotEmpty(doctor.getCheckPassword())?doctor.getCheckPassword():"11111111";
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getUID());
            if(b){
            if(b){
                return write(200, "设置密码成功!", "data", b);
                return write(200, "设置密码成功!", "data", b);
            }
            }
@ -2002,7 +2003,7 @@ public class DoctorController extends BaseController {
            @ApiParam(required = true, name = "strOriginalData", value = "原文数据") @RequestParam(value = "strOriginalData",required = true) String strOriginalData){
            @ApiParam(required = true, name = "strOriginalData", value = "原文数据") @RequestParam(value = "strOriginalData",required = true) String strOriginalData){
            try {
            try {
                boolean bl = doctorInfoService.verifySignOnMultiServer(strSignData,strCertData,strOriginalData);
                boolean bl = doctorInfoService.verifySignOnMultiServer(strSignData,strCertData,strOriginalData,getUID());
                return write(200, "获取信息成功!", "data", bl);
                return write(200, "获取信息成功!", "data", bl);
            }catch (Exception e) {
            }catch (Exception e) {
                error(e);
                error(e);

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionAdjustController.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.web.doctor.prescription;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.app.prescription.PrescriptionAdjustService;
import com.yihu.wlyy.service.app.prescription.PrescriptionAdjustService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
@ -61,6 +62,19 @@ public class PrescriptionAdjustController extends BaseController {
        }
        }
    }
    }
    @RequestMapping(value = "getPrescriptionStatus",method = RequestMethod.GET)
    @ApiOperation("获取续方状态")
    public String getPrescriptionStatus(@ApiParam(name = "code", value = "续方code", defaultValue = "10")
                                        @RequestParam(value = "code", required = true) String code){
        try {
            Prescription prescription = prescriptionDao.findByCode(code);
            return write(200,"success","data",prescription.getStatus());
        }catch (Exception e){
            error(e);
            return error(-1,"获取续方状态失败");
        }
    }

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -52,9 +52,9 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @ApiOperation(value = "获取过滤规则信息列表")
    @ApiOperation(value = "获取过滤规则信息列表")
    public String getPrescriptionFilter() {
    public String getPrescriptionFilter(Integer teamCode) {
        try {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescriptionFilter());
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescriptionFilter(teamCode));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败!");
            return error(-1, "查询失败!");
@ -405,10 +405,10 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/getPrescription", method = RequestMethod.GET)
    @RequestMapping(value = "/getPrescription", method = RequestMethod.GET)
    @ApiOperation(value = "获取长处方详细信息")
    @ApiOperation(value = "获取长处方详细信息")
    public String getPrescription(@RequestParam(required = true) @ApiParam(name = "code", value = "处方CODE") String
                                          code) {
    public String getPrescription(@RequestParam(required = true) @ApiParam(name = "code", value = "处方CODE") String code
            ,@RequestParam(required = true) @ApiParam(name = "patient", value = "居民CODE") String  patient) {
        try {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescription(code));
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescription(code,patient));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败!");
            return error(-1, "查询失败!");

+ 7 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcLoginController.java

@ -54,7 +54,7 @@ public class GcLoginController {
            String modulus = RSAUtils.getInstance(smsService).getModulus();
            String modulus = RSAUtils.getInstance(smsService).getModulus();
            String exponent = RSAUtils.getInstance(smsService).getExponent();
            String exponent = RSAUtils.getInstance(smsService).getExponent();
            if (StringUtils.isEmpty(modulus) || StringUtils.isEmpty(exponent)) {
            if (StringUtils.isEmpty(modulus) || StringUtils.isEmpty(exponent)) {
                return new ResultOneModel(BaseResultModel.codeEm.login_publickey_error.getCode(),BaseResultModel.codeEm.login_publickey_error.getMessage());
                return new ResultOneModel(BaseResultModel.statusEm.login_publickey_error.getCode(),BaseResultModel.statusEm.login_publickey_error.getMessage());
            } else {
            } else {
                JSONObject json = new JSONObject();
                JSONObject json = new JSONObject();
                json.put("modulus", modulus); //加密指数
                json.put("modulus", modulus); //加密指数
@ -62,7 +62,7 @@ public class GcLoginController {
                return new ResultOneModel(json);
                return new ResultOneModel(json);
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            return new ResultOneModel(BaseResultModel.codeEm.login_publickey_error.getCode(),BaseResultModel.codeEm.login_publickey_error.getMessage());
            return new ResultOneModel(BaseResultModel.statusEm.login_publickey_error.getCode(),BaseResultModel.statusEm.login_publickey_error.getMessage());
        }
        }
    }
    }
@ -94,7 +94,7 @@ public class GcLoginController {
                errorMessage = "获取IMEI码失败!";
                errorMessage = "获取IMEI码失败!";
                loginLog.setErrorMessage(errorMessage);
                loginLog.setErrorMessage(errorMessage);
                loginLogService.saveLog(loginLog);
                loginLogService.saveLog(loginLog);
                return new ResultOneModel<>(BaseResultModel.codeEm.login_IMEI_error.getCode(), BaseResultModel.codeEm.login_IMEI_error.getMessage());
                return new ResultOneModel<>(BaseResultModel.statusEm.login_IMEI_error.getCode(), BaseResultModel.statusEm.login_IMEI_error.getMessage());
            }
            }
            if (platform == null) {
            if (platform == null) {
                platform = 2;//默认为医生app端
                platform = 2;//默认为医生app端
@ -115,7 +115,7 @@ public class GcLoginController {
                    errorMessage = "该号码未注册!";
                    errorMessage = "该号码未注册!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    loginLogService.saveLog(loginLog);
                    return new ResultOneModel<>(BaseResultModel.codeEm.login_account_error.getCode(), BaseResultModel.codeEm.login_account_error.getMessage());
                    return new ResultOneModel<>(BaseResultModel.statusEm.login_account_error.getCode(), BaseResultModel.statusEm.login_account_error.getMessage());
                }
                }
                loginLog.setUserCode(doctor.getCode());
                loginLog.setUserCode(doctor.getCode());
                String loginPassword = MD5.GetMD5Code(password + doctor.getSalt());
                String loginPassword = MD5.GetMD5Code(password + doctor.getSalt());
@ -145,14 +145,14 @@ public class GcLoginController {
                    errorMessage = "密码错误,登录失败";
                    errorMessage = "密码错误,登录失败";
                    loginLog.setErrorMessage(errorMessage);
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    loginLogService.saveLog(loginLog);
                    return new ResultOneModel<>(BaseResultModel.codeEm.login_password_error.getCode(), BaseResultModel.codeEm.login_password_error.getMessage());
                    return new ResultOneModel<>(BaseResultModel.statusEm.login_password_error.getCode(), BaseResultModel.statusEm.login_password_error.getMessage());
                }
                }
            }
            }
            return new ResultOneModel<>(BaseResultModel.codeEm.error_params.getCode(), BaseResultModel.codeEm.error_params.getMessage());
            return new ResultOneModel<>(BaseResultModel.statusEm.error_params.getCode(), BaseResultModel.statusEm.error_params.getMessage());
        } catch (Exception e) {
        } catch (Exception e) {
            loginLog.setErrorMessage(e.getMessage());
            loginLog.setErrorMessage(e.getMessage());
            loginLogService.saveLog(loginLog);
            loginLogService.saveLog(loginLog);
            return new ResultOneModel<>(BaseResultModel.codeEm.login_system_error.getCode(), BaseResultModel.codeEm.login_system_error.getMessage());
            return new ResultOneModel<>(BaseResultModel.statusEm.login_system_error.getCode(), BaseResultModel.statusEm.login_system_error.getMessage());
        }
        }
    }
    }
}
}

+ 8 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcTokenController.java

@ -64,17 +64,17 @@ public class GcTokenController {
            GcClientDetails clientDetails = clientDetailsService.findByAppId(appid);
            GcClientDetails clientDetails = clientDetailsService.findByAppId(appid);
            if (clientDetails == null) {
            if (clientDetails == null) {
                ResultOneModel resultOneModel = new ResultOneModel(null);
                ResultOneModel resultOneModel = new ResultOneModel(null);
                resultOneModel.setCode(BaseResultModel.codeEm.error_Appid.getCode());
                resultOneModel.setMessage(BaseResultModel.codeEm.error_Appid.getMessage());
                saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.codeEm.error_Appid.getMessage());
                resultOneModel.setStatus(BaseResultModel.statusEm.error_Appid.getCode());
                resultOneModel.setMessage(BaseResultModel.statusEm.error_Appid.getMessage());
                saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.statusEm.error_Appid.getMessage());
                return resultOneModel;
                return resultOneModel;
            }
            }
            //判断appSecret
            //判断appSecret
            if (!appSecret.equals(clientDetails.getAppSecret())) {
            if (!appSecret.equals(clientDetails.getAppSecret())) {
                ResultOneModel resultOneModel = new ResultOneModel(null);
                ResultOneModel resultOneModel = new ResultOneModel(null);
                resultOneModel.setCode(BaseResultModel.codeEm.error_AppSecret.getCode());
                resultOneModel.setMessage(BaseResultModel.codeEm.error_AppSecret.getMessage());
                saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.codeEm.error_Appid.getMessage());
                resultOneModel.setStatus(BaseResultModel.statusEm.error_AppSecret.getCode());
                resultOneModel.setMessage(BaseResultModel.statusEm.error_AppSecret.getMessage());
                saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.statusEm.error_Appid.getMessage());
                return resultOneModel;
                return resultOneModel;
            }
            }
            //生成token
            //生成token
@ -89,8 +89,8 @@ public class GcTokenController {
            BeanUtils.copyProperties(gcToken, gcTokenModel);
            BeanUtils.copyProperties(gcToken, gcTokenModel);
            return new ResultOneModel(gcTokenModel);
            return new ResultOneModel(gcTokenModel);
        } catch (Exception e) {
        } catch (Exception e) {
            saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.codeEm.login_system_error.getMessage());
            return new ResultOneModel(BaseResultModel.codeEm.login_system_error.getCode(), BaseResultModel.codeEm.login_system_error.getMessage());
            saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.statusEm.login_system_error.getMessage());
            return new ResultOneModel(BaseResultModel.statusEm.login_system_error.getCode(), BaseResultModel.statusEm.login_system_error.getMessage());
        }
        }
    }
    }

+ 2 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcMessageController.java

@ -1,14 +1,11 @@
package com.yihu.wlyy.web.gateway.controller;
package com.yihu.wlyy.web.gateway.controller.doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.NetworkUtil;
import com.yihu.wlyy.util.NetworkUtil;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.gateway.vo.PatientModel;
import com.yihu.wlyy.web.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultBatchModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultBatchModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -16,14 +13,12 @@ import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
@ -99,7 +94,7 @@ public class GcMessageController {
            }
            }
            return new ResultBatchModel(success, error, errorLiust);
            return new ResultBatchModel(success, error, errorLiust);
        } catch (Exception e) {
        } catch (Exception e) {
            return new ResultBatchModel(BaseResultModel.codeEm.error_no_ip.getCode(), "获取IP失败", success, error, errorLiust);
            return new ResultBatchModel(BaseResultModel.statusEm.error_no_ip.getCode(), "获取IP失败", success, error, errorLiust);
        }
        }
    }
    }
}
}

+ 9 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/BaseResultModel.java

@ -9,16 +9,16 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel("返回实体")
@ApiModel("返回实体")
public class BaseResultModel {
public class BaseResultModel {
    @ApiModelProperty(value = "状态", required = false, access = "response")
    @ApiModelProperty(value = "状态", required = false, access = "response")
    protected Integer code = codeEm.success.getCode();
    protected Integer status = statusEm.success.getCode();
    @ApiModelProperty(value = "信息", required = false, access = "response")
    @ApiModelProperty(value = "信息", required = false, access = "response")
    protected String message = "成功";
    protected String message = "成功";
    public Integer getCode() {
        return code;
    public Integer getStatus() {
        return status;
    }
    }
    public void setCode(Integer code) {
        this.code = code;
    public void setStatus(Integer status) {
        this.status = status;
    }
    }
    public String getMessage() {
    public String getMessage() {
@ -29,7 +29,7 @@ public class BaseResultModel {
        this.message = message;
        this.message = message;
    }
    }
    public enum codeEm {
    public enum statusEm {
        success(10000, "请求成功"),//请求成功
        success(10000, "请求成功"),//请求成功
        error_Appid(-9000, "appid不存在"),//appid不存在
        error_Appid(-9000, "appid不存在"),//appid不存在
        error_AppSecret(-9001, "AppSecret不存在"),//AppSecret不存在
        error_AppSecret(-9001, "AppSecret不存在"),//AppSecret不存在
@ -52,7 +52,7 @@ public class BaseResultModel {
        ;
        ;
        codeEm(Integer code, String message) {
        statusEm(Integer code, String message) {
            this.code = code;
            this.code = code;
            this.message = message;
            this.message = message;
        }
        }
@ -84,8 +84,8 @@ public class BaseResultModel {
        this.message = message;
        this.message = message;
    }
    }
    public BaseResultModel(Integer code, String message) {
        this.code = code;
    public BaseResultModel(Integer status, String message) {
        this.status = status;
        this.message = message;
        this.message = message;
    }
    }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java

@ -59,7 +59,7 @@ public class PatientPrescriptionInfoController extends BaseController {
    @ApiOperation(value = "获取长处方详细信息")
    @ApiOperation(value = "获取长处方详细信息")
    public String getPrescription(@RequestParam(required = true)@ApiParam(name="code",value="处方CODE")String code){
    public String getPrescription(@RequestParam(required = true)@ApiParam(name="code",value="处方CODE")String code){
        try {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescription(code));
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescription(code,getUID()));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败!");
            return error(-1, "查询失败!");

+ 3 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -77,11 +77,12 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
                    "\"冰岛\",\"cityName\":\"厦门市\",\"townCode\":\"350205\",\"provinceCode\":\"350000\",\"cityCode\":\"350200\",\"name\":\"海沧区嵩屿街道社区卫生服务中心\"," +
                    "\"冰岛\",\"cityName\":\"厦门市\",\"townCode\":\"350205\",\"provinceCode\":\"350000\",\"cityCode\":\"350200\",\"name\":\"海沧区嵩屿街道社区卫生服务中心\"," +
                    "\"provinceName\":\"福建省\",\"streeCode\":\"35020501\",\"streeName\":\"皇后大道东\",\"phone\":\"13253541190\"}") String addressJson,
                    "\"provinceName\":\"福建省\",\"streeCode\":\"35020501\",\"streeName\":\"皇后大道东\",\"phone\":\"13253541190\"}") String addressJson,
            @RequestParam(required = true) @ApiParam(value = "页面回调地址", name = "returnUrl") String returnUrl,
            @RequestParam(required = true) @ApiParam(value = "页面回调地址", name = "returnUrl") String returnUrl,
            @RequestParam(required = true) @ApiParam(value = "订单总金额", name = "totalAmount") int totalAmount) throws Exception {
            @RequestParam(required = true) @ApiParam(value = "订单总金额", name = "totalAmount") int totalAmount,
            @RequestParam(required = false) @ApiParam(value = "送达时间", name = "deliveryTime") String deliveryTime) throws Exception {
        try {
        try {
            String accessToken = getAccessToken();
            String accessToken = getAccessToken();
            String patient = getUID();
            String patient = getUID();
            Map result = payService.charge(type, addressJson, orgCode, prescriptionCode, totalAmount, patient, accessToken, returnUrl);
            Map result = payService.charge(type, addressJson, orgCode, prescriptionCode, totalAmount, patient, accessToken, returnUrl,deliveryTime);
            if ("-1".equals(result.get("status").toString())) {
            if ("-1".equals(result.get("status").toString())) {
                return error(-1, "续方居民信息与微信支付身份信息不一致!");
                return error(-1, "续方居民信息与微信支付身份信息不一致!");
            } else if ("-2".equals(result.get("status").toString())) {
            } else if ("-2".equals(result.get("status").toString())) {

+ 16 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -29,6 +29,8 @@ import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -48,6 +50,7 @@ import java.util.*;
@Api(description = "预约挂号接口")
@Api(description = "预约挂号接口")
public class BookingController extends WeixinBaseController {
public class BookingController extends WeixinBaseController {
    private static final Logger logger = LoggerFactory.getLogger(BookingController.class);
    @Autowired
    @Autowired
    private GuahaoXMService guahaoXM;
    private GuahaoXMService guahaoXM;
@ -370,18 +373,19 @@ public class BookingController extends WeixinBaseController {
                }
                }
                //发送短信小时
                // 调用总部发送信息的接口
                //String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, p.getMobile()), "GBK");
                //JSONObject json = toJson(result);
//				if (json == null) {
//					// 发送失败
//					throw new Exception("短信发送失败!");
//				} else if (json.getInt("result") != 0) {
//					return json.getString("description");
//				} else {
//					//发送成功,保存到数据库
//				}
                //发送短信消息
                 //调用总部发送信息的接口
                String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, p.getMobile()), "GBK");
                JSONObject r = toJson(result);
				if (r == null) {
					// 发送失败
                    logger.error("短信发送失败!");
					//throw new Exception("短信发送失败!");
				} else if (r.getInt("result") != 0) {
					return r.getString("description");
				} else {
					//发送成功,保存到数据库
				}
                BusinessLogs.info(BusinessLogs.BusinessType.appointment, getUID(), p.getCode(), new JSONObject(obj));
                BusinessLogs.info(BusinessLogs.BusinessType.appointment, getUID(), p.getCode(), new JSONObject(obj));
                return write(200, "创建挂号单成功!");
                return write(200, "创建挂号单成功!");
            } else {
            } else {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/message/BaseMessage.java

@ -1,7 +1,7 @@
package com.yihu.wlyy.wechat.message;
package com.yihu.wlyy.wechat.message;
/**
/**
 * Created by lyr on 2016/08/11.
 * Created by lyr on 2016/08/11..
 */
 */
public class BaseMessage {
public class BaseMessage {
    // 开发者微信号
    // 开发者微信号

+ 11 - 23
patient-co/patient-co-wlyy/src/main/resources/application.yml

@ -46,11 +46,12 @@ spring:
  redis:
  redis:
    database: 0 # Database index used by the connection factory.
    database: 0 # Database index used by the connection factory.
    password: # Login password of the redis server.
    password: # Login password of the redis server.
    timeout: 0 # Connection timeout in milliseconds.
      #sentinel:
      #  master: # Name of Redis server.
      #  nodes: # Comma-separated list of host:port pairs.
    timeout: 120000 # 连接超时时间(毫秒) 60秒
    pool:
      max-active: 20 # 连接池最大连接数(使用负值表示没有限制)
      max-wait: -1  # 连接池最大阻塞等待时间(使用负值表示没有限制)
      max-idle: 20  # 连接池中的最大空闲连接
      min-idle: 5  # 连接池中的最小空闲连接
logging:
logging:
  level:
  level:
@ -172,9 +173,6 @@ sign:
  check_upload: http://172.19.103.88:8011/wlyy_service
  check_upload: http://172.19.103.88:8011/wlyy_service
quartz:
  name: schedulerFactoryBean_test
ylzpay:
ylzpay:
  onepayApi: http://120.42.37.94:1301/onepay-web/
  onepayApi: http://120.42.37.94:1301/onepay-web/
  onepayAppId: 1BGKM1UHM03P7B2CA8C000005626EB0E
  onepayAppId: 1BGKM1UHM03P7B2CA8C000005626EB0E
@ -198,13 +196,11 @@ spring:
      password: jkzlehr@123
      password: jkzlehr@123
    health:
    health:
      url: jdbc:mysql://59.61.92.90:8079/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#      username: wlyy
#      password: jkzlehr@321465
      username: wlyy
      username: wlyy
      password: jkzlehr@123
      password: jkzlehr@123
  redis:
  redis:
    host: 27.155.101.77 # Redis server host.
    host: 120.41.253.95 # Redis server host.
    port: 6380 # Redis server port.
    port: 6380 # Redis server port.
    password: jkzl_ehr
    password: jkzl_ehr
@ -272,9 +268,6 @@ sign:
quartz:
  name: schedulerFactoryBeanWlyy
ylzpay:
ylzpay:
#  onepayApi: https://xmhealth.ylzpay.com:8080/
#  onepayApi: https://xmhealth.ylzpay.com:8080/
  onepayApi: http://xmhealth.ylzpay.com:8070/
  onepayApi: http://xmhealth.ylzpay.com:8070/
@ -282,10 +275,11 @@ ylzpay:
  onepayAppSecret: 1BLF5SCBO01V3E78A8C00000F3A0FFE7
  onepayAppSecret: 1BLF5SCBO01V3E78A8C00000F3A0FFE7
express:
express:
  sf_url: http://bsp-ois.sit.sf-express.com:9080/bsp-ois/sfexpressService
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
#  sf_url: https://bsp-ois.sit.sf-express.com:9443/bsp-ois/sfexpressServic
#  sf_url: https://bsp-ois.sit.sf-express.com:9443/bsp-ois/sfexpressServic
  sf_code: BSPdevelop
  sf_check_word: j8DzkIFgmlomPt0aLuwU
  sf_code: sddf
  sf_check_word: PqFN0ADkTwnvXArMhqGxVduag44vyDQ7
---
---
##开发的配置
##开发的配置
@ -373,9 +367,6 @@ sign:
  check_upload: http://172.19.103.87:8011/wlyy_service
  check_upload: http://172.19.103.87:8011/wlyy_service
quartz:
  name: schedulerFactoryBean_dev
ylzpay:
ylzpay:
  onepayApi: http://120.42.37.94:1301/onepay-web/
  onepayApi: http://120.42.37.94:1301/onepay-web/
  onepayAppId: 1BGKM1UHM03P7B2CA8C000005626EB0E
  onepayAppId: 1BGKM1UHM03P7B2CA8C000005626EB0E
@ -470,9 +461,6 @@ sign:
  check_upload: http://172.19.103.88:8011/wlyy_service
  check_upload: http://172.19.103.88:8011/wlyy_service
quartz:
  name: schedulerFactoryBean_test_dev
express:
express:
  sf_url: http://218.17.248.244:11080/bsp-oisp/sfexpressService
  sf_url: http://218.17.248.244:11080/bsp-oisp/sfexpressService
#  sf_url: https://bsp-ois.sit.sf-express.com:9443/bsp-ois/sfexpressServic
#  sf_url: https://bsp-ois.sit.sf-express.com:9443/bsp-ois/sfexpressServic

+ 2 - 1
patient-co/patient-co-wlyy/src/main/resources/config/fdfs_client.conf

@ -12,4 +12,5 @@ http.secret_key = FastDFS1234567890
#tracker_server = 172.19.103.54:22122
#tracker_server = 172.19.103.54:22122
#-------------正式环境---------------#
#-------------正式环境---------------#
tracker_server = 192.168.120.153:22122
tracker_server = 192.168.120.172:22122

+ 4 - 0
patient-co/patient-co-wlyy/src/main/resources/system.properties

@ -26,6 +26,8 @@ patient_inspect_url =https://open.weixin.qq.com/connect/oauth2/authorize?appid={
patient_examination_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
patient_examination_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#处方记录
#处方记录
patient_prescription_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fprescription%2fhtml%2fprescription_records.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
patient_prescription_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fprescription%2fhtml%2fprescription_records.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#居民取药码
patient_QRCode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fprescription%2fhtml%2fmy-medicine-code.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#就诊记录
#就诊记录
@ -36,6 +38,8 @@ patient_inspect_pic ={server}/images/inspect.png
patient_examination_pic={server}/images/examination.png
patient_examination_pic={server}/images/examination.png
#处方记录
#处方记录
patient_prescription_pic={server}/images/prescriptionRecords.png
patient_prescription_pic={server}/images/prescriptionRecords.png
#居民取药码
patient_QRCode_pic={server}/images/patientQRCode.png
patient_operatinginstrutions_pic_url={server}/images/operatinginstructions.png
patient_operatinginstrutions_pic_url={server}/images/operatinginstructions.png
patient_booking_pic_url={server}/images/booking.png
patient_booking_pic_url={server}/images/booking.png

BIN
patient-co/patient-co-wlyy/src/main/webapp/images/patientQRCode.png


+ 1 - 1
pom.xml

@ -570,7 +570,7 @@
                        <target>1.8</target>
                        <target>1.8</target>
                        <compilerArguments>
                        <compilerArguments>
                            <verbose/>
                            <verbose/>
                            <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
                            <bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
                        </compilerArguments>
                        </compilerArguments>
                    </configuration>
                    </configuration>
                    <version>3.1</version>
                    <version>3.1</version>