ソースを参照

统计修改,添加云信接口

wangjun 4 年 前
コミット
164ecb37b8

+ 5 - 2
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -289,7 +289,6 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
        }
        return true;
    }
    /**
     * 修改医生服务配置
     * @param jsonObject
@ -308,7 +307,11 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
            doctorDO.setIntroduce(introduce);
            doctorDO.setExpertise(expertise);
            doctorDO.setPhoto(photo);
            doctorDO.setOutpatientType(outpatientType);
            if(StringUtils.isNoneBlank(outpatientType)){
                doctorDO.setOutpatientType(outpatientType);
            }else {
                doctorDO.setOutpatientType(null);
            }
            if (StringUtils.isNoneBlank(jsonObject.get("TWZXFee")==null?"":jsonObject.get("TWZXFee").toString())){
                String chargeType = findOrCreateChargeType(jsonObject.get("TWZXFee").toString(),doctorDO.getName());
                doctorDO.setTwzxChargeType(chargeType);

+ 4 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -210,7 +210,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                mixEnvelop.setMessage("您所添加的家属无就诊记录,无法添加");
            }
            }
        }else {
        }else if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
            com.alibaba.fastjson.JSONArray jsonArray1 = xzzxEntranceService.selectPateintCardByIdCard(idCard);
            if (null!=jsonArray1&&jsonArray1.size()>0){
                String familySex = IdCardUtil.getSexForIdcard(idCard);
@ -228,11 +228,13 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        basePatientDO.setSex(sex);
        if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
            basePatientDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
        }else {
        }else if("xm_zsyy_wx".equalsIgnoreCase(wxId)||"xm_ykyy_wx".equalsIgnoreCase(wxId)) {
            SimpleDateFormat sf3 = new SimpleDateFormat("yyyy-MM-dd");
            Date saveBirth1 = sf3.parse(birth);
            System.out.println("====="+saveBirth1);
            basePatientDO.setBirthday(saveBirth1);
        }else {
            basePatientDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
        }
        result.setFamilyRelation(dictId);
        result.setFamilyRelationName(dictName);

+ 61 - 9
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -18,6 +18,7 @@ import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
@ -90,6 +91,7 @@ import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.yx.dao.YxTokenMappingDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
@ -104,6 +106,7 @@ import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -267,6 +270,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private YxTokenMappingDao yxTokenMappingDao;
@ -5322,15 +5327,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                ") evaluate ON evaluate.doctor = d.id";
        params.put("startTime", date);
        params.put("endTime", date);
        if ("1".equalsIgnoreCase(isAttention)) {
            sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='" + patientid + "' ";
        }
        if ("0".equalsIgnoreCase(isAttention)) {
            sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' ";
        }
        if (StringUtils.isEmpty(isAttention)) {
            sql += " LEFT  JOIN base_doctor_patient_follow follow ON follow.patient='" + patientid + "' AND follow.doctor = d.id ";
        if(StringUtils.isNoneBlank(patientid)){
            if ("1".equalsIgnoreCase(isAttention)) {
                sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='" + patientid + "' ";
            }
            if ("0".equalsIgnoreCase(isAttention)) {
                sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' ";
            }
            if (StringUtils.isEmpty(isAttention)) {
                sql += " LEFT  JOIN base_doctor_patient_follow follow ON follow.patient='" + patientid + "' AND follow.doctor = d.id ";
            }
        }
        if (StringUtils.isNotBlank(diseaseKey)) {
            sql += " left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
@ -9612,6 +9618,52 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return null;
    }
    public String yxToken2(String userId,String channelName){
        YxTokenMappingDO yxTokenMappingDO = yxTokenMappingDao.findMappingByAccid(userId);
        if (yxTokenMappingDO!=null){
            return yxTokenMappingDO.getToken();
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce =  randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://api.netease.im/nimserver/user/create.action";
        Map<String,Object> httpPost = new HashedMap();
        // 设置请求的header
        httpPost.put("AppKey", appKey);
        httpPost.put("Nonce", nonce);
        httpPost.put("CurTime", curTime);
        httpPost.put("CheckSum", checkSum);
        httpPost.put("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
        nvps.add(new BasicNameValuePair("accid", userId));
        YxTokenMappingDO yxTokenMappingDO1 = new YxTokenMappingDO();
        if (StringUtils.isNoneBlank(channelName)){
            nvps.add(new BasicNameValuePair("name",channelName));
            yxTokenMappingDO1.setName(channelName);
        }
        String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
        logger.info("返回日志"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){
                com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("info"));
                if (StringUtils.isNoneBlank(jsonObject1.getString("token"))){
                    yxTokenMappingDO1.setAccid(userId);
                    yxTokenMappingDO1.setToken(jsonObject1.getString("token"));
                    yxTokenMappingDao.save(yxTokenMappingDO1);
                }
                return jsonObject1.getString("token");
            }
        }
        return null;
    }
    public static void main(String[] args) {
        String ss = DateUtil.getStringDateShort();

+ 12 - 0
business/base-service/src/main/java/com/yihu/jw/yx/dao/YxTokenMappingDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.yx.dao;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface YxTokenMappingDao extends PagingAndSortingRepository<YxTokenMappingDO, String>, JpaSpecificationExecutor<YxTokenMappingDO> {
    @Query("from YxTokenMappingDO where accid = ?1")
    YxTokenMappingDO findMappingByAccid(String accid);
}

+ 420 - 99
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -171,47 +171,66 @@ public class StatisticsEsService {
            object.put("data",array);
            JSONArray array1 = dateTotalStatistics2(startDate,endDate,area,level,"5","1",SaveModel.timeLevel_ZL,null);
            object.put("specialistData",array1);
            JSONArray array2 = dateTotalStatistics2(startDate,endDate,area,level,"12",null,SaveModel.timeLevel_ZL,null);
            JSONArray array2 = dateTotalStatistics2(startDate,endDate,area,level,"12","9",SaveModel.timeLevel_ZL,null);
            object.put("topicData",array2);
            JSONArray array3 = dateTotalStatistics2(startDate,endDate,area,level,"14",null,SaveModel.timeLevel_ZL,null);
            JSONArray array3 = dateTotalStatistics2(startDate,endDate,area,level,"14","12",SaveModel.timeLevel_ZL,null);
            object.put("synergyData",array3);
            JSONArray array4 = dateTotalStatistics2(startDate,endDate,area,level,"16",null,SaveModel.timeLevel_ZL,null);
            JSONArray array4 = dateTotalStatistics2(startDate,endDate,area,level,"16","16",SaveModel.timeLevel_ZL,null);
            object.put("vedioData",array4);
            JSONArray array5 = dateTotalStatistics2(startDate,endDate,area,level,"12","1",SaveModel.timeLevel_ZL,null);
            object.put("twzxData",array5);
            JSONArray array6 = dateTotalStatistics2(startDate,endDate,area,level,"16","17",SaveModel.timeLevel_ZL,null);
            object.put("spzxData",array6);
        }else if (interval==2){
            JSONArray array = weekTotalStatistics7(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL);
            object.put("data",array);
            JSONArray array1 = weekTotalStatistics7(startDate,endDate,area,level,"5","1",SaveModel.timeLevel_ZL);
            object.put("specialistData",array1);
            JSONArray array2 = weekTotalStatistics7(startDate,endDate,area,level,"12",null,SaveModel.timeLevel_ZL);
            JSONArray array2 = weekTotalStatistics7(startDate,endDate,area,level,"12","9",SaveModel.timeLevel_ZL);
            object.put("topicData",array2);
            JSONArray array3 = weekTotalStatistics7(startDate,endDate,area,level,"14",null,SaveModel.timeLevel_ZL);
            JSONArray array3 = weekTotalStatistics7(startDate,endDate,area,level,"14","12",SaveModel.timeLevel_ZL);
            object.put("synergyData",array3);
            JSONArray array4 = weekTotalStatistics7(startDate,endDate,area,level,"16",null,SaveModel.timeLevel_ZL);
            JSONArray array4 = weekTotalStatistics7(startDate,endDate,area,level,"16","16",SaveModel.timeLevel_ZL);
            object.put("vedioData",array4);
            JSONArray array5 = weekTotalStatistics7(startDate,endDate,area,level,"12","1",SaveModel.timeLevel_ZL);
            object.put("twzxData",array5);
            JSONArray array6 = weekTotalStatistics7(startDate,endDate,area,level,"16","17",SaveModel.timeLevel_ZL);
            object.put("spzxData",array6);
        }else if (interval==3){
            JSONArray array = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
            object.put("data",array);
            JSONArray array1 = monthTotalStatistics2(startDate,endDate,area,level,"5","1",SaveModel.timeLevel_ZL,null);
            object.put("specialistData",array1);
            JSONArray array2 = monthTotalStatistics2(startDate,endDate,area,level,"12",null,SaveModel.timeLevel_ZL,null);
            JSONArray array2 = monthTotalStatistics2(startDate,endDate,area,level,"12","9",SaveModel.timeLevel_ZL,null);
            object.put("topicData",array2);
            JSONArray array3 = monthTotalStatistics2(startDate,endDate,area,level,"14",null,SaveModel.timeLevel_ZL,null);
            JSONArray array3 = monthTotalStatistics2(startDate,endDate,area,level,"14","12",SaveModel.timeLevel_ZL,null);
            object.put("synergyData",array3);
            JSONArray array4 = monthTotalStatistics2(startDate,endDate,area,level,"16",null,SaveModel.timeLevel_ZL,null);
            JSONArray array4 = monthTotalStatistics2(startDate,endDate,area,level,"16","16",SaveModel.timeLevel_ZL,null);
            object.put("vedioData",array4);
            JSONArray array5 = monthTotalStatistics2(startDate,endDate,area,level,"12","1",SaveModel.timeLevel_ZL,null);
            object.put("twzxData",array5);
            JSONArray array6 = monthTotalStatistics2(startDate,endDate,area,level,"16","17",SaveModel.timeLevel_ZL,null);
            object.put("spzxData",array6);
        }
        if (StringUtils.isNoneBlank(level2_type)){
            //问诊量表格
            //专家咨询数量
/*
            List<SaveModel> specialistSaveModels = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,null,level2_type);
*/
            //协同门诊
            List<SaveModel> syngySaveModels = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, "14", SaveModel.timeLevel_ZL,null,level2_type);
            List<SaveModel> syngySaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, "14", SaveModel.timeLevel_ZL,"12",null,level2_type);
            //图文复诊
            List<SaveModel> topicSaveModels = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, "12", SaveModel.timeLevel_ZL,null,level2_type);
            List<SaveModel> topicSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, "12", SaveModel.timeLevel_ZL,"9",null,level2_type);
            ///视频复诊
            List<SaveModel> vedioSaveModels = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, "16", SaveModel.timeLevel_ZL,null,level2_type);
            List<SaveModel> vedioSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, "16", SaveModel.timeLevel_ZL,"16",null,level2_type);
            ///图文咨询
            List<SaveModel> twzxSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, "12", SaveModel.timeLevel_ZL,"1",null,level2_type);
            ///视频咨询
            List<SaveModel> spzxSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, "16", SaveModel.timeLevel_ZL,"17",null,level2_type);
            JSONArray array = new JSONArray();
            List<String> list = new ArrayList<>();
@ -240,9 +259,11 @@ public class StatisticsEsService {
                Double topic = 0.0;
                Double vedio =0.0;
                Double synegy =0.0;
                Double topicZJ =0.0;
                Double vedioZJ = 0.0;
                if (index.equalsIgnoreCase("3")){
                    specialist = 0.0;
                }else if (index.equalsIgnoreCase("5")){
                }/*else if (index.equalsIgnoreCase("5")){
                    for (SaveModel saveModel:specialistSaveModels){
                        if (level2_type.equals(SaveModel.OrgLevel)){
                            if (StringUtils.isNoneBlank(saveModel.getHospital())&&code.equalsIgnoreCase(saveModel.getHospital())){
@ -290,7 +311,7 @@ public class StatisticsEsService {
                            }
                        }
                    }
                }
                }*/
                for (SaveModel saveModel:syngySaveModels){
                    if (level2_type.equals(SaveModel.OrgLevel)){
@ -428,10 +449,102 @@ public class StatisticsEsService {
                        }
                    }
                }
                for (SaveModel saveModel:twzxSaveModels){
                    if (level2_type.equals(SaveModel.OrgLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getHospital())&&code.equalsIgnoreCase(saveModel.getHospital())){
                            jsonObject.put("code",code);
                            jsonObject.put("name",saveModel.getHospitalName());
                            jsonObject.put("topicZJ",saveModel.getResult1());
                            topicZJ = saveModel.getResult1();
                            break;
                        }
                    }else if (level2_type.equals(SaveModel.deptLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getDept())&&code.equalsIgnoreCase(saveModel.getDept())){
                            jsonObject.put("code",code);
                            jsonObject.put("name",saveModel.getDeptName());
                            jsonObject.put("topicZJ",saveModel.getResult1());
                            topicZJ = saveModel.getResult1();
                            break;
                        }
                    }else if (level2_type.equals(SaveModel.doctorLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getDoctor())&&code.equalsIgnoreCase(saveModel.getDoctor())){
                            if (level==6){
                                List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(area);
                                if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                                    BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
                                    jsonObject.put("code",doctorHospitalDO.getDeptCode());
                                    jsonObject.put("name",doctorHospitalDO.getDeptName());
                                }
                            }else {
                                DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
                                jsonObject.put("code",area);
                                jsonObject.put("name",dictHospitalDeptDO.getName());
                            }
                            jsonObject.put("doctorCode",code);
                            BaseDoctorDO doctorDO = doctorDao.findById(code);
                            if (doctorDO!=null){
                                jsonObject.put("doctorJob",doctorDO.getJobTitleName());
                            }else {
                                jsonObject.put("doctorJob",null);
                            }
                            jsonObject.put("doctorName",saveModel.getDoctorName());
                            jsonObject.put("topicZJ",saveModel.getResult1());
                            topicZJ = saveModel.getResult1();
                            break;
                        }
                    }
                }
                for (SaveModel saveModel:spzxSaveModels){
                    if (level2_type.equals(SaveModel.OrgLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getHospital())&&code.equalsIgnoreCase(saveModel.getHospital())){
                            jsonObject.put("code",code);
                            jsonObject.put("name",saveModel.getHospitalName());
                            jsonObject.put("vedioZJ",saveModel.getResult1());
                            vedioZJ = saveModel.getResult1();
                            break;
                        }
                    }else if (level2_type.equals(SaveModel.deptLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getDept())&&code.equalsIgnoreCase(saveModel.getDept())){
                            jsonObject.put("code",code);
                            jsonObject.put("name",saveModel.getDeptName());
                            jsonObject.put("vedioZJ",saveModel.getResult1());
                            vedioZJ = saveModel.getResult1();
                            break;
                        }
                    }else if (level2_type.equals(SaveModel.doctorLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getDoctor())&&code.equalsIgnoreCase(saveModel.getDoctor())){
                            if (level==6){
                                List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(area);
                                if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                                    BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
                                    jsonObject.put("code",doctorHospitalDO.getDeptCode());
                                    jsonObject.put("name",doctorHospitalDO.getDeptName());
                                }
                            }else {
                                DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
                                jsonObject.put("code",area);
                                jsonObject.put("name",dictHospitalDeptDO.getName());
                            }
                            jsonObject.put("doctorCode",code);
                            BaseDoctorDO doctorDO = doctorDao.findById(code);
                            if (doctorDO!=null){
                                jsonObject.put("doctorJob",doctorDO.getJobTitleName());
                            }else {
                                jsonObject.put("doctorJob",null);
                            }
                            jsonObject.put("doctorName",saveModel.getDoctorName());
                            jsonObject.put("vedioZJ",saveModel.getResult1());
                            vedioZJ = saveModel.getResult1();
                            break;
                        }
                    }
                }
                Double total1 = topic+vedio ;//图文和视频总和
                Double total = topic+vedio+synegy+specialist;//总和
                Double total = topic+vedio+synegy+specialist+topicZJ+vedioZJ;//总和
                Double total2 = topicZJ+vedioZJ ;//图文咨询和视频咨询总和
                jsonObject.put("total1",total1);//图文和视频总和
                jsonObject.put("total",total);//总和
                jsonObject.put("total2",total2);//图文咨询和视频咨询总和
                array.add(jsonObject);
            }
            object.put("excelData",array);
@ -455,6 +568,10 @@ public class StatisticsEsService {
            object.put("synergyData",array3);
            JSONArray array4 = dateTotalStatistics3(startDate,endDate,area,level,index,"1",SaveModel.timeLevel_ZL,"2");
            object.put("vedioData",array4);
            JSONArray array5 = dateTotalStatistics3(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,"1");
            object.put("twzxData",array5);
            JSONArray array6 = dateTotalStatistics3(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,"2");
            object.put("spzxData",array6);
        }else if (interval==2){
            JSONArray array = weekTotalStatistics7(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL);
            object.put("data",array);
@ -466,6 +583,10 @@ public class StatisticsEsService {
            object.put("synergyData",array3);
            JSONArray array4 = weekTotalStatistics8(startDate,endDate,area,level,index,"1",SaveModel.timeLevel_ZL,"2");
            object.put("vedioData",array4);
            JSONArray array5 = weekTotalStatistics8(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,"1");
            object.put("twzxData",array5);
            JSONArray array6 = weekTotalStatistics8(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,"2");
            object.put("spzxData",array6);
        }else if (interval==3){
            JSONArray array = monthTotalStatistics3(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
            object.put("data",array);
@ -477,6 +598,10 @@ public class StatisticsEsService {
            object.put("synergyData",array3);
            JSONArray array4 = monthTotalStatistics3(startDate,endDate,area,level,index,"1",SaveModel.timeLevel_ZL,"2");
            object.put("vedioData",array4);
            JSONArray array5 = monthTotalStatistics3(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,"1");
            object.put("twzxData",array5);
            JSONArray array6 = monthTotalStatistics3(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,"2");
            object.put("spzxData",array6);
        }
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        if (StringUtils.isNoneBlank(level2_type)){
@ -490,6 +615,10 @@ public class StatisticsEsService {
            List<SaveModel> topicSaveModels = elasticsearchUtil.findDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1","1",null,level2_type);
            ///视频复诊
            List<SaveModel> vedioSaveModels = elasticsearchUtil.findDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1","2",null,level2_type);
            ///图文咨询
            List<SaveModel> twzxSaveModels = elasticsearchUtil.findDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"3","1",null,level2_type);
            ///视频咨询
            List<SaveModel> spzxSaveModels = elasticsearchUtil.findDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"3","2",null,level2_type);
            JSONArray array = new JSONArray();
            List<String> list = new ArrayList<>();
@ -518,11 +647,13 @@ public class StatisticsEsService {
                Double topic = 0.0;
                Double vedio =0.0;
                Double synegy =0.0;
                Double topicZJ  =0.0;
                Double vedioZJ = 0.0;
                if (index.equalsIgnoreCase("3")){
                    specialist = 0.0;
                    jsonObject.put("specialist",specialist);
                }else if (index.equalsIgnoreCase("5")){
                    for (SaveModel saveModel:specialistSaveModels){
                   /* for (SaveModel saveModel:specialistSaveModels){
                        if (level2_type.equals(SaveModel.OrgLevel)){
                            if (StringUtils.isNoneBlank(saveModel.getHospital())&&code.equalsIgnoreCase(saveModel.getHospital())){
                                jsonObject.put("code",code);
@ -575,7 +706,7 @@ public class StatisticsEsService {
                                break;
                            }
                        }
                    }
                    }*/
                }
                for (SaveModel saveModel:syngySaveModels){
@ -735,10 +866,118 @@ public class StatisticsEsService {
                        }
                    }
                }
                for (SaveModel saveModel:twzxSaveModels){
                    if (level2_type.equals(SaveModel.OrgLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getHospital())&&code.equalsIgnoreCase(saveModel.getHospital())){
                            jsonObject.put("code",code);
                            jsonObject.put("name",saveModel.getHospitalName());
                            jsonObject.put("topicZJ",decimalFormat.format(saveModel.getResult1()));
                            topicZJ = saveModel.getResult1();
                            break;
                        }
                    }else if (level2_type.equals(SaveModel.deptLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getDept())&&code.equalsIgnoreCase(saveModel.getDept())){
                            jsonObject.put("code",code);
                            jsonObject.put("name",saveModel.getDeptName());
                            jsonObject.put("topicZJ",decimalFormat.format(saveModel.getResult1()));
                            topicZJ = saveModel.getResult1();
                            break;
                        }
                    }else if (level2_type.equals(SaveModel.doctorLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getDoctor())&&code.equalsIgnoreCase(saveModel.getDoctor())){
                            if (level==6){
                                List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(area);
                                if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                                    BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
                                    jsonObject.put("code",doctorHospitalDO.getDeptCode());
                                    jsonObject.put("name",doctorHospitalDO.getDeptName());
                                }
                            }else if (level==4){
                                BaseOrgDO orgDO = orgDao.findByCode(area);
                                jsonObject.put("code",area);
                                jsonObject.put("name",orgDO.getName());
                            }else if (level==2){
                                jsonObject.put("code",area);
                                jsonObject.put("name","厦门市");
                            }else {
                                DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
                                jsonObject.put("code",area);
                                jsonObject.put("name",dictHospitalDeptDO.getName());
                            }
                            BaseDoctorDO doctorDO = doctorDao.findById(code);
                            if (doctorDO!=null){
                                jsonObject.put("doctorJob",doctorDO.getJobTitleName());
                            }else {
                                jsonObject.put("doctorJob",null);
                            }
                            jsonObject.put("doctorCode",code);
                            jsonObject.put("doctorName",saveModel.getDoctorName());
                            jsonObject.put("topicZJ",decimalFormat.format(saveModel.getResult1()));
                            topicZJ = saveModel.getResult1();
                            break;
                        }
                    }
                }
                for (SaveModel saveModel:spzxSaveModels){
                    if (level2_type.equals(SaveModel.OrgLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getHospital())&&code.equalsIgnoreCase(saveModel.getHospital())){
                            jsonObject.put("code",code);
                            jsonObject.put("name",saveModel.getHospitalName());
                            jsonObject.put("vedioZJ",decimalFormat.format(saveModel.getResult1()));
                            vedioZJ = saveModel.getResult1();
                            break;
                        }
                    }else if (level2_type.equals(SaveModel.deptLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getDept())&&code.equalsIgnoreCase(saveModel.getDept())){
                            jsonObject.put("code",code);
                            jsonObject.put("name",saveModel.getDeptName());
                            jsonObject.put("vedioZJ",decimalFormat.format(saveModel.getResult1()));
                            vedioZJ = saveModel.getResult1();
                            break;
                        }
                    }else if (level2_type.equals(SaveModel.doctorLevel)){
                        if (StringUtils.isNoneBlank(saveModel.getDoctor())&&code.equalsIgnoreCase(saveModel.getDoctor())){
                            if (level==6){
                                List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(area);
                                if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                                    BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
                                    jsonObject.put("code",doctorHospitalDO.getDeptCode());
                                    jsonObject.put("name",doctorHospitalDO.getDeptName());
                                }
                            }else if (level==4){
                                BaseOrgDO orgDO = orgDao.findByCode(area);
                                jsonObject.put("code",area);
                                jsonObject.put("name",orgDO.getName());
                            }else if (level==2){
                                jsonObject.put("code",area);
                                jsonObject.put("name","厦门市");
                            }else {
                                DictHospitalDeptDO dictHospitalDeptDO =  hospitalDeptDao.findByCode(area);
                                jsonObject.put("code",area);
                                jsonObject.put("name",dictHospitalDeptDO.getName());
                            }
                            BaseDoctorDO doctorDO = doctorDao.findById(code);
                            if (doctorDO!=null){
                                jsonObject.put("doctorJob",doctorDO.getJobTitleName());
                            }else {
                                jsonObject.put("doctorJob",null);
                            }
                            jsonObject.put("doctorCode",code);
                            jsonObject.put("doctorName",saveModel.getDoctorName());
                            jsonObject.put("vedioZJ",decimalFormat.format(saveModel.getResult1()));
                            vedioZJ = saveModel.getResult1();
                            break;
                        }
                    }
                }
                Double total1 = topic+vedio ;//图文和视频总和
                Double total = topic+vedio+synegy+specialist;//总和
                Double total = topic+vedio+synegy+specialist+topicZJ+vedioZJ;//总和
                Double total2 = topicZJ+vedioZJ ;//图文咨询和视频咨询总和
                jsonObject.put("total1",decimalFormat.format(total1));//图文和视频总和
                jsonObject.put("total",decimalFormat.format(total));//总和
                jsonObject.put("total2",decimalFormat.format(total2));//咨询总和
                jsonObject.put("topicZJ",decimalFormat.format(topicZJ));//咨询总和
                jsonObject.put("vedioZJ",decimalFormat.format(vedioZJ));//咨询总和
                array.add(jsonObject);
            }
            List<JSONObject> bindArrayResult = JSONArray.parseArray(array.toJSONString(), JSONObject.class);
@ -818,16 +1057,22 @@ public class StatisticsEsService {
            Double specialistCount =0.0;
            //专科咨询
            SaveModel saveModel4 = null;
            saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index+",21", SaveModel.timeLevel_DDL, "3");
            saveModel4 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index+",21", SaveModel.timeLevel_DDL, "3","1");
            specialistCount = saveModel4.getResult1();//专家咨询数量
            //专科视频咨询
            Double specialistSPCount =0.0;
            SaveModel saveModel5 = null;
            saveModel5 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index+",21", SaveModel.timeLevel_DDL, "3","2");
            specialistSPCount = saveModel5.getResult1();//专家咨询视频数量
            Double synergyCount = saveModel1.getResult1();//协同门诊数量
            Double topicCount = saveModel2.getResult1();//图文复诊数量
            Double videoCount = saveModel3.getResult1();//视频复诊数量
            Double total = specialistCount+synergyCount+topicCount+videoCount;//总量
            Double total = specialistCount+synergyCount+topicCount+videoCount+specialistSPCount;//总量
            DecimalFormat decimalFormat = new DecimalFormat("0.00");
            object.put("specialistCount",decimalFormat.format(specialistCount));//专家咨询数
            object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
            object.put("specialistSPCount",decimalFormat.format(specialistSPCount));//专家咨询数
            object.put("specialistSPRate",getRange(specialistSPCount.intValue(),total.intValue(),0));
            object.put("synergyCount",decimalFormat.format(synergyCount));//专家咨询数
            object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
            object.put("topicCount",decimalFormat.format(topicCount));//图文复诊数量
@ -851,17 +1096,24 @@ public class StatisticsEsService {
*/
            saveModel3 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "16");
            Double specialistCount =0.0;
            //专科咨询
            //专科咨询图文
            SaveModel saveModel4 = null;
            saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1");
            specialistCount = saveModel4.getResult1();//专家咨询数量
            specialistCount = saveModel4.getResult1();
            //专科咨询视频
            Double specialistCountSP =0.0;
            SaveModel saveModel5 = null;
            saveModel5 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "17");
            specialistCountSP = saveModel5.getResult1();//专家咨询数量
            Double synergyCount = saveModel1.getResult1();//协同门诊数量
            Double topicCount = saveModel2.getResult1();//图文复诊数量
            Double videoCount = saveModel3.getResult1();//视频复诊数量
            Double total = specialistCount+synergyCount+topicCount+videoCount;//总量
            Double total = specialistCount+synergyCount+topicCount+videoCount+specialistCountSP;//总量
            object.put("specialistCount",specialistCount);//专家咨询数
            object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
            object.put("specialistSPCount",specialistCountSP);//专家咨询视频数
            object.put("specialistSPRate",getRange(specialistCountSP.intValue(),total.intValue(),0));
            object.put("synergyCount",synergyCount);//专家咨询数
            object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
            object.put("topicCount",topicCount);//图文复诊数量
@ -957,6 +1209,9 @@ public class StatisticsEsService {
        //专家咨询
        JSONArray specialistArray = dateTotalStatistics2(startDate,endDate,area,level,index,"1",SaveModel.timeLevel_ZL,null);
        object.put("specialistArray",specialistArray);
        //专家咨询
        JSONArray specialistSPArray = dateTotalStatistics2(startDate,endDate,area,level,index,"17",SaveModel.timeLevel_ZL,null);
        object.put("specialistSPArray",specialistSPArray);
        //协同复诊
        JSONArray syngeryArray = dateTotalStatistics2(startDate,endDate,area,level,index,"12",SaveModel.timeLevel_ZL,null);
        object.put("syngeryArray",syngeryArray);
@ -1147,7 +1402,7 @@ public class StatisticsEsService {
                    "AND bd.DEL = 1 " +
                    "AND bdh.DEL = 1 " +
                    "AND bd.OUTPATIENT_TYPE IS NOT NULL " +
                    " AND dhd.CONSULT_DEPT_FLAG='1' AND bd.job_title_code IN('1201','1301','1401','1101','066','067','061','1310','061','065')";
                    " AND dhd.CONSULT_DEPT_FLAG='1' AND bd.job_title_code IN('1201','1301','1401','1101','066','067','061','1310','061','065','1','2','3','4')";
            String deptSql = "select hd.CODE as \"CODE\",hd.NAME as \"NAME\" from DICT_HOSPITAL_DEPT hd where CONSULT_DEPT_FLAG=1";
            if (level==4){//科室
                sql+=" AND dhd.ORG_CODE = '"+area+"'";
@ -1169,6 +1424,8 @@ public class StatisticsEsService {
                    Long synegy = 0L;
                    Long specialist =0L;
                    Long other =0L;
                    Long topicZJ = 0L;
                    Long vedioZJ =0L;
                    for (Map<String,Object> map:mapList){
                        if (map.get("dept_code").toString().equalsIgnoreCase(map1.get("code").toString())){
                            String outpatientType = map.get("outpatient_type").toString();
@ -1181,7 +1438,9 @@ public class StatisticsEsService {
                                }else if (str[i].contains("xt")){
                                    synegy+=1;
                                }else if (str[i].contains("zj")){
                                    specialist+=1;
                                    topicZJ+=1;
                                } else if (str[i].contains("zxsp")){
                                    vedioZJ+=1;
                                }else {
                                    other+=1;
                                }
@ -1190,6 +1449,8 @@ public class StatisticsEsService {
                    }
                    object1.put("topic",topic);//图文
                    object1.put("vedio",vedio);//视频
                    object1.put("topicZJ",topicZJ);//图文
                    object1.put("vedioZJ",vedioZJ);//视频
                    object1.put("synegy",synegy);//协同
                    object1.put("specialist",specialist);//专家
                    object1.put("other",other);//其他
@ -1207,6 +1468,8 @@ public class StatisticsEsService {
                    Long synegy = 0L;
                    Long specialist =0L;
                    Long other =0L;
                    Long topicZJ = 0L;
                    Long vedioZJ =0L;
                    String outpatientType = map.get("outpatient_type").toString();
                    String str[]=outpatientType.split(",");
                    for (int i=0;i<str.length;i++){
@ -1217,13 +1480,17 @@ public class StatisticsEsService {
                        }else if (str[i].contains("xt")){
                            synegy+=1;
                        }else if (str[i].contains("zj")){
                            specialist+=1;
                            topicZJ+=1;
                        } else if (str[i].contains("zxsp")){
                            vedioZJ+=1;
                        }else {
                            other+=1;
                        }
                    }
                    object1.put("topic",topic);//图文
                    object1.put("vedio",vedio);//视频
                    object1.put("topicZJ",topicZJ);//图文
                    object1.put("vedioZJ",vedioZJ);//视频
                    object1.put("synegy",synegy);//协同
                    object1.put("specialist",specialist);//专家
                    object1.put("other",other);//其他
@ -1241,8 +1508,10 @@ public class StatisticsEsService {
            List<SaveModel> vedioModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "16",null, "6");
            //协同
            List<SaveModel> synegyModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "12",null, "6");
            //专科
            //专科图文
            List<SaveModel> specialistModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level,index, SaveModel.timeLevel_ZL,"1",null, "6");
            //专科视频
            List<SaveModel> specialistSPModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level,index, SaveModel.timeLevel_ZL,"17",null, "6");
            String deptSql = "select hd.CODE as \"CODE\",hd.NAME as \"NAME\" from DICT_HOSPITAL_DEPT hd where CONSULT_DEPT_FLAG=1";
            if (level==4){//科室
@ -1257,7 +1526,8 @@ public class StatisticsEsService {
                    Long topic = 0L;
                    Long vedio =0L;
                    Long synegy = 0L;
                    Long specialist =0L;
                    Long topicZJ =0L;
                    Long vedioZJ =0L;
                    Long other =0L;
                    JSONObject jsonObject = new JSONObject();
                    for(SaveModel saveModel:topicModels){
@ -1305,14 +1575,27 @@ public class StatisticsEsService {
                                saveModel.setDeptName(doctorHospitalDOs.get(0).getDeptName());
                            }
                            if(map.get("code").toString().equalsIgnoreCase(saveModel.getDept())){
                                    specialist+=1;
                                topicZJ+=1;
                            }
                        }
                    }
                    for(SaveModel saveModel:specialistSPModels){
                        if (saveModel.getResult1()>0){
                            List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(saveModel.getDoctor());
                            if (doctorHospitalDOs!=null&&doctorHospitalDOs.size()!=0){
                                saveModel.setDept(doctorHospitalDOs.get(0).getDeptCode());
                                saveModel.setDeptName(doctorHospitalDOs.get(0).getDeptName());
                            }
                            if(map.get("code").toString().equalsIgnoreCase(saveModel.getDept())){
                                vedioZJ+=1;
                            }
                        }
                    }
                    jsonObject.put("topic",topic);//图文
                    jsonObject.put("vedio",vedio);//视频
                    jsonObject.put("synegy",synegy);//协同
                    jsonObject.put("specialist",specialist);//专家
                    jsonObject.put("topicZJ",topicZJ);//专家
                    jsonObject.put("vedioZJ",vedioZJ);//视频
                    jsonObject.put("other",other);//其他
                    jsonObject.put("doctorName","-");//医生名字
                    jsonObject.put("doctorJob","-");//医生职称
@ -1343,7 +1626,8 @@ public class StatisticsEsService {
                    Long topic = 0L;
                    Long vedio =0L;
                    Long synegy = 0L;
                    Long specialist =0L;
                    Long topicZJ = 0L;
                    Long vedioZJ =0L;
                    Long other =0L;
                    for(SaveModel saveModel:topicModels){
                        if(jsonObject.getString("doctor").equalsIgnoreCase(saveModel.getDoctor())){
@ -1369,14 +1653,22 @@ public class StatisticsEsService {
                    for(SaveModel saveModel:specialistModels) {
                        if (jsonObject.getString("doctor").equalsIgnoreCase(saveModel.getDoctor())) {
                            if (saveModel.getResult1()>0){
                                specialist+=1;
                                topicZJ+=1;
                            }
                        }
                    }
                    for(SaveModel saveModel:specialistSPModels) {
                        if (jsonObject.getString("doctor").equalsIgnoreCase(saveModel.getDoctor())) {
                            if (saveModel.getResult1()>0){
                                vedioZJ+=1;
                            }
                        }
                    }
                    jsonObject.put("topic",topic);//图文
                    jsonObject.put("vedio",vedio);//视频
                    jsonObject.put("topicZJ",topicZJ);//图文
                    jsonObject.put("vedioZJ",vedioZJ);//视频
                    jsonObject.put("synegy",synegy);//协同
                    jsonObject.put("specialist",specialist);//专家
                    jsonObject.put("other",other);//其他
                    array.add(jsonObject);
                }
@ -1468,11 +1760,11 @@ public class StatisticsEsService {
            JSONObject json = new JSONObject();
            json.put("range", one.get("date"));
            json.put("amount", 0);
            json.put("num",0.0);
            json.put("num",0.00);
            result.add(json);
        }
//        }
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        if (saveModels != null) {
            // 计算结果
            for (SaveModel saveModel : saveModels) {
@ -1486,7 +1778,7 @@ public class StatisticsEsService {
                for(JSONObject obj : result){
                    if((obj.get("range")+"").equals(range)){
                        obj.put("amount", amount);
                        obj.put("num",num);
                        obj.put("num",decimalFormat.format(num));
                    }
                }
@ -1581,7 +1873,7 @@ public class StatisticsEsService {
            JSONObject json = new JSONObject();
            json.put("range", one.get("date"));
            json.put("amount", 0);
            json.put("num",0.0);
            json.put("num",0.00);
            result.add(json);
        }
//        }
@ -1753,7 +2045,7 @@ public class StatisticsEsService {
            JSONObject range = new JSONObject();
            range.put("range", endStr);
            range.put("amount", 0);
            range.put("num",0.0);
            range.put("num",0.00);
            countResult.put(endStr, range);
@ -1797,13 +2089,14 @@ public class StatisticsEsService {
//                if (range.equals(df.format(temp.getTime()))) {
//                    json.put("range", endDate);
//                }
                DecimalFormat decimalFormat = new DecimalFormat("0.00");
                if (json != null) {
                    long amount = saveModel.getResult2().longValue();
                    double num = saveModel.getResult1();
                    long previousAmount = Long.valueOf(json.get("amount").toString());
                    double previousNum = Double.parseDouble(json.get("num").toString());
                    json.put("amount", amount+previousAmount);
                    json.put("num",num+previousNum);
                    json.put("num",decimalFormat.format(num+previousNum));
                }
            }
@ -1927,7 +2220,7 @@ public class StatisticsEsService {
            JSONObject range = new JSONObject();
            range.put("range", endStr);
            range.put("amount", 0);
            range.put("num",0.0);
            range.put("num",0.00);
            countResult.put(endStr, range);
@ -2087,7 +2380,7 @@ public class StatisticsEsService {
            JSONObject range = new JSONObject();
            range.put("range", endStr);
            range.put("amount", 0);
            range.put("num",0.0);
            range.put("num",0.00);
            countResult.put(endStr, range);
@ -2122,7 +2415,7 @@ public class StatisticsEsService {
        else {
            saveModels = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, area, level, index, timelevel, SaveModel.interval_week);
        }
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        if (saveModels != null) {
            // 计算结果
            for (SaveModel saveModel : saveModels) {
@ -2139,11 +2432,12 @@ public class StatisticsEsService {
//                if (range.equals(df.format(temp.getTime()))) {
//                    json.put("range", endDate);
//                }
                if (json != null) {
                    long amount = saveModel.getResult2().longValue();
                    double num = saveModel.getResult1();
                    json.put("amount", amount);
                    json.put("num",num);
                    json.put("num",decimalFormat.format(num));
                }
            }
@ -2269,7 +2563,7 @@ public class StatisticsEsService {
            JSONObject range = new JSONObject();
            range.put("range", endStr);
            range.put("amount", 0);
            range.put("num",0.0);
            range.put("num",0.00);
            countResult.put(endStr, range);
@ -2427,7 +2721,7 @@ public class StatisticsEsService {
            range.put("range", endStr);
            range.put("amount", 0);
            range.put("num",0.0);
            range.put("num",0.00);
            countResult.put(endStr, range);
        }
@ -2464,11 +2758,12 @@ public class StatisticsEsService {
                /*if (range.equals(df.format(temp.getTime()))) {
                    json.put("range", endDate);
                }*/
                DecimalFormat decimalFormat = new DecimalFormat("0.00");
                if (json != null) {
                    long amount = saveModel.getResult2().longValue();
                    double num = saveModel.getResult1();
                    json.put("amount", amount);
                    json.put("num",num);
                    json.put("num",decimalFormat.format(num));
                }
            }
@ -2569,7 +2864,7 @@ public class StatisticsEsService {
            range.put("range", endStr);
            range.put("amount", 0);
            range.put("num",0.0);
            range.put("num",0.00);
            countResult.put(endStr, range);
        }
@ -2713,7 +3008,7 @@ public class StatisticsEsService {
            range.put("range", endStr);
            range.put("amount", 0);
            range.put("num",0.0);
            range.put("num",0.00);
            countResult.put(endStr, range);
        }
@ -2730,7 +3025,7 @@ public class StatisticsEsService {
        } else {
            saveModels = elasticsearchUtil.findDateQuotaLevel0AndPaibanLine(startDate, endDate, area, level, index, timelevel, SaveModel.interval_month,null);
        }
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        if (saveModels != null) {
            // 计算结果
            for (SaveModel saveModel : saveModels) {
@ -2747,7 +3042,7 @@ public class StatisticsEsService {
                    long amount = saveModel.getResult2().longValue();
                    double num = saveModel.getResult1();
                    json.put("amount", amount);
                    json.put("num",num);
                    json.put("num",decimalFormat.format(num));
                }
            }
@ -3571,25 +3866,32 @@ public class StatisticsEsService {
        JSONObject object = new JSONObject();
        //协同门诊
        SaveModel saveModel1 = null;
        saveModel1 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "14", SaveModel.timeLevel_ZL);
        saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "14", SaveModel.timeLevel_ZL,"12");
        //图文复诊
        SaveModel saveModel2 = null;
        saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "12", SaveModel.timeLevel_ZL);
        saveModel2 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "12", SaveModel.timeLevel_ZL,"9");
        //视频复诊
        SaveModel saveModel3 = null;
        saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "16", SaveModel.timeLevel_ZL);
        saveModel3 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "16", SaveModel.timeLevel_ZL,"16");
        Double specialistCount =0.0;
        //专科咨询
        SaveModel saveModel4 = null;
        saveModel4 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "7", SaveModel.timeLevel_ZL);
        saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "12", SaveModel.timeLevel_ZL,"1");
        specialistCount = saveModel4.getResult1();//专家咨询数量
        Double specialistSPCount =0.0;
        //专科咨询
        SaveModel saveModel5 = null;
        saveModel5 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "16", SaveModel.timeLevel_ZL,"17");
        specialistSPCount = saveModel5.getResult1();//专家咨询数量
        Double synergyCount = saveModel1.getResult1();//协同门诊数量
        Double topicCount = saveModel2.getResult1();//图文复诊数量
        Double videoCount = saveModel3.getResult1();//视频复诊数量
        Double total = specialistCount+synergyCount+topicCount+videoCount;//总量
        Double total = specialistCount+synergyCount+topicCount+videoCount+specialistSPCount;//总量
        object.put("specialistCount",specialistCount);//专家咨询数
        object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
        object.put("specialistSPCount",specialistSPCount);//专家咨询sp数
        object.put("specialistSPRate",getRange(specialistSPCount.intValue(),total.intValue(),0));
        object.put("synergyCount",synergyCount);//专家咨询数
        object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
        object.put("topicCount",topicCount);//图文复诊数量
@ -3709,7 +4011,7 @@ public class StatisticsEsService {
     * @return
     * @throws Exception
     */
    public JSONObject getConsultLinePC(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception {
    public JSONObject getConsultLinePC(String startDate, String endDate, String area, int level, String index,int interval, String level2_type,String lowCode) throws Exception {
        String index1= (Integer.parseInt(index)+1)+"";
        //问诊量
        JSONObject object = new JSONObject();
@ -3726,21 +4028,21 @@ public class StatisticsEsService {
                JSONArray array4 = dateTotalStatistics2(startDate,endDate,area,level,index1,"1",SaveModel.timeLevel_ZL,null);//已完成
                object.put("endData",array4);//已完成
            }else {
                JSONArray array = dateTotalStatistics2(startDate,endDate,area,level,index1,null,SaveModel.timeLevel_ZL,null);
                JSONArray array = dateTotalStatistics2(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,null);
                object.put("totalData",array);//新增量
                JSONArray array1 = dateTotalStatistics2(startDate,endDate,area,level,index1,"0",SaveModel.timeLevel_ZL,null);//未接诊
                JSONArray array1 = dateTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"0");//未接诊
                object.put("noReceiveData",array1);//未接诊
                JSONArray array2 = dateTotalStatistics2(startDate,endDate,area,level,index,"1,2,3",SaveModel.timeLevel_ZL,null);//已接诊
                JSONArray array2 = dateTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"1,2,3");//已接诊
                object.put("haveReceiveData",array2);//已接诊
                JSONArray array3 = dateTotalStatistics2(startDate,endDate,area,level,index,"-1",SaveModel.timeLevel_ZL,null);//患者取消
                JSONArray array3 = dateTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"-1");//患者取消
                object.put("concleData",array3);//患者取消
                JSONArray array4 = dateTotalStatistics2(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,null);//已结束
                JSONArray array4 = dateTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"3");//已结束
                object.put("endData",array4);//已结束
            }
        }else if (interval==2){
            if (index.equalsIgnoreCase("6")){
                JSONArray array = weekTotalStatistics7(startDate,endDate,area,level,index1,null,SaveModel.timeLevel_ZL);
                JSONArray array = weekTotalStatistics8(startDate,endDate,area,level,index1,null,SaveModel.timeLevel_ZL,null);
                object.put("totalData",array);//新增量
                JSONArray array1 = weekTotalStatistics7(startDate,endDate,area,level,index,"0",SaveModel.timeLevel_ZL);//未回复
                object.put("noReplyData",array1);;//未回复
@ -3751,15 +4053,15 @@ public class StatisticsEsService {
                JSONArray array4 = weekTotalStatistics7(startDate,endDate,area,level,index1,"1",SaveModel.timeLevel_ZL);//已完成
                object.put("endData",array3);//进行中
            }else {
                JSONArray array = weekTotalStatistics7(startDate,endDate,area,level,index1,null,SaveModel.timeLevel_ZL);
                JSONArray array = weekTotalStatistics8(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,null);
                object.put("totalData",array);//新增量
                JSONArray array1 = weekTotalStatistics7(startDate,endDate,area,level,index1,"0",SaveModel.timeLevel_ZL);//未接诊
                JSONArray array1 = weekTotalStatistics8(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"0");//未接诊
                object.put("noReceiveData",array1);;//未接诊
                JSONArray array2 = weekTotalStatistics7(startDate,endDate,area,level,index,"1,2,3",SaveModel.timeLevel_ZL);//已接诊
                JSONArray array2 = weekTotalStatistics8(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"1,2,3");//已接诊
                object.put("haveReceiveData",array2);//已接诊
                JSONArray array3 = weekTotalStatistics7(startDate,endDate,area,level,index,"-1",SaveModel.timeLevel_ZL);//患者取消
                JSONArray array3 = weekTotalStatistics8(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"-1");//患者取消
                object.put("concleData",array3);//患者取消
                JSONArray array4 = weekTotalStatistics7(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL);//已结束
                JSONArray array4 = weekTotalStatistics8(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"3");//已结束
                object.put("endData",array4);//已结束
            }
@ -3776,15 +4078,15 @@ public class StatisticsEsService {
                JSONArray array4 = monthTotalStatistics2(startDate,endDate,area,level,index1,"1",SaveModel.timeLevel_ZL,null);
                object.put("endData",array4);
            }else {
                JSONArray array = monthTotalStatistics2(startDate,endDate,area,level,index1,null,SaveModel.timeLevel_ZL,null);
                JSONArray array = monthTotalStatistics2(startDate,endDate,area,level,index1,lowCode,SaveModel.timeLevel_ZL,null);
                object.put("totalData",array);
                JSONArray array1 = monthTotalStatistics2(startDate,endDate,area,level,index1,"0",SaveModel.timeLevel_ZL,null);
                JSONArray array1 = monthTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"0");
                object.put("noReceiveData",array1);
                JSONArray array2 = monthTotalStatistics2(startDate,endDate,area,level,index,"1,2,3",SaveModel.timeLevel_ZL,null);
                JSONArray array2 = monthTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"1,2,3");
                object.put("haveReceiveData",array2);
                JSONArray array3 = monthTotalStatistics2(startDate,endDate,area,level,index,"-1",SaveModel.timeLevel_ZL,null);
                JSONArray array3 = monthTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"-1");
                object.put("concleData",array3);
                JSONArray array4 = monthTotalStatistics2(startDate,endDate,area,level,index,"3",SaveModel.timeLevel_ZL,null);
                JSONArray array4 = monthTotalStatistics2(startDate,endDate,area,level,index,lowCode,SaveModel.timeLevel_ZL,"3");
                object.put("endData",array4);
            }
@ -3804,13 +4106,13 @@ public class StatisticsEsService {
     * @return
     * @throws Exception
     */
    public JSONObject getConsultingListPC(String startTime,String endTime,int level, String area, String lowLevel,String index) throws Exception {
    public JSONObject getConsultingListPC(String startTime,String endTime,int level, String area, String lowLevel,String index,String lowCode) throws Exception {
        JSONObject result = new JSONObject();
        String index1= (Integer.parseInt(index)+1)+"";
//        timeKey= "2017-11-01 00:00:00";
        if(index.equalsIgnoreCase("6")){
            //已结束
            List<SaveModel> endTotal = elasticsearchUtil.findListDateQuotaLevel1(startTime, endTime, area, level, index1, SaveModel.timeLevel_ZL, lowLevel,"1");
            List<SaveModel> endTotal = elasticsearchUtil.findListDateQuotaLevel2(startTime, endTime, area, level, index1, SaveModel.timeLevel_ZL, lowLevel,lowCode,"1");
            //进行中
            List<SaveModel> comingTotal = elasticsearchUtil.findListDateQuotaLevel1(startTime, endTime, area, level, index1, SaveModel.timeLevel_ZL, lowLevel,"0");
            //咨询总数
@ -3822,18 +4124,18 @@ public class StatisticsEsService {
            result.put("resultList", getCoutListPC(level, lowLevel, endTotal, total, noRelyTotal,relyTotal,comingTotal));
        }else {
            //已结束
            List<SaveModel> endTotal = elasticsearchUtil.findListDateQuotaLevel1(startTime, endTime, area, level, index, SaveModel.timeLevel_ZL, lowLevel,"3");
            List<SaveModel> endTotal = elasticsearchUtil.findListDateQuotaLevel2(startTime, endTime, area, level, index, SaveModel.timeLevel_ZL, lowLevel,lowCode,"3");
            //居民取消
            List<SaveModel> concleTotal = elasticsearchUtil.findListDateQuotaLevel1(startTime, endTime, area, level, index, SaveModel.timeLevel_ZL, lowLevel,"-1");
            List<SaveModel> concleTotal = elasticsearchUtil.findListDateQuotaLevel2(startTime, endTime, area, level, index, SaveModel.timeLevel_ZL, lowLevel,lowCode,"-1");
            //咨询总数
            List<SaveModel> total = elasticsearchUtil.findListDateQuotaLevel0(startTime, endTime, area, level, index1, SaveModel.timeLevel_ZL, lowLevel);
            List<SaveModel> total = elasticsearchUtil.findListDateQuotaLevel1(startTime, endTime, area, level, index1, SaveModel.timeLevel_ZL, lowLevel,lowCode);
            logger.info("total"+total==null?"0":String.valueOf(total.size())+";"+total.get(0).getResult1());
            //已接诊
            List<SaveModel> haveReceiveTotal = elasticsearchUtil.findListDateQuotaLevel1(startTime, endTime, area, level, index, SaveModel.timeLevel_ZL, lowLevel,"1,2,3");
            List<SaveModel> haveReceiveTotal = elasticsearchUtil.findListDateQuotaLevel2(startTime, endTime, area, level, index, SaveModel.timeLevel_ZL, lowLevel,lowCode,"1,2,3");
            //未接诊
            List<SaveModel> noReceiveTotal = elasticsearchUtil.findListDateQuotaLevel1(startTime, endTime, area, level, index, SaveModel.timeLevel_ZL, lowLevel,"0");
            List<SaveModel> noReceiveTotal = elasticsearchUtil.findListDateQuotaLevel2(startTime, endTime, area, level, index, SaveModel.timeLevel_ZL, lowLevel,lowCode,"0");
            logger.info("noReceiveTotal"+noReceiveTotal==null?"0":String.valueOf(noReceiveTotal.size())+";"+noReceiveTotal.get(0).getResult1());
            result.put("resultList", getCoutListPC1(level, lowLevel, endTotal, total, haveReceiveTotal,noReceiveTotal,concleTotal));
                result.put("resultList", getCoutListPC1(level, lowLevel, endTotal, total, haveReceiveTotal,noReceiveTotal,concleTotal));
    }
@ -4126,11 +4428,11 @@ public class StatisticsEsService {
                SaveModel saveModel1 = null;//图文
                SaveModel saveModel2 = null;//视频
                if (timeLevel.equalsIgnoreCase(SaveModel.timeLevel_ZL)){
                    saveModel1 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level,"12" , SaveModel.timeLevel_ZL);
                    saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level,"16" , SaveModel.timeLevel_ZL);
                    saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level,"12" , SaveModel.timeLevel_ZL,"9");
                    saveModel2 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level,"16" , SaveModel.timeLevel_ZL,"16");
                }else if (timeLevel.equalsIgnoreCase(SaveModel.timeLevel_DDL)){
                    saveModel1 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level,"12" , SaveModel.timeLevel_DDL);
                    saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level,"16" , SaveModel.timeLevel_DDL);
                    saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level,"12" , SaveModel.timeLevel_DDL,"9");
                    saveModel2 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level,"16" , SaveModel.timeLevel_DDL,"16");
                }
                Double topicTotal = saveModel1.getResult1();
                Double vedioTotal = saveModel2.getResult1();
@ -4541,16 +4843,19 @@ public class StatisticsEsService {
    public  JSONObject appIndexCenter(String startDate, String endDate, String area, int level, String index) throws Exception {
        JSONObject object = new JSONObject();
        //图文复诊
        SaveModel topicTotal = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "12", SaveModel.timeLevel_ZL);
        SaveModel topicTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "12", SaveModel.timeLevel_ZL,"9");
        object.put("topicTotal",topicTotal.getResult1());
        //视频复诊
        SaveModel videoTotal = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "16", SaveModel.timeLevel_ZL);
        SaveModel videoTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "16", SaveModel.timeLevel_ZL,"16");
        object.put("videoTotal",videoTotal.getResult1());
        //专家咨询
        SaveModel specialistTotal = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "6", SaveModel.timeLevel_ZL);
        object.put("specialistTotal",specialistTotal.getResult1());
        //专家咨询twzxData
        SaveModel specialistTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "12", SaveModel.timeLevel_ZL,"1");
        object.put("twzxTotal",specialistTotal.getResult1());
        //专家咨询twzxData
        SaveModel specialistSPTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "16", SaveModel.timeLevel_ZL,"17");
        object.put("spzxTotal",specialistSPTotal.getResult1());
        //专科协同
        SaveModel synergyTotal = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, "14", SaveModel.timeLevel_ZL);
        SaveModel synergyTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, "14", SaveModel.timeLevel_ZL,"12");
        object.put("synergyTotal",synergyTotal.getResult1());
        return object;
    }
@ -4564,9 +4869,16 @@ public class StatisticsEsService {
        //视频复诊
        SaveModel videoTotal = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"1","2");
        object.put("videoTotal",decimalFormat.format(videoTotal.getResult1()));
        //专家咨询
        /*//专家咨询
        SaveModel specialistTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"3");
        object.put("specialistTotal",decimalFormat.format(specialistTotal.getResult1()));
        object.put("specialistTotal",decimalFormat.format(specialistTotal.getResult1()));*/
        //专家图文
        SaveModel specialistTW = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"3","1");
        object.put("specialistTW",decimalFormat.format(specialistTW.getResult1()));
        //专家视频
        SaveModel specialistSP = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"3","2");
        object.put("specialistSP",decimalFormat.format(specialistSP.getResult1()));
        //专科协同
        SaveModel synergyTotal = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL,"2");
        object.put("synergyTotal",decimalFormat.format(synergyTotal.getResult1()));
@ -4617,8 +4929,14 @@ public class StatisticsEsService {
            Double specialistCount =0.0;
            //专科咨询
            SaveModel saveModel4 = null;
            saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "3");
            specialistCount = saveModel4.getResult1();//专家咨询数量
            saveModel4 = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "3","1");
            specialistCount = saveModel4.getResult1();//专家咨询TW数量
            Double specialistCountSP =0.0;
            //专科咨询
            SaveModel saveModel6 = null;
            saveModel6 = elasticsearchUtil.findOneDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, "3","2");
            specialistCountSP = saveModel6.getResult1();//专家咨询SP数量
            //总量
            SaveModel saveModel5 = null;
@ -4631,7 +4949,9 @@ public class StatisticsEsService {
            Double total = saveModel5.getResult1();//总量
            DecimalFormat decimalFormat = new DecimalFormat("0.00");
            object.put("specialistCount",decimalFormat.format(specialistCount));//专家咨询数
            object.put("specialistSPCount",decimalFormat.format(specialistCountSP));//专家咨询视频数
            object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
            object.put("specialistSPRate",getRange(specialistCountSP.intValue(),total.intValue(),0));
            object.put("synergyCount",decimalFormat.format(synergyCount));//专家咨询数
            object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
            object.put("topicCount",decimalFormat.format(topicCount));//图文复诊数量
@ -4778,7 +5098,7 @@ public class StatisticsEsService {
            JSONObject range = new JSONObject();
            range.put("range", endStr);
            range.put("amount", 0);
            range.put("num",0.0);
            range.put("num",0.00);
            countResult.put(endStr, range);
@ -4804,6 +5124,7 @@ public class StatisticsEsService {
        } else {
            saveModels = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, area, level, index, timelevel, SaveModel.interval_day);
        }
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        if (saveModels != null) {
            // 计算结果
            for (SaveModel saveModel : saveModels) {
@ -4856,7 +5177,7 @@ public class StatisticsEsService {
                    long previousAmount = Long.valueOf(json.get("amount").toString());
                    double previousNum = Double.parseDouble(json.get("num").toString());
                    json.put("amount", amount+previousAmount);
                    json.put("num",num+previousNum);
                    json.put("num",decimalFormat.format(num+previousNum));
                }
            }
@ -4981,7 +5302,7 @@ public class StatisticsEsService {
            JSONObject range = new JSONObject();
            range.put("range", endStr);
            range.put("amount", 0);
            range.put("num",0.0);
            range.put("num",0.00);
            countResult.put(endStr, range);
@ -5069,7 +5390,7 @@ public class StatisticsEsService {
                    long previousAmount = Long.valueOf(json.get("amount").toString());
                    double previousNum = Double.parseDouble(json.get("num").toString());
                    json.put("amount", amount+previousAmount);
                    json.put("num",num+previousNum);
                    json.put("num",decimalFormat.format(num+previousNum));
                }
            }

+ 49 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/yx/YxTokenMappingDO.java

@ -0,0 +1,49 @@
package com.yihu.jw.entity.base.yx;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import sun.awt.SunHints;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "yx_token_mapping")
public class YxTokenMappingDO extends UuidIdentityEntityWithOperator {
    /**
     *云信token
     */
    private String token;
    /**
     *用户id
     */
    private String accid;
    /**
     *用户名称
     */
    private String name;
    @Column(name = "token")
    public String getToken() {
        return token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    @Column(name = "accid")
    public String getAccid() {
        return accid;
    }
    public void setAccid(String accid) {
        this.accid = accid;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

BIN
jkzl - 快捷方式.lnk


+ 57 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/WlyyHospitalSysDictEndpoint.java

@ -0,0 +1,57 @@
package com.yihu.jw.base.endpoint.dict;
import com.yihu.jw.hospital.dict.service.WlyyHospitalSysDictService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = BaseRequestMapping.DictDisease.PREFIX)
@Api(value = "Sys字典管理", description = "Sys字典管理", tags = {"wlyy基础服务 - Sys字典管理"})
public class WlyyHospitalSysDictEndpoint extends EnvelopRestEndpoint {
    private static Logger logger = LoggerFactory.getLogger(WlyyHospitalSysDictEndpoint.class);
    @Autowired
    private WlyyHospitalSysDictService wlyyHospitalSysDictService;
    @ApiOperation("查询字典")
    @GetMapping(value= BaseHospitalRequestMapping.PatientNoLogin.findDict)
    public ListEnvelop findDict(@ApiParam(name = "name", value = "name", required = false)
                                @RequestParam(value = "name", required = false)String name,
                                @ApiParam(name = "code", value = "code", required = false)
                                @RequestParam(value = "code", required = false)String code,
                                @ApiParam(name = "value", value = "value", required = false)
                                @RequestParam(value = "value", required = false)String value1,
                                @ApiParam(name = "page", value = "page", required = false)
                                @RequestParam(value = "page", required = false) Integer page,
                                @ApiParam(name = "pageSize", value = "pageSize", required = false)
                                @RequestParam(value = "pageSize", required = false)Integer pageSize){
        return success(wlyyHospitalSysDictService.findDictsByNameCode(name,code,value1,page,pageSize));
    }
    @ApiOperation("删除字典")
    @GetMapping(value= BaseHospitalRequestMapping.PatientNoLogin.delDict)
    public Envelop delDict(@ApiParam(name = "id", value = "id", required = true)
                           @RequestParam(value = "id", required = true)String id){
        return success(wlyyHospitalSysDictService.deleteDictById(id));
    }
    @ApiOperation("新增/修改字典")
    @GetMapping(value= BaseHospitalRequestMapping.PatientNoLogin.createOrUpdateDict)
    public Envelop createOrUpdateDict(@ApiParam(name = "json", value = "id", required = true)
                                      @RequestParam(value = "json", required = true)String json) throws Exception{
        return success(wlyyHospitalSysDictService.updateOrCreateDict(json));
    }
}

+ 7 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -195,7 +195,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
                mixEnvelop.setMessage("验证码发送失败");
                mixEnvelop.setStatus(500);
            }
        }else {
        }else if("xm_xzzx_wx".equalsIgnoreCase(wxId)){
            //发送短信获取验证码
            JSONObject object = new JSONObject();
            object.put("operatetel","18788888888");
@ -279,7 +279,12 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
            String medicareType = jsonObject.getString("medicareType");
            String medicare = jsonObject.getString("medicare");
            String clinicId = jsonObject.getString("clinicId");
            boolean checkCode = this.verification(client_id, username, code);
            boolean checkCode =false;
            if(!StringUtils.isEmpty(code)){
                checkCode = this.verification(client_id, username, code);
            }else if(StringUtils.isEmpty(code)&&StringUtils.isEmpty(client_id)) {
                checkCode = true;
            }
            if (checkCode) {
                String patientId = jsonObject.getString("patientId");
                String familyName = jsonObject.getString("familyName");

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -2311,7 +2311,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "flag", value = "flag")
            @RequestParam(value = "flag",defaultValue = "",required = false) String flag) throws Exception {
        if (StringUtils.isNoneBlank(flag)&&flag.equalsIgnoreCase("yx")){
            return success(prescriptionService.yxToken(userId,channelName));
            return success(prescriptionService.yxToken2(userId,channelName));
        }else {
            return success(prescriptionService.appletSign(userId));
        }

+ 5 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

@ -6,6 +6,7 @@ import com.yihu.jw.es.service.StatisticsEsService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -764,10 +765,11 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index,
            @RequestParam(required = true)Integer interval,
            @RequestParam(required = false)String  lowCode,
            @RequestParam(required = false)String level2_type) {
        JSONObject result = new JSONObject();
        try {
            result = statisticsEsService.getConsultLinePC(startDate, endDate, area, level, index,interval,level2_type);
            result = statisticsEsService.getConsultLinePC(startDate, endDate, area, level, index,interval,level2_type,lowCode);
        } catch (Exception e) {
            e.printStackTrace();
@ -792,10 +794,11 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index,
            @RequestParam(required = false) String lowCode,
            @RequestParam(required = true)String lowLevel) {
        JSONObject result = new JSONObject();
        try {
            result = statisticsEsService.getConsultingListPC(startDate, endDate, level,area,lowLevel, index);
            result = statisticsEsService.getConsultingListPC(startDate, endDate, level,area,lowLevel, index,lowCode);
        } catch (Exception e) {
            e.printStackTrace();