Parcourir la source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

trick9191 il y a 7 ans
Parent
commit
726b2b7288
28 fichiers modifiés avec 475 ajouts et 265 suppressions
  1. 17 17
      patient-co-statistics-es/doc/sql/system_dict.sql
  2. 8 7
      patient-co-statistics-es/doc/sql/wlyy_dimension.sql
  3. 9 7
      patient-co-statistics-es/doc/sql/wlyy_dimension_quota.sql
  4. 39 40
      patient-co-statistics-es/doc/sql/wlyy_job_config.sql
  5. 1 1
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/dao/QuartzJobConfigDao.java
  6. 5 5
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/compute/ComputeHelper.java
  7. 4 0
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/SimpleConvert.java
  8. 6 1
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/extract/ExtractHelper.java
  9. 5 9
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java
  10. 20 15
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/MysqlToEsQuotaJob.java
  11. 1 1
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/model/job/QuartzJobConfig.java
  12. 11 11
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  13. 3 3
      patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/QuartzHelper.java
  14. 2 1
      patient-co-statistics-es/src/main/resources/quartz.properties
  15. 10 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/charge/WlyyCharge.java
  16. 25 4
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/charge/ChargeDao.java
  17. 3 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  18. 6 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  19. 3 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  20. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  21. 48 12
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java
  22. 10 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/common/Configure.java
  23. 80 43
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  24. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  25. 9 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java
  26. 10 8
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java
  27. 135 67
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  28. 3 0
      patient-co-wlyy/src/main/resources/system.properties

+ 17 - 17
patient-co-statistics-es/doc/sql/system_dict.sql

@ -4,20 +4,20 @@ INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`,
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''465'', ''RENEW_CHANGE_REASON'', ''4'', ''无获得感'', NULL, ''4'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''465'', ''RENEW_CHANGE_REASON'', ''4'', ''无获得感'', NULL, ''4'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''466'', ''RENEW_CHANGE_REASON'', ''5'', ''医生服务态度差'', NULL, ''5'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''466'', ''RENEW_CHANGE_REASON'', ''5'', ''医生服务态度差'', NULL, ''5'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''467'', ''RENEW_CHANGE_REASON'', ''6'', ''其它'', NULL, ''6'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''467'', ''RENEW_CHANGE_REASON'', ''6'', ''其它'', NULL, ''6'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1000'', ''QUOTA_SEX_DICT'', ''1'', ''男'', NULL, ''1'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1001'', ''QUOTA_SEX_DICT'', ''2'', ''女'', NULL, ''2'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1003'', ''QUOTA_SEX_DICT'', ''3'', ''未知'', NULL, ''3'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1004'', ''QUOTA_AGE_DICT'', ''1'', ''0~6'', NULL, ''1'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1006'', ''QUOTA_AGE_DICT'', ''2'', ''7~18'', NULL, ''2'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1007'', ''QUOTA_AGE_DICT'', ''3'', ''19~30'', NULL, ''3'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1008'', ''QUOTA_AGE_DICT'', ''4'', ''31~50'', NULL, ''4'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1009'', ''QUOTA_AGE_DICT'', ''5'', ''51~65'', NULL, ''5'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1010'', ''QUOTA_AGE_DICT'', ''6'', ''>65'', NULL, ''6'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1011'', ''QUOTA_SIGN_EXPESEX'', ''0'', ''已扣费'', NULL, ''1'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1012'', ''QUOTA_SIGN_EXPESEX'', ''1'', ''已缴费'', NULL, ''2'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1013'', ''QUOTA_SIGN_EXPESEX'', ''2'', ''已退费'', NULL, ''3'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1014'', ''QUOTA_CONSULT_TIME'', ''1'', ''0~8'', NULL, NULL);
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1015'', ''QUOTA_CONSULT_TIME'', ''2'', ''8~12'', NULL, NULL);
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1016'', ''QUOTA_CONSULT_TIME'', ''3'', ''12~13'', NULL, NULL);
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1017'', ''QUOTA_CONSULT_TIME'', ''4'', ''13~18'', NULL, NULL);
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''1018'', ''QUOTA_CONSULT_TIME'', ''5'', ''18~24'', NULL, NULL);
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1000', 'QUOTA_SEX_DICT', '1', '男', '', '1');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1001', 'QUOTA_SEX_DICT', '2', '女', '', '2');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1003', 'QUOTA_SEX_DICT', '3', '未知', '', '3');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1004', 'QUOTA_AGE_DICT', '1', '0~6', '', '1');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1006', 'QUOTA_AGE_DICT', '2', '7~18', '', '2');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1007', 'QUOTA_AGE_DICT', '3', '19~30', '', '3');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1008', 'QUOTA_AGE_DICT', '4', '31~50', '', '4');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1009', 'QUOTA_AGE_DICT', '5', '51~65', '', '5');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1010', 'QUOTA_AGE_DICT', '6', '>65', '', '6');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1011', 'QUOTA_SIGN_EXPESEX', '0', '已扣费', '', '1');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1012', 'QUOTA_SIGN_EXPESEX', '1', '已缴费', '', '2');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1013', 'QUOTA_SIGN_EXPESEX', '2', '已退费', '', '3');
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1014', 'QUOTA_CONSULT_TIME', '1', '0~8', '', NULL);
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1015', 'QUOTA_CONSULT_TIME', '2', '8~12', '', NULL);
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1016', 'QUOTA_CONSULT_TIME', '3', '12~13', '', NULL);
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1017', 'QUOTA_CONSULT_TIME', '4', '13~18', '', NULL);
INSERT INTO `wlyy_quota`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES ('1018', 'QUOTA_CONSULT_TIME', '5', '18~24', '', NULL);

+ 8 - 7
patient-co-statistics-es/doc/sql/wlyy_dimension.sql

@ -15,10 +15,11 @@ CREATE TABLE `wlyy_dimension` (
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `wlyy`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('1', '1', '1', '患者性别维度', '1', '2017-07-11 09:42:33', NULL, NULL, '2017-06-02 14:19:25', NULL, NULL, NULL);
INSERT INTO `wlyy`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('2', '2', '2', '患者年龄维度', '1', '2017-07-11 09:42:34', NULL, NULL, '2017-06-02 14:19:27', NULL, NULL, NULL);
INSERT INTO `wlyy`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('3', '3', '3', '患者健康分布标签', '1', '2017-07-12 14:07:59', NULL, NULL, '2017-06-02 15:01:56', NULL, NULL, NULL);
INSERT INTO `wlyy`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('4', '4', '4', '签约扣费状态', '1', '2017-07-11 09:42:18', NULL, NULL, '2017-07-11 09:41:14', NULL, NULL, NULL);
INSERT INTO `wlyy`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('5', '5', '5', '签约服务类别', '1', '2017-07-12 12:05:40', NULL, NULL, '2017-07-11 09:41:44', NULL, NULL, NULL);
INSERT INTO `wlyy`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('6', '6', '6', '续签转签原因', '1', '2017-07-12 17:29:43', NULL, NULL, '2017-07-12 17:28:37', NULL, NULL, NULL);
INSERT INTO `wlyy`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('7', '7', '7', '咨询回复时间分布', '1', '2017-07-12 17:29:45', NULL, NULL, '2017-07-12 17:28:39', NULL, NULL, NULL);
INSERT INTO `wlyy_quota`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('1', '1', '1', '患者性别维度', '1', '2017-07-11 09:42:33', NULL, NULL, '2017-06-02 14:19:25', NULL, NULL, NULL);
INSERT INTO `wlyy_quota`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('2', '2', '2', '患者年龄维度', '1', '2017-07-11 09:42:34', NULL, NULL, '2017-06-02 14:19:27', NULL, NULL, NULL);
INSERT INTO `wlyy_quota`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('3', '3', '3', '患者健康分布标签', '1', '2017-07-12 14:07:59', NULL, NULL, '2017-06-02 15:01:56', NULL, NULL, NULL);
INSERT INTO `wlyy_quota`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('4', '4', '4', '签约扣费状态', '1', '2017-07-11 09:42:18', NULL, NULL, '2017-07-11 09:41:14', NULL, NULL, NULL);
INSERT INTO `wlyy_quota`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('5', '5', '5', '签约服务类别', '1', '2017-07-12 12:05:40', NULL, NULL, '2017-07-11 09:41:44', NULL, NULL, NULL);
INSERT INTO `wlyy_quota`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('6', '6', '6', '续签转签原因', '1', '2017-07-12 17:29:43', NULL, NULL, '2017-07-12 17:28:37', NULL, NULL, NULL);
INSERT INTO `wlyy_quota`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('7', '7', '7', '咨询回复时间分布', '1', '2017-07-12 17:29:45', NULL, NULL, '2017-07-12 17:28:39', NULL, NULL, NULL);
INSERT INTO `wlyy_quota`.`wlyy_dimension` (`id`, `code`, `type`, `name`, `status`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `remark`) VALUES ('8', '8', '8', '患者疾病标签', '1', '2017-07-19 16:53:44', NULL, NULL, '2017-07-19 16:53:46', NULL, NULL, NULL);

+ 9 - 7
patient-co-statistics-es/doc/sql/wlyy_dimension_quota.sql

@ -10,10 +10,12 @@ CREATE TABLE `wlyy_dimension_quota` (
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `wlyy`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('1', '6', '1', 'select s.code code,s.value name from system_dict s where  s.dict_name=\'QUOTA_SEX_DICT\'', 'com.yihu.wlyy.statistics.etl.convert.wlyy.SexConvert', '1', 'Idcard');
INSERT INTO `wlyy`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('2', '7', '3', NULL, NULL, NULL, NULL);
INSERT INTO `wlyy`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('3', '8', '2', 'select s.code code,s.value name from system_dict s where  s.dict_name=\'QUOTA_AGE_DICT\'', 'com.yihu.wlyy.statistics.etl.convert.wlyy.AgeConvert', '1', 'Idcard');
INSERT INTO `wlyy`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('4', '30', '6', 'select s.code code,s.value name from system_dict s where  s.dict_name=\'RENEW_CHANGE_REASON\'', 'com.yihu.wlyy.statistics.etl.convert.wlyy.SimpleConvert', '1', 'slavekey1');
INSERT INTO `wlyy`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('6', '36', '5', 'select DISTINCT code,name from wlyy_sign_dict where type=1', 'com.yihu.wlyy.statistics.etl.convert.wlyy.SimpleConvert', '1', 'ServerType');
INSERT INTO `wlyy`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('7', '15', '3', 'select label_code code,label_name name from wlyy_sign_patient_label where label_type=\'2\' and status=1', 'com.yihu.wlyy.statistics.etl.convert.wlyy.SimpleConvert', '1', 'HealthLable');
INSERT INTO `wlyy`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('8', '24', '7', 'select s.code code,s.value name from system_dict s where  s.dict_name=\'QUOTA_CONSULT_TIME\'', 'com.yihu.wlyy.statistics.etl.convert.wlyy.ConsultTimeConvert', '1', 'slavekey1');
INSERT INTO `wlyy_quota`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('1', '6', '1', 'select s.code code,s.value name from system_dict s where  s.dict_name=\'QUOTA_SEX_DICT\'', 'com.yihu.wlyy.statistics.etl.convert.wlyy.SexConvert', '1', 'Idcard');
INSERT INTO `wlyy_quota`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('2', '7', '3', NULL, NULL, NULL, NULL);
INSERT INTO `wlyy_quota`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('3', '8', '2', 'select s.code code,s.value name from system_dict s where  s.dict_name=\'QUOTA_AGE_DICT\'', 'com.yihu.wlyy.statistics.etl.convert.wlyy.AgeConvert', '1', 'Idcard');
INSERT INTO `wlyy_quota`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('4', '30', '6', 'select s.code code,s.value name from system_dict s where  s.dict_name=\'RENEW_CHANGE_REASON\'', 'com.yihu.wlyy.statistics.etl.convert.wlyy.SimpleConvert', '1', 'SlaveKey1');
INSERT INTO `wlyy_quota`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('6', '36', '5', 'select DISTINCT code,name from wlyy_sign_dict where type=1', 'com.yihu.wlyy.statistics.etl.convert.wlyy.SimpleConvert', '1', 'ServerType');
INSERT INTO `wlyy_quota`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('7', '15', '3', 'select label_code code,label_name name from wlyy_sign_patient_label where label_type=\'2\' and status=1', 'com.yihu.wlyy.statistics.etl.convert.wlyy.HealthLableConvert', '1', '');
INSERT INTO `wlyy_quota`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('8', '24', '7', 'select s.code code,s.value name from system_dict s where  s.dict_name=\'QUOTA_CONSULT_TIME\'', 'com.yihu.wlyy.statistics.etl.convert.wlyy.ConsultTimeConvert', '1', 'SlaveKey1');
INSERT INTO `wlyy_quota`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('9', '12', '2', 'select s.code code,s.value name from system_dict s where  s.dict_name=\'QUOTA_AGE_DICT\'', 'com.yihu.wlyy.statistics.etl.convert.wlyy.AgeConvert', '1', 'Idcard');
INSERT INTO `wlyy_quota`.`wlyy_dimension_quota` (`id`, `quota_code`, `dimension_code`, `dict_sql`, `convert_clazz`, `sort`, `key`) VALUES ('10', '12', '8', 'select label_code code,label_name name from wlyy_sign_patient_label where label_type=\'3\' and status=1', 'com.yihu.wlyy.statistics.etl.convert.wlyy.DiseaseLableConvert', '2', NULL);

Fichier diff supprimé car celui-ci est trop grand
+ 39 - 40
patient-co-statistics-es/doc/sql/wlyy_job_config.sql


+ 1 - 1
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/dao/QuartzJobConfigDao.java

@ -18,7 +18,7 @@ public interface QuartzJobConfigDao extends PagingAndSortingRepository<QuartzJob
    @Query(" FROM QuartzJobConfig a WHERE a.status=?1 and a.del='1'")
    @Query(" FROM QuartzJobConfig a WHERE a.status=?1 and a.del='1'")
    List<QuartzJobConfig> findByAll(String s);
    List<QuartzJobConfig> findByAll(String s);
    @Query(" FROM QuartzJobConfig a WHERE  a.del='1' order by a.id asc")
    @Query(" FROM QuartzJobConfig a WHERE  a.del='1' and a.id !=11 order by a.id asc")
    List<QuartzJobConfig> findByIds();
    List<QuartzJobConfig> findByIds();
    @Query(" FROM QuartzJobConfig a WHERE a.id=?1 and a.del='1'")
    @Query(" FROM QuartzJobConfig a WHERE a.id=?1 and a.del='1'")

+ 5 - 5
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/compute/ComputeHelper.java

@ -30,18 +30,18 @@ public class ComputeHelper {
    /**
    /**
     * @param dataModels      过滤之后的数据
     * @param dataModels      过滤之后的数据
     * @param dimensionQuotas 指标的维度
     * @param dimensionQuotas 指标的维度
     * @param wlyyJobConfigVO
     * @param wlyyJobCongId
     * @param endTime
     * @param endTime
     * @return
     * @return
     */
     */
    public List<SaveModel> compute(List<DataModel> dataModels, List<WlyyDimensionQuota> dimensionQuotas, WlyyJobConfigVO wlyyJobConfigVO, String endTime, String timeLevel) {
    public List<SaveModel> compute(List<DataModel> dataModels, List<WlyyDimensionQuota> dimensionQuotas, String wlyyJobCongId, String endTime, String timeLevel) {
        try {
        try {
            //得到全部团队
            //得到全部团队
            List<AdminTeam> teams = findAllTeam();
            List<AdminTeam> teams = findAllTeam();
            //计算数据 返回map key 根据团队和维度拼凑在map中的key   1-2-1  如果维度是长度是0返回团队id 1
            //计算数据 返回map key 根据团队和维度拼凑在map中的key   1-2-1  如果维度是长度是0返回团队id 1
            Map<String, List<DataModel>> computeMap = computeDataModel(dimensionQuotas, dataModels);
            Map<String, List<DataModel>> computeMap = computeDataModel(dimensionQuotas, dataModels);
            //初始化map并且设置统计出来的数目
            //初始化map并且设置统计出来的数目
            List<SaveModel> savemodels = initAndSetResult(teams, dimensionQuotas, computeMap, wlyyJobConfigVO, endTime, timeLevel);
            List<SaveModel> savemodels = initAndSetResult(teams, dimensionQuotas, computeMap, wlyyJobCongId, endTime, timeLevel);
            return savemodels;
            return savemodels;
        } catch (Exception e) {
        } catch (Exception e) {
@ -127,7 +127,7 @@ public class ComputeHelper {
    /**
    /**
     * 初始化map
     * 初始化map
     */
     */
    private List<SaveModel> initAndSetResult(List<AdminTeam> teams, List<WlyyDimensionQuota> dimensionQuotas, Map<String, List<DataModel>> countMap, WlyyJobConfigVO wlyyJobConfigVO, String endTime, String timeLevel) throws Exception {
    private List<SaveModel> initAndSetResult(List<AdminTeam> teams, List<WlyyDimensionQuota> dimensionQuotas, Map<String, List<DataModel>> countMap, String wlyyJobCongId, String endTime, String timeLevel) throws Exception {
        List<SaveModel> returnList = new ArrayList<>();
        List<SaveModel> returnList = new ArrayList<>();
        Map<String, SaveModel> lastMaps = new HashMap<>();
        Map<String, SaveModel> lastMaps = new HashMap<>();
@ -150,7 +150,7 @@ public class ComputeHelper {
                saveModel.setHospitalName(one.getOrgName());
                saveModel.setHospitalName(one.getOrgName());
                saveModel.setTeam(one.getId().toString());
                saveModel.setTeam(one.getId().toString());
                saveModel.setTeamName(one.getName());
                saveModel.setTeamName(one.getName());
                saveModel.setQuotaCode(wlyyJobConfigVO.getId());
                saveModel.setQuotaCode(wlyyJobCongId);
                saveModel.setCreateTime(new Date());
                saveModel.setCreateTime(new Date());
                saveModel.setTimeLevel(timeLevel);
                saveModel.setTimeLevel(timeLevel);
                saveModel.setAreaLevel("5");//团队
                saveModel.setAreaLevel("5");//团队

+ 4 - 0
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/SimpleConvert.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.statistics.model.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.util.IdCardUtil;
import com.yihu.wlyy.statistics.util.IdCardUtil;
import com.yihu.wlyy.statistics.vo.DataModel;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.List;
@ -23,6 +24,9 @@ public class SimpleConvert implements Convert {
        oneList.stream().forEach(one -> {
        oneList.stream().forEach(one -> {
            try {
            try {
                Object value = DataModel.class.getMethod("get" + temp.getKey()).invoke(one);
                Object value = DataModel.class.getMethod("get" + temp.getKey()).invoke(one);
                if(StringUtils.isEmpty(value)){
                    value="0";
                }
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, value.toString());
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, value.toString());
            } catch (Exception e) {
            } catch (Exception e) {
                e.printStackTrace();
                e.printStackTrace();

+ 6 - 1
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/extract/ExtractHelper.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.statistics.etl.extract;
package com.yihu.wlyy.statistics.etl.extract;
import com.yihu.wlyy.statistics.etl.extract.db.DBExtract;
import com.yihu.wlyy.statistics.etl.extract.db.DBExtract;
import com.yihu.wlyy.statistics.model.job.QuartzJobConfig;
import com.yihu.wlyy.statistics.util.SpringUtil;
import com.yihu.wlyy.statistics.util.SpringUtil;
import com.yihu.wlyy.statistics.vo.DataModel;
import com.yihu.wlyy.statistics.vo.DataModel;
import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
@ -44,7 +45,7 @@ public class ExtractHelper {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public List<DataModel> extractData(WlyyJobConfigVO wlyyJobConfigVO, String startTime, String endTime, String year, String timeLevel) throws Exception {
    public List<DataModel> extractData(QuartzJobConfig wlyyJobConfigVO, String startTime, String endTime, String year, String timeLevel) throws Exception {
        try {
        try {
            this.startTime = startTime;
            this.startTime = startTime;
            this.endTime = endTime;
            this.endTime = endTime;
@ -56,6 +57,10 @@ public class ExtractHelper {
            } else {
            } else {
                timeSql = wlyyJobConfigVO.getSqlDay();
                timeSql = wlyyJobConfigVO.getSqlDay();
            }
            }
            //如果为null 初始化
            if(StringUtils.isEmpty(timeSql)){
                timeSql="";
            }
            //设置时间
            //设置时间
            String sql = initSql(wlyyJobConfigVO.getSql() + "  " + timeSql, startTime, endTime, year);
            String sql = initSql(wlyyJobConfigVO.getSql() + "  " + timeSql, startTime, endTime, year);
            String sqlCount = initSql(wlyyJobConfigVO.getSqlCount() + "  " + timeSql, startTime, endTime, year);
            String sqlCount = initSql(wlyyJobConfigVO.getSqlCount() + "  " + timeSql, startTime, endTime, year);

+ 5 - 9
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java

@ -244,9 +244,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
     */
     */
    private List<SaveModel> compute(List<DataModel> dataModels, List<WlyyDimensionQuota> dimensionQuotas, String timeLevel, QuartzJobConfig quartzJobConfig) {
    private List<SaveModel> compute(List<DataModel> dataModels, List<WlyyDimensionQuota> dimensionQuotas, String timeLevel, QuartzJobConfig quartzJobConfig) {
        try {
        try {
            WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
            BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobConfigVO, endTime, timeLevel);
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, quartzJobConfig.getId(), endTime, timeLevel);
        } catch (Exception e) {
        } catch (Exception e) {
            logger.error("compute error:" + e.getMessage());
            logger.error("compute error:" + e.getMessage());
        }
        }
@ -275,21 +273,19 @@ public class CurrentMysqlToEsQuotaJob implements Job {
     */
     */
    private List<DataModel> extract(QuartzJobConfig quartzJobConfig) {
    private List<DataModel> extract(QuartzJobConfig quartzJobConfig) {
        try {
        try {
            WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
            BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
            List<DataModel> dataModels = null;
            List<DataModel> dataModels = null;
            //先判断指标是否支持缓存
            //先判断指标是否支持缓存
            if (StringUtils.isEmpty(wlyyJobConfigVO.getCacheKey())) {
            if (StringUtils.isEmpty(quartzJobConfig.getCacheKey())) {
                //不支持直接去数据库拿
                //不支持直接去数据库拿
                dataModels = SpringUtil.getBean(ExtractHelper.class).extractData(wlyyJobConfigVO, startTime, endTime, year, timeLevel);
                dataModels = SpringUtil.getBean(ExtractHelper.class).extractData(quartzJobConfig, startTime, endTime, year, timeLevel);
            } else {
            } else {
                //缓存的key 是 时间+timelevel+key
                //缓存的key 是 时间+timelevel+key
                StringBuffer bu = new StringBuffer(DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + "-" + timeLevel + wlyyJobConfigVO.getCacheKey());
                StringBuffer bu = new StringBuffer(DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + "-" + timeLevel + quartzJobConfig.getCacheKey());
                //支持的话判断缓存有没有值
                //支持的话判断缓存有没有值
                dataModels = Cache.getCache(bu.toString());
                dataModels = Cache.getCache(bu.toString());
                if (dataModels == null) {
                if (dataModels == null) {
                    //如果缓存是空的那么直接数据库拿 在放入缓存
                    //如果缓存是空的那么直接数据库拿 在放入缓存
                    dataModels = SpringUtil.getBean(ExtractHelper.class).extractData(wlyyJobConfigVO, startTime, endTime, year, timeLevel);
                    dataModels = SpringUtil.getBean(ExtractHelper.class).extractData(quartzJobConfig, startTime, endTime, year, timeLevel);
                    Cache.addCache(bu.toString(), dataModels);
                    Cache.addCache(bu.toString(), dataModels);
                }
                }
            }
            }

+ 20 - 15
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/MysqlToEsQuotaJob.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.statistics.job.business;
package com.yihu.wlyy.statistics.job.business;
import com.yihu.wlyy.statistics.dao.QuartzJobConfigDao;
import com.yihu.wlyy.statistics.dao.QuartzJobLogDao;
import com.yihu.wlyy.statistics.dao.QuartzJobLogDao;
import com.yihu.wlyy.statistics.dao.WlyyDimensionQuotaDao;
import com.yihu.wlyy.statistics.dao.WlyyDimensionQuotaDao;
import com.yihu.wlyy.statistics.etl.cache.Cache;
import com.yihu.wlyy.statistics.etl.cache.Cache;
@ -10,6 +11,7 @@ import com.yihu.wlyy.statistics.etl.filter.FilterHelper;
import com.yihu.wlyy.statistics.etl.save.SaveHelper;
import com.yihu.wlyy.statistics.etl.save.SaveHelper;
import com.yihu.wlyy.statistics.etl.save.es.ElasticFactory;
import com.yihu.wlyy.statistics.etl.save.es.ElasticFactory;
import com.yihu.wlyy.statistics.model.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.model.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.model.job.QuartzJobConfig;
import com.yihu.wlyy.statistics.model.job.QuartzJobLog;
import com.yihu.wlyy.statistics.model.job.QuartzJobLog;
import com.yihu.wlyy.statistics.util.DateUtil;
import com.yihu.wlyy.statistics.util.DateUtil;
import com.yihu.wlyy.statistics.util.SpringUtil;
import com.yihu.wlyy.statistics.util.SpringUtil;
@ -54,7 +56,8 @@ public class MysqlToEsQuotaJob implements Job {
    private Logger logger = LoggerFactory.getLogger(MysqlToEsQuotaJob.class);
    private Logger logger = LoggerFactory.getLogger(MysqlToEsQuotaJob.class);
    private WlyyJobConfigVO wlyyJobConfigVO;//指标对象
    private String wlyyJobCongId;//指标对象
    private QuartzJobConfig quartzJobConfig;//指标对象
    private String endTime;//结束时间
    private String endTime;//结束时间
    private String startTime;//开始时间
    private String startTime;//开始时间
    private String year;//要统计的年份
    private String year;//要统计的年份
@ -65,6 +68,8 @@ public class MysqlToEsQuotaJob implements Job {
    private QuartzJobLogDao quartzJobLogDao;//执行日志Dao
    private QuartzJobLogDao quartzJobLogDao;//执行日志Dao
    @Autowired
    @Autowired
    private WlyyDimensionQuotaDao dimensionQuotaDao;
    private WlyyDimensionQuotaDao dimensionQuotaDao;
    @Autowired
    private QuartzJobConfigDao quartzJobConfigDao;
    @Autowired
    @Autowired
    private ElasticFactory elasticFactory;
    private ElasticFactory elasticFactory;
@ -115,7 +120,7 @@ public class MysqlToEsQuotaJob implements Job {
        if ("2".equals(timeLevel)) {
        if ("2".equals(timeLevel)) {
            //按年度到达量
            //按年度到达量
            startTime = this.year + "-06-30 17:00:00";
            startTime = this.year + "-06-30 17:00:00";
        }else{
        } else {
            //增量
            //增量
            if (StringUtils.isEmpty(startTime)) {
            if (StringUtils.isEmpty(startTime)) {
                startTime = new LocalDate(new DateTime().minusDays(2)).toString("yyyy-MM-dd") + " 17:00:00"; //2017-06-01 17:00:00
                startTime = new LocalDate(new DateTime().minusDays(2)).toString("yyyy-MM-dd") + " 17:00:00"; //2017-06-01 17:00:00
@ -126,8 +131,8 @@ public class MysqlToEsQuotaJob implements Job {
        this.quotaDate = DateUtil.strToDate(endTime, "yyyy-MM-dd");
        this.quotaDate = DateUtil.strToDate(endTime, "yyyy-MM-dd");
        this.wlyyJobConfigVO = (WlyyJobConfigVO) map.get("jobConfig");
        this.wlyyJobCongId = map.getString("jobConfig");
        this.quartzJobConfig=quartzJobConfigDao.findById(wlyyJobCongId);
    }
    }
    /**
    /**
@ -135,19 +140,19 @@ public class MysqlToEsQuotaJob implements Job {
     */
     */
    private void computequota() {
    private void computequota() {
        try {
        try {
            logger.info("========================quotaCode:" + wlyyJobConfigVO.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+",timeLevel:"+timeLevel+" start========================");
            logger.info("========================quotaCode:" + wlyyJobCongId + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + ",timeLevel:" + timeLevel + " start========================");
            QuartzJobLog tjQuotaLog = new QuartzJobLog();
            QuartzJobLog tjQuotaLog = new QuartzJobLog();
            tjQuotaLog.setJobId(wlyyJobConfigVO.getId());
            tjQuotaLog.setJobId(wlyyJobCongId);
            tjQuotaLog.setJobStartTime(new Date());
            tjQuotaLog.setJobStartTime(new Date());
            // 0 删除这天的数据
            // 0 删除这天的数据
            deleteData(quotaDate, wlyyJobConfigVO.getId(), timeLevel);
            deleteData(quotaDate, wlyyJobCongId, timeLevel);
            //1..抽取数据 如果是累加就是 List<DataModel>  如果是相除 Map<String,List<DataModel>>
            //1..抽取数据 如果是累加就是 List<DataModel>  如果是相除 Map<String,List<DataModel>>
            List<DataModel> dataModels = extract();
            List<DataModel> dataModels = extract();
            //2..根据规则过滤数据
            //2..根据规则过滤数据
            FilterModel filterModel = filter(dataModels);
            FilterModel filterModel = filter(dataModels);
            //得到该指标的维度
            //得到该指标的维度
            List<WlyyDimensionQuota> dimensionQuotas = dimensionQuotaDao.findDimensionQuotasByQuotaCode(wlyyJobConfigVO.getId());
            List<WlyyDimensionQuota> dimensionQuotas = dimensionQuotaDao.findDimensionQuotasByQuotaCode(wlyyJobCongId);
            //2.1.从维度的key转换
            //2.1.从维度的key转换
            if (dimensionQuotas != null && dimensionQuotas.size() > 0) {
            if (dimensionQuotas != null && dimensionQuotas.size() > 0) {
                filterModel = convert(filterModel, dimensionQuotas);
                filterModel = convert(filterModel, dimensionQuotas);
@ -161,7 +166,7 @@ public class MysqlToEsQuotaJob implements Job {
            tjQuotaLog.setJobEndTime(new Date());
            tjQuotaLog.setJobEndTime(new Date());
            tjQuotaLog.setJobContent(JSONArray.fromObject(filterModel.getErrorModels()).toString());
            tjQuotaLog.setJobContent(JSONArray.fromObject(filterModel.getErrorModels()).toString());
            saveLog(tjQuotaLog);
            saveLog(tjQuotaLog);
            logger.info("========================quotaCode:" + wlyyJobConfigVO.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+" end========================");
            logger.info("========================quotaCode:" + wlyyJobCongId + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + " end========================");
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
        }
        }
@ -241,7 +246,7 @@ public class MysqlToEsQuotaJob implements Job {
     */
     */
    private List<SaveModel> compute(List<DataModel> dataModels, List<WlyyDimensionQuota> dimensionQuotas, String timeLevel) {
    private List<SaveModel> compute(List<DataModel> dataModels, List<WlyyDimensionQuota> dimensionQuotas, String timeLevel) {
        try {
        try {
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobConfigVO, endTime, timeLevel);
            return SpringUtil.getBean(ComputeHelper.class).compute(dataModels, dimensionQuotas, wlyyJobCongId, endTime, timeLevel);
        } catch (Exception e) {
        } catch (Exception e) {
            logger.error("compute error:" + e.getMessage());
            logger.error("compute error:" + e.getMessage());
        }
        }
@ -274,21 +279,21 @@ public class MysqlToEsQuotaJob implements Job {
        try {
        try {
            List<DataModel> dataModels = null;
            List<DataModel> dataModels = null;
            //先判断指标是否支持缓存
            //先判断指标是否支持缓存
            if (StringUtils.isEmpty(wlyyJobConfigVO.getCacheKey())) {
            if (StringUtils.isEmpty(quartzJobConfig.getCacheKey())) {
                //不支持直接去数据库拿
                //不支持直接去数据库拿
                dataModels = SpringUtil.getBean(ExtractHelper.class).extractData(wlyyJobConfigVO, startTime, endTime, year, timeLevel);
                dataModels = SpringUtil.getBean(ExtractHelper.class).extractData(quartzJobConfig, startTime, endTime, year, timeLevel);
            } else {
            } else {
                //缓存的key 是 时间+timelevel+key
                //缓存的key 是 时间+timelevel+key
                StringBuffer bu = new StringBuffer(DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + "-" + timeLevel + "-" + wlyyJobConfigVO.getCacheKey());
                StringBuffer bu = new StringBuffer(DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + "-" + timeLevel + "-" +quartzJobConfig.getCacheKey());
                //支持的话判断缓存有没有值
                //支持的话判断缓存有没有值
                dataModels = Cache.getCache(bu.toString());
                dataModels = Cache.getCache(bu.toString());
                if (dataModels == null) {
                if (dataModels == null) {
                    //如果缓存是空的那么直接数据库拿 在放入缓存
                    //如果缓存是空的那么直接数据库拿 在放入缓存
                    dataModels = SpringUtil.getBean(ExtractHelper.class).extractData(wlyyJobConfigVO, startTime, endTime, year, timeLevel);
                    dataModels = SpringUtil.getBean(ExtractHelper.class).extractData(quartzJobConfig, startTime, endTime, year, timeLevel);
                    Cache.addCache(bu.toString(), dataModels);
                    Cache.addCache(bu.toString(), dataModels);
                }
                }
            }
            }
            logger.info("quotaCode:" + wlyyJobConfigVO.getId() + ",size:" + dataModels.size());
            logger.info("quotaCode:" + wlyyJobCongId + ",size:" + dataModels.size());
            return dataModels;
            return dataModels;
        } catch (Exception e) {
        } catch (Exception e) {
            logger.error("extract error:" + e.getMessage());
            logger.error("extract error:" + e.getMessage());

+ 1 - 1
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/model/job/QuartzJobConfig.java

@ -8,7 +8,7 @@ import javax.persistence.*;
 * 计划任务
 * 计划任务
 */
 */
@Entity
@Entity
@Table(name = "wlyy_job_config")
@Table(name = "wlyy_job_config_cwd")
public class QuartzJobConfig implements java.io.Serializable {
public class QuartzJobConfig implements java.io.Serializable {
	private String id;
	private String id;

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

@ -118,8 +118,8 @@ public class JobService {
        WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
        WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
        BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
        BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("jobConfig", wlyyJobConfigVO);
        Map<String, String> params = new HashMap<String, String>();
        params.put("jobConfig", wlyyJobConfigVO.getId());
        for (int i = 1; i <= 2; i++) {
        for (int i = 1; i <= 2; i++) {
            params.put("timeLevel", i + "");
            params.put("timeLevel", i + "");
            //往quartz框架添加任务
            //往quartz框架添加任务
@ -137,8 +137,8 @@ public class JobService {
            WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
            WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
            BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
            BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("jobConfig", wlyyJobConfigVO);
            Map<String, String> params = new HashMap<String, String>();
            params.put("jobConfig", wlyyJobConfigVO.getId());
            for (int i = 1; i <= day; i++) {
            for (int i = 1; i <= day; i++) {
                for (int j = 1; j <= 2; j++) {
                for (int j = 1; j <= 2; j++) {
                    params.put("timeLevel", j + "");
                    params.put("timeLevel", j + "");
@ -179,8 +179,8 @@ public class JobService {
            WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
            WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
            BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
            BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("jobConfig", wlyyJobConfigVO);
            Map<String, String> params = new HashMap<String, String>();
            params.put("jobConfig", wlyyJobConfigVO.getId());
            //往quartz框架添加任务
            //往quartz框架添加任务
            params.put("startTime", daybefore);
            params.put("startTime", daybefore);
            params.put("endTime", yesterday);
            params.put("endTime", yesterday);
@ -224,8 +224,8 @@ public class JobService {
        WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
        WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
        BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
        BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("jobConfig", wlyyJobConfigVO);
        Map<String, String> params = new HashMap<String, String>();
        params.put("jobConfig", wlyyJobConfigVO.getId());
        //往quartz框架添加任务
        //往quartz框架添加任务
        params.put("startTime", daybefore);
        params.put("startTime", daybefore);
@ -254,8 +254,8 @@ public class JobService {
        WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
        WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
        BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
        BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("jobConfig", wlyyJobConfigVO);
        Map<String, String> params = new HashMap<String, String>();
        params.put("jobConfig", wlyyJobConfigVO.getId());
        for (int i = 1; i <= day; i++) {
        for (int i = 1; i <= day; i++) {
            //往quartz框架添加任务
            //往quartz框架添加任务
            params.put("startTime", getYesterday(0 - i - 1));
            params.put("startTime", getYesterday(0 - i - 1));
@ -361,7 +361,7 @@ public class JobService {
        calendar.add(calendar.DATE, 1);//把日期往后增加一天.整数往后推,负数往前移动
        calendar.add(calendar.DATE, 1);//把日期往后增加一天.整数往后推,负数往前移动
        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果
        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果
        String yesterday = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime());
        String yesterday = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime());
        Map<String, Object> params = new HashMap<String, Object>();
        Map<String, String> params = new HashMap<String, String>();
        //往quartz框架添加任务
        //往quartz框架添加任务
        params.put("now", yesterday);
        params.put("now", yesterday);
        params.put("yesterday", day);
        params.put("yesterday", day);

+ 3 - 3
patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/QuartzHelper.java

@ -76,7 +76,7 @@ public class QuartzHelper {
     * @param params
     * @param params
     * @throws Exception
     * @throws Exception
     */
     */
    public void startNow(Class jobClass, String id, Map<String, Object> params) throws Exception {
    public void startNow(Class jobClass, String id, Map<String, String> params) throws Exception {
        startAt(new Date(), jobClass, id, params);
        startAt(new Date(), jobClass, id, params);
    }
    }
@ -89,14 +89,14 @@ public class QuartzHelper {
     * @param params
     * @param params
     * @throws Exception
     * @throws Exception
     */
     */
    public void startAt(Date time, Class jobClass, String id, Map<String, Object> params) throws Exception {
    public void startAt(Date time, Class jobClass, String id, Map<String, String> params) throws Exception {
        JobDetail job = JobBuilder.newJob(jobClass).
        JobDetail job = JobBuilder.newJob(jobClass).
                withIdentity("job-id:" + id, "job-group:" + id)
                withIdentity("job-id:" + id, "job-group:" + id)
                .build();
                .build();
        JobDataMap jobDataMap = job.getJobDataMap();
        JobDataMap jobDataMap = job.getJobDataMap();
        if(null != params) jobDataMap.putAll(params);
        if(null != params) jobDataMap.putAll(params);
        SimpleTrigger trigger = TriggerBuilder.newTrigger().withIdentity("trigger-id:" + id, "group-group:" + id)
        SimpleTrigger trigger = TriggerBuilder.newTrigger().withIdentity("trigger-id:" + id, "trigger-group:" + id)
                .startAt(time)
                .startAt(time)
                .withSchedule(simpleSchedule().withIntervalInSeconds(10).withRepeatCount(0).withMisfireHandlingInstructionFireNow())
                .withSchedule(simpleSchedule().withIntervalInSeconds(10).withRepeatCount(0).withMisfireHandlingInstructionFireNow())
                .build();
                .build();

+ 2 - 1
patient-co-statistics-es/src/main/resources/quartz.properties

@ -7,7 +7,7 @@ org.quartz.scheduler.instanceName: DefaultQuartzScheduler
org.quartz.scheduler.rmi.export: false
org.quartz.scheduler.rmi.export: false
org.quartz.scheduler.rmi.proxy: false
org.quartz.scheduler.rmi.proxy: false
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
 
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 20
org.quartz.threadPool.threadCount: 20
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadPriority: 5
@ -23,6 +23,7 @@ org.quartz.jobStore.misfireThreshold: 60000
# org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
# org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
# Configure JobStore Cluster
# Configure JobStore Cluster
org.quartz.jobStore.class:org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.class:org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.useProperties=true
org.quartz.jobStore.driverDelegateClass:org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.driverDelegateClass:org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#datasource׺
#datasource׺
org.quartz.jobStore.tablePrefix:QRTZ_
org.quartz.jobStore.tablePrefix:QRTZ_

+ 10 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/charge/WlyyCharge.java

@ -32,6 +32,7 @@ public class WlyyCharge extends IdEntity {
	private Integer insuranceAmount;   //  医保支付金额
	private Integer insuranceAmount;   //  医保支付金额
	private String needUpload;// 是否需要上传 0否(已上传) 1是(未上传) 2重复失败(上传失败)
	private String needUpload;// 是否需要上传 0否(已上传) 1是(未上传) 2重复失败(上传失败)
	private String uploadLog;// 上传日志
	private String uploadLog;// 上传日志
	private String miRegisterNo;// 医保签约号(支付成功时由易联众返回)
	private String feeDetail;   //  费用明细
	private String feeDetail;   //  费用明细
	private String channel;   //  医保支付渠道
	private String channel;   //  医保支付渠道
	private String merchName;   //  收款单位名称
	private String merchName;   //  收款单位名称
@ -181,7 +182,15 @@ public class WlyyCharge extends IdEntity {
		this.uploadLog = uploadLog;
		this.uploadLog = uploadLog;
	}
	}
	public String getFeeDetail() {
    public String getMiRegisterNo() {
        return miRegisterNo;
    }
    public void setMiRegisterNo(String miRegisterNo) {
        this.miRegisterNo = miRegisterNo;
    }
    public String getFeeDetail() {
		return feeDetail;
		return feeDetail;
	}
	}

+ 25 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/charge/ChargeDao.java

@ -12,6 +12,8 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
import java.util.List;
public interface ChargeDao extends PagingAndSortingRepository<WlyyCharge, Long>, JpaSpecificationExecutor<WlyyCharge> {
public interface ChargeDao extends PagingAndSortingRepository<WlyyCharge, Long>, JpaSpecificationExecutor<WlyyCharge> {
@ -28,14 +30,33 @@ public interface ChargeDao extends PagingAndSortingRepository<WlyyCharge, Long>,
    WlyyCharge findByChargeRelation(String chargeRelation);
    WlyyCharge findByChargeRelation(String chargeRelation);
    /**
    /**
     * 根据流水号更新wlyy_charge数据
     * 根据code查询支付情况
     *
     * @param chargeCode
     * @return
     */
    @Query("select a from WlyyCharge a where a.code = ?1 ")
    WlyyCharge findByCode(String chargeCode);
    /**
     * 根据code查询上传状态 为0不需要更改数据
     *
     * @param code
     * @return
     */
    @Query("select a from WlyyCharge a where a.code = ?1 ")
    WlyyCharge getUploadStatus(String code);
    /**
     * 根据code更新wlyy_charge数据
     *
     *
     * @param chargeNo
     * @param chargeCode
     * @return
     * @return
     */
     */
    @Modifying
    @Modifying
    @Query("update WlyyCharge a set a.tradeStatus = '0' where a.chargeNo = ?1 ")
    WlyyCharge updateByChargeNo(String chargeNo);
    @Query("update WlyyCharge a set a.tradeStatus = ?9,a.chargeTime = ?2, a.updateTime = ?3, a.totalAmount = ?4, " +
            " a.insuranceAmount = ?5, a.selfpayAmount =?6 ,a.billNo = ?7, a.miRegisterNo = ?8 where a.code = ?1 ")
    WlyyCharge updateByChargeCode(String chargeCode, String chargeTime, Date updateTime, Integer totalAmount, Integer insuranceAmount, Integer selfPayAmount, String billNo, String miRegisterNo,String tradeStatus);
    List<WlyyCharge> findByPatient(String patient, Pageable pageRequest);
    List<WlyyCharge> findByPatient(String patient, Pageable pageRequest);
}
}

+ 3 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -403,10 +403,10 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query(value = " select a.*  from wlyy_sign_family a where a.patient = ?1  and a.status = -4 and a.team_code = ?2 order by a.apply_date desc limit 0,1", nativeQuery = true)
    @Query(value = " select a.*  from wlyy_sign_family a where a.patient = ?1  and a.status = -4 and a.team_code = ?2 order by a.apply_date desc limit 0,1", nativeQuery = true)
    SignFamily findOutTimeSigningByPatientAndTeamCode(String patient,String teamCode);
    SignFamily findOutTimeSigningByPatientAndTeamCode(String patient,String teamCode);
    //      完成缴费后更新签约开始时间 缴费状态 medical_insurance_num 医保流水号
    //      完成缴费后更新签约开始时间begin 缴费状态expensesStatus 医保流水号medical_insurance_num  扣费时间expenses_time
    @Modifying
    @Modifying
    @Query("update SignFamily a set a.begin = ?2 ,a.medicalInsuranceNum=?3,a.expensesStatus = ?4  where a.patient = ?1 ")
    int updatePatientBegin(String patient, Date begin,String medicalInsuranceNum,String expensesStatus );
    @Query("update SignFamily a set a.begin = ?2 ,a.medicalInsuranceNum=?3,a.expensesStatus = ?4,a.expensesTime = ?2 where a.code = ?1 ")
    int updatePatientBegin(String code, Date begin,String medicalInsuranceNum,String expensesStatus );
    //查询居民的扣费状态
    //查询居民的扣费状态
    @Query( " select a from SignFamily a where a.patient = ?1 ")
    @Query( " select a from SignFamily a where a.patient = ?1 ")

+ 6 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -892,9 +892,10 @@ public class FamilyContractService extends BaseService {
        }
        }
        SignFamily sf = new SignFamily();
        SignFamily sf = new SignFamily();
        String signCode = getCode();
        sf.setSignYear(DateUtil.getSignYear()+"");//设置签约年度
        sf.setSignYear(DateUtil.getSignYear()+"");//设置签约年度
        sf.setBegin(DateUtil.getNowDateShort());
        sf.setBegin(DateUtil.getNowDateShort());
        sf.setCode(getCode());
        sf.setCode(signCode);
        sf.setCzrq(new Date());
        sf.setCzrq(new Date());
        //设置全科医生的行政团队
        //设置全科医生的行政团队
@ -1095,6 +1096,8 @@ public class FamilyContractService extends BaseService {
            json.put("date", DateUtil.dateToStrShort(sf.getBegin()));
            json.put("date", DateUtil.dateToStrShort(sf.getBegin()));
            json.put("content", content);
            json.put("content", content);
            json.put("remark", ""); //您好,您成功签约家庭医生
            json.put("remark", ""); //您好,您成功签约家庭医生
//            添加签约code by wjj  2017.7.18
            json.put("signCode", signCode);
            if (StringUtils.isNotBlank(sf.getOpenid())) {
            if (StringUtils.isNotBlank(sf.getOpenid())) {
                // 添加到发送队列
                // 添加到发送队列
                PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
                PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
@ -1430,6 +1433,8 @@ public class FamilyContractService extends BaseService {
            json.put("date", DateUtil.dateToStrShort(new Date()));
            json.put("date", DateUtil.dateToStrShort(new Date()));
            json.put("content", content);
            json.put("content", content);
            json.put("remark", ""); //您好,您成功签约家庭医生
            json.put("remark", ""); //您好,您成功签约家庭医生
//            添加签约code by wjj 2017.7.18
            json.put("signCode",sf.getCode()); //签约code
            // 添加到发送队列
            // 添加到发送队列
            if (StringUtils.isNotBlank(sf.getOpenid())) {
            if (StringUtils.isNotBlank(sf.getOpenid())) {
                PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
                PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);

+ 3 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -553,7 +553,7 @@ public class SignWebService extends BaseService {
            //            新增缴费流水号
            //            新增缴费流水号
            WlyyCharge charge = chargeDao.findByChargeRelation(signCode);
            WlyyCharge charge = chargeDao.findByChargeRelation(signCode);
            if (charge != null) {
            if (charge != null) {
                jsonObject.put("chargeNo", charge.getChargeNo());
                jsonObject.put("chargeCode", charge.getCode());
            }
            }
            if (StringUtils.isNotBlank(signFamily.getRenewFlag())) {
            if (StringUtils.isNotBlank(signFamily.getRenewFlag())) {
                jsonObject.put("isRenew", "1");
                jsonObject.put("isRenew", "1");
@ -681,8 +681,8 @@ public class SignWebService extends BaseService {
        jsonObject.put("statusName", statusName);
        jsonObject.put("statusName", statusName);
//            增加支付流水号
//            增加支付流水号
        if (charge!=null) {
        if (charge!=null) {
            String chargeNo = charge.getChargeNo();
            jsonObject.put("chargeNo", chargeNo);
            String chargeCode = charge.getCode();
            jsonObject.put("chargeCode", chargeCode);
        }
        }
        jsonArray.add(jsonObject);
        jsonArray.add(jsonObject);

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -1411,7 +1411,7 @@ public class ManagerQuestionnaireService extends BaseService {
                    break;
                    break;
            }
            }
            String sql = "SELECT t.value,t.`name` " +
            String sql = "SELECT t.value,t.`name` " +
                    " FROM wlyy_survey_dimension_option t\n" +
                    " FROM wlyy_survey_dimension_option t " +
                    " WHERE t.`dimension_value`= " + value;
                    " WHERE t.`dimension_value`= " + value;
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
            List subLabel = new ArrayList();
            List subLabel = new ArrayList();

+ 48 - 12
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java

@ -351,7 +351,9 @@ public class JwSmjkService {
            JSONObject jsonObject = new JSONObject(response);
            JSONObject jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
            int status = jsonObject.getInt("status");
            if (status == 200) {
            if (status == 200) {
                re = jsonObject.getString("data");
                JSONArray jsonArray = jsonObject.getJSONArray("data");
                re = jsonArray.toString();
//                re = jsonObject.getString("data");
            } else {
            } else {
                String msg = "处理失败,请联系管理员";
                String msg = "处理失败,请联系管理员";
                if(!jsonObject.isNull("msg")){
                if(!jsonObject.isNull("msg")){
@ -399,7 +401,7 @@ public class JwSmjkService {
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseStr(response);
        return response;
    }
    }
    /**
    /**
@ -414,7 +416,7 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("hospitalId", hospitalId));
        params.add(new BasicNameValuePair("hospitalId", hospitalId));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseStr(response);
        return response;
    }
    }
    /**
    /**
@ -430,7 +432,7 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("hosDeptId", hosDeptId));
        params.add(new BasicNameValuePair("hosDeptId", hosDeptId));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseStr(response);
        return response;
    }
    }
    /**
    /**
@ -447,7 +449,7 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("doctorId", doctorId));
        params.add(new BasicNameValuePair("doctorId", doctorId));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseStr(response);
        return response;
    }
    }
    /**
    /**
@ -464,7 +466,7 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("doctorId", doctorId));
        params.add(new BasicNameValuePair("doctorId", doctorId));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseStr(response);
        return response;
    }
    }
@ -477,6 +479,7 @@ public class JwSmjkService {
    public String CreateOrder(String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,
    public String CreateOrder(String hospitalId,String hospitalName,String hosDeptId,String hosDeptName,
                               String doctorId,String doctorName,String arrangeDate,String patient,
                               String doctorId,String doctorName,String arrangeDate,String patient,
                               String patientName,String cardNo,String clinicCard,String patientPhone) throws Exception{
                               String patientName,String cardNo,String clinicCard,String patientPhone) throws Exception{
        String re = "";
        String url = jwUrl + "/third/guahao/CreateOrder";
        String url = jwUrl + "/third/guahao/CreateOrder";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("hospitalName", hospitalName));
        params.add(new BasicNameValuePair("hospitalName", hospitalName));
@ -493,7 +496,22 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("patientPhone", patientPhone));
        params.add(new BasicNameValuePair("patientPhone", patientPhone));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseStr(response);
        if (!StringUtils.isEmpty(response)) {
            JSONObject jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
            if (status == 200) {
                re = jsonObject.getString("data");
            } else {
                String msg = "处理失败,请联系管理员";
                if(!jsonObject.isNull("msg")){
                    msg = jsonObject.getString("msg");
                }
                throw new Exception(msg);
            }
        } else {
            throw new Exception("null response.");
        }
        return re;
    }
    }
@ -503,14 +521,30 @@ public class JwSmjkService {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    public boolean CancelOrder(String orderId,String clinicCard) throws Exception{
    public Boolean CancelOrder(String orderId,String clinicCard) throws Exception{
        boolean re = false;
        String url = jwUrl + "/third/guahao/CancelOrder";
        String url = jwUrl + "/third/guahao/CancelOrder";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("orderId", orderId));
        params.add(new BasicNameValuePair("orderId", orderId));
        params.add(new BasicNameValuePair("clinicCard", clinicCard));
        params.add(new BasicNameValuePair("clinicCard", clinicCard));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseBool(response);
        if (!StringUtils.isEmpty(response)) {
            JSONObject jsonObject = new JSONObject(response);
            int status = jsonObject.getInt("status");
            if (status == 200) {
                re = jsonObject.getBoolean("data");
            } else {
                String msg = "处理失败,请联系管理员";
                if(!jsonObject.isNull("msg")){
                    msg = jsonObject.getString("msg");
                }
                throw new Exception(msg);
            }
        } else {
            throw new Exception("null response.");
        }
        return re;
    }
    }
    /**
    /**
@ -520,6 +554,7 @@ public class JwSmjkService {
     * @throws Exception
     * @throws Exception
     */
     */
    public String GetDoctorInfo(String hospitalId,String hosDeptId,String doctorId) throws Exception{
    public String GetDoctorInfo(String hospitalId,String hosDeptId,String doctorId) throws Exception{
        String re = "";
        String url = jwUrl + "/third/guahao/GetDoctorInfo";
        String url = jwUrl + "/third/guahao/GetDoctorInfo";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("hospitalId", hospitalId));
        params.add(new BasicNameValuePair("hospitalId", hospitalId));
@ -527,7 +562,7 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("doctorId", doctorId));
        params.add(new BasicNameValuePair("doctorId", doctorId));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseStr(response);
        return response;
    }
    }
    /**
    /**
@ -572,7 +607,7 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("patient", patient));
        params.add(new BasicNameValuePair("patient", patient));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseStr(response);
        return response;
    }
    }
    /**
    /**
@ -582,6 +617,7 @@ public class JwSmjkService {
     * @throws Exception
     * @throws Exception
     */
     */
    public String GetRegDetail(String patient,String orgCode,String regCode) throws Exception{
    public String GetRegDetail(String patient,String orgCode,String regCode) throws Exception{
        String re = "";
        String url = jwUrl + "/third/guahao/GetRegDetail";
        String url = jwUrl + "/third/guahao/GetRegDetail";
        List<NameValuePair> params = new ArrayList<>();
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("patient", patient));
        params.add(new BasicNameValuePair("patient", patient));
@ -589,7 +625,7 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("regCode", regCode));
        params.add(new BasicNameValuePair("regCode", regCode));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return responseStr(response);
        return response;
    }
    }

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/common/Configure.java

@ -19,6 +19,16 @@ public class Configure {
	private String chargeType = "onepay.trade.medical.charge";
	private String chargeType = "onepay.trade.medical.charge";
	private String chargeQueryType = "onepay.trade.medical.charge.query";
	private String chargeQueryType = "onepay.trade.medical.charge.query";
	private String createSicardType = "onepay.sicard.createurl";
	private String createSicardType = "onepay.sicard.createurl";
//	易联众异步回调
	private String receiveNotify = "wlyy.onepay.receiveNotify";
	public String getReceiveNotify() {
		return receiveNotify;
	}
	public void setReceiveNotify(String receiveNotify) {
		this.receiveNotify = receiveNotify;
	}
	public String getOnepayApi() {
	public String getOnepayApi() {
		return onepayApi;
		return onepayApi;

+ 80 - 43
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -5,10 +5,12 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
@ -61,6 +63,8 @@ public class OnePayService {
    PatientDao patientDao;
    PatientDao patientDao;
    @Autowired
    @Autowired
    SignFamilyDao signFamilyDao;
    SignFamilyDao signFamilyDao;
    @Autowired
    DoctorDao doctorDao;
    /**
    /**
     * 查询绑卡信息(本人)
     * 查询绑卡信息(本人)
@ -122,11 +126,16 @@ public class OnePayService {
        try {
        try {
            RequestParams requestParams = new RequestParams();
            RequestParams requestParams = new RequestParams();
//            requestParams.setTransType();
//            requestParams.setVersion();
//            requestParams.setSign();
//            requestParams.setEncryptData();
            requestParams.setAppId(appId);
            requestParams.setAppId(appId);
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setSignType(signType);
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            requestParams.setEncryptType(encryptType);
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            // 请求报文体参数,详见接口文档各接口——请求参数定义
            // 请求报文体参数,详见接口文档各接口——请求参数定义
            // 如医保绑卡信息请求参数
            // 如医保绑卡信息请求参数
@ -143,6 +152,7 @@ public class OnePayService {
            // 如医保卡绑卡信息返回参数
            // 如医保卡绑卡信息返回参数
            if (OnepayDefaultClient.isSuccessful(res)) {
            if (OnepayDefaultClient.isSuccessful(res)) {
                JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, BindCard.class);
                JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, BindCard.class);
//                只返回了业务出参的附属绑卡情况 res.getRespCode()级别获取所有返回参数
                result = objectMapper.readValue(objectMapper.writeValueAsString(res.getParam().get("attachList")), javaType);
                result = objectMapper.readValue(objectMapper.writeValueAsString(res.getParam().get("attachList")), javaType);
            } else {
            } else {
                isSuccess = false;
                isSuccess = false;
@ -156,7 +166,7 @@ public class OnePayService {
            error = sw.toString();
            error = sw.toString();
        }
        }
        //保存http日志
        //type=3易联众接口 保存http日志
        logService.saveHttpLog(isSuccess, config.getBindCardType(), "查询绑卡信息", "POST", null, msgBody, response, error, logService.onepayType);
        logService.saveHttpLog(isSuccess, config.getBindCardType(), "查询绑卡信息", "POST", null, msgBody, response, error, logService.onepayType);
        if (!isSuccess) {
        if (!isSuccess) {
@ -169,20 +179,20 @@ public class OnePayService {
    /**
    /**
     * 家庭医生签约支付
     * 家庭医生签约支付
     */
     */
    public String charge(String orgCode, String chargeType, String chargeRelation, Integer totalAmount, String feeDetail, String patient, String openid) throws Exception {
    public String charge(String orgCode, String chargeType, String chargeRelation, Integer totalAmount, String feeDetail, String patient, String openid,String accessToken) throws Exception {
        //获取机构映射
        //获取机构映射
        HospitalMapping hos = hospitalMappingDao.findByCode(orgCode);
        HospitalMapping hos = hospitalMappingDao.findByCode(orgCode);
        if (hos == null) {
        if (hos == null) {
            throw new Exception("no hospital mapping!");
            throw new Exception("no hospital mapping!");
        }
        }
        return charge(orgCode, hos.getName(), hos.getAppId(), hos.getAppSecret(), chargeType, chargeRelation, totalAmount, feeDetail, patient, openid);
        return charge(orgCode, hos.getName(), hos.getAppId(), hos.getAppSecret(), chargeType, chargeRelation, totalAmount, feeDetail, patient, openid,accessToken);
    }
    }
    /**
    /**
     * 家庭医生签约支付,成功则返回支付路径
     * 家庭医生签约支付,成功则返回支付路径
     */
     */
    private String charge(String orgCode, String orgName, String appId, String appSecret, String chargeType, String chargeRelation, Integer totalAmount, String feeDetail, String patient, String openid) throws Exception {
    private String charge(String orgCode, String orgName, String appId, String appSecret, String chargeType, String chargeRelation, Integer totalAmount, String feeDetail, String patient, String openid,String accessToken) throws Exception {
        Boolean isSuccess = true;
        Boolean isSuccess = true;
        String msgBody = "";
        String msgBody = "";
        String response = "";
        String response = "";
@ -192,12 +202,12 @@ public class OnePayService {
        String subject = "家庭医生签约支付";   //  订单名称
        String subject = "家庭医生签约支付";   //  订单名称
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
//     未真正完成支付以前预存储支付信息到wlyy_charge表
        WlyyCharge charge = new WlyyCharge();
        WlyyCharge charge = new WlyyCharge();
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        charge.setChargeType(chargeType);   //交易类型
        charge.setChargeType(chargeType);   //交易类型
        charge.setChargeRelation(chargeRelation);  //交易关联代码
        charge.setChargeRelation(chargeRelation);  //交易关联代码 wlyy_sign_family字段code
        charge.setCode(uuid);  //  接入应用支付业务流水号
        charge.setCode(uuid);  //  接入应用支付业务流水号
        Date now = new Date();
        Date now = new Date();
        charge.setCreateTime(now);
        charge.setCreateTime(now);
@ -228,6 +238,9 @@ public class OnePayService {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
            SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
            String currentDateTime = formatter.format(now);
            String currentDateTime = formatter.format(now);
            RequestParams requestParams = new RequestParams();
            RequestParams requestParams = new RequestParams();
//            requestParams.setVersion();
//            requestParams.setSign();
//            requestParams.setEncryptData();
            requestParams.setAppId(appId);
            requestParams.setAppId(appId);
            requestParams.setTimestamp(currentDateTime);
            requestParams.setTimestamp(currentDateTime);
            requestParams.setSignType(signType);
            requestParams.setSignType(signType);
@ -251,36 +264,49 @@ public class OnePayService {
//            params.put("insuranceAmount",insuranceAmount);   //医保支付金额
//            params.put("insuranceAmount",insuranceAmount);   //医保支付金额
//            params.put("financialAmount",financialAmount);   //财政补贴金额
//            params.put("financialAmount",financialAmount);   //财政补贴金额
//            params.put("returnUrl","https://mp.weixin.qq.com/insurance/pay/detail");   //页面跳转地址
//            params.put("returnUrl","https://mp.weixin.qq.com/insurance/pay/detail");   //页面跳转地址
            params.put("returnUrl", "/html/qygl/html/pay-result.html");   //页面跳转地址
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            String returnUrl = systemConf.getProperty("return_url");
            params.put("returnUrl",returnUrl);   //页面跳转地址
            params.put("feeDetail", feeDetail);   //费用明细
            params.put("feeDetail", feeDetail);   //费用明细
            params.put("channel", channel);  //微信医保支付
            params.put("channel", channel);  //微信医保支付
            params.put("merchName", orgName);  //收款单位名称
            params.put("merchName", orgName);  //收款单位名称
            params.put("subject", subject);  //订单名称
            params.put("subject", subject);  //订单名称
            //params.put("wxToken","");
            params.put("wxToken",accessToken);
            //extendParams 扩展入参
            //extendParams 扩展入参
            //家庭医生签约信息
            //家庭医生签约信息
            Map<String, String> familyContent = new HashMap<>();
            familyContent.put("moRegNo", "04");//医院签约号
            familyContent.put("moRegName", "02"); //签约人姓名
            familyContent.put("moRegAddr", "02"); //签约人地址
            familyContent.put("moRegTelephone", "04");//签约人联系电话
            familyContent.put("moRegOrgNo", "02"); //签约机构
            familyContent.put("moRegDocNo", "04");//签约医生编号
            familyContent.put("moRegDocName", "02"); //签约医生姓名
            familyContent.put("moRegTime", "02"); //签约时间
            familyContent.put("moRegEndTime", "02"); //签约截止时间
            //      根据签约code查询签约信息
            SignFamily signFamily = signFamilyDao.findByCode(chargeRelation);
            if (signFamily!=null){
//                //签约人Code
                String signDoctorCode = signFamily.getSignDoctorCode();
                String people = signFamily.getPatient();
//                Doctor doctor = doctorDao.findByCode(signDoctorCode);
                Patient user = patientDao.findByCode(people);
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                Map<String, String> familyContent = new HashMap<>();
                familyContent.put("moRegNo", chargeRelation);//医院签约号
                familyContent.put("moRegName",signFamily.getName()); //签约人姓名
                familyContent.put("moRegAddr",user.getAddress() ); //签约人地址
                familyContent.put("moRegTelephone", signFamily.getMobile());//签约人联系电话
                familyContent.put("moRegOrgNo", signFamily.getHospital()); //签约机构
                familyContent.put("moRegDocNo", signFamily.getSignDoctorCode());//签约医生编号
                familyContent.put("moRegDocName", signFamily.getSignDoctorName()); //签约医生姓名
                familyContent.put("moRegTime", sdf.format(signFamily.getBegin())); //签约时间
                familyContent.put("moRegEndTime", sdf.format(signFamily.getEnd())); //签约截止时间
//            familyContent.put("moRegYear", "04");//签约年度
//            familyContent.put("moRegYear", "04");//签约年度
            familyContent.put("moRegTear", "04");//签约年度
            familyContent.put("moRegSource", "02"); //签约来源
            familyContent.put("moCollectOrgNo", "02"); //扣费机构
            familyContent.put("moCollectorNo", "04");//扣费人
            familyContent.put("benefitType", "02"); //补贴类型
            familyContent.put("moBookOrgNo", "04");//登记机构
            familyContent.put("moBookerNo", "02"); //登记人
            familyContent.put("moBookTime", "02"); //登记时间
            params.put("familyContent", objectMapper.writeValueAsString(familyContent));// 请求结构体
                familyContent.put("moRegTear", signFamily.getSignYear());//签约年度
                familyContent.put("moRegSource", signFamily.getSignSource()); //签约来源
                familyContent.put("moCollectOrgNo", "03"); //扣费机构
                familyContent.put("moCollectorNo", "04");//扣费人
                familyContent.put("benefitType", signFamily.getExpensesType()); //补贴类型
                familyContent.put("moBookOrgNo", "05");//登记机构
                familyContent.put("moBookerNo", "06"); //登记人
                familyContent.put("moBookTime", "07"); //登记时间
                params.put("familyContent", objectMapper.writeValueAsString(familyContent));// 家庭医生签约信息
            }
            //请求结构体
            //请求结构体
            Map<String, String> map = new HashMap<>();
            Map<String, String> map = new HashMap<>();
            map.put("feeType", "04");//家庭医生签约
            map.put("feeType", "04");//家庭医生签约
@ -288,7 +314,7 @@ public class OnePayService {
            params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体
            params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体
            requestParams.setParam(params);
            requestParams.setParam(params);
            msgBody = JSON.toJSONString(requestParams);
            msgBody = JSON.toJSONString(requestParams);
            //执行支付
            //执行支付  获取预支付原生返回值
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            response = JSON.toJSONString(res);
            response = JSON.toJSONString(res);
@ -300,7 +326,7 @@ public class OnePayService {
                charge.setChargeNo(chargeNo);
                charge.setChargeNo(chargeNo);
            } else {
            } else {
                charge.setTradeStatus("1");
//                charge.setTradeStatus("1");
                isSuccess = false;
                isSuccess = false;
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
            }
            }
@ -328,7 +354,7 @@ public class OnePayService {
    /**
    /**
     * 家庭医生签约支付查询
     * 家庭医生签约支付查询
     */
     */
    public Charge chargeQuery(String code) throws Exception {
    public Charge chargeQuery(String code,String accessToken) throws Exception {
        Boolean isSuccess = true;
        Boolean isSuccess = true;
        String msgBody = "";
        String msgBody = "";
        String response = "";
        String response = "";
@ -340,24 +366,29 @@ public class OnePayService {
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
        try {
        try {
            RequestParams requestParams = new RequestParams();
            RequestParams requestParams = new RequestParams();
//            requestParams.setVersion();
//            requestParams.setSign();
//            requestParams.setEncryptData();
            requestParams.setAppId(appId);
            requestParams.setAppId(appId);
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setSignType(signType);
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            requestParams.setEncryptType(encryptType);
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setTransType(config.getChargeQueryType());
            requestParams.setTransType(config.getChargeQueryType());
            //业务参数
            //业务参数
            JSONObject params = new JSONObject();
            JSONObject params = new JSONObject();
            params.put("outChargeNo", code);  //接入应用结算业务流水号
            params.put("outChargeNo", code);  //接入应用结算业务流水号
            params.put("wxToken", accessToken);
            requestParams.setParam(params);
            requestParams.setParam(params);
            msgBody = JSON.toJSONString(requestParams);
            msgBody = JSON.toJSONString(requestParams);
            //执行支付
            //执行支付 返回原生返回值
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            response = JSON.toJSONString(res);
            response = JSON.toJSONString(res);
            if (OnepayDefaultClient.isSuccessful(res)) {
            if (OnepayDefaultClient.isSuccessful(res)) {
//                只返回业务出参  res.getResponseContent()返回医保机构体
                result = JSON.toJavaObject(res.getParam(), Charge.class);
                result = JSON.toJavaObject(res.getParam(), Charge.class);
                //业务处理*******************
                //业务处理*******************
@ -374,7 +405,7 @@ public class OnePayService {
            error = sw.toString();
            error = sw.toString();
        }
        }
        //保存http日志
        //type = 3易联众接口保存http日志
        logService.saveHttpLog(isSuccess, config.getChargeType(), "家庭医生签约支付查询", "POST", null, msgBody, response, error, logService.onepayType);
        logService.saveHttpLog(isSuccess, config.getChargeType(), "家庭医生签约支付查询", "POST", null, msgBody, response, error, logService.onepayType);
        if (!isSuccess) {
        if (!isSuccess) {
@ -450,12 +481,12 @@ public class OnePayService {
    /**
    /**
     * 更新所有记录的交易状态
     * 更新所有记录的交易状态
     */
     */
    private List<WlyyCharge> updateTradeStatus(List<WlyyCharge> list) {
    private List<WlyyCharge> updateTradeStatus(List<WlyyCharge> list,String accessToken) {
        //更新交易状态
        //更新交易状态
        if (list != null && list.size() > 0) {
        if (list != null && list.size() > 0) {
            for (WlyyCharge item : list) {
            for (WlyyCharge item : list) {
                try {
                try {
                    Charge charge = chargeQuery(item.getCode());
                    Charge charge = chargeQuery(item.getCode(),accessToken);
                    if (charge != null) {
                    if (charge != null) {
                        item.setTradeStatus(charge.getTradeStatus());            //  交易状态0 成功 1 失败 2 已退款
                        item.setTradeStatus(charge.getTradeStatus());            //  交易状态0 成功 1 失败 2 已退款
                        item.setChargeNo(charge.getChargeNo());       //  流水号
                        item.setChargeNo(charge.getChargeNo());       //  流水号
@ -479,29 +510,35 @@ public class OnePayService {
    /**
    /**
     * 通过交易关联代码获取交易列表
     * 通过交易关联代码获取交易列表
     */
     */
    public List<WlyyCharge> chargeList(String chargeType, String chargeRelation) throws Exception {
    public List<WlyyCharge> chargeList(String chargeType, String chargeRelation,String accessToken) throws Exception {
        List<WlyyCharge> list = chargeDao.findByChargeTypeAndChargeRelation(chargeType, chargeRelation);
        List<WlyyCharge> list = chargeDao.findByChargeTypeAndChargeRelation(chargeType, chargeRelation);
        return updateTradeStatus(list);
        return updateTradeStatus(list,accessToken);
    }
    }
    /**
    /**
     * 通过患者代码获取交易列表
     * 通过患者代码获取交易列表
     */
     */
    public List<WlyyCharge> chargeListByPatient(String patient, Integer page, Integer size) throws Exception {
    public List<WlyyCharge> chargeListByPatient(String patient, String accessToken,Integer page, Integer size) throws Exception {
        PageRequest pageRequest = new PageRequest(page - 1, size);
        PageRequest pageRequest = new PageRequest(page - 1, size);
        List<WlyyCharge> list = chargeDao.findByPatient(patient, pageRequest);
        List<WlyyCharge> list = chargeDao.findByPatient(patient, pageRequest);
        return updateTradeStatus(list);
        return updateTradeStatus(list,accessToken);
    }
    }
    /**
    /**
     * 更改数据 wlyy_sign_family wlyy_charge
     * 更改数据 wlyy_sign_family wlyy_charge
     */
     */
    public void updateData(String patient, String chargeNo) throws Exception {
        chargeDao.updateByChargeNo(chargeNo);
        signFamilyDao.updatePatientBegin(patient, new Date(), chargeNo, "1");
    public void updateData(String chargeCode,String chargeNo,String chargeTime,String totalAmount,String insuranceAmount,String selfPayAmount,String billNo,String miRegisterNo) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat();
        Date chargeSuccess = sdf.parse(chargeTime);
        Date updateTime = new Date();
        chargeDao.updateByChargeCode(chargeCode,chargeTime,updateTime,Integer.parseInt(totalAmount),Integer.parseInt(insuranceAmount),Integer.parseInt(selfPayAmount),
                billNo,miRegisterNo,"0");
//        根据wlyy_charge的code 去查找关联代码signCode在更新签约表
        WlyyCharge charge = chargeDao.findByCode(chargeCode);
        signFamilyDao.updatePatientBegin(charge.getChargeRelation(), chargeSuccess, chargeNo, "1");
    }
    }
}
}

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -285,7 +285,7 @@ public class PushMsgTask {
                if(json.has("isRenew")&&type==2){
                if(json.has("isRenew")&&type==2){
                    //如果续签失败,不发送详情
                    //如果续签失败,不发送详情
                }else{
                }else{
                    temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&isRenew="+isRenew+"&signState="+signState+"&represented="+json.getString("represented"));
                    temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name+"&isRenew="+isRenew+"&signState="+signState+"&represented="+json.getString("represented")+"&signCode"+json.getString("signCode"));
                }
                }
                temp.setTouser(openid);
                temp.setTouser(openid);
                temp.setTopcolor("#000000");
                temp.setTopcolor("#000000");

+ 9 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java

@ -49,11 +49,13 @@ public class PatientBookingController extends WeixinBaseController{
    @ResponseBody
    @ResponseBody
    @ApiOperation("取消挂号单")
    @ApiOperation("取消挂号单")
    public String CancelOrder(@ApiParam(name = "orderId", value = "订单id", defaultValue = "48")
    public String CancelOrder(@ApiParam(name = "orderId", value = "订单id", defaultValue = "48")
                              @RequestParam(value = "orderId", required = true) String orderId) {
                              @RequestParam(value = "orderId", required = true) String orderId,
                              @ApiParam(name = "ssc", value = "社保卡号", defaultValue = "48")
                              @RequestParam(value = "ssc", required = true) String ssc) {
        try {
        try {
            //获取订单信息
            //获取订单信息
            PatientReservation obj = patientReservationService.findByCode(orderId);
            boolean re = jwSmjkService.CancelOrder(obj.getCode(),obj.getSsc());
            boolean re = jwSmjkService.CancelOrder(orderId,ssc);
//            if (obj != null) {
//            if (obj != null) {
//                String type = obj.getType();
//                String type = obj.getType();
//                String code = obj.getCode();
//                String code = obj.getCode();
@ -66,6 +68,10 @@ public class PatientBookingController extends WeixinBaseController{
//            }
//            }
            if (re) {
            if (re) {
                PatientReservation obj = patientReservationService.findByCode(orderId);
                if(obj==null){//不是在i健康预约
                    return write(200, "取消挂号单成功!");
                }
                //更新状态
                //更新状态
                patientReservationService.patientCancelOrder(orderId,getRepUID());//"9aa5c557e06a4324911487a035195545"
                patientReservationService.patientCancelOrder(orderId,getRepUID());//"9aa5c557e06a4324911487a035195545"
//                patientReservationService.patientCancelOrder(orderId,getUID());//"9aa5c557e06a4324911487a035195545"
//                patientReservationService.patientCancelOrder(orderId,getUID());//"9aa5c557e06a4324911487a035195545"

+ 10 - 8
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -144,7 +144,8 @@ public class BookingController extends WeixinBaseController {
        try {
        try {
//            List<Map<String, String>> list = getService(city).GetOrgList(city, filter, type, pageIndex, pageSize);
//            List<Map<String, String>> list = getService(city).GetOrgList(city, filter, type, pageIndex, pageSize);
            String re = jwSmjkService.GetOrgList(type);
            String re = jwSmjkService.GetOrgList(type);
            return write(200, "获取机构列表成功!", "data", re);
            return re;
//            return write(200, "获取机构列表成功!", "data", re);
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }
@ -167,7 +168,8 @@ public class BookingController extends WeixinBaseController {
        try {
        try {
//            List<Map<String, String>> list = getService(city).GetOrgDepList(hospitalId, filter, pageIndex, pageSize);
//            List<Map<String, String>> list = getService(city).GetOrgDepList(hospitalId, filter, pageIndex, pageSize);
            String list = jwSmjkService.GetOrgDepList(hospitalId);
            String list = jwSmjkService.GetOrgDepList(hospitalId);
            return write(200, "获取科室列表成功!", "data", list);
            return list;
//            return write(200, "获取科室列表成功!", "data", list);
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }
@ -191,7 +193,7 @@ public class BookingController extends WeixinBaseController {
        try {
        try {
//            List<GuahaoDoctor> list = getService(city).GetDoctorList(hospitalId, hosDeptId, filter, pageIndex, pageSize);
//            List<GuahaoDoctor> list = getService(city).GetDoctorList(hospitalId, hosDeptId, filter, pageIndex, pageSize);
            String list = jwSmjkService.GetDoctorList(hospitalId,hosDeptId);
            String list = jwSmjkService.GetDoctorList(hospitalId,hosDeptId);
            return write(200, "获取医生列表成功!", "data", list);
            return list;
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }
@ -211,7 +213,7 @@ public class BookingController extends WeixinBaseController {
        try {
        try {
//            List<Map<String, Object>> list = getService(city).GetDoctorArrange(hospitalId, hosDeptId, doctorId);
//            List<Map<String, Object>> list = getService(city).GetDoctorArrange(hospitalId, hosDeptId, doctorId);
            String list = jwSmjkService.GetDoctorArrange(hospitalId,hosDeptId,doctorId);
            String list = jwSmjkService.GetDoctorArrange(hospitalId,hosDeptId,doctorId);
            return write(200, "获取医生排班成功!", "data", list);
            return list;
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }
@ -231,7 +233,7 @@ public class BookingController extends WeixinBaseController {
        try {
        try {
//            List<Map<String, String>> list = getService(city).GetDoctorArrangeSimple(hospitalId, hosDeptId, doctorId);
//            List<Map<String, String>> list = getService(city).GetDoctorArrangeSimple(hospitalId, hosDeptId, doctorId);
            String list = jwSmjkService.GetDoctorArrangeSimple(hospitalId,hosDeptId,doctorId);
            String list = jwSmjkService.GetDoctorArrangeSimple(hospitalId,hosDeptId,doctorId);
            return write(200, "获取医生排班成功!", "data", list);
            return list;
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }
@ -251,7 +253,7 @@ public class BookingController extends WeixinBaseController {
        try {
        try {
//            GuahaoDoctor doctor = getService(city).GetDoctorInfo(doctorId, hospitalId, hosDeptId);
//            GuahaoDoctor doctor = getService(city).GetDoctorInfo(doctorId, hospitalId, hosDeptId);
            String doctor = jwSmjkService.GetDoctorInfo(hospitalId,hosDeptId,doctorId);
            String doctor = jwSmjkService.GetDoctorInfo(hospitalId,hosDeptId,doctorId);
            return write(200, "获取医生信息成功!", "data", doctor);
            return doctor;
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }
@ -712,7 +714,7 @@ public class BookingController extends WeixinBaseController {
//            Date threeMonthBefore = getMonthBefore(nowDate, 3);        //三个月历史记录
//            Date threeMonthBefore = getMonthBefore(nowDate, 3);        //三个月历史记录
//            List<PatientReservation> list = guahaoXM.GetRegList(patient, sm.format(threeMonthBefore), sm.format(oneMonthAfter), threeMonthBefore, oneMonthAfter);
//            List<PatientReservation> list = guahaoXM.GetRegList(patient, sm.format(threeMonthBefore), sm.format(oneMonthAfter), threeMonthBefore, oneMonthAfter);
            String list = jwSmjkService.GetRegList(patient);
            String list = jwSmjkService.GetRegList(patient);
            return write(200, "获取患者预约信息列表成功!", "data", list);
            return list;
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }
@ -730,7 +732,7 @@ public class BookingController extends WeixinBaseController {
        try {
        try {
//            PatientReservation obj = guahaoXM.getRegDetail(patientCode, orgCode, regCode);
//            PatientReservation obj = guahaoXM.getRegDetail(patientCode, orgCode, regCode);
            String obj = jwSmjkService.GetRegDetail(patientCode,orgCode,regCode);
            String obj = jwSmjkService.GetRegDetail(patientCode,orgCode,regCode);
            return write(200, "获取患者预约信息成功!", "data", obj);
            return obj;
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }

+ 135 - 67
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java

@ -7,11 +7,15 @@ import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.third.httplog.LogService;
import com.yihu.wlyy.service.weixin.wxpay.common.Configure;
import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
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.exception.PayException;
import com.ylzinfo.onepay.sdk.exception.PayException;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
@ -35,6 +39,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URLDecoder;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.nio.charset.Charset;
import java.util.Date;
import java.util.Date;
@ -61,6 +67,10 @@ public class OnePayController extends WeixinBaseController {
    private SignFamilyDao signFamilyDao;
    private SignFamilyDao signFamilyDao;
    @Autowired
    @Autowired
    private ChargeDao chargeDao;
    private ChargeDao chargeDao;
    @Autowired
    LogService logService;
    @Autowired
    private Configure config;
    @RequestMapping(value = "expensesStatus", method = RequestMethod.GET)
    @RequestMapping(value = "expensesStatus", method = RequestMethod.GET)
@ -70,9 +80,8 @@ public class OnePayController extends WeixinBaseController {
        try {
        try {
            //            获取居民个人信息  要根据签约code去查找签约扣费状态
            //            获取居民个人信息  要根据签约code去查找签约扣费状态
            String patient = getUID();
            String patient = getUID();
            String singCode = "044701ea-5b23-11e6-8344-fa163e8aee56";
            SignFamily sign = signFamilyDao.findByCode(singCode);
//            String singCode = "044701ea-5b23-11e6-8344-fa163e8aee56";
//            SignFamily sign = signFamilyDao.findByCode(singCode);
//            String patient = "915cc456-5b1d-11e6-8344-fa163e8aee56";
//            String patient = "915cc456-5b1d-11e6-8344-fa163e8aee56";
            SignFamily signFamily = signFamilyDao.findPatientExpensesStatus(patient);
            SignFamily signFamily = signFamilyDao.findPatientExpensesStatus(patient);
@ -158,10 +167,10 @@ public class OnePayController extends WeixinBaseController {
    @ResponseBody
    @ResponseBody
    public String bindCard() throws Exception {
    public String bindCard() throws Exception {
        try {
        try {
            //           String patient = getUID();
//            String openid = getOpenid();
            String patient = "0cc6e4562de2437ab2dbbf51a9fc3b49";
            String openid = "oULM4xAj9sOsHJ95ttKYd_Fjh6Hc";
            String patient = getUID();
            String openid = getOpenid();
//            String patient = "0cc6e4562de2437ab2dbbf51a9fc3b49";
//            String openid = "oULM4xAj9sOsHJ95ttKYd_Fjh6Hc";
            BindCard bindCard = pay.bindCard(patient, openid);//getUID(), getOpenid());      oULM4xAj9sOsHJ95ttKYd_Fjh6Hc
            BindCard bindCard = pay.bindCard(patient, openid);//getUID(), getOpenid());      oULM4xAj9sOsHJ95ttKYd_Fjh6Hc
            String sicardUrl = pay.createSicard(patient, openid);//getUID(), getOpenid());
            String sicardUrl = pay.createSicard(patient, openid);//getUID(), getOpenid());
            if (bindCard != null) {
            if (bindCard != null) {
@ -205,12 +214,12 @@ public class OnePayController extends WeixinBaseController {
            @RequestParam String feeDetail) throws Exception {
            @RequestParam String feeDetail) throws Exception {
        try {
        try {
            //            获取居民个人信息
            //            获取居民个人信息
//            String patient = getUID();
//            String openId = getOpenid();
            String patient = "0cc6e4562de2437ab2dbbf51a9fc3b49";
            String openId = "oULM4xAj9sOsHJ95ttKYd_Fjh6Hc";
            String patient = getUID();
            String openId = getOpenid();
//            String patient = "0cc6e4562de2437ab2dbbf51a9fc3b49";
//            String openId = "oULM4xAj9sOsHJ95ttKYd_Fjh6Hc";
            if (StringUtils.isNotEmpty(openId)) {
            if (StringUtils.isNotEmpty(openId)) {
                String settleNo = pay.charge(orgCode, chargeType, chargeRelation, totalAmount, feeDetail, patient, openId);  //ohNH9sh4uwuJCxIwcLJtGTX-BaSk    getUID(),getOpenid()
                String settleNo = pay.charge(orgCode, chargeType, chargeRelation, totalAmount, feeDetail, patient, openId,getAccessToken());  //ohNH9sh4uwuJCxIwcLJtGTX-BaSk    getUID(),getOpenid()
                return write(200, "家庭医生签约支付成功!", "data", settleNo);
                return write(200, "家庭医生签约支付成功!", "data", settleNo);
            } else {
            } else {
                return write(-1, "openId为空!");
                return write(-1, "openId为空!");
@ -226,10 +235,10 @@ public class OnePayController extends WeixinBaseController {
    @RequestMapping(value = "chargeQuery", method = RequestMethod.POST)
    @RequestMapping(value = "chargeQuery", method = RequestMethod.POST)
    @ApiOperation("家庭医生签约支付查询")
    @ApiOperation("家庭医生签约支付查询")
    @ResponseBody
    @ResponseBody
    public String chargeQuery(@ApiParam(name = "code", value = "支付流水号", defaultValue = "")
    public String chargeQuery(@ApiParam(name = "code", value = "接入应用业务流水号", defaultValue = "")
                              @RequestParam String code) throws Exception {
                              @RequestParam String code) throws Exception {
        try {
        try {
            Charge charge = pay.chargeQuery(code);
            Charge charge = pay.chargeQuery(code,getAccessToken());
            return write(200, "家庭医生签约支付查询成功!", "data", charge);
            return write(200, "家庭医生签约支付查询成功!", "data", charge);
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
@ -245,7 +254,7 @@ public class OnePayController extends WeixinBaseController {
                             @ApiParam(name = "chargeRelation", value = "支付关联代码", defaultValue = "044701ea5b2311e68344fa163e8aee56")
                             @ApiParam(name = "chargeRelation", value = "支付关联代码", defaultValue = "044701ea5b2311e68344fa163e8aee56")
                             @RequestParam String chargeRelation) throws Exception {
                             @RequestParam String chargeRelation) throws Exception {
        try {
        try {
            List<WlyyCharge> charge = pay.chargeList(chargeType, chargeRelation);
            List<WlyyCharge> charge = pay.chargeList(chargeType, chargeRelation,getAccessToken());
            return write(200, "获取某次签约的支付记录成功!", "data", charge);
            return write(200, "获取某次签约的支付记录成功!", "data", charge);
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
@ -263,7 +272,7 @@ public class OnePayController extends WeixinBaseController {
                                      @ApiParam(name = "size", value = "每页几行", defaultValue = "10")
                                      @ApiParam(name = "size", value = "每页几行", defaultValue = "10")
                                      @RequestParam Integer size) throws Exception {
                                      @RequestParam Integer size) throws Exception {
        try {
        try {
            List<WlyyCharge> charge = pay.chargeListByPatient(patient, page, size);
            List<WlyyCharge> charge = pay.chargeListByPatient(patient,getAccessToken(), page, size);
            return write(200, "获取患者的支付记录成功!", "data", charge);
            return write(200, "获取患者的支付记录成功!", "data", charge);
        } catch (Exception e) {
        } catch (Exception e) {
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
@ -320,39 +329,56 @@ public class OnePayController extends WeixinBaseController {
    }
    }
    /**
    /**
     * @param request
     * @param response
     * @throws IOException
     * @throws PayException
     * 页面回调更新数据
     */
     */
    @RequestMapping(value = "/returnUrl", method = RequestMethod.GET)
    @RequestMapping(value = "/returnUrl", method = RequestMethod.GET)
    @ApiOperation("商户页面跳转(模拟测试)")
    public void testReturnUrl(HttpServletRequest request, HttpServletResponse response) throws IOException, PayException {
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().write("返回结果:\n" + request.getQueryString() + "\n");
        String onepayUrl = request.getParameter("onepayUrl");
        String appId = "1BHEOI11C00J7B2CA8C0000071FA53E1";
        String appSecret = "1BHEOH8HB0006E0A0A0A00002DB28BC5";
        String signType = "MD5";
        String encryptType = "DES";
    @ApiOperation("商户页面跳转")
    public String testReturnUrl(@RequestParam String jsonData) throws IOException, PayException {
        try {
        try {
            OnepayDefaultClient client = new OnepayDefaultClient(onepayUrl, appId, appSecret, signType, encryptType);
            Map<String, String> returnParams = getRequestMap(request.getQueryString());
           /* boolean isVerify = client.verifyReturnSign(returnParams, returnParams.get("sign"));
            if (isVerify) {
                response.getWriter().write("签名结果:\nSIGN SUCCESS.\n");
                // TODO 继续处理业务
//                更改数据 wlyy_sign_family wlyy_charge
            } else {
                response.getWriter().write("签名结果:\nSIGN ERROR !!!\n");
            }*/
           String patient = request.getParameter("userId");
           String chargNo = request.getParameter("chargeNo");
            pay.updateData(patient,chargNo);
            JSONObject json = new JSONObject(jsonData);
            JSONObject requestParam = json.getJSONObject("param");//业务出参
            String chargeNo = requestParam.getString("chargeNo"); //支付平台流水号
            String chargeTime = requestParam.getString("chargeTime");//支付平台交易成功时间
            String outChargeNo = requestParam.getString("outChargeNo");//接入应用业务流水号
            String outChargeTime = requestParam.getString("outChargeTime");//接入应用时间
            String channel = requestParam.getString("channel");//支付方式
            String billNo = requestParam.getString("billNo");//待结算费用单据号
            String cardNo = requestParam.getString("cardNo");//医保卡号
            String totalAmount = requestParam.getString("totalAmount");//交易总金额
            String insuranceAmount = requestParam.getString("insuranceAmount");//医保支付金额
            String selfPayAmount = requestParam.getString("selfPayAmount");//自付金额
            String userId = requestParam.getString("userId");//用户openID
            String userName = requestParam.getString("userName");//用户名字
            String idType = requestParam.getString("idType");//证件类型
            String idNo = requestParam.getString("idNo");//证件号码
            String tradeStatus = requestParam.getString("tradeStatus");//交易状态
            JSONObject responseContents = json.getJSONObject("responseContent");//医保结构体
            String miRegisterNo = responseContents.getString("miRegisterNo");//医保签约号
            String miCollectDate = responseContents.getString("miCollectDate");//扣费日期
            String miCollectTime = responseContents.getString("miCollectTime");//扣费时间
            String miSettleNo = responseContents.getString("miSettleNo");//扣费单据号
            String miCollectStatus = responseContents.getString("miCollectStatus");//扣费状态
            String miRegisterStatus = responseContents.getString("miRegisterStatus");//登记状态
            String cadresPay = responseContents.getString("cadresPay");//政府补贴支付
            String miTotalFee = responseContents.getString("miTotalFee");//扣费总额
            String healthCarePay = responseContents.getString("healthCarePay");//医保统筹支付
//                responseContents.getString("healthPay");
            String heathPay = responseContents.getString("heathPay");//健康账户支付
            String accountPay = responseContents.getString("accountPay");//医保账户支付
            String selfPay = responseContents.getString("selfPay");//个人现金支付
//                判断是否需要更新数据 needUpload为0不需要更新
            WlyyCharge charge = chargeDao.getUploadStatus(outChargeNo);
            if (charge!=null&&!("0".equals(charge.getNeedUpload()))){
                pay.updateData(outChargeNo, chargeNo,chargeTime,totalAmount,insuranceAmount,selfPayAmount,billNo,miRegisterNo);
            }
            return write(200, "请求成功!");
        } catch (Exception e) {
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            return error(-1, e.getMessage());
        }
        }
    }
    }
@ -367,6 +393,9 @@ public class OnePayController extends WeixinBaseController {
    @RequestMapping(value = "/receiveNotify", method = RequestMethod.POST)
    @RequestMapping(value = "/receiveNotify", method = RequestMethod.POST)
    @ApiOperation("异步回调数据更改")
    @ApiOperation("异步回调数据更改")
    public void receiveNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, PayException {
    public void receiveNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, PayException {
        Boolean isSuccess = false;
        String error= "";
        String responses = "";
        response.setContentType("text/html;charset=utf-8");
        response.setContentType("text/html;charset=utf-8");
        String appId = "1BHEOI11C00J7B2CA8C0000071FA53E1";
        String appId = "1BHEOI11C00J7B2CA8C0000071FA53E1";
        String appSecret = "1BHEOH8HB0006E0A0A0A00002DB28BC5";
        String appSecret = "1BHEOH8HB0006E0A0A0A00002DB28BC5";
@ -382,30 +411,69 @@ public class OnePayController extends WeixinBaseController {
        OnepayDefaultClient client = new OnepayDefaultClient("", appId, appSecret, encryptRes.getSignType(), encryptRes.getEncryptType());
        OnepayDefaultClient client = new OnepayDefaultClient("", appId, appSecret, encryptRes.getSignType(), encryptRes.getEncryptType());
        try {
        try {
           /* client.execute(encryptRes);
            LOGGER.info("解密前:{}", JSON.toJSONString(encryptRes));
            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
            LOGGER.info("解密后:{}", JSON.toJSONString(decryptRes));
            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
            } else {
                boolean isVerify = client.verifyResponseSign(decryptRes);
                LOGGER.info("验签结果:{}", isVerify);
                if (!isVerify) {
                    response.getWriter().write("FAILURE");
                } else {
//                    更改数据 wlyy_sign_family wlyy_charge
                    response.getWriter().write("SUCCESS");
//            已经封装的加解密及签名验证
            RequestParams requestParams = JSON.parseObject(params, RequestParams.class);
            ResponseParams<com.alibaba.fastjson.JSONObject> res =  client.execute(requestParams);
            responses = JSON.toJSONString(res);
            if (OnepayDefaultClient.isSuccessful(res)) {
                isSuccess = true;
                String param = request.getParameter("param");//业务出参
                JSONObject requestParam = new JSONObject(param);
                String chargeNo = requestParam.getString("chargeNo"); //支付平台流水号
                String chargeTime = requestParam.getString("chargeTime");//支付平台交易成功时间
                String outChargeNo = requestParam.getString("outChargeNo");//接入应用业务流水号
                String outChargeTime = requestParam.getString("outChargeTime");//接入应用时间
                String channel = requestParam.getString("channel");//支付方式
                String billNo = requestParam.getString("billNo");//待结算费用单据号
                String cardNo = requestParam.getString("cardNo");//医保卡号
                String totalAmount = requestParam.getString("totalAmount");//交易总金额
                String insuranceAmount = requestParam.getString("insuranceAmount");//医保支付金额
                String selfPayAmount = requestParam.getString("selfPayAmount");//自付金额
                String userId = requestParam.getString("userId");//用户openID
                String userName = requestParam.getString("userName");//用户名字
                String idType = requestParam.getString("idType");//证件类型
                String idNo = requestParam.getString("idNo");//证件号码
                String tradeStatus = requestParam.getString("tradeStatus");//交易状态
                String responseContent = request.getParameter("responseContent");//医保结构体
                JSONObject responseContents = new JSONObject(responseContent);
                String miRegisterNo = responseContents.getString("miRegisterNo");//医保签约号
                String miCollectDate = responseContents.getString("miCollectDate");//扣费日期
                String miCollectTime = responseContents.getString("miCollectTime");//扣费时间
                String miSettleNo = responseContents.getString("miSettleNo");//扣费单据号
                String miCollectStatus = responseContents.getString("miCollectStatus");//扣费状态
                String miRegisterStatus = responseContents.getString("miRegisterStatus");//登记状态
                String cadresPay = responseContents.getString("cadresPay");//政府补贴支付
                String miTotalFee = responseContents.getString("miTotalFee");//扣费总额
                String healthCarePay = responseContents.getString("healthCarePay");//医保统筹支付
//                responseContents.getString("healthPay");
                String heathPay = responseContents.getString("heathPay");//健康账户支付
                String accountPay = responseContents.getString("accountPay");//医保账户支付
                String selfPay = responseContents.getString("selfPay");//个人现金支付
//                判断是否需要更新数据 needUpload为0不需要更新
                WlyyCharge charge = chargeDao.getUploadStatus(outChargeNo);
                if (charge!=null&&!("0".equals(charge.getNeedUpload()))){
                    pay.updateData(outChargeNo, chargeNo,chargeTime,totalAmount,insuranceAmount,selfPayAmount,billNo,miRegisterNo);
                }
                }
            }*/
            String patient = request.getParameter("userId");
            String chargNo = request.getParameter("chargeNo");
            pay.updateData(patient,chargNo);
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            }else {
                isSuccess = false;
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
            }
        } catch (Exception ex) {
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
            response.getWriter().write(ex.getMessage());
        }
        }
        //                记录log日志到数据库
                logService.saveHttpLog(isSuccess, config.getReceiveNotify(), "异步支付通知", "POST", null, params, responses, error, logService.onepayType);
    }
    }
}
}

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

@ -75,6 +75,9 @@ prenatal_inspector_job_trigger=0 0 6 * * ?
evaluate_score_job = 0 0 */2 * * ?
evaluate_score_job = 0 0 */2 * * ?
#统一支付平台 页面跳转地址
return_url={server}/wx/html/qygl/html/bind_return.html
#-------------------------开发环境配置-------------------------#
#-------------------------开发环境配置-------------------------#
## 服务器基本配置
## 服务器基本配置