Forráskód Böngészése

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

wujunjie 7 éve
szülő
commit
7c69c60dc0
18 módosított fájl, 356 hozzáadás és 266 törlés
  1. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  2. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  3. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  4. 20 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  5. 1 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  6. 48 35
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  7. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionExpressageDao.java
  8. 9 11
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  9. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  10. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  11. 25 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  12. 53 24
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java
  13. 139 157
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  14. 27 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java
  15. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java
  16. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java
  17. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  18. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

+ 1 - 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 type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民,3.预约失败
    private String dealContent; // 处理内容
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private String orderHospital; //预约医院code
    private String orderHospital; //预约医院code

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

@ -404,12 +404,12 @@ public class Prescription extends IdEntity {
         wait_pay("开方完成/待支付", 20),
         wait_pay("开方完成/待支付", 20),
         pay_error("支付失败", 21),
         pay_error("支付失败", 21),
         pay_success("支付成功/待配药", 30),
         wait_expressage("配药成功/待配送", 40),
         wait_expressage("配药成功/待配送", 40),
         expressageing_error("配送失败", 41),
         expressageing_error("配送失败", 41),
         expressageJGS("分配健管师", 42),
         expressageJGS("分配健管师", 42),
         expressageing("配送中", 45),
         expressageing("配送中", 45),
         pay_success("支付成功/待配药", 50),
         expressage2hospital("配送到服务站", 49),
         expressage2hospital("配送到服务站", 49),
         finish("配送到患者手中/已完成", 100);
         finish("配送到患者手中/已完成", 100);
         */
         */

+ 1 - 1
patient-co-manage/wlyy-manage/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 type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民,3预约失败
    private String dealContent; // 处理内容
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private String orderHospital; //预约医院code
    private String orderHospital; //预约医院code

+ 20 - 4
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.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.repository.DoctorDao;
import com.yihu.wlyy.repository.MessageDao;
import com.yihu.wlyy.repository.MessageDao;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.UserDao;
import com.yihu.wlyy.repository.UserDao;
@ -56,6 +57,8 @@ public class CustomerService extends BaseService{
	private JdbcTemplate jdbcTemplate;
	private JdbcTemplate jdbcTemplate;
	@Autowired
	@Autowired
	private MessageDao messageDao;
	private MessageDao messageDao;
	@Autowired
	private DoctorDao doctorDao;
	@Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
	@Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
	private String messageApi;
	private String messageApi;
@ -408,11 +411,18 @@ public class CustomerService extends BaseService{
		callService.setUser(user);
		callService.setUser(user);
		User u = userDao.findByCode(user);
		User u = userDao.findByCode(user);
		callService.setUserName(u.getName());
		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);
		callServiceDao.save(callService);
		//待处理发送消息给医生
		//待处理发送消息给医生
		if(callService.getState()==1){
		if(callService.getState()==1){
			Patient p = patientDao.findByCode(callService.getPatient());
			// 添加签约消息
			// 添加签约消息
			Message message = new Message();
			Message message = new Message();
			message.setCzrq(new Date());
			message.setCzrq(new Date());
@ -429,7 +439,7 @@ public class CustomerService extends BaseService{
			message.setReadonly(1);//是否只读消息
			message.setReadonly(1);//是否只读消息
			message.setSex(p.getSex());
			message.setSex(p.getSex());
			message.setOver("1");//未处理
			message.setOver("1");//未处理
			message.setDel("1");
			messageDao.save(message);
			messageDao.save(message);
		}
		}
@ -451,7 +461,12 @@ public class CustomerService extends BaseService{
			Message message = new Message();
			Message message = new Message();
			message.setCzrq(new Date());
			message.setCzrq(new Date());
			message.setCreateTime(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.setRead(1);//设置未读
			message.setReceiver(callService.getDoctor());//设置接受医生的code
			message.setReceiver(callService.getDoctor());//设置接受医生的code
			message.setSender(callService.getPatient());//设置发送的用户
			message.setSender(callService.getPatient());//设置发送的用户
@ -463,6 +478,7 @@ public class CustomerService extends BaseService{
			message.setReadonly(1);//是否只读消息
			message.setReadonly(1);//是否只读消息
			message.setSex(p.getSex());
			message.setSex(p.getSex());
			message.setOver("1");//未处理
			message.setOver("1");//未处理
			message.setDel("1");
			messageDao.save(message);
			messageDao.save(message);
		}
		}
@ -527,7 +543,7 @@ public class CustomerService extends BaseService{
			sql +=" AND (s.patient_name = '"+keyword+"' OR s.ssc ='"+keyword+"' OR s.Idcard ='"+keyword+"')";
			sql +=" AND (s.patient_name = '"+keyword+"' OR s.ssc ='"+keyword+"' OR s.Idcard ='"+keyword+"')";
		}
		}
		if(serverType!=null){
		if(serverType!=null){
			sql += " AND s.server_type ='"+serverType+"' " ;
			sql += " AND s.type ='"+serverType+"' " ;
		}
		}
		if(state != null){
		if(state != null){
			sql +=" AND s.state ='"+state+"'";
			sql +=" AND s.state ='"+state+"'";

+ 1 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java

@ -922,6 +922,7 @@ public class DeviceService {
                contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                contentPatient.put("needUpload","false");
                contentPatient.put("needUpload","false");
                contentPatient.put("healthindexid",result.getId());//体征记录 ID
            
            
                //患者发送Im消息
                //患者发送Im消息
                ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
                ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);

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

@ -341,7 +341,13 @@ public class PrescriptionService extends ZysoftBaseService{
                Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
                Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
                if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue())){
                if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue())){
                    prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    
                    if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                    } else{
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    }
                    
                    prescription.setDrugDeliveryTime(new Date());
                    prescription.setDrugDeliveryTime(new Date());
                    prescriptionDao.save(prescription);
                    prescriptionDao.save(prescription);
@ -356,44 +362,51 @@ public class PrescriptionService extends ZysoftBaseService{
                    log.setHospitalName(prescription.getHospitalName());
                    log.setHospitalName(prescription.getHospitalName());
                    log.setUserName(prescription.getDoctorName());
                    log.setUserName(prescription.getDoctorName());
                    log.setFlag(1);
                    log.setFlag(1);
                    log.setRemark("配药成功");
                    log.setUserCode(prescription.getDoctor());
                    log.setUserCode(prescription.getDoctor());
                    log.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    prescriptionLogDao.save(log);
                    //健管师配送
                    PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(prescription.getCode());
                    if(StringUtils.isNotBlank(expressage.getExpressageCode())){
                        Message message = new Message();
                        message.setCzrq(new Date());
                        message.setCreateTime(new Date());
                        message.setRead(1);//设置未读
                        message.setOver("1");
                        message.setReceiver(expressage.getExpressageCode());
                        message.setSender("system");
                        message.setCode(getCode());
                        message.setSenderName("系统");
                        message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                        message.setContent("您有一条新的续方订单待取药!");
                        message.setType(7);//续方订单待取药
                        message.setReadonly(1);//是否只读消息
                        message.setDel("1");
                        message.setRelationCode(prescription.getCode());
                        message.setPrescriptionStatus("0");//待取药
                        message.setData(prescription.getAdminTeamId()+"");
                        messageDao.save(message);
                    }
                    //判断提示健管师有续方代配送,居民待取药
                    JSONObject message = new JSONObject();
                    message.put("title","dispensingComplete");
                    message.put("state",1);
                    message.put("prescription",prescription.getCode());
                    message.put("mes","success");
                    if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        log.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                        log.setRemark("快递配送:配药成功,配送中");
                        prescriptionLogDao.save(log);
                    } else{
                        log.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                        log.setRemark("配药成功");
                        prescriptionLogDao.save(log);
    
                        //健管师配送
                        PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(prescription.getCode());
                        if(StringUtils.isNotBlank(expressage.getExpressageCode())){
                            Message message = new Message();
                            message.setCzrq(new Date());
                            message.setCreateTime(new Date());
                            message.setRead(1);//设置未读
                            message.setOver("1");
                            message.setReceiver(expressage.getExpressageCode());
                            message.setSender("system");
                            message.setCode(getCode());
                            message.setSenderName("系统");
                            message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                            message.setContent("您有一条新的续方订单待取药!");
                            message.setType(7);//续方订单待取药
                            message.setReadonly(1);//是否只读消息
                            message.setDel("1");
                            message.setRelationCode(prescription.getCode());
                            message.setPrescriptionStatus("0");//待取药
                            message.setData(prescription.getAdminTeamId()+"");
                            messageDao.save(message);
                        }
    
                        //判断提示健管师有续方代配送,居民待取药
                        JSONObject message = new JSONObject();
                        message.put("title","dispensingComplete");
                        message.put("state",1);
                        message.put("prescription",prescription.getCode());
                        message.put("mes","success");
//                redisTemplate.convertAndSend(channelTopic,message.toString());
//                redisTemplate.convertAndSend(channelTopic,message.toString());
//                redisTemplate.watch(channelTopic);
//                redisTemplate.watch(channelTopic);
                    redisTemplate.opsForList().leftPush(channelTopic,message.toString());
                        redisTemplate.opsForList().leftPush(channelTopic,message.toString());
//                redisTemplate.unwatch();
//                redisTemplate.unwatch();
                    }
                }else {
                }else {
                    error = "code:"+prescription.getCode()+",status:"+prescription.getStatus();
                    error = "code:"+prescription.getCode()+",status:"+prescription.getStatus();
                }
                }

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

@ -16,7 +16,7 @@ public interface PrescriptionExpressageDao extends PagingAndSortingRepository<Pr
    @Query("from PrescriptionExpressage p where p.prescriptionCode=?1")
    @Query("from PrescriptionExpressage p where p.prescriptionCode=?1")
    PrescriptionExpressage findByPrescriptionPay(String prescriptionCode);
    PrescriptionExpressage findByPrescriptionPay(String prescriptionCode);
    @Query(value = "select p.* FROM wlyy_prescription_expressage p LEFT JOIN wlyy_prescription a on a.code = p.prescription_code where a.status = 30 and p.mobile is null",nativeQuery = true)
    @Query(value = "select p.* FROM wlyy_prescription_expressage p LEFT JOIN wlyy_prescription a on a.code = p.prescription_code where a.status >= 50 and p.mobile is null",nativeQuery = true)
    List<PrescriptionExpressage> findByPrescriptionPaidExpressOrderFail();
    List<PrescriptionExpressage> findByPrescriptionPaidExpressOrderFail();
    @Query("from PrescriptionExpressage p where p.mailno=?1")
    @Query("from PrescriptionExpressage p where p.mailno=?1")

+ 9 - 11
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -42,26 +42,24 @@ public class PrescriptionExpressageService {
    /**
    /**
     * 1,保存快递单号增
     * 1,保存快递单号增
     * 2,加处方物流记录为配送
     * 2,加处方物流记录为配送
     * 3,修改处方状态为配送配送中
     *
     * @param prescriptionExpressage
     * @param prescriptionExpressage
     * @throws Exception
     * @throws Exception
     */
     */
    public void updatePrescriptionExpressage(PrescriptionExpressage prescriptionExpressage) throws Exception {
    public void updatePrescriptionExpressage(PrescriptionExpressage prescriptionExpressage) throws Exception {
        //修改处方状态为配送配送中
        //修改处方状态为配送配送中
        prescriptionDao.updateStatus(prescriptionExpressage.getPrescriptionCode(),65);
//        prescriptionDao.updateStatus(prescriptionExpressage.getPrescriptionCode(),65);
        //保存处方物流记录
        //保存处方物流记录
        prescriptionExpressageDao.save(prescriptionExpressage);
        prescriptionExpressageDao.save(prescriptionExpressage);
        //保存配送日志
        //保存配送日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setPrescriptionCode(prescriptionExpressage.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.sf.getValue());
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        prescriptionLogDao.save(prescriptionLog);
//        PrescriptionLog prescriptionLog = new PrescriptionLog();
//        prescriptionLog.setPrescriptionCode(prescriptionExpressage.getPrescriptionCode());
//        prescriptionLog.setCode(UUID.randomUUID().toString());
//        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.sf.getValue());
//        prescriptionLog.setCreateTime(new Date());
//        prescriptionLog.setFlag(1);
//        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
//        prescriptionLogDao.save(prescriptionLog);
    }
    }
}
}

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -62,7 +62,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @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")
    @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);
    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);
    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' ")
    @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  ")
    @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);
    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);
    List<Message> findByReceiverCallService(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 ")
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 ")
    List<Message> getMessageByType(String doctor, Integer type, Pageable pageRequest);
    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);
}
}

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

@ -624,42 +624,49 @@ public class PatientHealthIndexService extends BaseService {
                        obj.put("value1", data);
                        obj.put("value1", data);
                        obj.put("time1", recordDate);
                        obj.put("time1", recordDate);
                        obj.put("id1", id);
                        obj.put("id1", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn1", deviceSn);
                        obj.put("deviceSn1", deviceSn);
                        hadData = true;
                        hadData = true;
                    } else if (dataType.equals("2")) {
                    } else if (dataType.equals("2")) {
                        obj.put("value2", data);
                        obj.put("value2", data);
                        obj.put("time2", recordDate);
                        obj.put("time2", recordDate);
                        obj.put("id2", id);
                        obj.put("id2", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn2", deviceSn);
                        obj.put("deviceSn2", deviceSn);
                        hadData = true;
                        hadData = true;
                    } else if (dataType.equals("3")) {
                    } else if (dataType.equals("3")) {
                        obj.put("value3", data);
                        obj.put("value3", data);
                        obj.put("time3", recordDate);
                        obj.put("time3", recordDate);
                        obj.put("id3", id);
                        obj.put("id3", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn3", deviceSn);
                        obj.put("deviceSn3", deviceSn);
                        hadData = true;
                        hadData = true;
                    } else if (dataType.equals("4")) {
                    } else if (dataType.equals("4")) {
                        obj.put("value4", data);
                        obj.put("value4", data);
                        obj.put("time4", recordDate);
                        obj.put("time4", recordDate);
                        obj.put("id4", id);
                        obj.put("id4", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn4", deviceSn);
                        obj.put("deviceSn4", deviceSn);
                        hadData = true;
                        hadData = true;
                    } else if (dataType.equals("5")) {
                    } else if (dataType.equals("5")) {
                        obj.put("value5", data);
                        obj.put("value5", data);
                        obj.put("time5", recordDate);
                        obj.put("time5", recordDate);
                        obj.put("id5", id);
                        obj.put("id5", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn5", deviceSn);
                        obj.put("deviceSn5", deviceSn);
                        hadData = true;
                        hadData = true;
                    } else if (dataType.equals("6")) {
                    } else if (dataType.equals("6")) {
                        obj.put("value6", data);
                        obj.put("value6", data);
                        obj.put("time6", recordDate);
                        obj.put("time6", recordDate);
                        obj.put("id6", id);
                        obj.put("id6", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn6", deviceSn);
                        obj.put("deviceSn6", deviceSn);
                        hadData = true;
                        hadData = true;
                    } else if (dataType.equals("7")) {
                    } else if (dataType.equals("7")) {
                        obj.put("value7", data);
                        obj.put("value7", data);
                        obj.put("time7", recordDate);
                        obj.put("time7", recordDate);
                        obj.put("id7", id);
                        obj.put("id7", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn7", deviceSn);
                        obj.put("deviceSn7", deviceSn);
                        hadData = true;
                        hadData = true;
                    }
                    }
@ -934,6 +941,7 @@ public class PatientHealthIndexService extends BaseService {
                contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                contentPatient.put("needUpload","false");
                contentPatient.put("needUpload","false");
                contentPatient.put("healthindexid",result.getId());//体征记录 ID
                
                
                //患者发送Im消息
                //患者发送Im消息
                ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
                ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
@ -1204,6 +1212,7 @@ public class PatientHealthIndexService extends BaseService {
            for (Map<String, Object> map : list) {
            for (Map<String, Object> map : list) {
                JSONObject json = new JSONObject();
                JSONObject json = new JSONObject();
                json.put("id", map.get("id"));
                json.put("id", map.get("id"));
                json.put("healthindexid", map.get("id"));
                json.put("patient", map.get("user"));
                json.put("patient", map.get("user"));
                json.put("value1", map.get("value1"));
                json.put("value1", map.get("value1"));
                json.put("value2", map.get("value2"));
                json.put("value2", map.get("value2"));

+ 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.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ElasticsearchUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
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.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
@ -27,6 +30,8 @@ import java.util.*;
@Service
@Service
@Transactional
@Transactional
public class PrescriptionExpressageService extends BaseService {
public class PrescriptionExpressageService extends BaseService {
    private Logger logger = LoggerFactory.getLogger(ElasticsearchUtil.class);
    @Autowired
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    @Autowired
@ -559,23 +564,28 @@ public class PrescriptionExpressageService extends BaseService {
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
            prescriptionLogDao.save(prescriptionLog);
            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 "1";
        }
        }
        return "0";
        return "0";

+ 53 - 24
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java

@ -200,6 +200,7 @@ public class PrescriptionFollowupContentService extends BaseService {
			jsonObject1.put("statue","2");//1已填写,2未填写
			jsonObject1.put("statue","2");//1已填写,2未填写
			jsonObject1.put("createtime","");
			jsonObject1.put("createtime","");
		}
		}
		jsonObject1.put("typevalue","1");
		result.add(jsonObject1);
		result.add(jsonObject1);
		
		
		JSONObject jsonObject2 = new JSONObject();
		JSONObject jsonObject2 = new JSONObject();
@ -214,6 +215,7 @@ public class PrescriptionFollowupContentService extends BaseService {
			jsonObject2.put("statue","2");//1已填写,2未填写
			jsonObject2.put("statue","2");//1已填写,2未填写
			jsonObject2.put("createtime","");
			jsonObject2.put("createtime","");
		}
		}
		jsonObject2.put("typevalue","2,4");
		result.add(jsonObject2);
		result.add(jsonObject2);
		
		
		return result;
		return result;
@ -300,9 +302,12 @@ public class PrescriptionFollowupContentService extends BaseService {
		String sql = "select sum(category_code) amount FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
		String sql = "select sum(category_code) amount FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
		List<Map<String,Object>> result =  jdbcTemplate.queryForList(sql);
		List<Map<String,Object>> result =  jdbcTemplate.queryForList(sql);
		if (result != null && result.size() > 0) {
		if (result != null && result.size() > 0) {
			total = (result.get(0).get("amount") != null ? Integer.parseInt(result.get(0).get("amount").toString()) : 0);
			if(result.get(0).get("amount") != null){
				Double amount = new Double(result.get(0).get("amount").toString());
				total = (result.get(0).get("amount") != null ? amount.intValue() : 0);
			}
		}
		}
		if(total != 1 || total != 3){
		if(total != 1 && total !=3){
			contentDoctor.put("deviceMsg","您未绑定血糖智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
			contentDoctor.put("deviceMsg","您未绑定血糖智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
		}
		}
		
		
@ -364,7 +369,7 @@ public class PrescriptionFollowupContentService extends BaseService {
			
			
			FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"3");
			FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"3");
			
			
			if(followupContentESDO != null){
			if(followupContentESDO == null){
				followUpService.esSaveFollowupProjectData(followup_id, "3", followupProjectData);
				followUpService.esSaveFollowupProjectData(followup_id, "3", followupProjectData);
			}else{
			}else{
				FollowupContentESDO newfollowupContentESDO = JSON.parseObject(followupProjectData, FollowupContentESDO.class);
				FollowupContentESDO newfollowupContentESDO = JSON.parseObject(followupProjectData, FollowupContentESDO.class);
@ -401,6 +406,8 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("needUpload","false");
				contentPatient.put("needUpload","false");
				contentPatient.put("type",2);
				contentPatient.put("type",2);
				contentPatient.put("healthindexid",obj.getString("healthindexid"));
				
				
				
				//患者发送Im消息
				//患者发送Im消息
				ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
				ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
@ -421,6 +428,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("tzMsg", "体征记录:无");
				contentPatient.put("tzMsg", "体征记录:无");
				contentPatient.put("tzTime", "检测时间:");
				contentPatient.put("tzTime", "检测时间:");
				contentPatient.put("tzAlert","温馨提示:居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
				contentPatient.put("tzAlert","温馨提示:居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
				contentPatient.put("patientAlert","温馨提示:您近30天未上传血糖体征数据,您可以");
				contentPatient.put("needUpload","true");
				contentPatient.put("needUpload","true");
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("type",2);
				contentPatient.put("type",2);
@ -466,7 +474,7 @@ public class PrescriptionFollowupContentService extends BaseService {
			
			
			if(devicePatientHealthIndex != null){
			if(devicePatientHealthIndex != null){
				org.json.JSONObject json = new org.json.JSONObject();
				org.json.JSONObject json = new org.json.JSONObject();
				json.put("id", devicePatientHealthIndex.getId());
				json.put("healthindexid", devicePatientHealthIndex.getId());
				json.put("patient",devicePatientHealthIndex.getUser());
				json.put("patient",devicePatientHealthIndex.getUser());
				json.put("value1", devicePatientHealthIndex.getValue1());
				json.put("value1", devicePatientHealthIndex.getValue1());
				json.put("value2", devicePatientHealthIndex.getValue2());
				json.put("value2", devicePatientHealthIndex.getValue2());
@ -501,9 +509,12 @@ public class PrescriptionFollowupContentService extends BaseService {
		String sql = "select sum(category_code) amount FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
		String sql = "select sum(category_code) amount FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
		List<Map<String,Object>> result =  jdbcTemplate.queryForList(sql);
		List<Map<String,Object>> result =  jdbcTemplate.queryForList(sql);
		if (result != null && result.size() > 0) {
		if (result != null && result.size() > 0) {
			total = (result.get(0).get("amount") != null ? Integer.parseInt(result.get(0).get("amount").toString()) : 0);
			if(result.get(0).get("amount") != null){
				Double amount = new Double(result.get(0).get("amount").toString());
				total = (result.get(0).get("amount") != null ? amount.intValue() : 0);
			}
		}
		}
		if(total != 2 || total != 3){
		if(total != 2 && total !=3 ){
			contentDoctor.put("deviceMsg","您未绑定血压智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
			contentDoctor.put("deviceMsg","您未绑定血压智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
		}
		}
		
		
@ -516,7 +527,7 @@ public class PrescriptionFollowupContentService extends BaseService {
			
			
			FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"2");
			FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"2");
			
			
			if(followupContentESDO != null){
			if(followupContentESDO == null){
				followUpService.esSaveFollowupProjectData(followup_id, "2", followupProjectData);
				followUpService.esSaveFollowupProjectData(followup_id, "2", followupProjectData);
			}else{
			}else{
				followupContentESDO.setBP_D(jsonObject.getString("value1"));
				followupContentESDO.setBP_D(jsonObject.getString("value1"));
@ -544,6 +555,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("needUpload","false");
				contentPatient.put("needUpload","false");
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("type",1);
				contentPatient.put("type",1);
				contentPatient.put("healthindexid",jsonObject.get("healthindexid"));
				
				
				//患者发送Im消息
				//患者发送Im消息
				ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
				ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
@ -565,6 +577,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("tzMsg", "体征记录:无");
				contentPatient.put("tzMsg", "体征记录:无");
				contentPatient.put("tzTime", "检测时间:");
				contentPatient.put("tzTime", "检测时间:");
				contentPatient.put("tzAlert","温馨提示:居民近30天未上传血压体征数据,已通知居民上传数据,请耐心等待");
				contentPatient.put("tzAlert","温馨提示:居民近30天未上传血压体征数据,已通知居民上传数据,请耐心等待");
				contentPatient.put("patientAlert","温馨提示:您近30天未上传血压体征数据,您可以");
				contentPatient.put("needUpload","true");
				contentPatient.put("needUpload","true");
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("type",1);
				contentPatient.put("type",1);
@ -615,38 +628,54 @@ public class PrescriptionFollowupContentService extends BaseService {
		}else if("2".equals(type)){
		}else if("2".equals(type)){
			//2体征
			//2体征
			Map<String, String> datamap2 = new HashMap<>();
			Map<String, String> datamap2 = new HashMap<>();
			
			List<PrescriptionFollowupContent>  list2 = prescriptionFollowupContentDao.findByPrescriptionCodeAndFollowupProject(prescriptioncode,"2");
			List<PrescriptionFollowupContent>  list2 = prescriptionFollowupContentDao.findByPrescriptionCodeAndFollowupProject(prescriptioncode,"2");
			
			
			if(!list2.isEmpty()){
			if(!list2.isEmpty()){
				for (PrescriptionFollowupContent prescriptionFollowupContent: list2) {
				for (PrescriptionFollowupContent prescriptionFollowupContent: list2) {
					datamap2.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
					if(StringUtils.isNotBlank(prescriptionFollowupContent.getFollowupValue())){
						datamap2.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
					}
				}
				}
			}
			}
			//近30天血压
			String stardate = DateUtil.getNextMonth(new Date(),-1)+" 00:00:00";
			String enddate = DateUtil.getStringDateShort()+" 23:59:59";
			org.json.JSONArray jsonArray = healthIndexService.findIndexByPatient(patientCode, 2, stardate, enddate, 0, 2);
			if(jsonArray.length() > 0){
				org.json.JSONObject jsonObject = jsonArray.getJSONObject(0);
				datamap2.put("BP_D",jsonObject.getString("value1"));
				datamap2.put("BP_U",jsonObject.getString("value2"));
			}
			followUpService.esSaveFollowupProjectData(followup_id, "2", JSON.toJSONString(datamap2));
			
			
			//判断随访中是否已经有体征的相关数据
			FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"2");
			if(followupContentESDO == null){
				//如果没有,则自动获取近30天的血压
				//近30天血压
				String stardate = DateUtil.getNextMonth(new Date(),-1)+" 00:00:00";
				String enddate = DateUtil.getStringDateShort()+" 23:59:59";
				org.json.JSONArray jsonArray = healthIndexService.findIndexByPatient(patientCode, 2, stardate, enddate, 0, 2);
				if(jsonArray.length() > 0){
					org.json.JSONObject jsonObject = jsonArray.getJSONObject(0);
					datamap2.put("BP_D",jsonObject.getString("value1"));
					datamap2.put("BP_U",jsonObject.getString("value2"));
				}
			}else{
				datamap2.put("BP_D",followupContentESDO.getBP_D());
				datamap2.put("BP_U",followupContentESDO.getBP_U());
			}
			//保存随访体征数据
			if(!datamap2.isEmpty()){
				followUpService.esSaveFollowupProjectData(followup_id, "2", JSON.toJSONString(datamap2));
			}
			
			
			Map<String, String> datamap3 = new HashMap<>();
			Map<String, String> datamap3 = new HashMap<>();
			List<PrescriptionFollowupContent>  list3 = prescriptionFollowupContentDao.findByPrescriptionCodeAndFollowupProject(prescriptioncode,"4");
			List<PrescriptionFollowupContent>  list3 = prescriptionFollowupContentDao.findByPrescriptionCodeAndFollowupProject(prescriptioncode,"4");
			
			
			if(!list3.isEmpty()){
			if(!list3.isEmpty()){
				for (PrescriptionFollowupContent prescriptionFollowupContent: list3) {
				for (PrescriptionFollowupContent prescriptionFollowupContent: list3) {
					datamap3.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
					if(StringUtils.isNotBlank(prescriptionFollowupContent.getFollowupValue())){
						datamap3.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
					}
				}
				}
			}
			}
			followUpService.esSaveFollowupProjectData(followup_id, "4", JSON.toJSONString(datamap3));
		
			
			//保证生活方式
			if(!datamap3.isEmpty()){
				followUpService.esSaveFollowupProjectData(followup_id, "4", JSON.toJSONString(datamap3));
			}
		}else{}
		}else{}
	}
	}

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

@ -1334,12 +1334,11 @@ public class StatisticsESService {
        }
        }
        return rs;
        return rs;
    }
    }
    public List translateTeamLeaderNameListMap(List<Map<String, Object>> rs) {
    public List translateTeamLeaderNameListMap(List<Map<String,Object>> rs) {
        Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders();
        Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders();
        if (rs != null) {
        if (rs != null) {
            for (int i = 0; i < rs.size(); i++) {
            for (int i = 0; i < rs.size(); i++) {
                Map<String, Object> r = rs.get(i);
                Map<String,Object> r = rs.get(i);
                Integer id = Integer.valueOf(r.get("code").toString());
                Integer id = Integer.valueOf(r.get("code").toString());
                String name = getTeamLeaderNameByTeamCode(leaders, id);
                String name = getTeamLeaderNameByTeamCode(leaders, id);
                if (org.apache.commons.lang3.StringUtils.isNotBlank(name)) {
                if (org.apache.commons.lang3.StringUtils.isNotBlank(name)) {
@ -1349,7 +1348,6 @@ public class StatisticsESService {
        }
        }
        return rs;
        return rs;
    }
    }
    public JSONArray translateTeamLeaderNameByCode(JSONArray rs) {
    public JSONArray translateTeamLeaderNameByCode(JSONArray rs) {
        Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders();
        Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders();
        if (rs != null) {
        if (rs != null) {
@ -2426,7 +2424,7 @@ public class StatisticsESService {
     * @return
     * @return
     */
     */
    private JSONArray getLevel2JsonObjectForRedis(String index, String level, String code, String timeKey) throws Exception {
    private JSONArray getLevel2JsonObjectForRedis(String index, String level, String code, String timeKey) throws Exception {
        List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(timeKey, timeKey, code, Integer.parseInt(level), index, SaveModel.timeLevel_DDL, "", "");
        List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(timeKey, timeKey,code, Integer.parseInt(level), index, SaveModel.timeLevel_DDL,"","");
//        JSONObject jo = new JSONObject();
//        JSONObject jo = new JSONObject();
        JSONArray switchJo = new JSONArray();
        JSONArray switchJo = new JSONArray();
        list.stream().forEach(one -> {
        list.stream().forEach(one -> {
@ -2736,19 +2734,6 @@ public class StatisticsESService {
        rs.put(signTotal);
        rs.put(signTotal);
        //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;
        if (saveModel21.getResult2().intValue() != 0) {
            avgCout = saveModel2.getResult1() / saveModel21.getResult2();
        }
        Map<String, Object> avgScore = new HashMap<>();
        avgScore.put("avgScore", avgCout);
        rs.put(avgScore);
        //4.获取咨詢數
        //4.获取咨詢數
        SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        Map<String, Object> consultCout = new HashMap<>();
        Map<String, Object> consultCout = new HashMap<>();
@ -2779,6 +2764,26 @@ public class StatisticsESService {
        followupCout.put("followupCount", saveModel7.getResult2().longValue());
        followupCout.put("followupCount", saveModel7.getResult2().longValue());
        rs.put(followupCout);
        rs.put(followupCout);
        //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");
        if (saveModel2.getResult1().intValue()!=0 && saveModel2.getResult2().intValue()!=0){
            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);
        return rs;
        return rs;
    }
    }
@ -2801,10 +2806,12 @@ public class StatisticsESService {
        List<Map<String, Object>> rs = new ArrayList<>();
        List<Map<String, Object>> rs = new ArrayList<>();
        for (SaveModel saveModel : list) {
        for (SaveModel saveModel : list) {
            Map<String, Object> map = new HashMap<>();
            map.put("applyDate", dateFormat3.format(saveModel.getQuotaDate()));
            map.put("signCount", saveModel.getResult2().longValue());
            rs.add(map);
            if(saveModel.getResult2().intValue()!=0){
                Map<String, Object> map = new HashMap<>();
                map.put("applyDate", dateFormat.format(saveModel.getQuotaDate()));
                map.put("signCount", saveModel.getResult2().longValue());
                rs.add(map);
            }
        }
        }
        JSONArray rsJs = new JSONArray(rs);
        JSONArray rsJs = new JSONArray(rs);
        return rsJs;
        return rsJs;
@ -2828,10 +2835,12 @@ public class StatisticsESService {
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "42", SaveModel.timeLevel_ZL, String.valueOf(Integer.parseInt(type) + 1));
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "42", SaveModel.timeLevel_ZL, String.valueOf(Integer.parseInt(type) + 1));
        List<Map<String, Object>> rs = new ArrayList<>();
        List<Map<String, Object>> rs = new ArrayList<>();
        for (SaveModel saveModel : list) {
        for (SaveModel saveModel : list) {
            Map<String, Object> map = new HashMap<>();
            map.put("applyDate", dateFormat3.format(saveModel.getQuotaDate()));
            map.put("signCount", saveModel.getResult2().longValue());
            rs.add(map);
            if (saveModel.getResult2().intValue()!=0){
                Map<String, Object> map = new HashMap<>();
                map.put("applyDate", dateFormat.format(saveModel.getQuotaDate()));
                map.put("signCount", saveModel.getResult2().longValue());
                rs.add(map);
            }
        }
        }
        JSONArray rsJs = new JSONArray(rs);
        JSONArray rsJs = new JSONArray(rs);
        return rsJs;
        return rsJs;
@ -2854,13 +2863,14 @@ public class StatisticsESService {
        }
        }
        startDate = startDate + " 00:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 23:59:59";
        String quotaTime = elasticsearchUtil.getQuotaTime();
        Long id = admin.getId();
        Long id = admin.getId();
        //家庭医生、健康咨询到达量
        //家庭医生、健康咨询增量
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        Long totalCount = saveModel.getResult2().longValue();
        Long totalCount = saveModel.getResult2().longValue();
        //健康咨询量  未回复到达量
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "22", SaveModel.timeLevel_ZL);
        //健康咨询量  未回复当天的到达量
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(quotaTime, quotaTime, id + "", Integer.parseInt(SaveModel.teamLevel), "22", SaveModel.timeLevel_DDL);
        Long noReyCount = saveModel2.getResult2().longValue();
        Long noReyCount = saveModel2.getResult2().longValue();
        JSONObject rs = new JSONObject();
        JSONObject rs = new JSONObject();
        rs.put("onReyCount", noReyCount);
        rs.put("onReyCount", noReyCount);
@ -2891,25 +2901,23 @@ public class StatisticsESService {
        Map<String, Object> map = null;
        Map<String, Object> map = null;
        List<Map<String, Object>> rs = new ArrayList<>();
        List<Map<String, Object>> rs = new ArrayList<>();
        Double avgCount = 0.0;
        Double avgCount = 0.0;
        String avgCountStr = "";
        DecimalFormat df = new DecimalFormat("#.0");
        for (SaveModel one : list) {
        for (SaveModel one : list) {
            String quotaDate = dateFormat.format(one.getQuotaDate());
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(quotaDate, id + "", Integer.parseInt(SaveModel.teamLevel), "59", SaveModel.timeLevel_ZL);
            //如果曾量为0,则说明没有数据。直接返回
            if (one.getResult2() != 0 && saveModel.getResult2().intValue() != 0) {
                avgCount = one.getResult2() / saveModel.getResult2();
            } else if (one.getResult2() != 0 && saveModel.getResult2().intValue() == 0) {
                avgCount = 80.0;
            } else if (one.getResult2() == 0) {
                avgCount = 0.0;
            }
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                map.put("weekNo", dateFormat.format(one.getQuotaDate()));
            if (one.getResult1()==null || one.getResult2()==null){
                avgCount=80.0;
            }else if (one.getResult1().intValue()!=0 && one.getResult2().intValue()!=0){
                avgCount=one.getResult1().doubleValue()/one.getResult2().doubleValue();
                avgCountStr = df.format(avgCount);
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekNo", dateFormat.format(one.getQuotaDate()));
                }
                map.put("avgCount", avgCountStr);
                rs.add(map);
            }
            }
            map.put("avgCount", avgCount);
            rs.add(map);
        }
        }
        return new JSONArray(rs);
        return new JSONArray(rs);
    }
    }
@ -2926,33 +2934,37 @@ public class StatisticsESService {
    public JSONObject getTeamConsultCount(String teamCode, String startDate, String endDate, String type) throws Exception {
    public JSONObject getTeamConsultCount(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), "22", "2", interval + "");
        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", "2", interval + "");
        List<SaveModel> list2 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
        Map<String, Object> map = null;
        List<Map<String, Object>> noReyList = new ArrayList<>();
        List<Map<String, Object>> noReyList = new ArrayList<>();
        for (SaveModel one : list) {
        for (SaveModel one : list) {
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            } else {
                map.put("dateNo", 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("dateNo", dateFormat.format(one.getQuotaDate()));
                }
                map.put("noRely", one.getResult2().longValue());
                noReyList.add(map);
            }
            }
            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 : list) {
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            } else {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
        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("dateNo", dateFormat.format(one.getQuotaDate()));
                }
                map.put("total", one.getResult2().longValue());
                totalList.add(map);
            }
            }
            map.put("noRely", one.getResult2().longValue());
            totalList.add(map);
        }
        }
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        result.put("noReyList", noReyList);
        result.put("noReyList", noReyList);
@ -3035,7 +3047,7 @@ public class StatisticsESService {
        String index = "64";
        String index = "64";
        Map<String, Object> rs = new HashedMap();
        Map<String, Object> rs = new HashedMap();
        //总数
        //总数
        SaveModel total = elasticsearchUtil.findOneDateQuotaLevel1NoSlaveKey1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL);
        SaveModel total = elasticsearchUtil.findOneDateQuotaLevel1NoSlaveKey1(startDate,endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL);
        //进行中
        //进行中
        SaveModel processing = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL, "1");
        SaveModel processing = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL, "1");
        //已完成
        //已完成
@ -3106,7 +3118,6 @@ public class StatisticsESService {
            total = elasticsearchUtil.findOneDateQuotaLevel1NoSlaveKey1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL);
            total = elasticsearchUtil.findOneDateQuotaLevel1NoSlaveKey1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL);
        }
        }
        //进行中
        //进行中
        //进行中
        if (StringUtils.isNotBlank(disease)) {
        if (StringUtils.isNotBlank(disease)) {
            processing = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "1").get(0);
            processing = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "1").get(0);
        } else {
        } else {
@ -3265,15 +3276,12 @@ public class StatisticsESService {
            for (SaveModel one : list) {
            for (SaveModel one : list) {
                map = new HashMap<>();
                map = new HashMap<>();
                if (SaveModel.townLevel.equals(lowlevel)) {
                if (SaveModel.townLevel.equals(lowlevel)) {
                    map = new HashMap<>();
                    map.put("code", one.getTown());
                    map.put("code", one.getTown());
                    map.put("name", one.getTownName());
                    map.put("name", one.getTownName());
                } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                    map = new HashMap<>();
                    map.put("code", one.getHospital());
                    map.put("code", one.getHospital());
                    map.put("name", one.getHospitalName());
                    map.put("name", one.getHospitalName());
                } else if (SaveModel.teamLevel.equals(lowlevel)) {
                } else if (SaveModel.teamLevel.equals(lowlevel)) {
                    map = new HashMap<>();
                    map.put("code", one.getTeam());
                    map.put("code", one.getTeam());
                    map.put("name", one.getTeamName());
                    map.put("name", one.getTeamName());
                }
                }
@ -3291,13 +3299,13 @@ public class StatisticsESService {
                adminTeams = findAllTeam();
                adminTeams = findAllTeam();
            } else if (SaveModel.townLevel.equals(level)) {
            } else if (SaveModel.townLevel.equals(level)) {
                hospitalList = hospitalDao.findByTownCode(area);
                hospitalList = hospitalDao.findByTownCode(area);
//                adminTeams = adminTeamDao.findByTownCode(area);
                adminTeams = findAllTeam();
                adminTeams = findAllTeam();
            } else if (SaveModel.OrgLevel.equals(level)) {
            } else if (SaveModel.OrgLevel.equals(level)) {
                adminTeams = adminTeamDao.findByOrgCode(area);
                adminTeams = adminTeamDao.findByOrgCode(area);
            }
            }
            if (SaveModel.townLevel.equals(lowlevel)) {
            if (SaveModel.townLevel.equals(lowlevel)) {
                for (Town one : townList) {
                for (Town one : townList) {
                    map = new HashMap<>();
                    map.put("code", one.getCode());
                    map.put("code", one.getCode());
                    map.put("name", one.getName());
                    map.put("name", one.getName());
                    map.put("val", 0);
                    map.put("val", 0);
@ -3305,7 +3313,6 @@ public class StatisticsESService {
                }
                }
            } else if (SaveModel.OrgLevel.equals(lowlevel)) {
            } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                for (Hospital one : hospitalList) {
                for (Hospital one : hospitalList) {
                    map = new HashMap<>();
                    map.put("code", one.getCode());
                    map.put("code", one.getCode());
                    map.put("name", one.getName());
                    map.put("name", one.getName());
                    map.put("val", 0);
                    map.put("val", 0);
@ -3313,7 +3320,6 @@ public class StatisticsESService {
                }
                }
            } else if (SaveModel.teamLevel.equals(lowlevel)) {
            } else if (SaveModel.teamLevel.equals(lowlevel)) {
                for (AdminTeam one : adminTeams) {
                for (AdminTeam one : adminTeams) {
                    map = new HashMap<>();
                    map.put("code", one.getLeaderCode());
                    map.put("code", one.getLeaderCode());
                    map.put("name", one.getName());
                    map.put("name", one.getName());
                    map.put("val", 0);
                    map.put("val", 0);
@ -3321,11 +3327,6 @@ public class StatisticsESService {
                }
                }
            }
            }
        }
        }
        if (SaveModel.teamLevel.equals(lowlevel)) {
            translateTeamLeaderName(rs);
        }
        Collections.sort(rs, new Comparator<Map<String, Object>>() {
        Collections.sort(rs, new Comparator<Map<String, Object>>() {
            public int compare(Map<String, Object> o1, Map<String, Object> o2) {
            public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                Integer map1value = Integer.valueOf(String.valueOf(o1.get("val")));
                Integer map1value = Integer.valueOf(String.valueOf(o1.get("val")));
@ -3373,25 +3374,25 @@ public class StatisticsESService {
        String index60 = "60";  //统计长处方总数年龄和疾病维度
        String index60 = "60";  //统计长处方总数年龄和疾病维度
        String index65 = "65";  //统计长处方总数年龄维度
        String index65 = "65";  //统计长处方总数年龄维度
        List<SaveModel> chufanglist = null;
        List<SaveModel> numList = null;
        Map<String, SaveModel> numListMap = new HashMap<>();
        List<SaveModel> chufanglist =null;
        List<SaveModel> numList =null;
        Map<String,SaveModel> numListMap =new HashMap<>();
        String quotaDate = elasticsearchUtil.getQuotaTime();
        String quotaDate = elasticsearchUtil.getQuotaTime();
        //统计处方年龄分布
        //统计处方年龄分布
        if (org.springframework.util.StringUtils.isEmpty(disease)) {
        if(org.springframework.util.StringUtils.isEmpty(disease)){
            numList = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, Integer.parseInt(level), index68, SaveModel.timeLevel_DDL);
            numList = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, Integer.parseInt(level), index68, SaveModel.timeLevel_DDL);
        } else {
            numList = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, Integer.parseInt(level), index63, SaveModel.timeLevel_DDL, null, disease);
        }else{
            numList = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, Integer.parseInt(level), index63,  SaveModel.timeLevel_DDL,null,disease);
        }
        }
        //统计处方患者年龄分布
        //统计处方患者年龄分布
        if (org.springframework.util.StringUtils.isEmpty(disease)) {
        if(org.springframework.util.StringUtils.isEmpty(disease)){
            chufanglist = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, Integer.parseInt(level), index65, SaveModel.timeLevel_DDL);
            chufanglist = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, Integer.parseInt(level), index65, SaveModel.timeLevel_DDL);
        } else {
            chufanglist = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, Integer.parseInt(level), index60, SaveModel.timeLevel_DDL, null, disease);
        }else{
            chufanglist = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, Integer.parseInt(level), index60,  SaveModel.timeLevel_DDL,null,disease);
        }
        }
        for (int i = 0; i < numList.size(); i++) {
            SaveModel saveModel = numList.get(i);
            numListMap.put(saveModel.getSlaveKey1(), saveModel);
        for(int i=0;i<numList.size();i++){
            SaveModel saveModel=numList.get(i);
            numListMap.put(saveModel.getSlaveKey1(),saveModel);
        }
        }
        Map<String, Object> map = new HashMap<>();
        Map<String, Object> map = new HashMap<>();
        if (numList.size() == 0) {
        if (numList.size() == 0) {
@ -3402,41 +3403,41 @@ public class StatisticsESService {
            map.put("65ageRate", 0.0);
            map.put("65ageRate", 0.0);
        } else {
        } else {
            DecimalFormat decimalFormat = new DecimalFormat("0.00");//构造方法的字符格式这里如果小数不足2位,会以0补足.
            DecimalFormat decimalFormat = new DecimalFormat("0.00");//构造方法的字符格式这里如果小数不足2位,会以0补足.
            if (numListMap.get(chufanglist.get(0).getSlaveKey1()).getResult2() != 0.0D) {
                Double ageRate = chufanglist.get(0).getResult2() / numListMap.get(chufanglist.get(0).getSlaveKey1()).getResult2();
            if(numListMap.get(chufanglist.get(0).getSlaveKey1()).getResult2()!=0.0D){
                Double ageRate = chufanglist.get(0).getResult2() /numListMap.get(chufanglist.get(0).getSlaveKey1()).getResult2() ;
                map.put("0ageRate", decimalFormat.format(ageRate));
                map.put("0ageRate", decimalFormat.format(ageRate));
            } else {
                map.put("0ageRate", chufanglist.get(0).getResult2());
            }else{
                map.put("0ageRate",chufanglist.get(0).getResult2() );
            }
            }
            if (numListMap.get(chufanglist.get(1).getSlaveKey1()).getResult2() != 0.0D) {
                Double ageRate = chufanglist.get(1).getResult2() / numListMap.get(chufanglist.get(1).getSlaveKey1()).getResult2();
            if(numListMap.get(chufanglist.get(1).getSlaveKey1()).getResult2()!=0.0D){
                Double ageRate = chufanglist.get(1).getResult2() /numListMap.get(chufanglist.get(1).getSlaveKey1()).getResult2() ;
                map.put("7ageRate", decimalFormat.format(ageRate));
                map.put("7ageRate", decimalFormat.format(ageRate));
            } else {
                map.put("7ageRate", chufanglist.get(1).getResult2());
            }else{
                map.put("7ageRate", chufanglist.get(1).getResult2() );
            }
            }
            if (numListMap.get(chufanglist.get(2).getSlaveKey1()).getResult2() != 0.0D) {
                Double ageRate = chufanglist.get(2).getResult2() / numListMap.get(chufanglist.get(2).getSlaveKey1()).getResult2();
            if(numListMap.get(chufanglist.get(2).getSlaveKey1()).getResult2()!=0.0D){
                Double ageRate = chufanglist.get(2).getResult2() /numListMap.get(chufanglist.get(2).getSlaveKey1()).getResult2() ;
                map.put("19ageRate", decimalFormat.format(ageRate));
                map.put("19ageRate", decimalFormat.format(ageRate));
            } else {
                map.put("19ageRate", chufanglist.get(2).getResult2());
            }else{
                map.put("19ageRate", chufanglist.get(2).getResult2() );
            }
            }
            if (numListMap.get(chufanglist.get(3).getSlaveKey1()).getResult2() != 0.0D) {
                Double ageRate = chufanglist.get(3).getResult2() / numListMap.get(chufanglist.get(3).getSlaveKey1()).getResult2();
            if(numListMap.get(chufanglist.get(3).getSlaveKey1()).getResult2()!=0.0D){
                Double ageRate = chufanglist.get(3).getResult2() /numListMap.get(chufanglist.get(3).getSlaveKey1()).getResult2() ;
                map.put("31ageRate", decimalFormat.format(ageRate));
                map.put("31ageRate", decimalFormat.format(ageRate));
            } else {
                map.put("31ageRate", chufanglist.get(3).getResult2());
            }else{
                map.put("31ageRate",chufanglist.get(3).getResult2() );
            }
            }
            if (numListMap.get(chufanglist.get(4).getSlaveKey1()).getResult2() != 0.0D) {
                Double ageRate = chufanglist.get(4).getResult2() / numListMap.get(chufanglist.get(4).getSlaveKey1()).getResult2();
            if(numListMap.get(chufanglist.get(4).getSlaveKey1()).getResult2()!=0.0D){
                Double ageRate = chufanglist.get(4).getResult2() /numListMap.get(chufanglist.get(4).getSlaveKey1()).getResult2() ;
                map.put("51ageRate", decimalFormat.format(ageRate));
                map.put("51ageRate", decimalFormat.format(ageRate));
            } else {
                map.put("51ageRate", chufanglist.get(4).getResult2());
            }else{
                map.put("51ageRate",chufanglist.get(4).getResult2() );
            }
            }
            if (numListMap.get(chufanglist.get(5).getSlaveKey1()).getResult2() != 0.0D) {
                Double ageRate = chufanglist.get(5).getResult2() / numListMap.get(chufanglist.get(5).getSlaveKey1()).getResult2();
            if(numListMap.get(chufanglist.get(5).getSlaveKey1()).getResult2()!=0.0D){
                Double ageRate = chufanglist.get(5).getResult2() /numListMap.get(chufanglist.get(5).getSlaveKey1()).getResult2() ;
                map.put("65ageRate", decimalFormat.format(ageRate));
                map.put("65ageRate", decimalFormat.format(ageRate));
            } else {
                map.put("65ageRate", chufanglist.get(5).getResult2());
            }else{
                map.put("65ageRate", chufanglist.get(5).getResult2() );
            }
            }
        }
        }
        return map;
        return map;
@ -3446,6 +3447,7 @@ public class StatisticsESService {
     * @param level   等级
     * @param level   等级
     * @param area    等级编码
     * @param area    等级编码
     * @param disease 疾病编码
     * @param disease 疾病编码
     * @param type    类型0.总量,1.进行中,2.已完成,3.居民取消,4.审核不通过,5.其他原因取消
     * @return
     * @return
     */
     */
    public List<Map<String, Object>> getPrescriptionTotalHistogram(int level, String area, String disease, String type) throws Exception {
    public List<Map<String, Object>> getPrescriptionTotalHistogram(int level, String area, String disease, String type) throws Exception {
@ -3471,27 +3473,19 @@ public class StatisticsESService {
        String endTime = DateUtil.dateToStr(new Date(), "YYYY-MM-dd HH:mm:ss");
        String endTime = DateUtil.dateToStr(new Date(), "YYYY-MM-dd HH:mm:ss");
        List<SaveModel> resultList = new ArrayList<>();
        List<SaveModel> resultList = new ArrayList<>();
        if (StringUtils.isNotBlank(disease)) {
        if (StringUtils.isNotBlank(disease)) {
            //类型1.总量,2.已完成,3.居民取消,4.审核不通过,5.进行中,6.其他原因取消
            if ("1".equals(type)) {
            //类型0.总量,1.进行中,2.已完成,3.居民取消,4.审核不通过,5.其他原因取消
            if ("0".equals(type)) {
                //总数
                //总数
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2NoSlaveKey2(startTime, endTime, area, level, index58, SaveModel.timeLevel_ZL, SaveModel.interval_month, disease);
            }  else if ("2".equals(type) || "3".equals(type) || "4".equals(type))  {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index58, SaveModel.timeLevel_ZL,  SaveModel.interval_month, disease,type);
            }else if ("5".equals(type))  {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index58, SaveModel.timeLevel_ZL,  SaveModel.interval_month, disease,"1");
            }else if ("6".equals(type))  {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index58, SaveModel.timeLevel_ZL,  SaveModel.interval_month, disease,"5");
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2NoSlaveKey2(startTime, endTime, area, level, index58, "1", "3", disease);
            } else {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index58, "1", "3", disease, type);
            }
            }
        } else {
        } else {
            if ("1".equals(type)) {
            if ("0".equals(type)) {
                //总数
                //总数
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1NoSlaveKey1(startTime, endTime, area, level, index64, SaveModel.timeLevel_ZL,  SaveModel.interval_month);
            } else if ("2".equals(type) || "3".equals(type) || "4".equals(type)) {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index64, SaveModel.timeLevel_ZL,  SaveModel.interval_month,type);
            }else if ("5".equals(type)) {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index64, SaveModel.timeLevel_ZL,  SaveModel.interval_month,"1");
            } else if ("6".equals(type)) {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index64, SaveModel.timeLevel_ZL,  SaveModel.interval_month,"5");
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1NoSlaveKey1(startTime, endTime, area, level, index64, "1", "3");
            } else {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index64, "1", "3", type);
            }
            }
        }
        }
        //把数据设置到初始化的Map里面去
        //把数据设置到初始化的Map里面去
@ -3499,8 +3493,6 @@ public class StatisticsESService {
            String monthKeyEs = "";
            String monthKeyEs = "";
            if (saveModel.getQuotaDate() != null) {
            if (saveModel.getQuotaDate() != null) {
                monthKeyEs = DateUtil.changeQuotaDate(saveModel.getQuotaDate());
                monthKeyEs = DateUtil.changeQuotaDate(saveModel.getQuotaDate());
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
                monthKeyEs = sdf.format(saveModel.getQuotaDate());
            }
            }
            if (StringUtils.isNotBlank(monthKeyEs) && rs.containsKey(monthKeyEs)) {
            if (StringUtils.isNotBlank(monthKeyEs) && rs.containsKey(monthKeyEs)) {
                Map<String, Object> oneMc = rs.get(monthKeyEs);
                Map<String, Object> oneMc = rs.get(monthKeyEs);
@ -3511,7 +3503,6 @@ public class StatisticsESService {
        return new ArrayList<>(rs.values());
        return new ArrayList<>(rs.values());
    }
    }
    /**
    /**
     * @param level    等级 1 省 2 市 3 区县 4 机构 5团队
     * @param level    等级 1 省 2 市 3 区县 4 机构 5团队
     * @param lowlevel 等级 1 省 2 市 3 区县 4 机构 5团队
     * @param lowlevel 等级 1 省 2 市 3 区县 4 机构 5团队
@ -3522,7 +3513,6 @@ public class StatisticsESService {
     * @return
     * @return
     */
     */
    public List<Map<String, Object>> getPrescriptionTotalLowLevel(int level, String lowlevel, String area, String disease, String type) throws Exception {
    public List<Map<String, Object>> getPrescriptionTotalLowLevel(int level, String lowlevel, String area, String disease, String type) throws Exception {
        //转换type 前端type和ES生成的数据字典对不上
        String quotaDate = elasticsearchUtil.getQuotaTime();
        String quotaDate = elasticsearchUtil.getQuotaTime();
        //因为一个处方可能有多个疾病状态 所以分开2个指标
        //因为一个处方可能有多个疾病状态 所以分开2个指标
        String index58 = "58";//统计长处方总数疾病和状态维度
        String index58 = "58";//统计长处方总数疾病和状态维度
@ -3564,15 +3554,12 @@ public class StatisticsESService {
//                    lowlevel = String.valueOf(level + 1);
//                    lowlevel = String.valueOf(level + 1);
//                }
//                }
                if (SaveModel.townLevel.equals(lowlevel)) {
                if (SaveModel.townLevel.equals(lowlevel)) {
                    map=new HashMap<>();
                    map.put("code", one.getTown());
                    map.put("code", one.getTown());
                    map.put("name", one.getTownName());
                    map.put("name", one.getTownName());
                } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                    map=new HashMap<>();
                    map.put("code", one.getHospital());
                    map.put("code", one.getHospital());
                    map.put("name", one.getHospitalName());
                    map.put("name", one.getHospitalName());
                } else if (SaveModel.teamLevel.equals(lowlevel)) {
                } else if (SaveModel.teamLevel.equals(lowlevel)) {
                    map=new HashMap<>();
                    map.put("code", one.getTeam());
                    map.put("code", one.getTeam());
                    map.put("name", one.getTeamName());
                    map.put("name", one.getTeamName());
                }
                }
@ -3580,6 +3567,7 @@ public class StatisticsESService {
                rs.add(map);
                rs.add(map);
            }
            }
        } else {
        } else {
            //统计数据为空时,自建结果集
            //统计数据为空时,自建结果集
            List<Town> townList = null;
            List<Town> townList = null;
            List<Hospital> hospitalList = null;
            List<Hospital> hospitalList = null;
@ -3596,30 +3584,25 @@ public class StatisticsESService {
            }
            }
            if (SaveModel.townLevel.equals(lowlevel)) {
            if (SaveModel.townLevel.equals(lowlevel)) {
                for (Town one : townList) {
                for (Town one : townList) {
                    map=new HashMap<>();
                    map.put("code", one.getCode());
                    map.put("code", one.getCode());
                    map.put("name", one.getName());
                    map.put("name", one.getName());
                    map.put("val", 0);
                    map.put("val", 0);
                    rs.add(map);
                }
                }
            } else if (SaveModel.OrgLevel.equals(lowlevel)) {
            } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                for (Hospital one : hospitalList) {
                for (Hospital one : hospitalList) {
                    map=new HashMap<>();
                    map.put("code", one.getCode());
                    map.put("code", one.getCode());
                    map.put("name", one.getName());
                    map.put("name", one.getName());
                    map.put("val", 0);
                    map.put("val", 0);
                    rs.add(map);
                }
                }
            } else if (SaveModel.teamLevel.equals(lowlevel)) {
            } else if (SaveModel.teamLevel.equals(lowlevel)) {
                for (AdminTeam one : adminTeams) {
                for (AdminTeam one : adminTeams) {
                    map=new HashMap<>();
                    map.put("code", one.getLeaderCode());
                    map.put("code", one.getLeaderCode());
                    map.put("name", one.getName());
                    map.put("name", one.getName());
                    map.put("val", 0);
                    map.put("val", 0);
                    rs.add(map);
                }
                }
            }
            }
            rs.add(map);
        }
        }
        Collections.sort(rs, new Comparator<Map<String, Object>>() {
        Collections.sort(rs, new Comparator<Map<String, Object>>() {
            public int compare(Map<String, Object> o1, Map<String, Object> o2) {
            public int compare(Map<String, Object> o1, Map<String, Object> o2) {
@ -3787,7 +3770,7 @@ public class StatisticsESService {
        List<SaveModel> resultList = new ArrayList<>();
        List<SaveModel> resultList = new ArrayList<>();
        if (StringUtils.isNotBlank(disease)) {
        if (StringUtils.isNotBlank(disease)) {
            resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index62, SaveModel.timeLevel_ZL, SaveModel.interval_month, type, disease);
            resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index62, SaveModel.timeLevel_ZL, SaveModel.interval_month, type,disease);
        } else {
        } else {
            resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index67, SaveModel.timeLevel_ZL, SaveModel.interval_month, type);
            resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index67, SaveModel.timeLevel_ZL, SaveModel.interval_month, type);
        }
        }
@ -3840,7 +3823,7 @@ public class StatisticsESService {
        List<Map<String, Object>> rs = new ArrayList<>();
        List<Map<String, Object>> rs = new ArrayList<>();
        if (StringUtils.isNotBlank(disease)) {
        if (StringUtils.isNotBlank(disease)) {
            //类型 1.自取,2.快递配送,3.健管师配送
            //类型 1.自取,2.快递配送,3.健管师配送
            saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index62, SaveModel.timeLevel_DDL, lowlevel, type, disease);
            saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index62, SaveModel.timeLevel_DDL, lowlevel, type,disease);
        } else {
        } else {
            saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index67, SaveModel.timeLevel_DDL, lowlevel, type);
            saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index67, SaveModel.timeLevel_DDL, lowlevel, type);
        }
        }
@ -3972,31 +3955,30 @@ public class StatisticsESService {
                if (SaveModel.townLevel.equals(lowlevel)) {
                if (SaveModel.townLevel.equals(lowlevel)) {
                    map.put("code", one.getTown());
                    map.put("code", one.getTown());
                    map.put("name", one.getTownName());
                    map.put("name", one.getTownName());
                    if (one != null && one.getResult2() > 0) {
                        avg = decimalFormat.format(one.getResult1() / (one.getResult2() * 100));
                    if (one != null&&one.getResult2()>0) {
                        avg = decimalFormat.format(one.getResult1() / (one.getResult2()*100));
                    }
                    }
                    map.put("val", avg);
                    map.put("val", avg);
                } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                    map.put("code", one.getHospital());
                    map.put("code", one.getHospital());
                    map.put("name", one.getHospitalName());
                    map.put("name", one.getHospitalName());
                    if (one != null && one.getResult2() > 0) {
                        avg = decimalFormat.format(one.getResult1() / (one.getResult2() * 100));
                    if (one != null&&one.getResult2()>0) {
                        avg = decimalFormat.format(one.getResult1() / (one.getResult2()*100));
                    }
                    }
                    map.put("val", avg);
                    map.put("val", avg);
                } else if (SaveModel.teamLevel.equals(lowlevel)) {
                } else if (SaveModel.teamLevel.equals(lowlevel)) {
                    map.put("code", one.getTeam());
                    map.put("code", one.getTeam());
                    map.put("name", one.getTeamName());
                    map.put("name", one.getTeamName());
                    if (one != null && one.getResult2() > 0) {
                        avg = decimalFormat.format(one.getResult1() / (one.getResult2() * 100));
                    if (one != null&&one.getResult2()>0) {
                        avg = decimalFormat.format(one.getResult1() / (one.getResult2()*100));
                    }
                    }
                    map.put("val", avg);
                    map.put("val", avg);
                }
                }
                countList.add(map);
                countList.add(map);
            }
            }
        }
        }
        if (SaveModel.teamLevel.equals(lowlevel)) {
            translateTeamLeaderNameListMap(countList);
            ;
        if(SaveModel.teamLevel.equals(lowlevel)){
            translateTeamLeaderNameListMap(countList);;
        }
        }
        Collections.sort(countList, new Comparator<Map<String, Object>>() {
        Collections.sort(countList, new Comparator<Map<String, Object>>() {
@ -4054,10 +4036,10 @@ public class StatisticsESService {
                key = DateUtil.getMonth(dateFormat.format(one.getQuotaDate()));
                key = DateUtil.getMonth(dateFormat.format(one.getQuotaDate()));
            }
            }
            String avg = "0.0";
            String avg = "0.0";
            if (one.getResult2() != 0) {
                avg = decimalFormat.format(one.getResult1() / (one.getResult2() * 100));
            if (one.getResult2()!=0) {
                avg = decimalFormat.format(one.getResult1() / (one.getResult2()*100));
            }
            }
            map.put("avg", avg);
            map.put("avg",avg);
            map.put("date", key);
            map.put("date", key);
            countList.add(map);
            countList.add(map);

+ 27 - 2
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;
package com.yihu.wlyy.service.call;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.message.Message;
@ -46,13 +47,12 @@ public class CustomerService extends BaseService{
				" s.create_time AS createTime, " +
				" s.create_time AS createTime, " +
				" s.user, " +
				" s.user, " +
				" s.user_name AS userName ," +
				" s.user_name AS userName ," +
				" s.create_Time AS createTime ," +
				" p.sex," +
				" p.sex," +
				" p.photo," +
				" p.photo," +
				" TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age" +
				" TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age" +
				" FROM " +
				" FROM " +
				" manage_call_service s " +
				" 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 " +
				" WHERE " +
				" s.state >0 ";
				" s.state >0 ";
		if(StringUtils.isNotBlank(keyword)){
		if(StringUtils.isNotBlank(keyword)){
@ -116,6 +116,13 @@ public class CustomerService extends BaseService{
		CallService callService = callServiceDao.findByCode(code);
		CallService callService = callServiceDao.findByCode(code);
		CallRecord callRecord = callRecordDao.findByCode(callService.getCallCode());
		CallRecord callRecord = callRecordDao.findByCode(callService.getCallCode());
		Map<String,Object> rs = new HashedMap();
		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("callService",callService);
		rs.put("callRecord",callRecord);
		rs.put("callRecord",callRecord);
		return rs;
		return rs;
@ -129,6 +136,15 @@ public class CustomerService extends BaseService{
		 callService.setDealTime(new Date());
		 callService.setDealTime(new Date());
		 callService.setState(2);
		 callService.setState(2);
		 callServiceDao.save(callService);
		 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";
		return "1";
	}
	}
@ -168,6 +184,15 @@ public class CustomerService extends BaseService{
			cs.setDealContent(dealContent);
			cs.setDealContent(dealContent);
		}
		}
		callServiceDao.save(cs);
		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";
		return "1";
	}
	}
}
}

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

+ 1 - 0
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="page",value="第几页,从1开始")@RequestParam(required = true)Integer page,
                                  @ApiParam(name="size",value="每页大小")@RequestParam(required = true)Integer size){
                                  @ApiParam(name="size",value="每页大小")@RequestParam(required = true)Integer size){
        try {
        try {
            return write(200,"保存成功","data",customerService.getCallServices(keyword, serverType,state,patientName,ssc,idCard,doctorName, code,adminTeamCode,startDate, endDate, page, size));
            return write(200,"保存成功","data",customerService.getCallServices(keyword, serverType,state,patientName,ssc,idCard,doctorName, code,adminTeamCode,startDate, endDate, page, size));
        }catch (Exception e){
        }catch (Exception e){
            error(e);
            error(e);

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

@ -835,7 +835,7 @@ public class EsStatisticsController extends BaseController {
        try {
        try {
            return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo(getUID(), startDate, endDate));
            return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo(getUID(), startDate, endDate));
            //return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo("xh1D201703150222",startDate,endDate));
            //return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo("xh1D2017031502222",startDate,endDate));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
@ -862,10 +862,10 @@ public class EsStatisticsController extends BaseController {
            //判断是签约还是续签
            //判断是签约还是续签
            if ("0".equals(signType)) {
            if ("0".equals(signType)) {
                return write(200, "查询成功", "data", statisticsESService.getSignCountLineByType(getUID(), type, startDate, endDate));
                return write(200, "查询成功", "data", statisticsESService.getSignCountLineByType(getUID(), type, startDate, endDate));
                //return write(200, "查询成功", "data", statisticsESService.getSignCountLineByType("xh1D201703150222",type,startDate,endDate));
                //return write(200, "查询成功", "data", statisticsESService.getSignCountLineByType("xh1D2017031502222",type,startDate,endDate));
            } else {
            } else {
                return write(200, "查询成功", "data", statisticsESService.getRenewCountLineByType(getUID(), type, startDate, endDate));
                return write(200, "查询成功", "data", statisticsESService.getRenewCountLineByType(getUID(), type, startDate, endDate));
                //return write(200, "查询成功", "data", statisticsESService.getRenewCountLineByType("xh1D201703150222",type,startDate,endDate));
                //return write(200, "查询成功", "data", statisticsESService.getRenewCountLineByType("xh1D2017031502222",type,startDate,endDate));
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
@ -888,7 +888,7 @@ public class EsStatisticsController extends BaseController {
                                   @RequestParam(required = true) String isNow) {
                                   @RequestParam(required = true) String isNow) {
        try {
        try {
            return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            //return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow("xh1D201703150222",startDate,endDate,isNow));
            //return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow("xh1D2017031502222",startDate,endDate,isNow));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
@ -896,7 +896,7 @@ public class EsStatisticsController extends BaseController {
    }
    }
    /**
    /**
     * 获取机构内服务排行.
     * 获取机构内服务排行
     *
     *
     * @param startDate
     * @param startDate
     * @param endDate
     * @param endDate
@ -930,7 +930,7 @@ public class EsStatisticsController extends BaseController {
                             @RequestParam(required = true) String type) {
                             @RequestParam(required = true) String type) {
        try {
        try {
            return write(200, "查询成功", "data", statisticsESService.getAvgLine(getUID(), startDate, endDate, type));
            return write(200, "查询成功", "data", statisticsESService.getAvgLine(getUID(), startDate, endDate, type));
            //return write(200, "查询成功", "data", statisticsESService.getAvgLine("xh1D201703150222",startDate,endDate,type));
            //return write(200, "查询成功", "data", statisticsESService.getAvgLine("xh1D2017031502222",startDate,endDate,type));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");

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

@ -867,7 +867,7 @@ public class StatisticsController extends BaseController {
        try {
        try {
            return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(), startDate, endDate));
            return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(), startDate, endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("xh1D201703150222",startDate,endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("xh1D2017031502222",startDate,endDate));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
@ -895,10 +895,10 @@ public class StatisticsController extends BaseController {
            //判断是签约还是续签
            //判断是签约还是续签
            if ("0".equals(signType)) {
            if ("0".equals(signType)) {
                return write(200, "查询成功", "data", statisticsService.getSignCountLineByType(getUID(), type, startDate, endDate));
                return write(200, "查询成功", "data", statisticsService.getSignCountLineByType(getUID(), type, startDate, endDate));
                //return write(200, "查询成功", "data", statisticsService.getSignCountLineByType("xh1D201703150222",type,startDate,endDate));
                //return write(200, "查询成功", "data", statisticsService.getSignCountLineByType("xh1D2017031502222",type,startDate,endDate));
            } else {
            } else {
                return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType(getUID(), type, startDate, endDate));
                return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType(getUID(), type, startDate, endDate));
                //return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType("xh1D201703150222",type,startDate,endDate));
                //return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType("xh1D2017031502222",type,startDate,endDate));
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
@ -922,7 +922,7 @@ public class StatisticsController extends BaseController {
                                   @RequestParam(required = true) String isNow) {
                                   @RequestParam(required = true) String isNow) {
        try {
        try {
            return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow("xh1D201703150222",startDate,endDate,isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow("xh1D2017031502222",startDate,endDate,isNow));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
@ -966,7 +966,7 @@ public class StatisticsController extends BaseController {
                             @RequestParam(required = true) String type) {
                             @RequestParam(required = true) String type) {
        try {
        try {
             return write(200, "查询成功", "data", statisticsService.getAvgLine(getUID(), startDate, endDate, type));
             return write(200, "查询成功", "data", statisticsService.getAvgLine(getUID(), startDate, endDate, type));
             //return write(200, "查询成功", "data", statisticsService.getAvgLine("xh1D201703150222",startDate,endDate,type));
             //return write(200, "查询成功", "data", statisticsService.getAvgLine("xh1D2017031502222",startDate,endDate,type));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");