Explorar o código

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan %!s(int64=4) %!d(string=hai) anos
pai
achega
5164cffe4e
Modificáronse 42 ficheiros con 2357 adicións e 339 borrados
  1. 2 0
      business/base-service/src/main/java/com/yihu/jw/area/dao/BaseCityDao.java
  2. 5 2
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  3. 4 2
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  4. 224 22
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 2 0
      business/base-service/src/main/java/com/yihu/jw/org/dao/BaseOrgDao.java
  6. 3 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientMedicareCardDao.java
  7. 4 3
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  8. 32 4
      business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java
  9. 12 0
      business/base-service/src/main/java/com/yihu/jw/yx/dao/YxTokenMappingDao.java
  10. 451 119
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  11. 10 0
      business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java
  12. 2 0
      business/im-service/src/main/java/com/yihu/jw/im/dao/ConsultDao.java
  13. 17 0
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  14. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  15. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  16. 49 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/yx/YxTokenMappingDO.java
  17. 84 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/DoctorQuickReply.java
  18. 4 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  19. BIN=BIN
      jkzl - 快捷方式.lnk
  20. 14 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/core/redis/WlyyRedisVerifyCodeService.java
  21. 155 97
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  22. 57 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/WlyyHospitalSysDictEndpoint.java
  23. 149 0
      svr/svr-door-serivce/sql/初始sql.sql
  24. 160 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/common/DistrictController.java
  25. 56 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorConsultController.java
  26. 27 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorController.java
  27. 170 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorQuickReplyController.java
  28. 8 8
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java
  29. 18 5
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/ConsultController.java
  30. 31 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/PatientController.java
  31. 40 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/consult/DoctorQuickReplyDao.java
  32. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java
  33. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorServiceApplicationService.java
  34. 6 3
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java
  35. 14 9
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/HospitalService.java
  36. 167 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/PatientService.java
  37. 62 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/consult/ConsultTeamService.java
  38. 190 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/consult/DoctorQuickReplyService.java
  39. 80 54
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  40. 17 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  41. 9 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  42. 8 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/area/dao/BaseCityDao.java

@ -28,5 +28,7 @@ public interface BaseCityDao extends PagingAndSortingRepository<BaseCityDO, Inte
    @Query("select code,name from BaseCityDO")
    List<BaseCityDO> getAllCity();
    @Query("select a from BaseCityDO a where a.province = ?1 order by id")
    Iterable<BaseCityDO> findByProvince(String province);
}

+ 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);

+ 224 - 22
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;
@ -3589,7 +3594,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("popularity",doctorDO.getPopularity());
            rs.put("qrcode",doctorDO.getQrcode());
            //号别
            String deptTyepCode = "";
            /*String deptTyepCode = "";
            if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                deptTyepCode = "6";
                List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor);
@ -3605,7 +3610,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                }
            }
            }*/
            List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
            /*String chargeType = doctorDO.getChargeType();
            if (StringUtils.isNotBlank(chargeType)){
@ -3696,11 +3701,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//            Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
//            rs.put("coordinationCout",coordinationCout);
            //医生关注
            List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctor,patient);
            if (doctorPatientFollowDOS != null && doctorPatientFollowDOS.size() > 0) {
                rs.put("attention", "1");
            } else {
                rs.put("attention", "0");
            if(StringUtils.isNotBlank(patient)){
                List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctor,patient);
                if (doctorPatientFollowDOS != null && doctorPatientFollowDOS.size() > 0) {
                    rs.put("attention", "1");
                } else {
                    rs.put("attention", "0");
                }
            }
@ -5298,9 +5305,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " d.outpatient_type AS \"outpatientType\"," +
                " a.total AS \"consultTotal\"," +
                " h.org_name AS \"orgName\"," +
                " h.org_code AS \"orgCode\"," +
                " follow.id AS \"followid\" " +
                " FROM " +
                " h.org_code AS \"orgCode\" " ;
        if(StringUtils.isNoneBlank(patientid)){
            sql+=" , follow.id AS \"followid\" " ;
        }
        sql+=" FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 3 GROUP BY doctor ) a on a.doctor = d.id ";
@ -5322,15 +5331,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 ";
@ -5343,9 +5353,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        sql += " WHERE  1=1 ";
        if (StringUtils.isBlank(chargType)) {
            sql += " AND d.charge_type is not null ";
        }
        if (StringUtils.isNotBlank(chargType)) {
            if ("all".equals(chargType)) {
                //不过滤
@ -9612,6 +9620,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();
@ -9968,4 +10022,152 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        List<WlyyHospitalSysDictDO> isWork=sysDictDao.findByDictCode(dictCode);
        return isWork;
    }
    /**
     * 上门复诊
     *
     * @param outpatientJson
     * @param expressageJson
     * @return
     * @throws Exception
     */
    @Transactional
    public WlyyOutpatientDO appointmentRevisitOnDoor(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("1");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setOutpatientType("4");//4为上门复诊
        outpatientDO.setType("1");//1为图文复诊(上门默认图文复诊)
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
        outpatientDO.setPayStatus(1);
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        if (StringUtils.isNoneBlank(expressageJson)){
            WlyyPrescriptionExpressageDO expressageDO = new WlyyPrescriptionExpressageDO();
            expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
            System.out.println("写入自取信息");
            String drugStoreCode = expressageDO.getHospitalCode();
            BaseDrugStoreDO baseDrugStoreDO = baseDrugStoreDao.findDrugByid(drugStoreCode);
            if (null!=baseDrugStoreDO){
                expressageDO.setCityCode(baseDrugStoreDO.getCityCode());
                expressageDO.setCityName(baseDrugStoreDO.getCityName());
                expressageDO.setProvinceCode(baseDrugStoreDO.getProvinceCode());
                expressageDO.setProvinceName(baseDrugStoreDO.getProvinceName());
                expressageDO.setTownCode(baseDrugStoreDO.getTownCode());
                expressageDO.setTownName(baseDrugStoreDO.getTownName());
                expressageDO.setHospitalCode(baseDrugStoreDO.getDrugStoreCode());
                expressageDO.setHospitalName(baseDrugStoreDO.getHospitalName());
                expressageDO.setHospitalAddress(baseDrugStoreDO.getAddress());
            }
            expressageDO.setDel(1);
            expressageDO.setCreateTime(new Date());
            expressageDO.setOutpatientId(outpatient.getId());
            prescriptionExpressageDao.save(expressageDO);
        }
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY");
        Double price = 0.0;
        String chargeType1 = null;
        if (doctorDO!=null){
            if (outpatient.getOutpatientType().equalsIgnoreCase("1")){
                if(outpatientDO.getType().equalsIgnoreCase("1")){
                    chargeType1 = doctorDO.getTwfzChargeType();
                }else if(outpatientDO.getType().equalsIgnoreCase("2")){
                    chargeType1 = doctorDO.getSpfzChargeType();
                }
            }else if (outpatient.getOutpatientType().equalsIgnoreCase("3")){
                if(outpatientDO.getType().equalsIgnoreCase("1")){
                    chargeType1 = doctorDO.getTwzxChargeType();
                }else if(outpatientDO.getType().equalsIgnoreCase("2")){
                    chargeType1 = doctorDO.getSpzxChargeType();
                }
            }else if (outpatient.getOutpatientType().equalsIgnoreCase("2")){
                chargeType1 = doctorDO.getXtfzChargeType();
            }else if (outpatient.getOutpatientType().equalsIgnoreCase("4")){
                chargeType1 = "on_door_type";
            }
            if(doctorDO!=null){
                if (StringUtils.isNoneBlank(chargeType1)){
                    WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeType(chargeType1);
                    if (chargeDictDO!=null){
                        price = chargeDictDO.getReqFee();
                    }else {
                        price = Double.parseDouble(hospitalSysDictDO.getDictValue());
                    }
                }
            }else {
                price = Double.parseDouble(hospitalSysDictDO.getDictValue());
            }
        }else {
            if (StringUtils.isNoneBlank(chargeType)){
                WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeType(chargeType);
                if (chargeDictDO!=null){
                    price = chargeDictDO.getReqFee();
                }else {
                    price = Double.parseDouble(hospitalSysDictDO.getDictValue());
                }
            }
        }
        outpatient.setFee(price);
        outpatientDao.save(outpatient);
        /*if (doctorDO != null && StringUtils.isNoneBlank(doctorDO.getFee())) {
            price = Double.parseDouble(doctorDO.getFee());
        }else {
            price = Double.parseDouble(hospitalSysDictDO.getDictValue());
        }*/
        /*if (price == 0.0) {
        } else {
            outpatientDO.setPayStatus(0);
        }*/
        if (outpatient.getOutpatientType().equalsIgnoreCase("1")){
            if (outpatient.getType().equalsIgnoreCase("1")){
                businessOrderService.recharge(outpatient.getId(), "图文复诊-诊查费", "2", "图文复诊-诊查费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
            }else if (outpatient.getType().equalsIgnoreCase("2")){
                businessOrderService.recharge(outpatient.getId(), "视频复诊-诊查费", "3", "视频复诊-诊查费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
            }
        }else if (outpatient.getOutpatientType().equalsIgnoreCase("2")){
            businessOrderService.recharge(outpatient.getId(), "协同复诊-诊查费", "5", "协同复诊-诊查费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
        }else if ("3".equalsIgnoreCase(outpatient.getOutpatientType())){
            BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "专家咨询费", "1", "专家咨询费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
        }
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        WlyyPatientRegisterTimeDO wlyyPatientRegisterTimeDO =new WlyyPatientRegisterTimeDO();
        try {
            //如果是视频预约咨询
            if (StringUtils.isNotBlank(registerJson)) {
                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class);
                registerTimeDO.setOutpatientId(outpatient.getId());
                registerTimeDO.setCreateTime(new Date());
                wlyyPatientRegisterTimeDO = patientRegisterTimeDao.save(registerTimeDO);
            }
        } catch (Exception e) {
            throw new RuntimeException("号源已经被预约,请选择其他号源");
        }
        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            logger.info("心脏中心同步患者开始");
            xzzxEntranceService.updatePatientMapping(outpatient.getConsumer(),outpatient.getCardNo());
            logger.info("同步患者id成功");
        }
        //3.创建候诊室
        //createRoom(outpatient, chargeType);
        String content = "向您发起了图文复诊,点击查看";
        return outpatient;
    }
}

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/org/dao/BaseOrgDao.java

@ -46,6 +46,8 @@ public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String
    List<BaseOrgDO> findByCityCode(String cityCode);
    List<BaseOrgDO> findByTownCode(String townCode);
    List<BaseOrgDO> findByCityCodeAndOrgLevel(String cityCode,Integer level);
    List<BaseOrgDO> findByDel(String del);

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientMedicareCardDao.java

@ -20,6 +20,9 @@ public interface BasePatientMedicareCardDao extends PagingAndSortingRepository<P
    PatientMedicareCardDO findByCode(String code);
    @Query("from PatientMedicareCardDO where  code= ?1 and patientCode = ?2")
    PatientMedicareCardDO findByCodeAndPatientCode(String code ,String patientCode);
    PatientMedicareCardDO findByTypeAndPatientCodeAndDel(String Type,String patientCode,String del);
    boolean existsByCodeAndDel(String code,String del);

+ 4 - 3
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -163,14 +163,15 @@ public class WxTemplateService {
                            wlyyOutpatientDO = outpatientDao.findById(consultDo.getRelationCode());
                        }
                        if (wlyyOutpatientDO!=null){
                            config.setKeyword2(config.getKeyword2()+DateUtil.dateToStrLong(wlyyOutpatientDO.getCreateTime()));
                            config.setKeyword3(config.getKeyword3()+wlyyOutpatientDO.getIcd10Name());
                            config.setKeyword2(DateUtil.dateToStrLong(wlyyOutpatientDO.getCreateTime()));
                            config.setKeyword3(wlyyOutpatientDO.getDeptName());
                            config.setKeyword4(wlyyOutpatientDO.getDescription());
                        }
                        WxWechatDO wechatDO = wechatDao.findById(wechatId);
                        if (wechatDO!=null){
                            config.setAppid(wechatDO.getApplets());
                        }
                        config.setKeyword1(config.getKeyword1()+doctorDO.getName());
                        config.setKeyword1(doctorDO.getName());
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                    }
                }

+ 32 - 4
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -218,6 +218,14 @@ public class WlyyBusinessService {
                    patient.setBirthday(DateUtil.strToDate(data.getString("birthday"),"yyyyMMdd"));
                    patient = basePatientDao.save(patient);
                    result = patient.getId();
                    if(data.get("ssc")!=null){
                        PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
                        patientMedicareCardDO.setDel("1");
                        patientMedicareCardDO.setPatientCode(patient.getId());
                        patientMedicareCardDO.setCode(data.getString("ssc"));
                        patientMedicareCardDO.setType("A_01");
                        patientMedicareCardDao.save(patientMedicareCardDO);
                    }
                }else{
                    throw new Exception("请求i健康接口,获取居民信息失败");
                }
@ -340,7 +348,29 @@ public class WlyyBusinessService {
                    }
                }
            }else {
                //TODO
                PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patientId,"1");
                if (patientMedicareCardDO!=null){
                    patientCardNo = patientMedicareCardDO.getCode();
                }else {
                    Map<String,String> params2 = new HashMap<>();
                    params2.put("idcard",idcard);
                    JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatient",null,params2);
                    if(rs!=null) {
                        Integer status = rs.getInteger("status");
                        if (200 == status) {
                            JSONObject data = rs.getJSONObject("data");
                            if (data.get("ssc")!=null){
                                patientCardNo = data.getString("ssc");
                                patientMedicareCardDO = new PatientMedicareCardDO();
                                patientMedicareCardDO.setPatientCode(patientId);
                                patientMedicareCardDO.setCode(patientCardNo);
                                patientMedicareCardDO.setType("A_01");
                                patientMedicareCardDO.setDel("1");
                                patientMedicareCardDao.save(patientMedicareCardDO);
                            }
                        }
                    }
                }
            }
            if (!StringUtils.isNoneBlank(patientCardNo)){
                return "社保卡不能为空!";
@ -353,9 +383,7 @@ public class WlyyBusinessService {
            patientSccParams.put("sex",basePatientDO.getSex().toString());
            patientSccParams.put("phone",basePatientDO.getMobile());
            patientSccParams.put("birthday",DateUtil.dateToStrShort(basePatientDO.getBirthday()));
            JSONObject object = wlyyHttpService.sendWlyyMes("wlyyFindAccountBySsc", null, patientSccParams);
            //JSONObject object = wlyyHttpService.sendWlyyMes("wlyyFindAccountBySsc", null, patientSccParams);
            JSONObject rs = wlyyHttpService.sendWlyyMes("wlyyGetPatientAccetokenByIdcard",null,params);
            if(rs!=null){

+ 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);
}

+ 451 - 119
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){
@ -637,7 +768,7 @@ public class StatisticsEsService {
                            jsonObject.put("code",code);
                            jsonObject.put("name",saveModel.getHospitalName());
                            jsonObject.put("topic",decimalFormat.format(saveModel.getResult1()));
                            synegy = saveModel.getResult1();
                            topic = saveModel.getResult1();
                            break;
                        }
                    }else if (level2_type.equals(SaveModel.deptLevel)){
@ -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));
                }
            }
@ -3401,7 +3696,7 @@ public class StatisticsEsService {
     * @return
     * @throws Exception
     */
    public JSONObject getConsultHead(String startDate, String endDate, String area, int level, String index) throws Exception {
    public JSONObject getConsultHead(String startDate, String endDate, String area, int level, String index,String lowCode) throws Exception {
        JSONObject object = new JSONObject();
        if (index.equalsIgnoreCase("6")){
            //总量
@ -3444,14 +3739,25 @@ public class StatisticsEsService {
         /*   //进行中
            SaveModel saveModel5 = null;*/
            String index1= (Integer.parseInt(index)+1)+"";
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, area, level, index1, SaveModel.timeLevel_ZL);
            saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(startDate,endDate, area, level, index1, SaveModel.timeLevel_ZL,"1");
            saveModel3 = elasticsearchUtil.findOneDateQuotaLevel1(startDate,endDate, area, level, index, SaveModel.timeLevel_ZL,"2");
            saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(startDate,endDate, area, level, index, SaveModel.timeLevel_ZL,"-1");
            //居民取消
            List<SaveModel> concleTotal = elasticsearchUtil.findListDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, null,lowCode,"-1");
            //咨询总数
            List<SaveModel> total = elasticsearchUtil.findListDateQuotaLevel1(startDate, endDate, area, level, index1, SaveModel.timeLevel_ZL, null,lowCode);
            //已结束
            List<SaveModel> endTotal = elasticsearchUtil.findListDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, null,lowCode,"3");
            logger.info("total"+total==null?"0":String.valueOf(total.size())+";"+total.get(0).getResult1());
            //已接诊
            List<SaveModel> haveReceiveTotal = elasticsearchUtil.findListDateQuotaLevel2(startDate, endDate, area, level, index1, SaveModel.timeLevel_ZL, null,lowCode,"1");
            //未接诊
            List<SaveModel> noReceiveTotal = elasticsearchUtil.findListDateQuotaLevel2(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, null,lowCode,"0");
            saveModel = total.get(0);//elasticsearchUtil.bfindOneDateQuotaLevel12(startDate, endDate, area, level, index1, SaveModel.timeLevel_ZL,lowCode,"");
            saveModel1 = haveReceiveTotal.get(0);//elasticsearchUtil.bfindOneDateQuotaLevel12(startDate,endDate, area, level, index1, SaveModel.timeLevel_ZL,lowCode,"1");
            saveModel3 = endTotal.get(0);//elasticsearchUtil.bfindOneDateQuotaLevel12(startDate,endDate, area, level, index, SaveModel.timeLevel_ZL,lowCode,"3");
            saveModel4 = concleTotal.get(0);//elasticsearchUtil.bfindOneDateQuotaLevel12(startDate,endDate, area, level, index, SaveModel.timeLevel_ZL,lowCode,"-1");
/*
            saveModel5 = elasticsearchUtil.findOneDateQuotaLevel1(startDate, area, level, index1, SaveModel.timeLevel_ZL,"0");
*/
            saveModel2 = elasticsearchUtil.findOneDateQuotaLevel1(startDate,endDate, area, level, index1, SaveModel.timeLevel_ZL,"0");
            saveModel2 = noReceiveTotal.get(0);elasticsearchUtil.bfindOneDateQuotaLevel12(startDate,endDate, area, level, index, SaveModel.timeLevel_ZL,lowCode,"0");
            object.put("consultTotal",saveModel.getResult1());//咨询总量
            object.put("haveReceiveTotal",saveModel1.getResult1());//已接诊
            object.put("noReceiveTotal",saveModel2.getResult1());//未接诊
@ -3571,25 +3877,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 +4022,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 +4039,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,index1,lowCode,SaveModel.timeLevel_ZL,"1");//已接诊
                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 +4064,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,index1,lowCode,SaveModel.timeLevel_ZL,"1");//已接诊
                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 +4089,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,index1,lowCode,SaveModel.timeLevel_ZL,"1");
                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 +4117,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 +4135,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, index1, SaveModel.timeLevel_ZL, lowLevel,lowCode,"1");
            //未接诊
            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));
    }
@ -3938,11 +4251,11 @@ public class StatisticsEsService {
            Integer haveReceiveNm = haveReceiveRs.getResult2().intValue();
//            rs.put("name", relyRs.get(area+"Name"));
            if (SaveModel.doctorLevel.equals(low_level)) {
                rs.put("name", endRs.getDoctorName());
                rs.put("name", totalRs.getDoctorName());
            } else if (SaveModel.deptLevel.equals(low_level)) {
                rs.put("name", endRs.getDeptName());
                rs.put("name", totalRs.getDeptName());
            } else if (SaveModel.OrgLevel.equals(low_level)) {
                rs.put("name", endRs.getHospitalName());
                rs.put("name", totalRs.getHospitalName());
            }
            rs.put("concleCount", concleNm);
            rs.put("endCount", endNm);
@ -4126,11 +4439,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();
@ -4241,7 +4554,7 @@ public class StatisticsEsService {
                    jsonObject.put("deptName",saveModel.getDeptName());
                    jsonObject.put("specialist",saveModel.getResult1());
                    jsonObject.put("doctorName",saveModel.getDoctorName());
                    jsonObject.put("doctorcode",saveModel.getDoctor());
                    jsonObject.put("doctorCode",saveModel.getDoctor());
                    for(SaveModel saveModel1:outpatientList){
                        String outdoc=saveModel1.getDoctor()==null?"":saveModel1.getDoctor();
                        String predoc=saveModel.getDoctor()==null?"":saveModel.getDoctor();
@ -4304,7 +4617,7 @@ public class StatisticsEsService {
                jsonObject.put("deptName",saveModel.getDeptName());
                jsonObject.put("specialist",saveModel.getResult1());
                jsonObject.put("doctorName",saveModel.getDoctorName());
                jsonObject.put("doctorcode",saveModel.getDoctor());
                jsonObject.put("doctorCode",saveModel.getDoctor());
                for(SaveModel saveModel1:outpatientList){
                    String out=saveModel1.getHospital()==null?"":saveModel1.getHospital();
                    String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
@ -4362,23 +4675,23 @@ public class StatisticsEsService {
        JSONObject object = new JSONObject();
        if (interval==1){
            //自取
            JSONArray array = dateTotalStatistics2(startDate,endDate,area,level,indexes[1],"0",SaveModel.timeLevel_ZL,"");
            JSONArray array = dateTotalStatistics2(startDate,endDate,area,level,indexes[1],"1",SaveModel.timeLevel_ZL,"");
            object.put("data",array);
            //快递
            JSONArray array1 = dateTotalStatistics2(startDate,endDate,area,level,indexes[1],"1",SaveModel.timeLevel_ZL,null);
            JSONArray array1 = dateTotalStatistics2(startDate,endDate,area,level,indexes[1],"0",SaveModel.timeLevel_ZL,null);
            object.put("data2",array1);
            JSONArray arraytotal = dateTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,null);
            object.put("data3",arraytotal);
        }else if (interval==2){
            JSONArray array = weekTotalStatistics2(startDate,endDate,area,level,indexes[1],"0",SaveModel.timeLevel_ZL,"");
            JSONArray array1 = weekTotalStatistics2(startDate,endDate,area,level,indexes[1],"1",SaveModel.timeLevel_ZL,"");
            JSONArray array = weekTotalStatistics2(startDate,endDate,area,level,indexes[1],"1",SaveModel.timeLevel_ZL,"");
            JSONArray array1 = weekTotalStatistics2(startDate,endDate,area,level,indexes[1],"0",SaveModel.timeLevel_ZL,"");
            object.put("data",array);
            object.put("data2",array1);
            JSONArray arraytotal = weekTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,null);
            object.put("data3",arraytotal);
        }else if (interval==3){
            JSONArray array = monthTotalStatistics2(startDate,endDate,area,level,indexes[1],"0",SaveModel.timeLevel_ZL,"");
            JSONArray array1 = monthTotalStatistics2(startDate,endDate,area,level,indexes[1],"1",SaveModel.timeLevel_ZL,"");
            JSONArray array = monthTotalStatistics2(startDate,endDate,area,level,indexes[1],"1",SaveModel.timeLevel_ZL,"");
            JSONArray array1 = monthTotalStatistics2(startDate,endDate,area,level,indexes[1],"0",SaveModel.timeLevel_ZL,"");
            object.put("data",array);
            object.put("data2",array1);
            JSONArray arraytotal = monthTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,null);
@ -4426,7 +4739,7 @@ public class StatisticsEsService {
                    jsonObject.put("deptName", saveModel.getDeptName());
                    jsonObject.put("specialist", saveModel.getResult1());
                    jsonObject.put("doctorName", saveModel.getDoctorName());
                    jsonObject.put("doctorcode", saveModel.getDoctor());
                    jsonObject.put("doctorCode", saveModel.getDoctor());
                    for (SaveModel saveModel1 : outpatientList) {
                        String out=saveModel1.getDoctor()==null?"":saveModel1.getDoctor();
                        String pre=saveModel.getDoctor()==null?"":saveModel.getDoctor();
@ -4489,7 +4802,7 @@ public class StatisticsEsService {
                jsonObject.put("deptName", saveModel.getDeptName());
                jsonObject.put("specialist", saveModel.getResult1());
                jsonObject.put("doctorName", saveModel.getDoctorName());
                jsonObject.put("doctorcode", saveModel.getDoctor());
                jsonObject.put("doctorCode", saveModel.getDoctor());
                for (SaveModel saveModel1 : outpatientList) {
                    String out=saveModel1.getHospital()==null?"":saveModel1.getHospital();
                    String pre=saveModel.getHospital()==null?"":saveModel.getHospital();
@ -4541,16 +4854,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 +4880,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 +4940,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 +4960,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 +5109,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 +5135,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 +5188,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 +5313,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 +5401,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));
                }
            }

+ 10 - 0
business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java

@ -1091,6 +1091,16 @@ public class ElasticsearchUtil {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel, slaveKey1, null, null);
        return (SaveModel) list.get(0);
    }
    public SaveModel bfindOneDateQuotaLevel12(String startDate, String endDate, String area, int level, String index, String timelevel, String slaveKey1, String slaveKey2) throws Exception {
        if (org.springframework.util.StringUtils.isEmpty(slaveKey1)) {
            slaveKey1 = commonParams;
        }
        if (org.springframework.util.StringUtils.isEmpty(slaveKey2)) {
            slaveKey2 = commonParams;
        }
        List list = findDateQuotaLevel2(startDate, endDate, area, level, index, timelevel, slaveKey1, slaveKey2, null, null);
        return (SaveModel) list.get(0);
    }
    /**
     * 1级维度

+ 2 - 0
business/im-service/src/main/java/com/yihu/jw/im/dao/ConsultDao.java

@ -30,4 +30,6 @@ public interface ConsultDao extends PagingAndSortingRepository<ConsultDo, String
//	Page<Object> findByPatient(String patient, Pageable pageRequest);
	ConsultDo queryByRelationCode(String relationCode);
	ConsultDo queryByIdAndType(String id,Integer type);
}

+ 17 - 0
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -376,6 +376,23 @@ public class ImUtil {
		}
		return HttpClientUtil.postBody(imAddr, params);
	}
	/**
	 * 更新会话成员(新增或删除) 活跃成员
	 * @param sessionId 会话id
	 * @param user 新增的成员id
	 * @param oldUserId  删除的成员id
	 */
	public String updateParticipantNew(String sessionId, String user,String oldUserId) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/participant/updateNew";
		JSONObject params = new JSONObject();
		params.put("session_id", sessionId );
		params.put("user_id", user );
		if(!StringUtils.isEmpty(oldUserId)){
			params.put("old_user_id", oldUserId);
		}
		return HttpClientUtil.postBody(imAddr, params);
	}
	
	/**
	 * 更新消息内容

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
    /*@GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
 /*  @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -243,6 +243,15 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String phone;
    private String openid;
    private Date openidTime;
    public Date getOpenidTime() {
        return openidTime;
    }
    public void setOpenidTime(Date openidTime) {
        this.openidTime = openidTime;
    }
    @Column(name = "openid")
    public String getOpenid() {
        return openid;

+ 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;
    }
}

+ 84 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/DoctorQuickReply.java

@ -0,0 +1,84 @@
package com.yihu.jw.entity.door;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by lyr-pc on 2016/12/28.
 */
@Entity
@Table(name = "wlyy_doctor_quick_reply")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_doctor_quick_reply")
public class DoctorQuickReply extends IdEntity {
    // 医生
    private String doctor;
    // 回复内容
    private String content;
    // 排序
    private Integer sort;
    // 更新时间
    private Date updateTime;
    // 状态 1:有效  0:无效
    private Integer status;
    // 类型 0为健康教育,1为续方咨询
    private Integer type;
    // 0为自定义消息  大于1为系统消息(1体征和生活方式 2症状 3血糖 4血压)
    private Integer systag;
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    public Integer getType() {
        return type;
    }
    
    public void setType(Integer type) {
        this.type = type;
    }
    
    public Integer getSystag() {
        return systag;
    }
    
    public void setSystag(Integer systag) {
        this.systag = systag;
    }
}

+ 4 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -103,6 +103,10 @@ public class BaseHospitalRequestMapping {
         * 居民发起复诊
         */
        public static final String appointmentRevisit = "/appointmentRevisit";
        /**
         * 上门复诊
         */
        public static final String appointmentRevisitOnDoor = "/appointmentRevisitOnDoor";
        /**
         * 查询所有机构

BIN=BIN
jkzl - 快捷方式.lnk


+ 14 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/core/redis/WlyyRedisVerifyCodeService.java

@ -1,5 +1,9 @@
package com.yihu.jw.security.oauth2.core.redis;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.security.dao.patient.WlyyHospitalSysDictDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils;
@ -10,6 +14,8 @@ import java.util.concurrent.TimeUnit;
 * Created by progr1mmer on 2018/4/18.
 */
public class WlyyRedisVerifyCodeService {
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    private final String KEY_SUFFIX = ":code";
    private final RedisTemplate redisTemplate;
@ -44,6 +50,14 @@ public class WlyyRedisVerifyCodeService {
        if (StringUtils.isEmpty(code)) {
            return false;
        }
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            if (code.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                return true;
            }else {
                return false;
            }
        }
        String key = client_id + ":" + username + KEY_SUFFIX;
        String _code = (String) redisTemplate.opsForValue().get(key);
        if (null == _code) {

+ 155 - 97
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -499,22 +499,37 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        //发送短信获取验证码
        String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
        int result =  zhongShanSMSService.ZhongShangSendSMS(username,"您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
        if (0 == result) {
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("success", 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            int result =  zhongShanSMSService.ZhongShangSendSMS(username,"您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
            if (0 == result) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
        }
        throw new IllegalStateException("验证码发送失败!");
    }
@ -542,35 +557,50 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        //发送短信获取验证码
        String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
        JSONObject object = new JSONObject();
        object.put("operatetel","18788888888");
        object.put("interfaceid","jcpt");
        object.put("interfacepwd","jcpt");
        object.put("operator","xxgwxgzh");
        object.put("operateid","xxgwxgzh");
        JSONArray array = new JSONArray();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
        jsonObject.put("sendtel",username);
        jsonObject.put("sendtime",DateUtil.dateToStrLong(new Date()));
        array.add(jsonObject);
        object.put("messageinfo",array);
        int result =  xzzxService.SendSms(object.toJSONString());
        if (0 == result) {
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("success", 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            JSONObject object = new JSONObject();
            object.put("operatetel","18788888888");
            object.put("interfaceid","jcpt");
            object.put("interfacepwd","jcpt");
            object.put("operator","xxgwxgzh");
            object.put("operateid","xxgwxgzh");
            JSONArray array = new JSONArray();
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
            jsonObject.put("sendtel",username);
            jsonObject.put("sendtime",DateUtil.dateToStrLong(new Date()));
            array.add(jsonObject);
            object.put("messageinfo",array);
            int result =  xzzxService.SendSms(object.toJSONString());
            if (0 == result) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
        }
        throw new IllegalStateException("验证码发送失败!");
    }
@ -606,90 +636,106 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        if ("1".equalsIgnoreCase(isDoctor)){
            String res = ykyyService.getResetCode("4",username);
            String resltCode ="";
            String captcha = "";
            if (!StringUtils.isEmpty(res)){
                JSONObject jsonObject = JSONObject.parseObject(res);
                if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
                    captcha = jsonObject.getString("value");
                    resltCode = jsonObject.getString("code");
                    msg = "发送成功";
                }
            }
            if ("10000".equalsIgnoreCase(resltCode)) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
            throw new IllegalStateException("验证码发送失败!");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }else {
            //发送短信获取验证码
            String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
            ResultMsg result= null;
            if(StringUtils.isEmpty(type)){
                String  res = ykyyService.getShortMessage("1",username);
            if ("1".equalsIgnoreCase(isDoctor)){
                String res = ykyyService.getResetCode("4",username);
                String resltCode ="";
                String captcha1 = "";
                String captcha = "";
                if (!StringUtils.isEmpty(res)){
                    JSONObject jsonObject = JSONObject.parseObject(res);
                    if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
                        captcha1 = jsonObject.getString("value");
                        captcha = jsonObject.getString("value");
                        resltCode = jsonObject.getString("code");
                    }else if("199".equalsIgnoreCase(jsonObject.getString("code"))){
                        msg = jsonObject.getString("msg");
                        Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 199);
                        return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
                    }else {
                        msg="发送失败";
                        Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, -1);
                        return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
                        msg = "发送成功";
                    }
                }
                if ("10000".equalsIgnoreCase(resltCode)) {
                    Captcha _captcha = new Captcha();
                    _captcha.setCode(captcha1);
                    _captcha.setCode(captcha);
                    _captcha.setExpiresIn(300);
                    wlyyRedisVerifyCodeService.store(client_id, username, captcha1, 300);
                    wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                    Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
                    Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
                    HttpHeaders headers = new HttpHeaders();
                    headers.set("Cache-Control", "no-store");
                    headers.set("Pragma", "no-cache");
                    return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
                }
            }else if("1".equals(type)){
                result = ykyySMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
            }else if("2".equals(type)) {
                result = ykyySMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
            }
            if (result.isSuccess()) {
                Captcha _captcha = new Captcha();
                _captcha.setCode(captcha);
                _captcha.setExpiresIn(300);
                wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                throw new IllegalStateException("验证码发送失败!");
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }else {
                //发送短信获取验证码
                String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
                ResultMsg result= null;
                if(StringUtils.isEmpty(type)){
                    String  res = ykyyService.getShortMessage("1",username);
                    String resltCode ="";
                    String captcha1 = "";
                    if (!StringUtils.isEmpty(res)){
                        JSONObject jsonObject = JSONObject.parseObject(res);
                        if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
                            captcha1 = jsonObject.getString("value");
                            resltCode = jsonObject.getString("code");
                        }else if("199".equalsIgnoreCase(jsonObject.getString("code"))){
                            msg = jsonObject.getString("msg");
                            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 199);
                            return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
                        }else {
                            msg="发送失败";
                            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, -1);
                            return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
                        }
                    }
                    if ("10000".equalsIgnoreCase(resltCode)) {
                        Captcha _captcha = new Captcha();
                        _captcha.setCode(captcha1);
                        _captcha.setExpiresIn(300);
                        wlyyRedisVerifyCodeService.store(client_id, username, captcha1, 300);
                        Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
                        HttpHeaders headers = new HttpHeaders();
                        headers.set("Cache-Control", "no-store");
                        headers.set("Pragma", "no-cache");
                        return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
                    }
                }else if("1".equals(type)){
                    result = ykyySMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
                }else if("2".equals(type)) {
                    result = ykyySMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
                }
                if (result.isSuccess()) {
                    Captcha _captcha = new Captcha();
                    _captcha.setCode(captcha);
                    _captcha.setExpiresIn(300);
                    wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
                    Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
                    HttpHeaders headers = new HttpHeaders();
                    headers.set("Cache-Control", "no-store");
                    headers.set("Pragma", "no-cache");
                    return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
                }
                Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
                return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
            }
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
            return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
        }
    }
    /**
@ -1642,13 +1688,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @RequestMapping(value = "/oauth/findPatientPw", method = RequestMethod.POST)
    public Envelop findPatientPw(String mobile,String client_id,String login_type,String captcha,String pw)throws Exception {
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
            //验证码正确
        } else {
            return ObjEnvelop.getError("验证码错误!");
            }else {
                return ObjEnvelop.getError("验证码错误!");
            }
        }else {
            if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                //验证码正确
            } else {
                return ObjEnvelop.getError("验证码错误!");
            }
        }
        String rs = registerService.updatePatientPw(pw,mobile);
        if("ok".equals(rs)){
            return ObjEnvelop.getSuccess("修改成功!");
@ -1671,10 +1724,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                return ObjEnvelop.getError("修改失败!");
            }
        }else if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
            if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                //验证码正确
            } else {
                return ObjEnvelop.getError("验证码错误!");
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
            if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            }else {
                if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                    //验证码正确
                } else {
                    return ObjEnvelop.getError("验证码错误!");
                }
            }
            String rs = registerService.updateDoctorPw(mobile,pw,wechatId);
            if("ok".equals(rs)){

+ 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));
    }
}

+ 149 - 0
svr/svr-door-serivce/sql/初始sql.sql

@ -570,6 +570,155 @@ CREATE TABLE `wlyy_sign_family` (
  KEY `idx_type` (`type`,`status`,`expenses_status`,`apply_date`,`sign_year`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='家庭签约/三师签约';
CREATE TABLE `wlyy_doctor_registration_temp` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '业务无关主键',
  `code` varchar(50) NOT NULL COMMENT '二级模板标识',
  `doctor` varchar(50) DEFAULT NULL COMMENT '医生标识',
  `registration` varchar(50) DEFAULT NULL COMMENT '一级模板标识',
  `content` text COMMENT '服务登记内容',
  `send_times` int(11) DEFAULT NULL COMMENT '发送次数',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  `last_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '最后一次发送时间',
  PRIMARY KEY (`id`),
  KEY `idx_code` (`code`) USING BTREE,
  KEY `idx_owner` (`doctor`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='医生登记服务模板表';
CREATE TABLE `wlyy_doctor_registration` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `code` varchar(50) NOT NULL COMMENT '登记服务一级模板编码',
  `model_name` varchar(50) DEFAULT NULL COMMENT '模板名称',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  `is_hide` int(2) NOT NULL DEFAULT '0' COMMENT '是否隐藏 0 隐藏 1不隐藏',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
INSERT INTO `wlyy_doctor_registration` (`id`, `code`, `model_name`, `create_time`, `is_hide`) VALUES ('1', '1', '主诉记录', '2019-03-14 10:14:07', '0');
INSERT INTO `wlyy_doctor_registration` (`id`, `code`, `model_name`, `create_time`, `is_hide`) VALUES ('2', '2', '现病史', '2019-03-14 10:14:24', '0');
INSERT INTO `wlyy_doctor_registration` (`id`, `code`, `model_name`, `create_time`, `is_hide`) VALUES ('3', '3', '既往史、个人史、家族史', '2019-03-14 10:15:25', '0');
INSERT INTO `wlyy_doctor_registration` (`id`, `code`, `model_name`, `create_time`, `is_hide`) VALUES ('4', '4', '体格检查', '2019-03-14 10:15:49', '0');
INSERT INTO `wlyy_doctor_registration` (`id`, `code`, `model_name`, `create_time`, `is_hide`) VALUES ('5', '5', '既往辅助检查', '2019-03-14 10:16:09', '0');
INSERT INTO `wlyy_doctor_registration` (`id`, `code`, `model_name`, `create_time`, `is_hide`) VALUES ('6', '6', '诊断记录', '2019-03-14 10:16:23', '0');
INSERT INTO `wlyy_doctor_registration` (`id`, `code`, `model_name`, `create_time`, `is_hide`) VALUES ('7', '7', '治疗情况', '2019-03-14 10:16:38', '0');
INSERT INTO `base`.`base_doctor_role_dict` ( `code`, `name`, `del`, `create_user`, `create_user_name`, `create_time`, `update_user`, `update_user_name`, `update_time`) VALUES ( 'dispatcher', '调度员', '1', 'admin', '系统默认', '2020-12-29 11:38:31', NULL, NULL, '2020-12-29 11:38:26');
INSERT INTO `base`.`base_system_dict_entry` (`id`, `saas_id`, `dict_code`, `code`, `py_code`, `value`, `sort`, `remark`) VALUES ('1', NULL, 'PROFESSIONAL_STATE', '0', '工单--患者职业', '国家机关、党群组织、企业、事业单位负责人', '1', NULL);
INSERT INTO `base`.`base_system_dict_entry` (`id`, `saas_id`, `dict_code`, `code`, `py_code`, `value`, `sort`, `remark`) VALUES ('2', NULL, 'PROFESSIONAL_STATE', '1', '1', '专业技术人员', '2', NULL);
INSERT INTO `base`.`base_system_dict_entry` (`id`, `saas_id`, `dict_code`, `code`, `py_code`, `value`, `sort`, `remark`) VALUES ('3', NULL, 'PROFESSIONAL_STATE', '2', '1', '办事人员和有关人员', '3', NULL);
INSERT INTO `base`.`base_system_dict_entry` (`id`, `saas_id`, `dict_code`, `code`, `py_code`, `value`, `sort`, `remark`) VALUES ('4', NULL, 'PROFESSIONAL_STATE', '3', '1', '商业、服务业人员', '4', NULL);
INSERT INTO `base`.`base_system_dict_entry` (`id`, `saas_id`, `dict_code`, `code`, `py_code`, `value`, `sort`, `remark`) VALUES ('5', NULL, 'PROFESSIONAL_STATE', '4', '1', '农、林、牧、渔、水利业生产人员', '5', '');
INSERT INTO `base`.`base_system_dict_entry` (`id`, `saas_id`, `dict_code`, `code`, `py_code`, `value`, `sort`, `remark`) VALUES ('6', NULL, 'PROFESSIONAL_STATE', '5', '1', '生产、运输设备操作人员及有关人员', '6', NULL);
INSERT INTO `base`.`base_system_dict_entry` (`id`, `saas_id`, `dict_code`, `code`, `py_code`, `value`, `sort`, `remark`) VALUES ('7', NULL, 'PROFESSIONAL_STATE', '6', '1', '军人', '7', NULL);
INSERT INTO `base`.`base_system_dict_entry` (`id`, `saas_id`, `dict_code`, `code`, `py_code`, `value`, `sort`, `remark`) VALUES ('8', NULL, 'PROFESSIONAL_STATE', '7', '1', '不便分类的其他从业人员', '8', NULL);
INSERT INTO `base`.`base_system_dict_entry` (`id`, `saas_id`, `dict_code`, `code`, `py_code`, `value`, `sort`, `remark`) VALUES ('9', NULL, 'PROFESSIONAL_STATE', '8', '1', '无职业', '9', NULL);
CREATE TABLE `wlyy_doctor_quick_reply` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `doctor` varchar(50) NOT NULL COMMENT '医生',
  `content` varchar(255) DEFAULT NULL COMMENT '快捷回复内容',
  `sort` int(11) DEFAULT NULL COMMENT '排序',
  `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` int(11) DEFAULT NULL COMMENT '状态 1:有效 0:无效',
  `type` int(11) DEFAULT NULL COMMENT '0为健康咨询,1为续方咨询',
  `systag` int(11) DEFAULT NULL COMMENT '1为默认消息,0为自定义消息',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_doctor` (`doctor`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='医生快捷回复表';
INSERT INTO `wlyy_doctor_quick_reply` ( `doctor`, `content`, `sort`, `update_time`, `status`, `type`, `systag`) VALUES ( 'default', '请填写您近期体征及生活方式调查问卷', '1', '2017-11-23 14:27:22', '1', '1', '1');
INSERT INTO `wlyy_doctor_quick_reply` ( `doctor`, `content`, `sort`, `update_time`, `status`, `type`, `systag`) VALUES ( 'default', '请填写您近期身体异常症状问卷', '2', '2017-11-23 15:46:46', '1', '1', '2');
INSERT INTO `wlyy_doctor_quick_reply` ( `doctor`, `content`, `sort`, `update_time`, `status`, `type`, `systag`) VALUES ( 'default', '请提供您最近一次的血糖检测数值及检测时间', '3', '2017-11-23 15:46:45', '1', '1', '3');
INSERT INTO `wlyy_doctor_quick_reply` ( `doctor`, `content`, `sort`, `update_time`, `status`, `type`, `systag`) VALUES ( 'default', '请提供您最近一次的血压检测数值及检测时间', '4', '2017-11-23 15:46:46', '1', '1', '4');
DROP TABLE IF EXISTS `zy_nation_dict`;
CREATE TABLE `zy_nation_dict` (
  `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `ORG_ID` int(11) DEFAULT NULL,
  `NATION_CODE` varchar(3) DEFAULT NULL COMMENT '民族编码',
  `NATION_NAME` varchar(50) DEFAULT NULL COMMENT '民族名称',
  `VALID_FLAG` varchar(2) DEFAULT NULL,
  `USER_CODE` varchar(50) DEFAULT NULL,
  `CUSTOM_CODE` varchar(50) DEFAULT NULL,
  `SPELL_CODE` varchar(50) DEFAULT NULL,
  `WBZX_CODE` varchar(50) DEFAULT NULL,
  `SORT_NO` varchar(50) DEFAULT NULL,
  `CREATE_TIME` datetime DEFAULT NULL,
  `CREATE_OPERATOR` varchar(50) DEFAULT NULL,
  `MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `MODIFY_OPERATOR` varchar(50) DEFAULT NULL,
  `REMARK` varchar(50) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`ID`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of zy_nation_dict
-- ----------------------------
INSERT INTO `zy_nation_dict` VALUES ('1', '0', '1', '汉族', '1', '', '', 'HZ', 'IY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('2', '0', '2', '蒙古族', '1', '', '', 'MGZ', 'ADY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('3', '0', '3', '回族', '1', '', '', 'HZ', 'LY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('4', '0', '4', '藏族', '1', '', '', 'CZ', 'AY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('5', '0', '5', '维吾尔族', '1', '', '', 'WWEZ', 'XGQY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('6', '0', '6', '苗族', '1', '', '', 'MZ', 'AY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('7', '0', '7', '彝族', '1', '', '', 'YZ', 'XY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('8', '0', '8', '壮族', '1', '', '', 'ZZ', 'UY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('9', '0', '9', '布依族', '1', '', '', 'BYZ', 'DWY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('10', '0', '10', '朝鲜族', '1', '', '', 'CXZ', 'FQY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('11', '0', '11', '满族', '1', '', '', 'MZ', 'IY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('12', '0', '12', '侗族', '1', '', '', 'DZ', 'WY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('13', '0', '13', '瑶族', '1', '', '', 'YZ', 'GY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('14', '0', '14', '白族', '1', '', '', 'BZ', 'RY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('15', '0', '15', '土家族', '1', '', '', 'TJZ', 'FPY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('16', '0', '16', '哈尼族', '1', '', '', 'HNZ', 'KNY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('17', '0', '17', '哈萨克族', '1', '', '', 'HSKZ', 'KADY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('18', '0', '18', '傣族', '1', '', '', 'DZ', 'WY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('19', '0', '19', '黎族', '1', '', '', 'LZ', 'TY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('20', '0', '20', '傈僳族', '1', '', '', 'LSZ', 'WWY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('21', '0', '21', '佤族', '1', '', '', 'WZ', 'WY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('22', '0', '22', '畲族', '1', '', '', 'SZ', 'WY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('23', '0', '23', '高山族', '1', '', '', 'GSZ', 'YMY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('24', '0', '24', '拉祜族', '1', '', '', 'LBZ', 'RPY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('25', '0', '25', '水族', '1', '', '', 'SZ', 'IY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('26', '0', '26', '东乡族', '1', '', '', 'DXZ', 'AXY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('27', '0', '27', '纳西族', '1', '', '', 'NXZ', 'XSY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('28', '0', '28', '景颇族', '1', '', '', 'JPZ', 'JHY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('29', '0', '29', '柯尔克孜族', '1', '', '', 'KEKZZ', 'SQDBY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('30', '0', '30', '土族', '1', '', '', 'TZ', 'FY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('31', '0', '31', '达斡尔族', '1', '', '', 'DHEZ', 'DFQY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('32', '0', '32', '仫佬族', '1', '', '', 'MLZ', 'WWY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('33', '0', '33', '羌族', '1', '', '', 'QZ', 'UY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('34', '0', '34', '布朗族', '1', '', '', 'BLZ', 'DYY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('35', '0', '35', '撒拉族', '1', '', '', 'SLZ', 'RRY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('36', '0', '36', '毛南族', '1', '', '', 'MNZ', 'TFY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('37', '0', '37', '仡佬族', '1', '', '', 'GLZ', 'WWY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('38', '0', '38', '锡伯族', '1', '', '', 'XBZ', 'QWY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('39', '0', '39', '阿昌族', '1', '', '', 'ACZ', 'BJY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('40', '0', '40', '普米族', '1', '', '', 'PMZ', 'UOY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('41', '0', '41', '塔吉克族', '1', '', '', 'TJKZ', 'FFDY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('42', '0', '42', '怒族', '1', '', '', 'NZ', 'VY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('43', '0', '43', '乌孜别克族', '1', '', '', 'WZBKZ', 'QBKDY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('44', '0', '44', '俄罗斯族', '1', '', '', 'ELSZ', 'WLAY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('45', '0', '45', '鄂温克族', '1', '', '', 'EWKZ', 'KIDY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('46', '0', '46', '德昂族', '1', '', '', 'DAZ', 'TJY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('47', '0', '47', '保安族', '1', '', '', 'BAZ', 'WPY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('48', '0', '48', '裕固族', '1', '', '', 'YGZ', 'PLY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('49', '0', '49', '京族', '1', '', '', 'JZ', 'YY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('50', '0', '50', '塔塔尔族', '1', '', '', 'TTEZ', 'FFQY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('51', '0', '51', '独龙族', '1', '', '', 'DLZ', 'QDY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('52', '0', '52', '鄂伦春族', '1', '', '', 'ELCZ', 'KWDY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('53', '0', '53', '赫哲族', '1', '', '', 'HZZ', 'FRY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('54', '0', '54', '门巴族', '1', '', '', 'MBZ', 'UCY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('55', '0', '55', '珞巴族', '1', '', '', 'LBZ', 'CY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('56', '0', '56', '基诺族', '1', '', '', 'JNZ', 'AYY', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('57', '0', '99', '其他', '1', '', '', 'QT', 'AW', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('58', '0', '57', '穿青人', '1', '', '57', 'CQZ', 'CQZ', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('59', '0', '58', 'Turkish', '1', '', '', 'teq', 'Turkish', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('60', '0', '59', 'BRITAIN', '1', '', '', 'BRITISH', 'BRITAIN', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('61', '0', '60', 'AUSTRALIAN', '1', '', '', 'AUSTRALIAN', 'AUSTRALIAN', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('62', '0', '61', '/', '1', '', '', '/', '/', '0', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('63', '0', '63', 'Ukrainian', '1', '', '', 'Ukrainian', 'Ukrainian', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('64', '0', '101', '亻革家人', '1', '', '', 'RGJR', '', '', null, '', null, '', '');
INSERT INTO `zy_nation_dict` VALUES ('65', '0', '62', '山由族', '1', '', '', 'SYZ', 'MMY', '', null, '', null, '', '');

+ 160 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/common/DistrictController.java

@ -0,0 +1,160 @@
package com.yihu.jw.door.controller.common;
import com.yihu.jw.area.dao.BaseCityDao;
import com.yihu.jw.area.dao.BaseProvinceDao;
import com.yihu.jw.area.dao.BaseStreetDao;
import com.yihu.jw.area.dao.BaseTownDao;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.entity.base.area.BaseCityDO;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
import com.yihu.jw.entity.base.area.BaseStreetDO;
import com.yihu.jw.entity.base.area.BaseTownDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
 * Created by yeshijie on 2020/12/30.
 */
@RestController
@RequestMapping(value = "common", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "省市区三级地址")
public class DistrictController extends BaseController {
    @Autowired
    private BaseProvinceDao provinceDao;
    @Autowired
    private BaseCityDao cityDao;
    @Autowired
    private BaseTownDao townDao;
    @Autowired
    private BaseStreetDao streetDao;
    @Autowired
    private BaseOrgDao orgDao;
    /**
     * 省市一二三级查询接口
     * @param type 1一级目录,2二级目录,3三级目录,4街道目录
     * @param code 省或市标识
     * @return
     */
    @RequestMapping(value = "district",method = RequestMethod.POST)
    @ResponseBody
    public String district(int type, String code) {
        try {
            List<?> list = null;
            switch (type) {
                case 1:
                    list =  findProvince();
                    break;
                case 2:
                    list = findCity(code);
                    break;
                case 3:
                    list = findTown(code);
                    break;
                case 4:
                    list = findStreet(code);
                    break;
                case 5:
                    list = findHospital(code);
                    break;
            }
            return write(200, "查询成功!", "list", list);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    /**
     * 查询所有的省份信息
     * @return
     */
    public List<BaseProvinceDO> findProvince() {
        List<BaseProvinceDO> list = new ArrayList<>();
        Iterable<BaseProvinceDO> iterable = provinceDao.findAll(new Sort(Direction.ASC, "id"));
        if (iterable != null) {
            Iterator<BaseProvinceDO> it = iterable.iterator();
            while (it != null && it.hasNext()) {
                list.add(it.next());
            }
        }
        return list;
    }
    /**
     * 查询省份下的城市信息
     * @param province 省编码
     * @return
     */
    public List<BaseCityDO> findCity(String province) {
        List<BaseCityDO> list = new ArrayList<>();
        Iterable<BaseCityDO> iterable = cityDao.findByProvince(province);
        if (iterable != null) {
            Iterator<BaseCityDO> it = iterable.iterator();
            while (it != null && it.hasNext()) {
                list.add(it.next());
            }
        }
        return list;
    }
    /**
     * 查询城市下的区县信息
     * @param city 城市编码
     * @return
     */
    public List<BaseTownDO> findTown(String city) {
        List<BaseTownDO> list = new ArrayList<>();
        Iterable<BaseTownDO> iterable = townDao.findByCityCode(city);
        if (iterable != null) {
            Iterator<BaseTownDO> it = iterable.iterator();
            while (it != null && it.hasNext()) {
                list.add(it.next());
            }
        }
        return list;
    }
    /**
     * 查询城市下的街道信息
     * @param town 区县编码
     * @return
     */
    public List<BaseStreetDO> findStreet(String town) {
        List<BaseStreetDO> list = new ArrayList<>();
        Iterable<BaseStreetDO> iterable = streetDao.findByTown(town);
        if (iterable != null) {
            Iterator<BaseStreetDO> it = iterable.iterator();
            while (it != null && it.hasNext()) {
                list.add(it.next());
            }
        }
        return list;
    }
    public List<BaseOrgDO> findHospital(String town) {
        List<BaseOrgDO> list = new ArrayList<>();
        Iterable<BaseOrgDO> iterable = orgDao.findByTownCode(town);
        if (iterable != null) {
            Iterator<BaseOrgDO> it = iterable.iterator();
            while (it != null && it.hasNext()) {
                list.add(it.next());
            }
        }
        return list;
    }
}

+ 56 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorConsultController.java

@ -0,0 +1,56 @@
package com.yihu.jw.door.controller.doctor;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.door.service.consult.ConsultTeamService;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.im.dao.ConsultTeamDao;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by yeshijie on 2020/12/31.
 */
@RestController
@RequestMapping(value = "/doctor/consult", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-咨询")
public class DoctorConsultController extends BaseController {
    @Autowired
    private ConsultTeamService consultTeamService;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @ApiOperation("咨询是否结束")
    @RequestMapping(value = "/getConsultStatus",method = RequestMethod.GET)
    public String getConsultStatus(@RequestParam(required = true) String consult){
        try {
            ConsultTeamDo consultTeam = consultTeamDao.findByConsult(consult);
            return write(200, "查询成功", "data", consultTeam.getStatus());
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "queryByConsultCode",method = RequestMethod.GET)
    @ApiOperation("根据咨询code查询关联业务项详情")
    public String queryByConsultCode(@ApiParam(name = "code", value = "咨询code") @RequestParam(value = "code", required = true) String code,
                                     @ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) Integer type){
        try{
            com.alibaba.fastjson.JSONObject detail = consultTeamService.queryByConsultCode(code,type);
            return write(200, "查询成功", "data", detail.get("data"));
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");
        }
    }
}

+ 27 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorController.java

@ -3,7 +3,9 @@ package com.yihu.jw.door.controller.doctor;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.door.service.common.PatientService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -27,6 +29,31 @@ public class DoctorController extends BaseController {
    private BaseDoctorDao doctorDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private PatientService patientService;
    /**
     * 查询居民信息
     *
     * @param patient 患者
     * @return
     */
    @GetMapping(value = "/patient")
    @ApiOperation("查询居民信息")
    public String getPatient(String patient) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "居民不能为空");
            }
            JSONObject p = patientService.getPatient(patient,getUID());
            return write(200, "查询成功", "data", p);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     * 医生基本信息查询接口

+ 170 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorQuickReplyController.java

@ -0,0 +1,170 @@
package com.yihu.jw.door.controller.doctor;
import com.yihu.jw.door.controller.BaseController;
import com.yihu.jw.door.service.consult.DoctorQuickReplyService;
import com.yihu.jw.entity.door.DoctorQuickReply;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * Created by lyr-pc on 2016/12/28.
 */
@RestController
@RequestMapping(value = "/doctor/reply", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生快捷回复")
public class DoctorQuickReplyController extends BaseController {
    @Autowired
    DoctorQuickReplyService quickReplyService;
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加快捷回复")
    public String addReply(
            @RequestParam(value = "content", required = true) @ApiParam(value = "快捷回复内容") String content,
            @ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
            @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
            if (StringUtils.isEmpty(content)) {
                return error(-1, "快捷回复内容不能为空");
            }
            DoctorQuickReply reply = quickReplyService.addReply(getUID(), content,type);
            if (reply != null) {
                return write(200, "添加成功", "data", reply);
            } else {
                return error(-1, "添加失败");
            }
        } catch (Exception e) {
            return error(-1, "添加失败");
        }
    }
    @RequestMapping(value = "/modify", method = RequestMethod.POST)
    @ApiOperation(value = "修改快捷回复")
    public String modifyReply(@RequestParam @ApiParam(value = "快捷回复ID") Long id,
                              @RequestParam @ApiParam(value = "快捷回复内容") String content,
                              @ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
                                  @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
            if (id == null || id < 1) {
                return error(-1, "快捷回复ID不能为空");
            }
            if (StringUtils.isEmpty(content)) {
                return error(-1, "快捷回复内容不能为空");
            }
            DoctorQuickReply reply = quickReplyService.modifyReply(id, content,type);
            if (reply != null) {
                return write(200, "添加成功", "data", reply);
            } else {
                return error(-1, "添加失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "添加失败");
        }
    }
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @ApiOperation(value = "删除快捷回复")
    public String delReply(@RequestParam @ApiParam(value = "快捷回复ID") Long id) {
        try {
            if (id == null || id < 1) {
                return error(-1, "请选择需删除的快捷回复");
            }
            int result = quickReplyService.delReply(getUID(), id);
            if (result == 1) {
                return write(200, "删除成功");
            } else if (result == -1) {
                return error(-1, "快捷回复不存在或已删除");
            } else {
                return error(-1, "删除失败");
            }
        } catch (Exception e) {
            return error(-1, "删除失败");
        }
    }
    @RequestMapping(value = "/sort", method = RequestMethod.POST)
    @ApiOperation(value = "快捷回复排序")
    public String sortReply(@RequestParam @ApiParam(value = "快捷回复ID")Long id,
                            @RequestParam @ApiParam(value = "排序位置")Integer sort) {
        try {
            if (id == null || id < 1) {
                return error(-1, "请选择排序的快捷回复");
            }
            if (sort == null || sort < 1) {
                return error(-1, "请设置快捷回复的排序位置");
            }
            int result = quickReplyService.sortReply(getUID(), id, sort);
            if (result == 1) {
                return write(200, "排序成功");
            } else if (result == -1) {
                return error(-1, "快捷回复不存在或已删除");
            }  else if (result == -2) {
                return error(-1, "快捷回复已在排序位置");
            } else {
                return error(-1, "排序失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "排序失败");
        }
    }
    @RequestMapping(value = "/sortList", method = RequestMethod.POST)
    @ApiOperation(value = "快捷回复排序")
    public String sortReplyList(@RequestParam @ApiParam(value = "快捷回复ID")String id,
                                @ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
                                @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
            if (StringUtils.isEmpty(id)) {
                return error(-1, "请输入排序后的回复ID");
            }
            int result = quickReplyService.sortReplyList(id,type);
            if (result == 1) {
                return write(200, "排序成功");
            } else if (result == -1) {
                return error(-1, "快捷回复不存在或已删除");
            }  else if (result == -2) {
                return error(-1, "快捷回复已在排序位置");
            } else {
                return error(-1, "排序失败");
            }
        } catch (Exception e) {
            return error(-1, "排序失败");
        }
    }
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ApiOperation(value = "快捷回复列表")
    public String replyList(@ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
                            @RequestParam(value = "type", required = false, defaultValue = "0") String type,
                            @ApiParam(name = "keyword", value = "搜索关键字", defaultValue = "")
                            @RequestParam(value = "keyword", required = false, defaultValue = "") String keyword) {
        try {
            List<DoctorQuickReply> replies = quickReplyService.getDoctorReplyList(getUID(),type,keyword);
            return write(200, "查询成功", "data", replies);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
}

+ 8 - 8
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java

@ -121,7 +121,7 @@ public class DoorOrderController extends BaseController {
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = false) String orderId,
            @ApiParam(name = "level", value = "医院等级,1.三级医院,2.二级医院,3.一级及以下")
            @RequestParam(value = "level",required = true)Integer level) {
            @RequestParam(value = "level",required = false)Integer level) {
        try {
            // 没有提供工单id的情况下,则获取该医生当前最新一条的工单
            if (StringUtils.isEmpty(orderId)) {
@ -146,7 +146,7 @@ public class DoorOrderController extends BaseController {
            @ApiParam(value = "工单id", name = "orderId", required = true) @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "医生职称code", name = "jobCode", required = true) @RequestParam(value = "jobCode", required = true) String jobCode,
            @ApiParam(value = "医生职称", name = "jobCodeName", required = true) @RequestParam(value = "jobCodeName", required = true) String jobCodeName,
            @ApiParam(value = "医院级别", name = "hospitalLevel", required = true) @RequestParam(value = "hospitalLevel", required = true) int hospitalLevel) {
            @ApiParam(value = "医院级别", name = "hospitalLevel", required = false) @RequestParam(value = "hospitalLevel", required = false) int hospitalLevel) {
        try {
            doorOrderService.acceptOrder(orderId,jobCode,jobCodeName,hospitalLevel);
            return write(200, "操作成功");
@ -600,9 +600,9 @@ public class DoorOrderController extends BaseController {
            List<JSONObject> array = new ArrayList<>();
            WlyyDoorServiceOrderDO one = doorServiceOrderDao.findOne(orderId);
            // 被服务的居民的次数(非代理居民)
            Integer times = wlyyDoorServiceOrderService.countPatientDoorTimes(one.getPatient());
//            Integer times = wlyyDoorServiceOrderService.countPatientDoorTimes(one.getPatient());
            List<String> doctors = doorDoctorDao.findDoctors(orderId);
            List<Map<String, Object>> list = hospitalService.getDoctorsByhospitalNoPage(hospital, name, type, times);
            List<Map<String, Object>> list = hospitalService.getDoctorsByhospitalNoPage(hospital, name, type, 0);
            if (list != null) {
                for (Map<String, Object> doctor : list) {
                    if (doctor == null) {
@ -611,7 +611,7 @@ public class DoorOrderController extends BaseController {
                    JSONObject json = new JSONObject();
                    json.put("id", doctor.get("id"));
                    // 医生标识
                    json.put("code", doctor.get("code"));
                    json.put("code", doctor.get("id"));
                    // 医生姓名
                    json.put("name", doctor.get("name"));
                    // 所在医院名称
@ -622,7 +622,7 @@ public class DoorOrderController extends BaseController {
                    json.put("dept_name", (doctor.get("dept_name") == null ||
                            org.apache.commons.lang3.StringUtils.isEmpty(doctor.get("dept_name").toString())) ? " " : doctor.get("dept_name"));
                    json.put("level", doctor.get("level") );
//                    json.put("level", doctor.get("level") );
                    json.put("job", doctor.get("job") );
                    // 职称名称
                    json.put("job_name", (doctor.get("job_name") == null ||
@ -636,7 +636,7 @@ public class DoorOrderController extends BaseController {
                    json.put("flag", doctors.contains(String.valueOf(doctor.get("code"))) ? true : false);
                    json.put("fixed", one != null && String.valueOf(doctor.get("code")).equals(one.getDoctor()) ? true : false);
                    //出诊费用
                    json.put("fee", doctor.get("fee"));
                    json.put("fee", 0);
                    array.add(json);
                }
            }
@ -708,7 +708,7 @@ public class DoorOrderController extends BaseController {
    @GetMapping(value = "queryDoctorList")
    @ApiOperation(value = "服务人员列表(医生列表)")
    public String queryDoctorList(
            @ApiParam(name = "town", value = "调度员所在的机构code") @RequestParam(value = "town", required = true) String town,
            @ApiParam(name = "town", value = "调度员所在的机构code") @RequestParam(value = "town", required = false) String town,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = false) String doctorName,
            @ApiParam(name = "status", value = "医生接单状态,状态为全部时不传") @RequestParam(value = "status", required = false) String status,
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = false) String patient,

+ 18 - 5
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/ConsultController.java

@ -14,10 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
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;
import org.springframework.web.bind.annotation.*;
/**
 * Created by yeshijie on 2020/12/29.
@ -38,7 +35,23 @@ public class ConsultController extends BaseController {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @RequestMapping(value = "updateMsg",method = RequestMethod.POST)
    @ApiOperation("修改会话消息内容")
    public String queryByConsultCode(@ApiParam(name = "sessionId", value = "会话id") @RequestParam(value = "sessionId", required = true) String sessionId,
                                     @ApiParam(name = "sessionType", value = "会话类型") @RequestParam(value = "sessionType", required = true) String sessionType,
                                     @ApiParam(name = "msgId", value = "消息id") @RequestParam(value = "msgId", required = true) String msgId,
                                     @ApiParam(name = "content", value = "消息内容") @RequestParam(value = "content", required = true) String content){
        JSONObject result = null;
        try{
            result = consultTeamService.updateIMMsg(sessionId,sessionType,msgId,content);
            if(result.getInteger("status") != -1){
                return write(200, "修改成功", "data", result.get("data"));
            }
        }catch (Exception e){
            error(e);
        }
        return error(-1,result.getString("data"));
    }
    /**
     * 网络咨询咨询日志查询

+ 31 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/PatientController.java

@ -10,6 +10,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.utils.security.MD5;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.json.JSONObject;
@ -43,6 +44,36 @@ public class PatientController extends BaseController {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @GetMapping(value = "getProfessionalDict")
    @ApiOperation("职业状态字典")
    public String getProfessionalDict(){
        try {
            String sql = "SELECT code,`value` from base_system_dict_entry WHERE dict_code = 'PROFESSIONAL_STATE' ORDER BY sort";
            List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
            return write(200, "获取成功!", "data",rs);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取字典信息失败!");
        }
    }
    @GetMapping(value = "getNationDict")
    @ApiOperation("获取民族信息列表")
    public String getNationDict(){
        try {
            String sql = "SELECT t.NATION_CODE,t.NATION_NAME FROM zy_nation_dict t";
            List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
            return write(200, "获取成功!", "data",rs);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取字典信息失败!");
        }
    }
    public static void main(String[] args) {
        System.out.println(MD5.md5Hex("011633{40b56bcdf86f4c03ae230bf2104da9bb}"));
    }
    /**
     * 患者基本信息查询接口

+ 40 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/consult/DoctorQuickReplyDao.java

@ -0,0 +1,40 @@
package com.yihu.jw.door.dao.consult;
import com.yihu.jw.entity.door.DoctorQuickReply;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by lyr-pc on 2016/12/28.
 */
public interface DoctorQuickReplyDao extends PagingAndSortingRepository<DoctorQuickReply, Long> ,JpaSpecificationExecutor<DoctorQuickReply> {
    @Query("select max(q.sort) from DoctorQuickReply q where q.doctor = ?1 and q.status = 1")
    Integer findMaxSort(String doctor);
    @Query("update DoctorQuickReply q set q.sort = q.sort - 1 where q.doctor = ?1 and q.sort > ?2 and q.status = 1")
    @Modifying
    int updateSort(String doctor, Integer sort);
    @Query("update DoctorQuickReply q set q.sort = q.sort - 1 where q.doctor = ?1 and q.sort > ?2 and q.sort <= ?3 and q.status = 1")
    @Modifying
    int updateSortLt(String doctor, Integer sort1, Integer sort2);
    @Query("update DoctorQuickReply q set q.sort = q.sort + 1 where q.doctor = ?1 and q.sort < ?2 and q.sort >= ?3 and q.status = 1")
    @Modifying
    int updateSortGt(String doctor, Integer sort1, Integer sort2);
    @Query("select q from DoctorQuickReply q where q.doctor = ?1 and q.status = 1")
    List<DoctorQuickReply> findDoctorReplies(String doctor, Sort sort);
    
    @Query("select q from DoctorQuickReply q where q.doctor = ?1 and q.type = ?2 and q.status = 1")
    List<DoctorQuickReply> findDoctorRepliesByType(String doctor, Integer type, Sort sort);
    @Query("select q from DoctorQuickReply q where q.doctor = ?1 and q.type = ?2 and q.content like CONCAT('%',?3,'%') and q.status = 1")
    List<DoctorQuickReply> findDoctorRepliesByType(String doctor, Integer type, String keyword, Sort sort);
}

+ 1 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java

@ -261,7 +261,7 @@ public class DoorOrderService {
     * @return
     */
    public List<Map<String, Object>> getDoorServiceDoctor(String orderId) {
        String sql = "SELECT dd.id as id,CONCAT(d.`name`,' (',dd.doctor_job_name,')') as name, dd.doctor from wlyy_door_doctor dd join wlyy_doctor d on d.`code` = dd.doctor WHERE order_id=?";
        String sql = "SELECT dd.id as id,CONCAT(d.`name`,' (',dd.doctor_job_name,')') as name, dd.doctor from wlyy_door_doctor dd JOIN base_doctor d ON d.id = dd.doctor WHERE order_id=?";
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql, orderId);
        return mapList;
    }

+ 1 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorServiceApplicationService.java

@ -301,7 +301,7 @@ public class DoorServiceApplicationService {
        String sql="SELECT d.code,d.name FROM " +
                " manage_role_user ru LEFT JOIN " +
                " manage_roles r  ON ru.role_id=r.id " +
                " LEFT JOIN (select d.code,d.name from wlyy.wlyy_doctor d LEFT JOIN wlyy.wlyy_sign_family a ON d.hospital=a.hospital  " +
                " LEFT JOIN (select d.code,d.name from wlyy_doctor d LEFT JOIN wlyy_sign_family a ON d.hospital=a.hospital  " +
                "                 where a.patient = '"+patient+"' and a.status > 0  " +
                "                 AND d.status=1 and d.del=1) d ON ru.user_code=d.code " +
                " WHERE r.code='dispatcher' AND d.`code` IS NOT NULL";

+ 6 - 3
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -493,7 +493,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    /**
     * 获取居民所签约的机构的调度员(一个机构可以有多个调度员)
     * wlyy_doctor中,level -- 11-- 调度员
     * doctor中,level -- 11-- 调度员
     * @param hospitalCode
     * @return
     */
@ -927,6 +927,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        orderBriefInfo.put("doctorSignTime", DateUtil.dateToStr(orderDO.getDoctorSignTime(), "MM-dd HH:mm"));
        orderBriefInfo.put("completeTime", DateUtil.dateToStr(orderDO.getCompleteTime(), "MM-dd HH:mm"));
        orderBriefInfo.put("prescriptionTime", DateUtil.dateToStr(orderDO.getPrescriptionTime(), "MM-dd HH:mm"));
        orderBriefInfo.put("cancelTime", DateUtil.dateToStr(orderDO.getCancelTime(), "MM-dd HH:mm"));
        // 计算服务包支付多少钱
        List<Map<String, Object>> feeDetailDOS = doorOrderService.getDoorFeeDetailGroupByStatus(id);
@ -1882,7 +1883,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        }
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        if(StringUtils.isEmpty(hospital)){
            hospital = "350211A1002";
        }
        //
        String sql = "SELECT " +
                "  d.id as doctor, " +
@ -2269,7 +2272,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        this.save(doorServiceOrderDO);
        // 给医生发派单消息
        if(doorServiceOrderDO.getIsTransOtherOrg().equals(WlyyDoorServiceOrderDO.IsTransOtherOrg.yes.getType())){
        if(WlyyDoorServiceOrderDO.IsTransOtherOrg.yes.getType().equals(doorServiceOrderDO.getIsTransOtherOrg())){
            this.createMessage(orderId,doorServiceOrderDO.getTransedDispatcher(),doctor,407,"服务工单待接单","您有新的服务工单,请前往处理");
        }else{
            this.createMessage(orderId,doorServiceOrderDO.getDispatcher(),doctor,407,"服务工单待接单","您有新的服务工单,请前往处理");

+ 14 - 9
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/HospitalService.java

@ -1,6 +1,5 @@
package com.yihu.jw.door.service.common;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,35 +21,41 @@ public class HospitalService {
    private BaseOrgDao baseOrgDao;
    public List<Map<String, Object>> getDoctorsByhospitalNoPage(String hospital, String name, Integer type, Integer times) throws Exception {
        BaseOrgDO h = baseOrgDao.findByCode(hospital);
/*        BaseOrgDO h = baseOrgDao.findByCode(hospital);
        Integer level = 1;
        if(h != null && h.getOrgLevel()!=null) {
            level = h.getOrgLevel();
        }else {
            throw new Exception("未获取到机构等级");
        }
        String sql = "";
        }*/
//        String sql = "";
        //服务次数是否大于12
        if (times != null && times <= 12) {
/*        if (times != null && times <= 12) {
            sql = "select d.*,j.fee_level_" + level + " - j.subsidy as fee  from wlyy_doctor d LEFT JOIN dm_job j on d.job = j.`code` and j.del = 1 " +
                    "where d.del=1  and d.status=1 ";
        }else {
            sql = "select d.*,j.fee_level_" + level + " as fee  from wlyy_doctor d LEFT JOIN dm_job j on d.job = j.`code` and j.del = 1 " +
                    "where d.del=1  and d.status=1 ";
        }
        }*/
        String sql = "SELECT d.id," +
                " d.id name,d.name,h.org_code hospital,h.org_name hospital_name, " +
                " h.dept_name,d.job_title_code job,d.job_title_name job_name,d.photo,d.expertise,d.introduce " +
                "FROM base_doctor d, base_doctor_hospital h " +
                "WHERE d.id = h.doctor_code AND h.del = 1 AND d.del = 1";
        List<Object> params = new ArrayList<Object>();
        if (StringUtils.isNoneEmpty(hospital)) {
            sql += " and hospital =? ";
            sql += " and h.org_code =? ";
            params.add(hospital);
        }
        if (StringUtils.isNoneEmpty(name)) {
            sql += " and d.name like ? ";
            params.add("%" + name + "%");
        }
        if (type != null && type > 0) {
/*        if (type != null && type > 0) {
            sql += " and level =? ";
            params.add(type);
        }
        }*/
        return jdbcTemplate.queryForList(sql, params.toArray());
    }

+ 167 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/PatientService.java

@ -0,0 +1,167 @@
package com.yihu.jw.door.service.common;
import com.yihu.jw.door.dao.common.SignFamilyDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.door.SignFamily;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
 * Created by yeshijie on 2020/12/31.
 */
@Service
public class PatientService {
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    /**
     * 查询单个居民信息
     *
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONObject getPatient(String patient, String doctor) throws Exception {
        JSONObject json = new JSONObject();
        BasePatientDO p = patientDao.findById(patient);
        if (p == null) {
            throw new Exception("patient info can not find");
        }
        // 设置患者标识
        json.put("code", p.getId());
        // 设置患者姓名
        json.put("name", p.getName());
        // 设置患者手机号
        json.put("mobile", p.getMobile());
        // 设置患者微信openid
        json.put("openid", StringUtils.isNotEmpty(p.getOpenid()) ? p.getOpenid() : "");
        json.put("openidTime", DateUtil.dateToStr(p.getOpenidTime(), DateUtil.YYYY_MM_DD_HH_MM_SS));
        // 设置患者联系电话
        json.put("phone", p.getPhone());
        // 设置患者头像
        json.put("photo", p.getPhoto());
        // 设置患者年龄
        json.put("age", IdCardUtil.getAgeByIdcardOrBirthday(p.getIdcard(),p.getBirthday()));
        // 设置患者性别
        json.put("sex", p.getSex());
        // 身份证号
        json.put("idcard", p.getIdcard());
        //1.4.2新增medicareNumber
//        json.put("medicareNumber", p.getMedicareNumber());
        // 设置患者居住省份
        json.put("provinceName", p.getProvinceName());
        json.put("cityName", p.getCityName());
        json.put("townName", p.getTownName());
        json.put("streetName", p.getStreetName());
        // 设置患者地址
        json.put("address", p.getAddress());
        // 社保号
//        json.put("ssc", p.getSsc());
        //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
/*        json.put("disease",p.getDisease());
        // 病情:0绿标,1黄标,2红标,
        json.put("diseaseCondition",p.getDiseaseCondition());
        //预警状态
        json.put("standardStatus",p.getStandardStatus());
        //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
        json.put("deviceType",p.getDeviceType()==null?"":p.getDeviceType());
        //20190719 增加返回字段:档案状态(-2冻结 1未管理 2死亡3 正常4 高危)
        json.put("archiveStatus",p.getArchiveStatus() == null? "":p.getArchiveStatus().toString());*/
        SignFamily familySign = signFamilyDao.findSignByPatient(patient, 2);
        if (familySign != null) {
            // 设置患者紧急联系人
            json.put("signCode",familySign.getCode());
            json.put("emerMobile", StringUtils.isEmpty(familySign.getEmerMobile()) ? "" : String.valueOf(familySign.getEmerMobile()));
            // 设置签约日期
            json.put("qyrq", familySign.getApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getApplyDate(), DateUtil.YYYY_MM_DD) : "");
            // 设置签约日期
            json.put("patientApplyDate", familySign.getPatientApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getPatientApplyDate(), DateUtil.YYYY_MM_DD) : "");
            // 设置签约类型
            json.put("signType", json.has("signType") ? 3 : 2);
            // 缴费情况
            json.put("expensesStatus", StringUtils.isNotEmpty(familySign.getExpensesStatus()) ? String.valueOf(familySign.getExpensesStatus()) : "0");
            // 缴费时间
            json.put("expensesTime", familySign.getExpensesTime() != null ? DateUtil.dateToStr((Date) familySign.getExpensesTime(), DateUtil.YYYY_MM_DD_HH_MM) : "");
            // 缴费类型
            json.put("expensesType", StringUtils.isNotEmpty(familySign.getExpensesType()) ? String.valueOf(familySign.getExpensesType()) : "");
            // 设置签约状态
            json.put("familyStatus", familySign.getStatus());
            json.put("jtBeginDate", DateUtil.dateToStr(familySign.getBegin(), DateUtil.YYYY_MM_DD));
            json.put("jtEndDate", DateUtil.dateToStr(familySign.getEnd(), DateUtil.YYYY_MM_DD));
//            Doctor jtDoctor = doctorDao.findByCode(familySign.getDoctor());
//            json.put("jtDoctor", familySign.getDoctor());
//            json.put("jtDoctorName", familySign.getDoctorName());
//            json.put("jtDoctorSex", jtDoctor.getSex());
//            json.put("jtDoctorPhoto", jtDoctor.getPhoto());
//            json.put("jtDoctorHealth", familySign.getDoctorHealth());
//            json.put("jtDoctorHealthName", familySign.getDoctorHealthName());
//            json.put("jtSpecialist", familySign.getSpecialist());
//            json.put("jtSpecialistName", familySign.getSpecialistName());
//            json.put("jtAdminTeam", familySign.getAdminTeamId());
//            json.put("jtHospital", familySign.getHospital());
//            json.put("jtHospitalName", familySign.getHospitalName());
        }
/*        boolean epTime = false;
        try {
            epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (!epTime) {
            json.put("wechatFocusRemind", 0);
        } else {
            json.put("wechatFocusRemind", 1);
        }*/
/*        json.put("countryCode",p.getSickVillage()==null?"":p.getSickVillage());
        json.put("countryName",p.getSickVillageName()==null?"":p.getSickVillageName());*/
/*        //1.4.2 是否追踪居民健康体征
        if(StringUtils.isNotBlank(doctor)){
            TrackPatient tp = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
            if(tp!=null){
                json.put("isTrack",tp.getDel());
            }else{
                json.put("isTrack","0");
            }
        }
        //1.4.9  是否专科医生服务
        JSONArray jsonArray =specialistService.findPatientSignSpecialist(patient);
        if(jsonArray!=null&&jsonArray.length()>0){
            json.put("isSpecialist",1);
            json.put("specialistArray", jsonArray);
        }else{
            json.put("isSpecialist",0);
        }
        //1.5.0 是否有康复计划
        JSONArray planList = rehabilitationManageService.planListByPatient(patient);
        if(planList!=null&&planList.length()>0){
            json.put("havePlan",1);
        }else{
            json.put("havePlan",0);
        }*/
        return json;
    }
}

+ 62 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/consult/ConsultTeamService.java

@ -2,6 +2,7 @@ package com.yihu.jw.door.service.consult;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.door.dao.WlyyDoorServiceOrderDao;
import com.yihu.jw.door.service.WlyyDoorServiceOrderService;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
@ -11,6 +12,7 @@ import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -32,6 +34,61 @@ public class ConsultTeamService {
    private ImUtil imUtill;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
    private WlyyDoorServiceOrderService wlyyDoorServiceOrderService;
    public JSONObject updateIMMsg(String sessionId,String sessionType,String msgId,String content){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(sessionId) || StringUtils.isEmpty(sessionType) || StringUtils.isEmpty(msgId) || StringUtils.isEmpty(content)){
            result.put("data", "参数【sessionId,sessionType,msgId,content】不可为空!");
            result.put("status", -1);
            return result ;
        }
        JSONObject contentJsonObj = null;
        try{
            contentJsonObj = JSONObject.parseObject(content);
        }catch (Exception e){
            result.put("status", -1);
            result.put("data", "【content】必须是json格式:" + e.getMessage());
            return result;
        }
        String response = imUtill.updateMessage(sessionId,sessionType,msgId,content);
        return JSONObject.parseObject(response);
    }
    /**
     * 根据咨询查关联业务记录
     * @param code
     * @param type
     * @return
     */
    public JSONObject queryByConsultCode(String code,Integer type){
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(code) || null == type){
            return null;
        }
        ConsultDo consult = consultDao.queryByIdAndType(code,type);
        if(null == consult){
            result.put("data", "");
            return result;
        }
        switch (type) {
            case 11:
                WlyyDoorServiceOrderDO orderDO = wlyyDoorServiceOrderDao.findOne(consult.getRelationCode());
                JSONObject patientInfo = wlyyDoorServiceOrderService.queryOrderCardInfo(orderDO);
                result.put("data", patientInfo);
                break;
            default:
                break;
        }
        if(null == result.get("data")){
            result.put("data", consult);
        }
        return result;
    }
    /**
     * 添加一条咨询记录
@ -135,6 +192,11 @@ public class ConsultTeamService {
            return result;
        }
        // 把医生拉入会话,作为其中一个成员
        if(StringUtils.isNotBlank(doorServiceOrderDO.getDoctor())){
            imUtill.updateParticipantNew(sessionId,doorServiceOrderDO.getDoctor(),null);
        }
        consultTeam.setStartMsgId(imResponseJson.get("start_msg_id").toString());
        consultTeamDao.save(consultTeam);
        consultDao.save(consult);

+ 190 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/consult/DoctorQuickReplyService.java

@ -0,0 +1,190 @@
package com.yihu.jw.door.service.consult;
import com.yihu.jw.door.dao.consult.DoctorQuickReplyDao;
import com.yihu.jw.entity.door.DoctorQuickReply;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * Created by lyr-pc on 2016/12/28.
 */
@Service
@Transactional
public class DoctorQuickReplyService {
    @Autowired
    DoctorQuickReplyDao quickReplyDao;
    /**
     * 添加快捷回复
     *
     * @param doctor  医生
     * @param content 快捷回复内容
     * @return
     */
    public DoctorQuickReply addReply(String doctor, String content, String type) {
        DoctorQuickReply reply = new DoctorQuickReply();
        Integer sort = quickReplyDao.findMaxSort(doctor);
        sort = sort == null ? 1 : sort + 1;
        reply.setDoctor(doctor);
        reply.setContent(content);
        reply.setStatus(1);
        reply.setSort(sort);
        reply.setUpdateTime(new Date());
        reply.setType(Integer.parseInt(type));
        reply.setSystag(0);
        return quickReplyDao.save(reply);
    }
    /**
     * 修改快捷回复
     *
     * @param id      回复ID
     * @param content 快捷回复内容
     * @return
     */
    public DoctorQuickReply modifyReply(long id, String content,String type) throws Exception {
        DoctorQuickReply reply = quickReplyDao.findOne(id);
        if (reply == null) {
            throw new Exception("reply not exist");
        }
        reply.setContent(content);
        reply.setType(Integer.parseInt(type));
        reply.setSystag(0);
        return quickReplyDao.save(reply);
    }
    /**
     * 删除快捷回复
     *
     * @param id
     * @return
     */
    public int delReply(String doctor, long id) {
        DoctorQuickReply reply = quickReplyDao.findOne(id);
        // 快捷回复不存在
        if (reply == null) {
            return -1;
        }
        if (reply.getStatus() == 0) {
            return -1;
        }
        reply.setStatus(0);
        quickReplyDao.save(reply);
        quickReplyDao.updateSort(doctor, reply.getSort());
        return 1;
    }
    /**
     * 获取医生快捷回复列表
     *
     * @param doctor
     * @return
     */
    public List<DoctorQuickReply> getDoctorReplyList(String doctor,String type,String keyword) throws Exception{
        Sort sort = new Sort(Sort.Direction.DESC, "sort");
        if("1".equals(type)){
            sort = new Sort(Sort.Direction.ASC, "sort");
        }
        List<DoctorQuickReply> replies = new ArrayList<>();
        if (StringUtils.isEmpty(keyword)){
            replies = quickReplyDao.findDoctorRepliesByType(doctor, Integer.parseInt(type),sort);
        }else {
            replies = quickReplyDao.findDoctorRepliesByType(doctor, Integer.parseInt(type),keyword,sort);
        }
        if(replies.isEmpty() && "1".equals(type)){
            //如果是续方咨询,拿到的列表为空,则默认添加系统消息
            List<DoctorQuickReply> defaults = quickReplyDao.findDoctorReplies("default",sort);
    
            List<DoctorQuickReply> newList = new ArrayList<>();
            
            for (DoctorQuickReply doctorQuickReply:defaults) {
                DoctorQuickReply doctorQuickReplyThis = new DoctorQuickReply();
                doctorQuickReplyThis.setDoctor(doctor);
                doctorQuickReplyThis.setType(doctorQuickReply.getType());
                doctorQuickReplyThis.setContent(doctorQuickReply.getContent());
                doctorQuickReplyThis.setSort(doctorQuickReply.getSort());
                doctorQuickReplyThis.setSystag(doctorQuickReply.getSystag());
                doctorQuickReplyThis.setStatus(doctorQuickReply.getStatus());
                doctorQuickReplyThis.setUpdateTime(new Date());
                newList.add(doctorQuickReplyThis);
            }
            quickReplyDao.save(newList);
    
            replies = quickReplyDao.findDoctorRepliesByType(doctor, Integer.parseInt(type),sort);
        }
        
        return replies;
    }
    /**
     * 排序回复
     *
     * @param id
     * @param sort
     * @return
     */
    public int sortReply(String doctor, long id, int sort) {
        DoctorQuickReply reply = quickReplyDao.findOne(id);
        // 快捷回复不存在
        if (reply == null) {
            return -1;
        }
        if (reply.getStatus() == 0) {
            return -1;
        }
        if (reply.getSort() < sort) {
            quickReplyDao.updateSortLt(doctor, reply.getSort(), sort);
        } else if (reply.getSort() > sort) {
            quickReplyDao.updateSortGt(doctor, reply.getSort(), sort);
        } else {
            return -2;
        }
        reply.setSort(sort);
        quickReplyDao.save(reply);
        return 1;
    }
    /**
     * 排序回复
     *
     * @param id
     * @param type
     * @return
     */
    public int sortReplyList(String id,String type) {
        String[] ids = id.split(",");
        for (int i = 0; i < ids.length; i++) {
            DoctorQuickReply reply = quickReplyDao.findOne(Long.valueOf(ids[i]));
            if (reply == null) {
                return -1;
            }
            if("1".equals(type)){
                reply.setSort(i+1);
            }else{
                reply.setSort(ids.length - i);
            }
            
        }
        return 1;
    }
}

+ 80 - 54
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -3,7 +3,9 @@ package com.yihu.jw.hospital.endpoint.hospital;
import com.alibaba.fastjson.JSONObject;
import com.sun.media.jfxmedia.logging.Logger;
import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.family.service.PatientMemberDictService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
@ -26,6 +28,7 @@ import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
@ -61,6 +64,8 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${wechat.id}")
    private String wxId;
@ -159,67 +164,76 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
            throw new IllegalAccessException("SMS request frequency is too fast");
            //发送短信获取验证码
        }
        String captcha = this.getCodeNumber();
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            System.out.println("发送眼科验证码开始");
            ResultMsg result= null;
            if (null!=jsonArray&&jsonArray.size() > 0) {
                result = ykyySMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                if (result.isSuccess()){
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            this.store(client_id, phoneNum, captcha, 120);
            mixEnvelop.setMessage("验证码发送成功");
        }else {
            String captcha = this.getCodeNumber();
            System.out.println("=====================当前短信验证码============="+captcha+"=====================");
            if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                System.out.println("发送眼科验证码开始");
                ResultMsg result= null;
                if (null!=jsonArray&&jsonArray.size() > 0) {
                    result = ykyySMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                    if (result.isSuccess()){
                        this.store(client_id, phoneNum, captcha, 120);
                        mixEnvelop.setMessage("验证码发送成功");
                    } else {
                        mixEnvelop.setMessage("验证码发送失败");
                        mixEnvelop.setStatus(500);
                    }
                }else {
                    mixEnvelop.setStatus(408);
                    mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
                }
            }else if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                System.out.println("发送中山验证码开始");
                int result = 1;
                if (null!=jsonArray&&jsonArray.size() > 0) {
                    result = zhongShanSMSService.ZhongShangSendSMS(phoneNum, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                } else {
                    result = 2;
                }
                if (0 == result) {
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");
                } else if (2 == result) {
                    mixEnvelop.setStatus(408);
                    mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
                } else {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }else if("xm_xzzx_wx".equalsIgnoreCase(wxId)){
                //发送短信获取验证码
                JSONObject object = new JSONObject();
                object.put("operatetel","18788888888");
                object.put("interfaceid","jcpt");
                object.put("interfacepwd","jcpt");
                object.put("operator","xxgwxgzh");
                object.put("operateid","xxgwxgzh");
                com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
                jsonObject.put("sendtel",phoneNum);
                jsonObject.put("sendtime", DateUtil.dateToStrLong(new Date()));
                array.add(jsonObject);
                object.put("messageinfo",array);
                int result =  xzzxEntranceService.SendSmsToEntrance(object.toJSONString());
                if (0 == result) {
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");
                } else {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }else {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
            }
        }else if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            System.out.println("发送中山验证码开始");
            int result = 1;
            if (null!=jsonArray&&jsonArray.size() > 0) {
                result = zhongShanSMSService.ZhongShangSendSMS(phoneNum, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
            } else {
                result = 2;
            }
            if (0 == result) {
                this.store(client_id, phoneNum, captcha, 120);
                mixEnvelop.setMessage("验证码发送成功");
            } else if (2 == result) {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
            } else {
                mixEnvelop.setMessage("验证码发送失败");
                mixEnvelop.setStatus(500);
            }
        }else {
            //发送短信获取验证码
            JSONObject object = new JSONObject();
            object.put("operatetel","18788888888");
            object.put("interfaceid","jcpt");
            object.put("interfacepwd","jcpt");
            object.put("operator","xxgwxgzh");
            object.put("operateid","xxgwxgzh");
            com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
            jsonObject.put("sendtel",phoneNum);
            jsonObject.put("sendtime", DateUtil.dateToStrLong(new Date()));
            array.add(jsonObject);
            object.put("messageinfo",array);
            int result =  xzzxEntranceService.SendSmsToEntrance(object.toJSONString());
            if (0 == result) {
                this.store(client_id, phoneNum, captcha, 120);
                mixEnvelop.setMessage("验证码发送成功");
            } else {
                mixEnvelop.setMessage("验证码发送失败");
                mixEnvelop.setStatus(500);
            }
        }
        return mixEnvelop;
    }
@ -252,6 +266,14 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    //验证验证码
    public boolean verification(String client_id, String username, String code) {
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            if (code.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                return true;
            }else {
                return false;
            }
        }
        if (StringUtils.isEmpty(code)) {
            return false;
        }
@ -279,7 +301,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");
@ -295,7 +322,6 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
                        return mixEnvelop;
                    }
                }
                String id = "";
                if (null != jsonObject.get("id")) {
                    id = jsonObject.get("id").toString();

+ 17 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -1405,5 +1405,22 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                       @ApiParam(name = "keyWord", value = "名字关键字")
                                       @RequestParam(value = "keyWord", required = false)String keyWord) {
        return success(prescriptionService.findAllHospital(level,keyWord));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.appointmentRevisitOnDoor)
    @ApiOperation(value = "上门复诊", notes = "上门复诊")
    public ObjEnvelop appointmentRevisitOnDoor(@ApiParam(name = "outpatientJson", value = "居民门诊json")
                                               @RequestParam(value = "outpatientJson", required = false)String outpatientJson,
                                               @ApiParam(name = "expressageJson", value = "居民物流json")
                                               @RequestParam(value = "expressageJson", required = false)String expressageJson,
                                               @ApiParam(name = "registerJson", value = "预约时间")
                                               @RequestParam(value = "registerJson", required = false)String registerJson,
                                               @ApiParam(name = "chargeType", value = "预约实体json")
                                               @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisitOnDoor(outpatientJson,expressageJson,registerJson,chargeType);
        return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
    }
}

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

@ -1246,7 +1246,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getPatientAccetokenByIdcard)
    @ApiOperation(value = "根据居民CODE换取居民请求秘钥")
    public Envelop getPatientAccetokenByIdcard(@ApiParam(name = "patientCode", value = "居民CODE")
                                               @RequestParam(value = "patientCode",required = true) String patientCode)throws Exception{
                                               @RequestParam(value = "patientCode",required = true) String patientCode,
                                               @ApiParam(name = "wxid", value = "wxid")
                                               @RequestParam(value = "wxid",required = false) String wxid)throws Exception{
        if (StringUtils.isNoneBlank(wxid)){
            wxId = wxid;
        }
        return success(wlyyBusinessService.wlyyGetPatientAccetokenByIdcard(patientCode,wxId));
    }
    
@ -2346,10 +2351,12 @@ 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));
        }
    }
}

+ 8 - 4
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;
@ -565,11 +566,12 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            @RequestParam(required = true) String endDate,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index) {
            @RequestParam(required = true) String index,
            @RequestParam(required = false) String lowCode) {
        //新版与旧版统计适配
        JSONObject result = new JSONObject();
        try {
            result = statisticsEsService.getConsultHead(startDate, endDate, area, level, index);
            result = statisticsEsService.getConsultHead(startDate, endDate, area, level, index,lowCode);
        } catch (Exception e) {
            e.printStackTrace();
@ -764,10 +766,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 +795,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();