瀏覽代碼

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

huangwenjie 7 年之前
父節點
當前提交
3c2816ad56
共有 36 個文件被更改,包括 865 次插入404 次删除
  1. 10 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  2. 11 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  3. 26 28
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  4. 1 1
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  5. 0 23
      patient-co/patient-co-statistics-es/doc/sql/system_dict.sql
  6. 0 25
      patient-co/patient-co-statistics-es/doc/sql/wlyy_dimension.sql
  7. 0 21
      patient-co/patient-co-statistics-es/doc/sql/wlyy_dimension_quota.sql
  8. 0 56
      patient-co/patient-co-statistics-es/doc/sql/wlyy_job_config.sql
  9. 192 0
      patient-co/patient-co-statistics-es/doc/sql/统计相关表数据备份20171121.txt
  10. 44 2
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/controller/JobController.java
  11. 0 63
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionAgeConvert.java
  12. 94 2
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  13. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/charge/ChargeDao.java
  14. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java
  15. 5 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorWorkWeekDao.java
  16. 6 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  17. 14 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java
  18. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  19. 25 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  20. 16 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  21. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsAllService.java
  22. 113 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  23. 191 89
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  24. 29 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java
  25. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  26. 30 28
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  27. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java
  28. 5 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  29. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java
  30. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  31. 5 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java
  32. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java
  33. 25 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  34. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java
  35. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  36. 2 2
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

+ 10 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -31,7 +31,7 @@ public class CallService extends IdEntity {
    private Integer type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民,3.预约失败
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private String orderHospital; //预约医院code
@ -41,6 +41,7 @@ public class CallService extends IdEntity {
    private String orderDoctor; //预约医生code
    private String orderDoctorName; //预约医生名称
    private String orderTime; //预约时间段
    private Date registerTime; //挂号时间
    private String user; //创建人
    private String userName; //创建人
    private Long adminTeamCode; //团队id
@ -287,4 +288,12 @@ public class CallService extends IdEntity {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getRegisterTime() {
        return registerTime;
    }
    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }
}

+ 11 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -14,7 +14,7 @@ import java.util.Date;
@Table(name = "manage_call_service")
public class CallService extends IdEntity {
    private String code; //服务编号
    private String code; //服务编号.
    private String callCode; //关联通话记录
    private String patient; //服务对象(患者code)
    private String patientName; // 服务对象名称(患者名称)
@ -31,7 +31,7 @@ public class CallService extends IdEntity {
    private Integer type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民,3.预约失败
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private String orderHospital; //预约医院code
@ -41,6 +41,7 @@ public class CallService extends IdEntity {
    private String orderDoctor; //预约医生code
    private String orderDoctorName; //预约医生名称
    private String orderTime; //预约时间段
    private Date registerTime; //挂号时间
    private String user; //创建人
    private String userName; //创建人
    private Long adminTeamCode; //团队id
@ -287,4 +288,12 @@ public class CallService extends IdEntity {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getRegisterTime() {
        return registerTime;
    }
    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }
}

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

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.manager.account;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.repository.DoctorDao;
import com.yihu.wlyy.repository.MessageDao;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.UserDao;
@ -56,6 +57,8 @@ public class CustomerService extends BaseService{
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private MessageDao messageDao;
	@Autowired
	private DoctorDao doctorDao;
	@Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
	private String messageApi;
@ -408,31 +411,17 @@ public class CustomerService extends BaseService{
		callService.setUser(user);
		User u = userDao.findByCode(user);
		callService.setUserName(u.getName());
		//存储患者信息
		Patient p = patientDao.findByCode(callService.getCode());
		callService.setIdcard(p.getIdcard());
		callService.setSsc(p.getSsc());
		//存储医生
		SignFamily sf = familyService.findByPatientCode(callService.getPatient());
		callService.setAdminTeamCode(sf.getAdminTeamId());
		callService.setCreateTime(new Date());
		callServiceDao.save(callService);
		//待处理发送消息给医生
		if(callService.getState()==1){
			Patient p = patientDao.findByCode(callService.getPatient());
			// 添加签约消息
			Message message = new Message();
			message.setCzrq(new Date());
			message.setCreateTime(new Date());
			message.setContent("您有一条新的协同服务消息!");
			message.setRead(1);//设置未读
			message.setReceiver(callService.getDoctor());//设置接受医生的code
			message.setSender(callService.getPatient());//设置发送的用户
			message.setSenderName(callService.getPatientName());
			message.setCode(getCode());
			message.setSenderPhoto(p.getPhoto());
			message.setTitle("协同服务消息");
			message.setType(12);//协同服务消息
			message.setReadonly(1);//是否只读消息
			message.setSex(p.getSex());
			message.setOver("1");//未处理
			messageDao.save(message);
		}
		sendCallServiceMes(callService,u);
		return "1";
	}
@ -443,7 +432,12 @@ public class CustomerService extends BaseService{
		User u = userDao.findByCode(user);
		callService.setUserName(u.getName());
		callServiceDao.save(callService);
		//待处理发送消息给医生
		sendCallServiceMes(callService,u);
		return "1";
	}
	public void sendCallServiceMes(CallService callService,User u){
		//待处理发送消息给医生
		if(callService.getState()==1){
			Patient p = patientDao.findByCode(callService.getPatient());
@ -451,7 +445,12 @@ public class CustomerService extends BaseService{
			Message message = new Message();
			message.setCzrq(new Date());
			message.setCreateTime(new Date());
			message.setContent("您有一条新的协同服务消息!");
			if("1".equals(callService.getType())){
				message.setContent(u.getName()+"需要预约挂号");
			}else{
				message.setContent(u.getName()+"发起咨询");
			}
			message.setRead(1);//设置未读
			message.setReceiver(callService.getDoctor());//设置接受医生的code
			message.setSender(callService.getPatient());//设置发送的用户
@ -463,11 +462,10 @@ public class CustomerService extends BaseService{
			message.setReadonly(1);//是否只读消息
			message.setSex(p.getSex());
			message.setOver("1");//未处理
			message.setDel("1");
			message.setRelationCode(callService.getCode());
			messageDao.save(message);
		}
		return "1";
	}
	public Map<String,Object> getCallServices(String keyword, Integer serverType,Integer state,String patientName,String ssc,String idCard,String doctorName,String code,Integer adminTeamCode ,String startDate,String endDate,Integer page,Integer size){
@ -527,7 +525,7 @@ public class CustomerService extends BaseService{
			sql +=" AND (s.patient_name = '"+keyword+"' OR s.ssc ='"+keyword+"' OR s.Idcard ='"+keyword+"')";
		}
		if(serverType!=null){
			sql += " AND s.server_type ='"+serverType+"' " ;
			sql += " AND s.type ='"+serverType+"' " ;
		}
		if(state != null){
			sql +=" AND s.state ='"+state+"'";

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

@ -109,7 +109,7 @@ im-service:
yueren:
  api: http://120.77.209.211:8080
doctorAssistant:
  api: http://172.19.103.88:10090/wlyy
  api: http://172.19.103.88:443/assistant
wlyyService:
  api: http://ehr.yihu.com/wlyy/
image:

+ 0 - 23
patient-co/patient-co-statistics-es/doc/sql/system_dict.sql

@ -1,23 +0,0 @@
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''462'', ''RENEW_CHANGE_REASON'', ''1'', ''常住地变更'', NULL, ''1'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''463'', ''RENEW_CHANGE_REASON'', ''2'', ''医生专业度不够'', NULL, ''2'');
INSERT INTO `data_for_stats`.`system_dict` (`id`, `dict_name`, `code`, `value`, `py_code`, `sort`) VALUES (''464'', ''RENEW_CHANGE_REASON'', ''3'', ''咨询回复慢'', NULL, ''3'');
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 (''467'', ''RENEW_CHANGE_REASON'', ''6'', ''其它'', NULL, ''6'');
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);

+ 0 - 25
patient-co/patient-co-statistics-es/doc/sql/wlyy_dimension.sql

@ -1,25 +0,0 @@
CREATE TABLE `wlyy_dimension` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键(uuid)',
  `code` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '业务代码',
  `type` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '类型:1 性别 2 年龄 ',
  `name` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '指标名称',
  `status` int(2) DEFAULT NULL COMMENT '1: 正常 0:不可以用 -1 已删除',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `create_user` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人',
  `create_user_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建人名',
  `update_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '修改时间',
  `update_user` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人',
  `update_user_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '修改人名',
  `remark` varchar(1500) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
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);

+ 0 - 21
patient-co/patient-co-statistics-es/doc/sql/wlyy_dimension_quota.sql

@ -1,21 +0,0 @@
CREATE TABLE `wlyy_dimension_quota` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `quota_code` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '关联 wlyy_quota code',
  `dimension_code` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '关联 wlyy_dimension',
  `dict_sql` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
  `convert_clazz` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '数据转换的类',
  `sort` int(2) DEFAULT NULL COMMENT '维度顺序',
  `key` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '查询出来的key',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
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);

File diff suppressed because it is too large
+ 0 - 56
patient-co/patient-co-statistics-es/doc/sql/wlyy_job_config.sql


File diff suppressed because it is too large
+ 192 - 0
patient-co/patient-co-statistics-es/doc/sql/统计相关表数据备份20171121.txt


+ 44 - 2
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/controller/JobController.java

@ -110,10 +110,10 @@ public class JobController extends BaseController {
    @RequestMapping(value = "productDataByDayToDayAndId", method = RequestMethod.GET)
    public String productDataByDayToDayAndId( @ApiParam(name = "start", value = "yyyy-MM-dd")@RequestParam(value = "start", required = true)String start,
                                         @ApiParam(name = "end", value = "yyyy-MM-dd")@RequestParam(value = "end", required = true)String end,
                                              @ApiParam(name = "id", value = "任务id")@RequestParam(value = "id", required = true)String id) {
                                         @ApiParam(name = "ids", value = "任务ids多个逗号分割")@RequestParam(value = "ids", required = true)String ids) {
        try {
            
            jobService.productDataByDayToDayAndId(start,end,id);
            jobService.productDataByDayToDayAndId(start,end,ids);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
@ -240,4 +240,46 @@ public class JobController extends BaseController {
        }
    }
    //================================================没有休眠时间=============================================================
    /**
     * 生成过去某一天到某一天的某个指标的数据
     *
     * @param start
     * @param end
     * @return
     */
    @ApiOperation(value = "生成过去某一天到某一天的某个指标的数据(包含头尾)没有休眠时间")
    @RequestMapping(value = "productDataByDayToDayAndIdNoSleep", method = RequestMethod.GET)
    public String productDataByDayToDayAndIdNoSleep( @ApiParam(name = "start", value = "yyyy-MM-dd")@RequestParam(value = "start", required = true)String start,
                                                     @ApiParam(name = "end", value = "yyyy-MM-dd")@RequestParam(value = "end", required = true)String end,
                                                     @ApiParam(name = "id", value = "任务id")@RequestParam(value = "id", required = true)String id,
                                                     @ApiParam(name = "sleepTime", value = "任务间隔时间(秒)")@RequestParam(value = "sleepTime", required = true)Long sleepTime) {
        try {
            jobService.productDataByDayToDayAndIdNoSleep(start,end,id,sleepTime);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 生成过去某一天的全部的数据
     *
     * @param day
     * @return
     */
    @ApiOperation(value = "生成过去某一天的全部的数据")
    @RequestMapping(value = "productDataByOneDayNoSleep", method = RequestMethod.GET)
    public String productDataByOneDayNoSleep( @ApiParam(name = "day", value = "yyyy-MM-dd")@RequestParam(value = "day", required = true)String day,
                                              @ApiParam(name = "sleepTime", value = "任务间隔时间(秒)")@RequestParam(value = "sleepTime", required = true)Long sleepTime) {
        try {
            jobService.productDataByOneDayNoSleep(day,sleepTime);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
}

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

@ -1,63 +0,0 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.util.Contant;
import com.yihu.wlyy.statistics.util.IdCardUtil;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2017/6/5.
 */
public class PrescriptionAgeConvert implements Convert {
    /**
     * @param oneList    数据
     * @param slaveLevel 从1开始
     * @return
     */
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp ) {
        Map<String,Object> tempMap = new HashMap<>();
        List<DataModel> result = new ArrayList<>();
        for(DataModel one:oneList) {
            try {
                Object value = one.getIdcard();
                Integer age= IdCardUtil.getAgeForIdcard(String.valueOf(value));
                String key = getAgeCode(age);
                if("63".equals(temp.getQuotaCode())){
                    if(tempMap.containsKey(String.valueOf(value))){
                        continue;
                    }
                }
                tempMap.put(String.valueOf(value),one);
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, key);
//                result.add(one);
            } catch (Exception e) {
                e.printStackTrace();
            }
        };
        return oneList;
    }
    public String getAgeCode(Integer age) {
        if (age >= 0 && age <= 6) {
            return Contant.convert.level_age_1;
        } else if (age >= 7 && age <= 18) {
            return Contant.convert.level_age_2;
        } else if (age >= 19 && age <= 30) {
            return Contant.convert.level_age_3;
        } else if (age >= 31 && age <= 50) {
            return Contant.convert.level_age_4;
        } else if (age >= 51 && age <= 64) {
            return Contant.convert.level_age_5;
        } else {
            return Contant.convert.level_age_6;
        }
    }
}

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

@ -245,6 +245,7 @@ public class JobService {
        }
    }
    public void productDataByDayAndId(Integer day, String id) throws Exception {
        QuartzJobConfig quartzJobConfig = wlyyJobConfigDao.findById(id);
        if (quartzJobConfig == null) {
@ -306,7 +307,7 @@ public class JobService {
    }
    public void productDataByDayToDayAndId(String start, String end, String id) throws Exception {
    public void productDataByDayToDayAndId(String start, String end, String ids) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date startDate = sdf.parse(start);
        Date endDate = sdf.parse(end);
@ -314,10 +315,101 @@ public class JobService {
            throw new Exception("日期参数错误");
        }
        int day = daysBetween(startDate, endDate);
        String [] idStr=ids.split(",");
        for (int i = 0; i < day; i++) {
            Cache.cleanCache();//清空缓存
            productDataByOneDayWithId(getYesterday(i, startDate), id);
            for(String id:idStr){
                productDataByOneDayWithId(getYesterday(i, startDate), id);
            }
        }
    }
    //================================================没有休眠时间=============================================================
    public void productDataByDayToDayAndIdNoSleep(String start, String end, String id,Long sleepTime) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date startDate = sdf.parse(start);
        Date endDate = sdf.parse(end);
        if (startDate.after(endDate)) {
            throw new Exception("日期参数错误");
        }
        int day = daysBetween(startDate, endDate);
        for (int i = 0; i < day; i++) {
            Cache.cleanCache();//清空缓存
            productDataByOneDayWithIdNoSleep(getYesterday(i, startDate), id,sleepTime);
        }
    }
    public void productDataByOneDayWithIdNoSleep(String yesterday, String id,Long sleepTime) throws Exception {
        SimpleDateFormat dataSimple = new SimpleDateFormat("yyyy-MM-dd");
        Date date = dataSimple.parse(yesterday);
        if (date == null) {
            throw new Exception("时间格式错误");
        }
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        calendar.add(calendar.DATE, -1);//把日期往后增加一天.整数往后推,负数往前移动
        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果
        String daybefore = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime());
        QuartzJobConfig quartzJobConfig = wlyyJobConfigDao.findById(id);
        if (quartzJobConfig == null) {
            throw new Exception("id不存在");
        }
        WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
        BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
        Map<String, String> params = new HashMap<String, String>();
        params.put("jobConfig", wlyyJobConfigVO.getId());
        //往quartz框架添加任务
        params.put("startTime", daybefore);
        params.put("endTime", yesterday);
        for (int j = 1; j <= 2; j++) {
            params.put("timeLevel", j + "");
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
            }
            Thread.sleep(sleepTime*1000L);
        }
    }
    public void productDataByOneDayNoSleep(String yesterday,Long sleepTime) throws Exception {
        String sql="select * from wlyy_job_config_new a where  a.del='1' and a.id !=11 order by a.id asc";
        SimpleDateFormat dataSimple = new SimpleDateFormat("yyyy-MM-dd");
        Date date = dataSimple.parse(yesterday);
        if (date == null) {
            throw new Exception("时间格式错误");
        }
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        calendar.add(calendar.DATE, -1);//把日期往后增加一天.整数往后推,负数往前移动
        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果
        String daybefore = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime());
        List<QuartzJobConfig> quartzJobConfigs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(QuartzJobConfig.class));
        for (QuartzJobConfig quartzJobConfig : quartzJobConfigs) {
            WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
            BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
            Map<String, String> params = new HashMap<String, String>();
            params.put("jobConfig", wlyyJobConfigVO.getId());
            //往quartz框架添加任务
            params.put("startTime", daybefore);
            params.put("endTime", yesterday);
            for (int j = 1; j <= 2; j++) {
                params.put("timeLevel", j + "");
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                }
                Thread.sleep(sleepTime*1000L);
            }
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/charge/ChargeDao.java

@ -64,6 +64,6 @@ public interface ChargeDao extends PagingAndSortingRepository<WlyyCharge, Long>,
    List<WlyyCharge> findByTradeStatusAndMiRegisterNoAndUpdateTime(int tradestatus, Date enddate, Date startdate);
    //   查询当天支付,页面回调及异步回调均失败的支付 tradeStatus为空
    @Query(value = "SELECT t.`code` FROM wlyy_charge t WHERE t.trade_status is null AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY)", nativeQuery = true)
    @Query(value = "SELECT t.`code` FROM wlyy_charge t WHERE t.trade_status != '0' AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY) ", nativeQuery = true)
    List<String> findTodayUnpay();
}

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java

@ -19,6 +19,6 @@ public interface PrescriptionPayDao extends PagingAndSortingRepository<Prescript
    PrescriptionPay findByCode(String code);
    //   查询当天支付,页面回调及异步回调均失败的支付 tradeStatus为空
    @Query(value = "SELECT t.`code` FROM wlyy_prescription_pay t WHERE t.trade_status is null AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY)", nativeQuery = true)
    @Query(value = "SELECT t.`code` FROM wlyy_prescription_pay t WHERE t.trade_status != '1' AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY) ", nativeQuery = true)
    List<String> findTodayUnpay();
}

+ 5 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorWorkWeekDao.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.schedule.WlyyDoctorWorkWeek;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -31,10 +32,8 @@ public interface DoctorWorkWeekDao extends PagingAndSortingRepository<WlyyDoctor
    @Query("select a from WlyyDoctorWorkWeek a where a.doctor = ?1 and a.week = ?2")
    WlyyDoctorWorkWeek findDoctorWorkWeek(String doctor,String week);
    /**
     * 删除医生的排班信息
     *
     * @param doctor
     */
    void deleteByDoctor(String doctor);
    //删除医生的排班信息
    @Modifying
    @Query("delete WlyyDoctorWorkWeek a where a.doctor = ?1")
    int deleteByDoctor(String doctor);
}

+ 6 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -56,13 +56,13 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    int updateHealthIndexMessageByPatient(String doctor, String patient, String type);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7) order by a.czrq desc")
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7,12) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.prescriptionStatus=?2 and a.type in (6,7) order by a.createTime desc")
    List<Message> getSysTemMessageByPrescription(String doctor, String prescriptionStatus);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7)")
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12)")
    List<Message> getSystemMessage(String doctor, Pageable pageRequest);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 and a.prescriptionStatus='0' ")
@ -98,9 +98,12 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("from Message a where a.type = 8 and a.state=0 and a.del='1' and a.over='0' and relationCode = ?1  ")
    Message findByRelationCode(String relationCode);
    @Query("from Message a where a.type = 12 and a.state=0 and a.del='1' and a.over='0' and receiver = ?1  ")
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and receiver = ?1  ")
    List<Message> findByReceiverCallService(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 ")
    List<Message> getMessageByType(String doctor, Integer type, Pageable pageRequest);
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and relationCode = ?1  ")
    List<Message> findByCallServiceRelationCode(String relationCode);
}

+ 14 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -163,12 +163,17 @@ public class FamilyMemberService extends BaseService {
        memberDao.save(fm);
        memberDao.save(fmt);
        //设置家人openid
        if(StringUtils.isBlank(m.getOpenid())){
        //设置家人openid 加入undefined 判断
        if(!"undefined".equals(m.getOpenid())&&StringUtils.isNotBlank(m.getOpenid())){
            m.setOpenid(p.getOpenid());
            m.setOpenidTime(new Date());
            patientDao.save(m);
        }
//        if(StringUtils.isBlank(m.getOpenid())){
//            m.setOpenid(p.getOpenid());
//            m.setOpenidTime(new Date());
//            patientDao.save(m);
//        }
        return 1;
    }
@ -1130,12 +1135,18 @@ public class FamilyMemberService extends BaseService {
        memberDao.save(fmt);
        //设置家人openid
        if(StringUtils.isBlank(m.getOpenid())){
        if(!"undefined".equals(m.getOpenid())&&StringUtils.isNotBlank(m.getOpenid())){
            m.setOpenid(p.getOpenid());
            m.setOpenidTime(new Date());
            patientDao.save(m);
        }
//        if(StringUtils.isBlank(m.getOpenid())){
//            m.setOpenid(p.getOpenid());
//            m.setOpenidTime(new Date());
//            patientDao.save(m);
//        }
        return 1;
    }

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

@ -469,6 +469,7 @@ public class PatientHealthIndexService extends BaseService {
            message.setTitle("预警值信息");
            message.setContent(content);
            message.setType(2);
            message.setDel("1");
            message.setValue1(Double.valueOf(model.getValue1()));
            message.setValue2(Double.valueOf(model.getValue2()));
            message.setTzCode(String.valueOf(model.getId()));//消息关联的体征id

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

@ -10,8 +10,11 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ElasticsearchUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
@ -27,6 +30,8 @@ import java.util.*;
@Service
@Transactional
public class PrescriptionExpressageService extends BaseService {
    private Logger logger = LoggerFactory.getLogger(ElasticsearchUtil.class);
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
@ -559,23 +564,28 @@ public class PrescriptionExpressageService extends BaseService {
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
            prescriptionLogDao.save(prescriptionLog);
            //更新二维码(isUse)
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(prescriptionCode);
            if(prescriptionDispensaryCode!=null){
                //修改取药码code为已经使用
                prescriptionDispensaryCode.setIsUse(1);
                prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
            try {
                //更新二维码(isUse)
                PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(prescriptionCode);
                if(prescriptionDispensaryCode!=null){
                    //修改取药码code为已经使用
                    prescriptionDispensaryCode.setIsUse(1);
                    prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
                    //更新配送信息
                    PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
                    if(prescriptionExpressage!=null){
                        prescriptionExpressage.setHospitalDoctor(doctor);
                        prescriptionExpressage.setHospitalDoctorCode(d.getCode());
                        prescriptionExpressage.setFetchingMedicineTime(new Date());
                        prescriptionExpressageDao.save(prescriptionExpressage);
                    }
                }
            }catch (Exception e){
                logger.info("更新二维码(isUse),更新配送信息 异常:"+e.getMessage());
            }
            //更新配送信息
            PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            if(prescriptionExpressage!=null){
                prescriptionExpressage.setHospitalDoctor(doctor);
                prescriptionExpressage.setHospitalDoctorCode(d.getCode());
                prescriptionExpressage.setFetchingMedicineTime(new Date());
                prescriptionExpressageDao.save(prescriptionExpressage);
            }
            return "1";
        }
        return "0";

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

@ -394,14 +394,20 @@ public class FamilyContractService extends BaseService {
        json.put("expertise", d.getExpertise());
        json.put("level", d.getLevel());
        //获取健康文章
        com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
        try {
            jsonArray = healthEducationArticleService.getDoctorArticalByUserId(null,1,null,0,3,doctor);
        }catch (Exception e){
            logger.error("获取福州健康文章失败,"+e.getMessage());
        SignFamily sf = signFamilyDao.findByjiatingPatient(patient);
        if(sf==null||!sf.getHospital().startsWith("350211")){
            //未签约和不是集美签约的按原有接口走
        }else {
            //获取健康文章
            com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
            try {
                jsonArray = healthEducationArticleService.getDoctorArticalByUserId(null,1,null,0,3,doctor);
            }catch (Exception e){
                logger.error("获取福州健康文章失败,"+e.getMessage());
            }
            json.put("healthEduArticles",jsonArray);
        }
        json.put("healthEduArticles",jsonArray);
        return json;
    }
@ -551,7 +557,9 @@ public class FamilyContractService extends BaseService {
            p.setTown(town);
            p.setTownName(townName);
            p.setAddress(address);
            p.setOpenid(openid);
            if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
                p.setOpenid(openid);
            }
            p.setOpenidTime(new Date());
            p.setIdcard(idcard);
            p.setMobile(mobile);

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

@ -2823,6 +2823,7 @@ public class StatisticsAllService extends BaseService {
                            num = peopleNum.getTnbNum();
                            taskNum = peopleNum.getTnbTaskNum();
                        }
                        map.put("rate", df.format(((long) map.get("amount") * 1.0000) / num * 100));
                        map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / taskNum * 100));
                        map.put("targetRate", df.format(taskNum * 1.0000 / num * 100));

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

@ -2609,6 +2609,7 @@ public class StatisticsService extends BaseService {
                    " AND c.patient = s.id " +
                    " AND t. STATUS <> 10 " +
                    " AND t.`reply` = 0 " +
                    " AND c.type = 2 "+
                    " AND p.session_id = t.session_id " +
                    " AND d.id ='" + doctor + "'" +
                    " AND c.admin_team_code = " + teamCode +
@ -2631,6 +2632,7 @@ public class StatisticsService extends BaseService {
                    " AND p.session_id = t.session_id " +
                    " AND d.id ='" + doctor + "'" +
                    " AND c.admin_team_code = " + teamCode +
                    " AND c.type = 2 "+
                    " AND t.create_time >= '" + startDate + "' " +
                    " AND t.create_time <= '" + endDate + "' " +
                    " GROUP BY dateNo";
@ -2654,6 +2656,7 @@ public class StatisticsService extends BaseService {
                    "  AND d.id ='" + doctor + "'" +
                    "  AND t. STATUS <> 10  " +
                    "  AND t.`reply` = 0  " +
                    "  AND c.type = 2 "+
                    "  AND t.create_time >= '" + startDate + "' " +
                    "  AND t.create_time <= '" + endDate + "' " +
                    "  GROUP BY weekOfMonth";
@ -2673,6 +2676,7 @@ public class StatisticsService extends BaseService {
                    "  AND p.session_id = t.session_id " +
                    "  AND d.id ='" + doctor + "'" +
                    "  AND c.admin_team_code = " + teamCode +
                    "  AND c.type = 2 "+
                    "  AND t.create_time >= '" + startDate + "' " +
                    "  AND t.create_time <= '" + endDate + "' " +
                    "  GROUP BY weekOfMonth";
@ -2928,6 +2932,7 @@ public class StatisticsService extends BaseService {
                " AND c.patient = s.id " +
                " AND p.session_id = t.session_id " +
                " AND c.type <> 8"+
                " AND c.type = 2"+
                " AND c.admin_team_code =" + teamCode +
                " AND d.id='" + doctor + "'" +
                " AND t.create_time <= '" + endDate + "'";
@ -2946,6 +2951,7 @@ public class StatisticsService extends BaseService {
                " AND c.patient = s.id " +
                " AND p.session_id = t.session_id " +
                " AND c.type <> 8"+
                " AND c.type = 2"+
                " AND t.`reply`=1 " +
                " AND c.admin_team_code =" + teamCode +
                " AND d.id='" + doctor + "'" +
@ -2966,6 +2972,7 @@ public class StatisticsService extends BaseService {
                " AND c.patient = s.id " +
                " AND p.session_id = t.session_id " +
                " AND c.type <> 8"+
                " AND c.type = 2"+
                " AND c.admin_team_code =" + teamCode +
                " AND d.id='" + doctor + "'" +
                " AND t.create_time >= '" + startDate + "' " +
@ -2985,6 +2992,7 @@ public class StatisticsService extends BaseService {
                " AND c.patient = s.id " +
                " AND p.session_id = t.session_id " +
                " AND c.type <> 8"+
                " AND c.type = 2"+
                " AND t. STATUS <> 10  " +
                " AND t.`reply` = 0  " +
                " AND c.admin_team_code =" + teamCode +
@ -3733,8 +3741,8 @@ public class StatisticsService extends BaseService {
                " wlyy_patient_health_guidance w " +
                " WHERE " +
                " w.admin_team_code =  " + teamCode +
                " AND w.czrq <= '" + endDate + "' " +
                " AND w.czrq >= '" + startDate + "' " +
                //" AND w.czrq <= '" + endDate + "' " +
                //" AND w.czrq >= '" + startDate + "' " +
                " GROUP BY w.doctor " +
                " ) c ON c.doctor = m.doctor_code, " +
                " wlyy_doctor d " +
@ -4093,7 +4101,8 @@ public class StatisticsService extends BaseService {
                " w.admin_team_code =" + teamCode +
                " AND w.doctor ='" + doctor + "'" +
                " AND w.czrq <= '" + endDate + "' " +
                " AND w.czrq >= '" + startDate + "'";
                " AND w.czrq >= '" + startDate + "'"+
                " GROUP BY w.batch_no";
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> addList = jdbcTemplate.queryForList(addSql);
        JSONObject rs = new JSONObject();
@ -6660,5 +6669,106 @@ public class StatisticsService extends BaseService {
        }
        return null;
    }
    /**
     * esController里的getRayStatByTeam求咨询总数
     * 2017-11-21
     * zhangdan
     * @param startDate
     * @param endDate
     * @param id
     * @return
     */
    public Long getConsultTotalForEsGetRayStatByTeam(String startDate,String endDate,long id){
        String imDataBaseName = im_dataBase_name;
        //startDate = startDate + " 00:00:00";
        //endDate = endDate + " 23:59:59";
        String totalSql = "SELECT " +
                "  COUNT(1) total " +
                "  FROM " +
                "  " + imDataBaseName + ".Topics t, " +
                "  " + imDataBaseName + ".Participants p, " +
                "  " + imDataBaseName + ".Doctors d, " +
                "  Wlyy_Consult_Team c, " +
                "  " + imDataBaseName + ".Patients s " +
                "  WHERE " +
                "  d.id = p.participant_id " +
                " AND c.consult = t.id " +
                " AND c.patient = s.id " +
                " AND c.type = 2 " +
                " AND p.session_id = t.session_id " +
                " AND c.admin_team_code =" + id +
                " AND t.create_time >= '" + startDate + "' " +
                " AND t.create_time <= '" + endDate + "'";
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
        Long totalCount = 0L;
        if (totalList != null && totalList.size() > 0) {
            Map<String, Object> total = totalList.get(0);
            totalCount = (Long) total.get("total");
        }
        return totalCount;
    }
    /**
     * esController里的getTeamConsultCount求咨询总数
     * 2017-11-21
     * zhangdan
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param type
     * @return
     */
    public List<Map<String, Object>> getCousultTotalForEsGetTeamConsultCount(String teamCode, String startDate, String endDate, String type) {
        String imDataBaseName = im_dataBase_name;
        String totalSql;
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        if ("0".equals(type)) {
            //按周统计
            totalSql = "SELECT " +
                    "  left(t.create_time,10) AS dateNo, COUNT(1) total " +
                    " FROM " +
                    "  " + imDataBaseName + ".Topics t, " +
                    "  " + imDataBaseName + ".Participants p, " +
                    "  " + imDataBaseName + ".Doctors d, " +
                    "  Wlyy_Consult_Team c, " +
                    "  " + imDataBaseName + ".Patients s " +
                    " WHERE " +
                    "  d.id = p.participant_id " +
                    " AND c.consult = t.id " +
                    " AND c.patient = s.id " +
                    " AND p.session_id = t.session_id " +
                    " AND c.type <> 8" +
                    " AND c.admin_team_code = " + teamCode +
                    " AND t.create_time >= '" + startDate + "' " +
                    " AND t.create_time <= '" + endDate + "' " +
                    " GROUP BY dateNo";
        } else {
            //按月统计
            totalSql = "SELECT " +
                    "  (DATE_FORMAT(t.create_time, '%v') - DATE_FORMAT('" + startDate + "', '%v') + 1) AS weekOfMonth, " +
                    "  COUNT(1) AS total " +
                    "  FROM " +
                    "  " + imDataBaseName + ".Topics t, " +
                    "  " + imDataBaseName + ".Participants p, " +
                    "  " + imDataBaseName + ".Doctors d, " +
                    "  Wlyy_Consult_Team c, " +
                    "  " + imDataBaseName + ".Patients s " +
                    "  WHERE " +
                    "  d.id = p.participant_id " +
                    "  AND c.consult = t.id " +
                    "  AND c.patient = s.id " +
                    "  AND p.session_id = t.session_id " +
                    "  AND c.type <> 8" +
                    "  AND c.admin_team_code = " + teamCode +
                    "  AND t.create_time >= '" + startDate + "' " +
                    "  AND t.create_time <= '" + endDate + "' " +
                    "  GROUP BY weekOfMonth";
        }
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
        return totalList;
    }
}

+ 191 - 89
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.service.app.statisticsES;
import com.yihu.wlyy.config.es.ElasticFactory;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDispensaryCode;
@ -9,8 +10,10 @@ import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.entity.statistics.PopulationBase;
import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.service.app.statistics.StatisticsAllService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.util.Constant;
import com.yihu.wlyy.util.DateUtil;
@ -57,14 +60,21 @@ public class StatisticsESService {
    @Autowired
    TownDao townDao;
    @Autowired
    DoctorDao doctorDao;
    @Autowired
    private SystemDictService systemDictService;
    @Autowired
    private StatisticsAllService statisticsAllService;
    @Autowired
    private StatisticsService statisticsService;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXX");
    SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    DecimalFormat decimalFormat = new DecimalFormat("0.00");
    @Autowired
    private StringRedisTemplate redisTemplate;
    /**
     * 获取上次统计时间
@ -75,16 +85,7 @@ public class StatisticsESService {
        String date = DateUtil.dateToStrLong(new Date());
        try {
//            date = redisTemplate.opsForValue().get("quota:date");
//            JestClient jestClient = elasticFactory.getJestClient();
//
//            Bulk.Builder bulk = new Bulk.Builder().defaultIndex("health_edu_article_patient_test").defaultType("health_edu_article_patient_test");
//            PrescriptionDispensaryCode ap = new PrescriptionDispensaryCode();
//            ap.setCode("aaaa");
//            ap.setType(2);
//            Index index = new Index.Builder(ap).build();
//            bulk.addAction(index);
//            BulkResult br = jestClient.execute(bulk.build());
            date = redisTemplate.opsForValue().get("quota:date");
        } catch (Exception e) {
            e.printStackTrace();
        }
@ -209,13 +210,23 @@ public class StatisticsESService {
        SaveModel saveModel = null;
        if (StringUtils.isNotEmpty(level2_type)) {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, "1", level2_type);
            saveModel = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, level2_type);
        } else {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, "1");
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL);
        }
        return saveModel.getResult2().longValue();
    }
    public long getTotalAmount3(String startDate, String endDate, String area, int level, String index, String level2_type) throws Exception {
        SaveModel saveModel = null;
        if (StringUtils.isNotEmpty(level2_type)) {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index,SaveModel.timeLevel_DDL, level2_type);
        } else {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL);
        }
        return saveModel.getResult2().longValue();
    }
    /**
     * 查询截止某个日期某个区域后机构各下级指标累计情况
     *
@ -269,7 +280,7 @@ public class StatisticsESService {
                }
                PopulationBase peopleNum = getPopulationBase(area, year);
                if (peopleNum != null) {
                    map.put("rate", df.format((saveModel.getResult2() * 1.0000) / peopleNum.getNum() * 100));
                    map.put("rate", (peopleNum.getNum() > 0 ? df.format((saveModel.getResult2() * 1.0000) / peopleNum.getNum() * 100) : 0));
                    map.put("rateString", saveModel.getResult2().longValue() + "/" + peopleNum.getNum());
                }
            }
@ -406,7 +417,7 @@ public class StatisticsESService {
                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, area, level, "1", "2");
                Long num = saveModel.getResult2().longValue();
                for (Map<String, Object> map : resultList) {
                    double rateG = (total > 0 ? ((long) map.get("amount")) * 1.0000 / num * 100 : 0);
                    double rateG = (num > 0 ? ((long) map.get("amount")) * 1.0000 / num * 100 : 0);
                    map.put("rate", df.format(rateG));
                    map.put("rateString", ((long) map.get("amount")) + "/" + num);
                }
@ -447,10 +458,15 @@ public class StatisticsESService {
     */
    public JSONArray getPayPremiums(String endDate, String area, int level) throws Exception {
        //已缴费
        SaveModel paidSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "1", "2");
        SaveModel paidSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "1", SaveModel.timeLevel_DDL);
        //未交费
        SaveModel noPaySaveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "14", "2");
        SaveModel noPaySaveModel =null;
        //因为14的指标 16年度是分为 已缴费 未交费 已退费  17年度过后就只有未交费  所以16年度用1级指标 17年度用0级指标
        if("2017-06-30".equals(endDate)){
             noPaySaveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, "14", "2","0");
        }else{
            noPaySaveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "14", "2");
        }
        List<Map<String, Object>> resultList = new ArrayList<>();
        DecimalFormat df = new DecimalFormat("0.0000");
        long paidTotal = paidSaveModel.getResult2().longValue();
@ -462,23 +478,25 @@ public class StatisticsESService {
        //求签约总数
        long totalNum = paidTotal + noPayTotal;
        map2.put("code", "0");
        map2.put("amount", noPayTotal);
        map2.put("name", "未缴费人数");
        double rateG2 = (noPayTotal > 0 ? noPayTotal * 1.0000 / totalNum * 100 : 0);
        map2.put("rate", df.format(rateG2));
        map2.put("rateString", noPayTotal + "/" + totalNum);
        resultList.add(map2);
        map1.put("code", "1");
        map1.put("amount", paidTotal);
        map1.put("name", "已缴费人数");
        double rateG = (paidTotal > 0 ? paidTotal * 1.0000 / totalNum * 100 : 0);
        map1.put("rate", df.format(rateG));
        ;
        map1.put("rateString", paidTotal + "/" + totalNum);
        resultList.add(map1);
        map2.put("code", "0");
        map2.put("amount", noPayTotal);
        map2.put("name", "未缴费人数");
        double rateG2 = (noPayTotal > 0 ? noPayTotal * 1.0000 / totalNum * 100 : 0);
        map2.put("rate", df.format(rateG2));
        ;
        map2.put("rateString", noPayTotal + "/" + totalNum);
        resultList.add(map2);
        return new JSONArray(resultList);
    }
@ -1205,7 +1223,7 @@ public class StatisticsESService {
        if (date.compareTo(dateFormat.format(new Date())) >= 0) {
            date = elasticsearchUtil.getQuotaTime();
        }
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel1(date, area, level, index, SaveModel.timeLevel_DDL, low_level, low_level);
        List<SaveModel> esModelList = elasticsearchUtil.findListDateQuotaLevel1(date, area, level, index, SaveModel.timeLevel_DDL,lowLevel, lowCode);
        //esModelList=elasticsearchUtil.findDateQuotaLevel1(date,date,area,level,index,SaveModel.timeLevel_DDL,1,lowCode,"",low_level);
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {
@ -1238,24 +1256,24 @@ public class StatisticsESService {
                map.put("signTaskNum", signTaskNum);//目标量
                map.put("signRegulationNum", signRegulationNum);//调控量
                if (!low_level.equals("5")) {
                    PopulationBase peopleNum = getPopulationBase(map.get("code").toString(), year);
                    PopulationBase peopleNum = getPopulationBase(String.valueOf(map.get("code")), year);
                    if (peopleNum != null) {
                        int num = 0;
                        int taskNum = 0;
                        if (lowCode.equals("3")) {
                        if (low_level.equals("3")) {
                            num = peopleNum.getSixFiveNum();
                            taskNum = peopleNum.getSixFiveTaskNum();
                        } else if (lowCode.equals("5")) {
                        } else if (low_level.equals("5")) {
                            num = peopleNum.getGxyNum();
                            taskNum = peopleNum.getGxyTaskNum();
                        } else if (lowCode.equals("4")) {
                        } else if (low_level.equals("4")) {
                            num = peopleNum.getTnbNum();
                            taskNum = peopleNum.getTnbTaskNum();
                        }
                        map.put("rate", df.format(((long) map.get("amount") * 1.0000) / num * 100));
                        map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / taskNum * 100));
                        map.put("targetRate", df.format(taskNum * 1.0000 / num * 100));
                        map.put("rate", (num > 0 ? df.format(((long) map.get("amount") * 1.0000) / num * 100) : 0));
                        map.put("taskRate", (taskNum > 0 ? df.format(((long) map.get("amount") * 1.0000) / taskNum * 100) : 0));
                        map.put("targetRate", (num > 0 ? df.format(taskNum * 1.0000 / num * 100) : 0));
                        map.put("rateString", map.get("amount") + "/" + num);
                        map.put("taskRateString", map.get("amount") + "/" + taskNum);
                        map.put("targetRateString", taskNum + "/" + num);
@ -2276,6 +2294,66 @@ public class StatisticsESService {
        return resultMaps;
    }
    /**
     * 团队报告团队详情中健康教育折线图
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param type
     * @return
     */
    public JSONArray getTeamEduLine(String teamCode, String startDate, String endDate, String type)throws Exception {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        List<Map<String,Object>> dateList = DateUtil.findDates(dateFormat.parse(startDate),dateFormat.parse(endDate));
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> articleCountList = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,teamCode,Integer.valueOf(SaveModel.teamLevel),"59",SaveModel.timeLevel_ZL,String.valueOf(interval));
        List<SaveModel> batchNoCountList = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,teamCode,Integer.valueOf(SaveModel.teamLevel),"71",SaveModel.timeLevel_ZL,String.valueOf(interval));
        List<Map<String, Object>> list = new ArrayList<>();
        if(articleCountList!=null){
            //循环人数集合
            for (SaveModel one1:articleCountList){
                String date = "";
                if(one1.getQuotaDate()!=null){
                    date=dateFormat.format(one1.getQuotaDate());
                }
                if (one1.getResult2().intValue()!=0){
                    Map<String,Object> map = new HashedMap();
                    map.put("articleCount",one1.getResult2().intValue());
                    //查看批次集合里是否有同时间的数据
                    for (SaveModel one2:batchNoCountList) {
                        if (one2.getQuotaDate()!=null && dateFormat.format(one2.getQuotaDate()).equals(date)){
                            map.put("batchCount",one2.getResult2().intValue());
                        }
                    }
                    if ("0".equals(type)) {
                        map.put("dateNo",date);
                    } else {
                        map.put("weekOfMonth", DateUtil.getWeekOfMonth(date));
                    }
                    list.add(map);
                }else{
                    //循环批次
                    for (SaveModel one2:batchNoCountList) {
                        if (one2.getResult2().intValue()!=0 && one2.getQuotaDate()!=null && dateFormat.format(one2.getQuotaDate()).equals(date)){
                            Map<String,Object> map = new HashedMap();
                            map.put("articleCount",0);
                            map.put("batchCount",one2.getResult2().intValue());
                            if ("0".equals(type)) {
                                map.put("dateNo",dateFormat.format(date));
                            } else {
                                map.put("weekOfMonth", DateUtil.getWeekOfMonth(date));
                            }
                            list.add(map);
                        }
                    }
                }
            }
        }
        return new JSONArray(list);
    }
    public JSONObject getRenewPercentAndChangePercent(String index, Integer level, String area, String year, String lowCode) {
        JSONObject jo = new JSONObject();
        String switchIndex = "";//转签index
@ -2463,13 +2541,13 @@ public class StatisticsESService {
//        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        //获取微信关注的未交费
//        Map<String, Object> expenseStatus0 = getByIndexSingle(date, area, level, "49",dateFormat);
        SaveModel expenseStatus0 = elasticsearchUtil.findOneDateQuotaLevel0(date, area, level, "49", "2");
        SaveModel expenseStatus0 = elasticsearchUtil.findOneDateQuotaLevel0(date, area, level, "49", SaveModel.timeLevel_DDL);
        //获取微信关注的已交费
//        Map<String, Object> expenseStatus1 = getByIndexSingle(date, area, level, "50",dateFormat);
        SaveModel expenseStatus1 = elasticsearchUtil.findOneDateQuotaLevel0(date, area, level, "50", "2");
        SaveModel expenseStatus1 = elasticsearchUtil.findOneDateQuotaLevel0(date, area, level, "50", SaveModel.timeLevel_DDL);
        //获取已缴费的签约数
//        Map<String, Object> expenseStatus1Sigjn = getByIndexSingle(date, area, level, "1",dateFormat);
        SaveModel expenseStatus1Sigjn = elasticsearchUtil.findOneDateQuotaLevel0(date, area, level, "1", "2");
        SaveModel expenseStatus1Sigjn = elasticsearchUtil.findOneDateQuotaLevel0(date, area, level, "1", SaveModel.timeLevel_DDL);
        JSONObject jsonObject = new JSONObject();
        if (Integer.valueOf(SaveModel.teamLevel) == level) {
            jsonObject.put("name", expenseStatus1Sigjn.getTeamName());
@ -2569,8 +2647,7 @@ public class StatisticsESService {
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index, "2", "", low_level);
        } else {
            //续签量
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(DateUtil.getNextDay(new Date(), -1), DateUtil.getNextDay(new Date(), -1), area, level, index, "2", lowCode, "", low_level);
            //renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index, "2",1,lowCode,"",low_level);
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey, area, level, index, "2", lowCode, "", low_level);
        }
@ -2734,10 +2811,11 @@ public class StatisticsESService {
        rs.put(signTotal);
        //4.获取咨詢數
        SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        Map<String, Object> consultCout = new HashMap<>();
        consultCout.put("consultCount", saveModel3.getResult2().longValue());
        //4.获取咨詢數(先使用旧版)
        Map<String, Object> consultCout = statisticsService.getConsultByteam(admin.getId(),startDate,endDate);
        //SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        //Map<String, Object> consultCout = new HashMap<>();
        //consultCout.put("consultCount", saveModel3.getResult2().longValue());
        rs.put(consultCout);
        //5.获取待预约
@ -2766,9 +2844,6 @@ public class StatisticsESService {
        //3.平均满意度
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "28", SaveModel.timeLevel_ZL);
//        String sql = "SELECT count(1) as num FROM wlyy_consult_team d WHERE d.czrq>= ? and d.czrq<=? and d.admin_team_code =? ";
//        Map<String, Object> map = jdbcTemplate.queryForMap(sql, startDate, endDate,admin.getId());
        //SaveModel saveModel21 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        Double avgCout = 0.0;
        String avgCoutStr="";
        DecimalFormat df = new DecimalFormat("#.0");
@ -2776,10 +2851,6 @@ public class StatisticsESService {
            avgCout = saveModel2.getResult1()/saveModel2.getResult2();
            avgCoutStr=df.format(avgCout);
        }
//        if (saveModel21.getResult2().intValue()!=0){
//            avgCout = saveModel2.getResult1() / saveModel21.getResult2();
//            avgCoutStr = df.format(avgCout);
//        }
        Map<String, Object> avgScore = new HashMap<>();
        avgScore.put("avgScore", avgCoutStr);
        rs.put(avgScore);
@ -2865,9 +2936,10 @@ public class StatisticsESService {
        endDate = endDate + " 23:59:59";
        String quotaTime = elasticsearchUtil.getQuotaTime();
        Long id = admin.getId();
        //家庭医生、健康咨询增量
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        Long totalCount = saveModel.getResult2().longValue();
        //家庭医生、健康咨询增量(先使用旧版 17-11-21)
        Long totalCount = statisticsService.getConsultTotalForEsGetRayStatByTeam(startDate,endDate,id);
        /*SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        Long totalCount = saveModel.getResult2().longValue();*/
        //健康咨询量  未回复当天的到达量
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(quotaTime, quotaTime, id + "", Integer.parseInt(SaveModel.teamLevel), "22", SaveModel.timeLevel_DDL);
@ -2936,9 +3008,11 @@ public class StatisticsESService {
        //咨询未回复
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "22", SaveModel.timeLevel_ZL, interval + "");
        //咨询总数
        List<SaveModel> list2 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL, interval + "");
        //咨询总数(先使用旧版17-11-21)
        //List<SaveModel> list2 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL, interval + "");
        List<Map<String,Object>> totalList = statisticsService.getCousultTotalForEsGetTeamConsultCount(teamCode,startDate,endDate,type);
        Map<String, Object> map = null;
        //遍历未回复集合
        List<Map<String, Object>> noReyList = new ArrayList<>();
        for (SaveModel one : list) {
            if (one.getResult2().intValue()!=0){
@ -2946,14 +3020,14 @@ public class StatisticsESService {
                if ("0".equals(type)) {
                    map.put("dateNo",dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("noRely", one.getResult2().longValue());
                noReyList.add(map);
            }
        }
        List<Map<String, Object>> totalList = new ArrayList<>();
        /*List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list2) {
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
@ -2965,7 +3039,7 @@ public class StatisticsESService {
                map.put("total", one.getResult2().longValue());
                totalList.add(map);
            }
        }
        }*/
        JSONObject result = new JSONObject();
        result.put("noReyList", noReyList);
        result.put("totalList", totalList);
@ -2973,7 +3047,7 @@ public class StatisticsESService {
    }
    /**
     * 获取团队随访量折线统计图(弃用)
     * 获取团队随访量折线统计图
     *
     * @param type
     * @param teamCode
@ -2983,22 +3057,40 @@ public class StatisticsESService {
     */
    public JSONObject getTeamFollowupLine(String teamCode, String startDate, String endDate, String type) throws Exception {
        Integer interval = Integer.parseInt(type) + 2;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "4", "2", interval + "");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list1 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "69", SaveModel.timeLevel_ZL, interval + "");
        List<SaveModel> list2 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "70", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list) {
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
        for (SaveModel one : list1) {
            if(one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("followupCount", one.getResult2().longValue());
                totalList.add(map);
            }
            map.put("followupCount", one.getResult2().longValue());
            totalList.add(map);
        }
        return null;
        List<Map<String, Object>> planList = new ArrayList<>();
        for (SaveModel one : list2) {
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("planCount", one.getResult2().longValue());
                planList.add(map);
            }
        }
        JSONObject result = new JSONObject();
        result.put("planList", planList);
        result.put("totalList", totalList);
        return result;
    }
    /**
@ -3014,19 +3106,21 @@ public class StatisticsESService {
        startDate = elasticsearchUtil.changeTime(startDate + " 00:00:00");
        endDate = elasticsearchUtil.changeTime(endDate + " 23:59:59");
        Integer interval = Integer.parseInt(type) + 2;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "27", "2", interval + "");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "27", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list) {
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("reservationCount", one.getResult2().longValue());
                totalList.add(map);
            }
            map.put("reservationCount", one.getResult2().longValue());
            totalList.add(map);
        }
        return new JSONArray(totalList);
    }
@ -3192,19 +3286,21 @@ public class StatisticsESService {
        startDate = elasticsearchUtil.changeTime(startDate + " 00:00:00");
        endDate = elasticsearchUtil.changeTime(endDate + " 23:59:59");
        Integer interval = Integer.parseInt(type) + 2;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "5", "2", interval + "");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "5", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list) {
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("guidanceCount", one.getResult2().longValue());
                totalList.add(map);
            }
            map.put("guidanceCount", one.getResult2().longValue());
            totalList.add(map);
        }
        return new JSONArray(totalList);
    }
@ -3327,6 +3423,10 @@ public class StatisticsESService {
                }
            }
        }
        //团队翻译
        if(SaveModel.teamLevel.equals(lowlevel)){
            translateTeamLeaderName(rs);
        }
        Collections.sort(rs, new Comparator<Map<String, Object>>() {
            public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                Integer map1value = Integer.valueOf(String.valueOf(o1.get("val")));
@ -4084,4 +4184,6 @@ public class StatisticsESService {
        resultJSON.put("rs", json);
        return resultJSON;
    }
}

+ 29 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.call;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.entity.message.Message;
@ -46,13 +47,12 @@ public class CustomerService extends BaseService{
				" s.create_time AS createTime, " +
				" s.user, " +
				" s.user_name AS userName ," +
				" s.create_Time AS createTime ," +
				" p.sex," +
				" p.photo," +
				" TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age" +
				" FROM " +
				" manage_call_service s " +
				" LEFT JOIN wlyy_patient p ON s.code = s.patient" +
				" LEFT JOIN wlyy_patient p ON p.code = s.patient" +
				" WHERE " +
				" s.state >0 ";
		if(StringUtils.isNotBlank(keyword)){
@ -116,6 +116,13 @@ public class CustomerService extends BaseService{
		CallService callService = callServiceDao.findByCode(code);
		CallRecord callRecord = callRecordDao.findByCode(callService.getCallCode());
		Map<String,Object> rs = new HashedMap();
		String id = callRecord.getIdcard();
		if(StringUtils.isNotBlank(id)){
			String idCard = id.substring(0,id.length()-10)+"*******"+id.substring(id.length()-2,id.length());
			callRecord.setIdcard(idCard);
			callService.setIdcard(idCard);
		}
		rs.put("callService",callService);
		rs.put("callRecord",callRecord);
		return rs;
@ -129,6 +136,15 @@ public class CustomerService extends BaseService{
		 callService.setDealTime(new Date());
		 callService.setState(2);
		 callServiceDao.save(callService);
		List<Message> mes = messageDao.findByCallServiceRelationCode(code);
		if(mes!=null&&mes.size()>0){
			for(Message m :mes){
				m.setOver("0");
				m.setRead(0);
				messageDao.save(m);
			}
		}
		return "1";
	}
@ -145,7 +161,7 @@ public class CustomerService extends BaseService{
	 * @param orderHospital
     * @return
     */
	public String dealAppointCallService(String type ,String code,Integer dealReason,String dealContent, String orderHospital,String orderHospitalName,String orderDept,String orderDeptName,String orderDoctor,String orderDoctorName,String orderTime){
	public String dealAppointCallService(String type ,String code,Integer dealReason,String dealContent, String orderHospital,String orderHospitalName,String orderDept,String orderDeptName,String orderDoctor,String orderDoctorName,String orderTime,String registerTime){
		CallService cs = callServiceDao.findByCode(code);
		//预约成功
		if("1".equals(type)){
@ -158,6 +174,7 @@ public class CustomerService extends BaseService{
			cs.setOrderHospitalName(orderHospitalName);
			cs.setOrderTime(orderTime);
			cs.setDealTime(new Date());
			cs.setRegisterTime(new Date());
			cs.setDealState(1);
		//预约失败
		}else{
@ -168,6 +185,15 @@ public class CustomerService extends BaseService{
			cs.setDealContent(dealContent);
		}
		callServiceDao.save(cs);
		List<Message> mes = messageDao.findByCallServiceRelationCode(code);
		if(mes!=null&&mes.size()>0){
			for(Message m :mes){
				m.setOver("0");
				m.setRead(0);
				messageDao.save(m);
			}
		}
		return "1";
	}
}

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -142,7 +142,9 @@ public class PatientService extends TokenService {
            patient.setOpenidTime(new Date());
        }
        //System.out.println("========openid=======");
        patient.setOpenid(openid);
        if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
            patient.setOpenid(openid);
        }
        Patient ps = patientDao.save(patient);
        System.out.print(new JSONObject(ps));
        if (StringUtils.isNotEmpty(patient.getOpenid())) {

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

@ -82,33 +82,33 @@ public class OnePayService {
    /**
     * 查询绑卡信息(本人)
     */
    public BindCard bindCard(String patient, String openid) throws Exception {
        BindCard card = ownerCard(openid);
        //更新患者信息
        if (card != null) {
            Patient p = patientDao.findByCode(patient);
            p.setOpenid(openid);
            p.setSsc(card.getAttachCardNo());
//            增加绑定电子社保卡信息
            p.setSicardStatus(1);
            if (p.getSicardTime() == null) {
                p.setSicardTime(new Date());
            }
            ;
            if (card.getAttachIdType() == "01")      //身份证
            {
                p.setIdcard(card.getAttachIdNo());
            }
            if (!card.getAttachName().equals(p.getName())) {
                System.out.print("姓名不一致,姓名:" + p.getName() + "  社保姓名:" + card.getAttachName());
            }
            patientDao.save(p);
        }
        return card;
    }
//    public BindCard bindCard(String patient, String openid) throws Exception {
//        BindCard card = ownerCard(openid);
//
//        //更新患者信息
//        if (card != null) {
//            Patient p = patientDao.findByCode(patient);
//            p.setOpenid(openid);
//            p.setSsc(card.getAttachCardNo());
////            增加绑定电子社保卡信息
//            p.setSicardStatus(1);
//            if (p.getSicardTime() == null) {
//                p.setSicardTime(new Date());
//            }
//            ;
//            if (card.getAttachIdType() == "01")      //身份证
//            {
//                p.setIdcard(card.getAttachIdNo());
//            }
//            if (!card.getAttachName().equals(p.getName())) {
//                System.out.print("姓名不一致,姓名:" + p.getName() + "  社保姓名:" + card.getAttachName());
//            }
//
//            patientDao.save(p);
//        }
//
//        return card;
//    }
    /**
     * 查询绑卡信息(本人)
@ -694,7 +694,9 @@ public class OnePayService {
                //保存到患者表
                Patient p = patientDao.findByCode(patient);
                p.setOpenid(openid);
                if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
                    p.setOpenid(openid);
                }
//            增加绑定电子社保卡信息
                if (!"1".equals(p.getSicardStatus())){
                    p.setSicardTime(new Date());

+ 4 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java

@ -16,6 +16,7 @@ import org.springframework.util.ReflectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
@ApiResponses(value = {
@ -255,10 +256,12 @@ public class BaseController {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, list);
            return mapper.writeValueAsString(map);
            String s = mapper.writeValueAsString(map);
            return s;
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -278,10 +278,14 @@ public class WechatController extends WeixinBaseController {
            password = StringUtils.reverse(password);
            patient.setPassword(MD5.GetMD5Code(password + salt));
            patient.setSsc(ssc);
            if (!org.springframework.util.StringUtils.isEmpty(openid)) {
            if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            }
//            if (!org.springframework.util.StringUtils.isEmpty(openid)) {
//                patient.setOpenid(openid);
//                patient.setOpenidTime(new Date());
//            }
            JSONObject json = patientService.register(idcard, ssc, name, mobile, MD5.GetMD5Code(password + salt)
                    ,salt,openid,3);
            if (json != null) {

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java

@ -40,6 +40,7 @@ public class CallRecordController extends BaseController {
                                  @ApiParam(name="page",value="第几页,从1开始")@RequestParam(required = true)Integer page,
                                  @ApiParam(name="size",value="每页大小")@RequestParam(required = true)Integer size){
        try {
            return write(200,"保存成功","data",customerService.getCallServices(keyword, serverType,state,patientName,ssc,idCard,doctorName, code,adminTeamCode,startDate, endDate, page, size));
        }catch (Exception e){
            error(e);
@ -96,9 +97,10 @@ public class CallRecordController extends BaseController {
                                         @ApiParam(name="orderDeptName",value="科室")@RequestParam(required = false)String orderDeptName,
                                         @ApiParam(name="orderDoctor",value="预约医生编码")@RequestParam(required = false)String orderDoctor,
                                         @ApiParam(name="orderDoctorName",value="预约医生")@RequestParam(required = false)String orderDoctorName,
                                         @ApiParam(name="orderTime",value="预约时间,按需求格式拼接字符串")@RequestParam(required = false)String orderTime){
                                         @ApiParam(name="orderTime",value="预约时间,按需求格式拼接字符串")@RequestParam(required = false)String orderTime,
                                         @ApiParam(name="registerTime",value="挂号时间")@RequestParam(required = false)String registerTime){
        try {
            return write(200,"保存成功","data",customerService.dealAppointCallService( type , code, dealReason, dealContent,  orderHospital, orderHospitalName, orderDept, orderDeptName, orderDoctor, orderDoctorName, orderTime));
            return write(200,"保存成功","data",customerService.dealAppointCallService( type , code, dealReason, dealContent,  orderHospital, orderHospitalName, orderDept, orderDeptName, orderDoctor, orderDoctorName, orderTime,registerTime));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -805,7 +805,7 @@ public class ConsultController extends WeixinBaseController {
                    failed.add(String.valueOf(resObj.get("data")));
                    try {
                        //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                        Doctor doctor = doctorDao.findByCode(log.getDoctor());
                        Doctor doctor = doctorDao.findByCode(consultModel.getDoctor());
                        String doctorOpenID = doctor.getOpenid();
                        if (StringUtils.isNotEmpty(doctorOpenID)) {
                                String title = "";
@ -825,7 +825,7 @@ public class ConsultController extends WeixinBaseController {
                                    params.add(new BasicNameValuePair("url", targetUrl));
                                    params.add(new BasicNameValuePair("first",  first));
                                    params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                                    String keywords = title + "," + content +","+ log.getDoctorName();
                                    String keywords = title + "," + content +","+ doctor.getName();
                                    params.add(new BasicNameValuePair("keywords", keywords));
                                    httpClientUtil.post(url, params, "UTF-8");

+ 5 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -186,6 +186,7 @@ public class PatientDeviceController extends BaseController {
            return success("设备保存成功!");
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
@ -208,6 +209,7 @@ public class PatientDeviceController extends BaseController {
            return write(200, "查询成功", "data", list);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
@ -228,6 +230,7 @@ public class PatientDeviceController extends BaseController {
            mapList.put("device", device);
            return write(200, "查询成功", "data", mapList);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
@ -247,6 +250,7 @@ public class PatientDeviceController extends BaseController {
            List<Map<String, String>> list = patientDeviceService.getDeviceUser(getRepUID(), deviceSn, type);
            return write(200, "获取设备绑定信息成功!", "data", list);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
@ -274,6 +278,7 @@ public class PatientDeviceController extends BaseController {
                return error(-1, "不存在该设备!");
            }
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java

@ -218,6 +218,7 @@ public class HealthEduArticleController extends BaseController {
    @RequestMapping(value = "getDoctorArticalByUserId",method = RequestMethod.GET)
    @ApiOperation("获取医生发表的文章列表")
    @ResponseBody
    public String getDoctorArticalByUserId(@ApiParam(name = "doctorCode", value = "医生code")
                                           @RequestParam(value = "doctorCode", required = true) String doctorCode,
                                           @ApiParam(name = "articleTitle", value = "文章标题")

+ 25 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -29,10 +29,10 @@ import java.util.Map;
import java.util.TreeMap;
/**
 * Created by chenweida on 2017/10/13.
 * Created by chenweida on 2017/10/13
 */
@Controller
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@RequestMapping(value = "/esstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@Api(description = "ES统计查询")
public class EsStatisticsController extends BaseController {
@ -164,8 +164,12 @@ public class EsStatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
//                result.put("index_" + idx, statisticsService.getTotalAmount(startDate, endDate, area, level, idx, level2_type));
                result.put("index_" + idx, statisticsESService.getTotalAmount(startDate, endDate, area, level, idx, level2_type));
                if("3".equals(idx)){
                    //为了确保之前是咨询量是准确的 所以咨询量用到达量不用增量累加
                    result.put("index_" + idx, statisticsESService.getTotalAmount3(startDate, endDate, area, level, idx, level2_type));
                }else{
                    result.put("index_" + idx, statisticsESService.getTotalAmount(startDate, endDate, area, level, idx, level2_type));
                }
            }
            return write(200, "查询成功", "data", result);
@ -356,6 +360,7 @@ public class EsStatisticsController extends BaseController {
                if(!"16".equals(idx)){
                    result.put("index_" + idx, statisticsESService.getIndexLevelTwototal(endDate, area, level, idx));
                }else{
                    //16的指标删除 改成 1和14
                    result.put("index_"+idx,statisticsESService.getPayPremiums(endDate,area,level));
                }
            }
@ -649,12 +654,16 @@ public class EsStatisticsController extends BaseController {
     * ②未回复数(数、率)----------当前未回复咨询数、以及相应比例
     * ③处理咨询回复时间分布---------全部咨询的首次回复咨询时间分布
     *
     * 备注:注解为Deprecated是因为前端代码全局搜索没有,并且本地代码没有调用该方法
     * 视为无效(2017-11-21)
     *
     * @param level 查询的等级,按市、区、机构
     * @param area  查询的等级对应Code
     * @return
     */
    @RequestMapping("/Consulting_Stat")
    @ResponseBody
    @Deprecated
    public String getConsultingStatistics(@RequestParam(required = true) Integer level,
                                          @RequestParam(required = true) String area) {
@ -765,11 +774,13 @@ public class EsStatisticsController extends BaseController {
     * 获取绑定率
     * 1、选定绑定微信指标,下面排行内,在绑定微信数后新增:"绑定率:xx.22%"
     * 2、绑定率=绑定数/已签约数
     *
     *备注:注解为Deprecated是因为前端代码全局搜索没有,并且本地代码没有调用该方法
     * 视为无效(2017-11-21)
     * @return
     */
    @RequestMapping("/bindingRate_stat")
    @ResponseBody
    @Deprecated
    public String getBindingRate() {
        try {
            return write(200, "查询成功", "data", statisticsESService.getBindingRate());
@ -1049,7 +1060,7 @@ public class EsStatisticsController extends BaseController {
    }
    /**
     * 获取团队随访量折线统计图(弃用)
     * 获取团队随访量折线统计图
     *
     * @param type
     * @param teamCode
@ -1064,7 +1075,7 @@ public class EsStatisticsController extends BaseController {
                                      @RequestParam(required = true) String startDate,
                                      @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamFollowupLine(teamCode, startDate, endDate, type));
            return write(200, "查询成功", "data", statisticsESService.getTeamFollowupLine(teamCode, startDate, endDate, type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1342,7 +1353,7 @@ public class EsStatisticsController extends BaseController {
                                 @RequestParam(required = true) String endDate,
                                 @RequestParam(required = true) String type) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamEduLine(teamCode, startDate, endDate, type));
            return write(200, "查询成功", "data", statisticsESService.getTeamEduLine(teamCode, startDate, endDate, type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1445,8 +1456,14 @@ public class EsStatisticsController extends BaseController {
        }
    }
    /**
     * 备注:注解为Deprecated是因为前端代码全局搜索没有,并且本地代码没有调用该方法
     * 视为无效(2017-11-21).
     * @return
     */
    @RequestMapping("/cleanDoctorScore")
    @ResponseBody
    @Deprecated
    public String cleanDoctorScore() {
        try {
            return write(200, "清洗完成", "data", statisticsAllService.cleanDoctorScore());

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -26,10 +26,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*;
/**
 * Created by lyr on 2016/08/16.
 * Created by lyr on 2016/08/16
 */
@Controller
@RequestMapping(value = "/oldstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@Api(description = "统计")
public class StatisticsController extends BaseController {

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

@ -771,7 +771,7 @@ public class OnePayController extends WeixinBaseController {
                String outChargeNo = code.get("code").toString();
                pay.chargeQuery(outChargeNo,getAccessToken());
            }*/
            String url = doctorAssistant + "/wllyy/feldsher/sendDoctorTemplates";
            String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("type", "5"));
            params.add(new BasicNameValuePair("openId", "orrOgwATDaljVunlAq_Tdx3imhYg"));

+ 2 - 2
patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

@ -3,11 +3,11 @@ spring:
  profiles: prod
  datasource:
    wlyy:
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:9069/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    health:
      url: jdbc:mysql://59.61.92.90:8079/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:9069/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123