Browse Source

代码修改

liubing 4 years ago
parent
commit
258aadcee6
88 changed files with 5416 additions and 619 deletions
  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. 786 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TnPrescriptionService.java
  6. 642 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java
  7. 5 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/useragent/BaseUserAgent.java
  8. 2 0
      business/base-service/src/main/java/com/yihu/jw/org/dao/BaseOrgDao.java
  9. 3 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientMedicareCardDao.java
  10. 129 10
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  11. 32 4
      business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java
  12. 12 0
      business/base-service/src/main/java/com/yihu/jw/yx/dao/YxTokenMappingDao.java
  13. 451 119
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  14. 10 0
      business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java
  15. 2 0
      business/im-service/src/main/java/com/yihu/jw/im/dao/ConsultDao.java
  16. 17 0
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  17. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  18. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  19. 49 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/yx/YxTokenMappingDO.java
  20. 84 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/DoctorQuickReply.java
  21. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/DoctorRegistration.java
  22. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/DoctorRegistrationTemp.java
  23. 2 4
      common/common-entity/src/main/java/com/yihu/jw/entity/door/SignFamily.java
  24. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorCommentDO.java
  25. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorCommentDoctorDO.java
  26. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorOrderItemDO.java
  27. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorPrescriptionDO.java
  28. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorPrescriptionDetailDO.java
  29. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorPrescriptionDrugDO.java
  30. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorProcessLogDO.java
  31. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceApplicationDo.java
  32. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceConfigureDo.java
  33. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceVoucherDo.java
  34. 2 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyFeldsherCADO.java
  35. 4 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  36. 1 1
      gateway/ag-basic/pom.xml
  37. 14 1
      gateway/ag-basic/src/main/resources/application.yml
  38. 9 0
      gateway/ag-basic/src/main/resources/bootstrap.yml
  39. BIN
      jkzl - 快捷方式.lnk
  40. 14 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/core/redis/WlyyRedisVerifyCodeService.java
  41. 157 99
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  42. 30 1
      server/svr-authentication/src/main/resources/application.yml
  43. 10 1
      server/svr-authentication/src/main/resources/bootstrap.yml
  44. 15 1
      server/svr-configuration/src/main/resources/bootstrap.yml
  45. 57 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/dict/WlyyHospitalSysDictEndpoint.java
  46. 46 0
      svr/svr-base/src/main/resources/application.yml
  47. 8 0
      svr/svr-base/src/main/resources/bootstrap.yml
  48. 16 13
      svr/svr-door-serivce/pom.xml
  49. 724 0
      svr/svr-door-serivce/sql/初始sql.sql
  50. 57 57
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/config/jpa/DoorServiceJpa.java
  51. 35 35
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/config/jpa/HibernateProperties.java
  52. 160 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/common/DistrictController.java
  53. 56 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorConsultController.java
  54. 147 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorController.java
  55. 170 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoctorQuickReplyController.java
  56. 8 8
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java
  57. 112 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/ConsultController.java
  58. 77 2
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/PatientController.java
  59. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorCommentController.java
  60. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorCommentDoctorController.java
  61. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorConclusionController.java
  62. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorDoctorController.java
  63. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorDoctorFeeController.java
  64. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorFeeDetailController.java
  65. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorPatientConfirmLogController.java
  66. 6 15
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorServiceOrderController.java
  67. 40 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/consult/DoctorQuickReplyDao.java
  68. 6 6
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorOrderService.java
  69. 1 1
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/DoorServiceApplicationService.java
  70. 0 32
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorDoctorService.java
  71. 88 79
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java
  72. 14 9
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/HospitalService.java
  73. 167 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/common/PatientService.java
  74. 62 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/consult/ConsultTeamService.java
  75. 190 0
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/consult/DoctorQuickReplyService.java
  76. 10 10
      svr/svr-door-serivce/src/main/resource/application.yml
  77. 0 0
      svr/svr-door-serivce/src/main/resources/banner.txt
  78. 0 0
      svr/svr-door-serivce/src/main/resources/bootstrap.yml
  79. 1 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/TnyyController.java
  80. 51 2
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  81. 41 0
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  82. 80 54
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  83. 17 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  84. 49 9
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  85. 8 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java
  86. 52 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/tnyy/TnyyController.java
  87. 91 0
      svr/svr-internet-hospital/src/main/resources/application.yml
  88. 9 1
      svr/svr-internet-hospital/src/main/resources/bootstrap.yml

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

+ 786 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TnPrescriptionService.java

@ -0,0 +1,786 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionExpressageDao;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/5/17.
 */
@Service
@Transactional
public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
    private static final Logger logger = LoggerFactory.getLogger(TnPrescriptionService.class);
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private HospitalWaitingRoomDao hospitalWaitingRoomDao;
    @Autowired
    private PatientMappingService patientMappingService;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private PatientRegisterTimeDao patientRegisterTimeDao;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private WechatDao wechatDao;
    @Autowired
    private BasePatientWechatDao patientWechatDao;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private BaseDrugStoreDao baseDrugStoreDao;
    @Autowired
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private BaseDoctorRoleDao doctorRoleDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private WlyyChargeDictDao wlyyChargeDictDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.flag}")
    private boolean flag;
    @Value("${pay.flag}")
    private boolean payFlag;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private YkyyService ykyyService;
    /**
     * 获取居民就诊记录接口
     * @param patient
     * @param startTime
     * @param endTime
     * @param demoFlag
     * @return
     * @throws Exception
     */
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String cardNo, String startTime, String endTime, boolean demoFlag, String ksdm)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo ="";
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if(StringUtils.isNotBlank(cardNo)){
            BasePatientDO patientDO = basePatientDao.findByIdAndDel(patient,"1");
            /*JSONArray res = ykyyEntranceService.findPatientCodeByCardNo(cardNo,false);
            if(res !=null&&res.size()>0){
                JSONObject object = (JSONObject) res.get(0);
                if (object.get("brid")!=null){
                    patNo = object.get("brid").toString();
                }
            }*/
            JSONArray res = tnyyEntranceService.selectPatientMappingCode(patientDO.getIdcard());
            if (res!=null&&res.size()!=0){
                JSONObject object = res.getJSONObject(0);
                patNo = object.getString("BRID");
            }
            if(!StringUtils.isBlank(patNo)){
                if (patientMappingDO!=null){
                    patientMappingDO.setMappingCode(patNo);
                }else {
                    patientMappingDO = new PatientMappingDO();
                    patientMappingDO.setMappingCode(patNo);
                    patientMappingDO.setCreateTime(new Date());
                    patientMappingDO.setSource("1");
                    patientMappingDO.setPatient(patient);
                    patientMappingDO.setIdcard(patientDO.getIdcard());
                    patientMappingDO.setPatientName(patientDO.getName());
                }
                patientMappingDao.save(patientMappingDO);
            }
        }else {
            if (patientMappingDO!=null){
                patNo = patientMappingDO.getMappingCode();
            }
        }
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        logger.info("findOutpatientList patNo "+patNo);
        return tnyyEntranceService.BS30025(patNo,null,startTime,endTime,demoFlag,ksdm);
    }
    /**
     *
     */
    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn, String patient, String realOrder, String admNo, boolean demoFlag)throws Exception{
        String patNo =patientMappingService.findHisPatNoByPatient(patient,null);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" realOrder:"+realOrder+" admNo:"+admNo);
        return tnyyEntranceService.findMS_CF01And02(admNo,demoFlag);
    }
    /**
     * 获取居民就诊记录接口
     * @param patient
     * @return
     * @throws Exception
     */
    public  WlyyOutpatientVO findOutpatientInfo(String patient,String conNo, boolean demoFlag,String ksdm)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient,demoFlag);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        logger.info("findOutpatientList patNo "+patNo);
        List<WlyyOutpatientVO> wlyyOutpatientVOS = tnyyEntranceService.BS30025(patNo,conNo,null,null,demoFlag,ksdm);
        if (wlyyOutpatientVOS!=null&&wlyyOutpatientVOS.size()!=0){
            WlyyOutpatientVO outpatientVO = wlyyOutpatientVOS.get(0);
            BasePatientDO patientDO = basePatientDao.findById(patient);
            outpatientVO.setSex(patientDO.getSex()+"");
            outpatientVO.setBirthday(patientDO.getBirthday());
            outpatientVO.setIdcard(patientDO.getIdcard());
            return outpatientVO;
        }
       return null;
    }
    /**
     * 发起图文和视频复诊
     *
     * @param outpatientJson
     * @param expressageJson
     * @return
     * @throws Exception
     *//*
    public WlyyOutpatientDO appointmentRevisit(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 = doctorDao.findById(outpatientDO.getDoctor());
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("0");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setCreateTime(new Date());
        if (!payFlag){
            outpatientDO.setPayStatus(1);
        }else {
            outpatientDO.setPayStatus(0);
        }
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        BusinessOrderDO businessOrderDO = new BusinessOrderDO();
        if("3".equalsIgnoreCase(outpatient.getOutpatientType())){
            businessOrderDO.setRelationCode(outpatient.getId());
            businessOrderDO.setRelationName("专家咨询费");
            businessOrderDO.setDescription("专家咨询费");
            businessOrderDO.setRematk(outpatient.getDescription());
            businessOrderDO.setPatient(outpatient.getConsumer());
            businessOrderDO.setPatientName(outpatient.getConsumerName());
            businessOrderDO.setDoctor(outpatient.getDoctor());
            if (outpatientDO.getType().equalsIgnoreCase("1")) {
                businessOrderDO.setOrderType(1);
                businessOrderDO.setOrderCategory("1");
            } else if (outpatientDO.getType().equalsIgnoreCase("2")) {
                businessOrderDO.setOrderType(17);
                businessOrderDO.setOrderCategory("1");
            }
        }else {
            businessOrderDO.setRelationCode(outpatient.getId());
            businessOrderDO.setRelationName("复诊-诊查费");
            businessOrderDO.setDescription("复诊-诊查费");
            businessOrderDO.setRematk(outpatient.getDescription());
            businessOrderDO.setPatient(outpatient.getConsumer());
            businessOrderDO.setPatientName(outpatient.getConsumerName());
            businessOrderDO.setDoctor(outpatient.getDoctor());
            if (outpatientDO.getType().equalsIgnoreCase("1")) {
                businessOrderDO.setOrderType(1);
                businessOrderDO.setOrderCategory("2");
            } else if (outpatientDO.getType().equalsIgnoreCase("2")) {
                businessOrderDO.setOrderType(3);
                businessOrderDO.setOrderCategory("3");
            }
        }
        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();
            }
            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());
                }
            }
        }
        *//*if (doctorDO != null && StringUtils.isNoneBlank(doctorDO.getFee())) {
            price = Double.parseDouble(doctorDO.getFee());
        }else {
            price = Double.parseDouble(hospitalSysDictDO.getDictValue());
        }*//*
        if (price == 0.0) {
            outpatientDO.setPayStatus(1);
        } else {
            outpatientDO.setPayStatus(0);
        }
        businessOrderDO.setPayPrice(price*100);
        if (!flag){
            businessOrderDO = businessOrderService.saveOrder(businessOrderDO);
        }
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        try {
            //如果是视频预约咨询
            if (StringUtils.isNotBlank(registerJson)) {
                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class);
                registerTimeDO.setOutpatientId(outpatient.getId());
                registerTimeDO.setCreateTime(new Date());
                patientRegisterTimeDao.save(registerTimeDO);
            }
        } catch (Exception e) {
            throw new RuntimeException("号源已经被预约,请选择其他号源");
        }
        if ("3".equalsIgnoreCase(outpatient.getOutpatientType())){
        }else {
            //2.物流信息
            WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
            expressageDO.setDel(1);
            expressageDO.setCreateTime(new Date());
            expressageDO.setOutpatientId(outpatient.getId());
            prescriptionExpressageDao.save(expressageDO);
            if (0==expressageDO.getOneselfPickupFlg()){
                if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                    String drugCode= expressageDO.getHospitalCode()==null?"5550":expressageDO.getHospitalCode();
                    expressageDO.setHospitalCode(drugCode);
                }
                System.out.println("进入物流信息");
                expressageDO.setDel(1);
                expressageDO.setCreateTime(new Date());
                expressageDO.setOutpatientId(outpatient.getId());
                prescriptionExpressageDao.save(expressageDO);
            }else {
                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);
            }
        }
        //3.创建候诊室
        createRoom(outpatient, chargeType);
        return outpatient;
    }
    *//**
     * 创建候诊室
     *
     * @param outpatientDO
     * @return
     *//*
    public Boolean createRoom(WlyyOutpatientDO outpatientDO, String chargeType) {
        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
        waitingRoom.setDept(outpatientDO.getDept());
        waitingRoom.setDeptName(outpatientDO.getDeptName());
        waitingRoom.setHospital(outpatientDO.getHospital());
        waitingRoom.setHospitalName(outpatientDO.getHospitalName());
        //是否是有协同门诊医生
        if (StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())) {
            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor());
            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName());
        }
        waitingRoom.setPatientId(outpatientDO.getConsumer());
        waitingRoom.setPatientName(outpatientDO.getConsumerName());
        waitingRoom.setReservationTime(outpatientDO.getRegisterDate());
        waitingRoom.setVisitStatus(0);
        //设置复诊类型
        waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType()) ? Integer.parseInt(outpatientDO.getOutpatientType()) : 1);
        waitingRoom.setSort(0);
        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType()));
        if (StringUtils.isNotBlank(outpatientDO.getDoctor())) {
            waitingRoom.setDoctor(outpatientDO.getDoctor());
            waitingRoom.setDoctorName(outpatientDO.getDoctorName());
        }
        waitingRoom.setOutpatientId(outpatientDO.getId());
        waitingRoom.setCreateTime(new Date());
        if (StringUtils.isNotBlank(chargeType)) {
            waitingRoom.setChargeType(chargeType);
        }
        hospitalWaitingRoomDao.save(waitingRoom);
        return true;
    }*/
    /**
     * 获取药品
     *
     `prescription_id` varchar(50) DEFAULT NULL COMMENT '处方code 关联表wlyy_prescription code',
     `drug_no` varchar(50) DEFAULT NULL COMMENT '药品编号',
     `drug_name` varchar(50) DEFAULT NULL COMMENT '药品名称',
     `disp_deposite` varchar(50) DEFAULT NULL COMMENT '库房号',
     `dosage` varchar(50) DEFAULT NULL COMMENT '药量',
     `quantity` varchar(50) DEFAULT NULL COMMENT '数量',
     `unit` varchar(50) DEFAULT NULL COMMENT '用量单位',
     `unit_name` varchar(50) DEFAULT NULL COMMENT '用量单位中文',
     `pack_unit` varchar(50) DEFAULT NULL COMMENT '包装单位',
     `pack_unit_name` varchar(50) DEFAULT NULL COMMENT '包装单位名称',
     `usage_code` varchar(50) DEFAULT NULL COMMENT '频率code',
     `usage_name` varchar(50) DEFAULT NULL COMMENT '频次名称',
     `supply_code` varchar(50) DEFAULT NULL COMMENT '用法',
     `supply_name` varchar(50) DEFAULT NULL COMMENT '用法名称',
     `days` varchar(50) DEFAULT NULL COMMENT '天数',
     `frequency` varchar(50) DEFAULT NULL COMMENT '组号',
     `serial` varchar(50) DEFAULT NULL COMMENT '药品序列号',
     `group_no` varchar(50) DEFAULT NULL COMMENT '库房号',
     `specification` varchar(50) DEFAULT NULL COMMENT '规格(10mgx10片/盒)',
     `pack_retprice` double(10,4) DEFAULT NULL COMMENT '包装价格',
     `herbal_count` varchar(10) DEFAULT NULL COMMENT '草药数量',
     `post_count` varchar(10) DEFAULT NULL COMMENT '贴数',
     `comm` varchar(50) DEFAULT NULL COMMENT '中药用法',
     `del` int(2) DEFAULT '1' COMMENT '1可用 0删除',
     `drug_place` varchar(100) DEFAULT NULL COMMENT '药品产地',
     `pack_quantity` int(11) DEFAULT NULL COMMENT '包装数量',
     PRIMARY KEY (`id`),
     */
    public JSONArray getDrugDictionary(String chargeCode, String pyKey, String winNo, String groupNo,String oupatientId) throws Exception {
        String hisCode = "";
        if (StringUtils.isNotEmpty(oupatientId)){
            List<WlyyPrescriptionExpressageDO> wlyyPrescriptionExpressageDOS = prescriptionExpressageDao.findByOutpatientIdAndOneSelfPick(oupatientId);
            if (wlyyPrescriptionExpressageDOS.size()>0){
                hisCode = wlyyPrescriptionExpressageDOS.get(0).getHospitalCode();
            }
        }
        JSONArray mapList = new JSONArray();
        mapList = tnyyEntranceService.findTnYpxx(chargeCode, null, null, pyKey,hisCode);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("charge_code",map.get("YPXH"));
            object.put("drugname",map.get("YPMC"));
            object.put("specification",map.get("YPGG"));
            object.put("pack_unit_name",map.get("JLDW"));
            object.put("yfdw",map.get("YFDW"));
            object.put("pack_size",map.get("YFBZ"));
         /*   object.put("yfsx",map.get("yfsx"));//药房属性*/
            object.put("ypjl",map.get("YPJL"));//药剂量
            object.put("jldw",map.get("JLDW"));//剂量单位
            object.put("py_code",map.get("PYDM"));//拼音代码
            object.put("fyfs",map.get("FYFS"));//发药方式
            object.put("supply_code",map.get("GYFF"));//给药方式
            object.put("yfzf",map.get("YFZF"));//药房作废
            object.put("supply_name",map.get("GYFF"));//给药方式名称
/*            object.put("ybfl",map.get("ybfl"));//医保分类*/
            object.put("retprice",map.get("LSJG"));//零售价格
            object.put("kcsl",map.get("KCSL"));//库存
            object.put("ypcd",map.get("YPCD"));//产地
            object.put("zfpb",map.get("ZFPB"));//作废判别
            object.put("jbywbz",map.get("jbywbz"));//基本药物标志
            if (map.get("XTSB")!=null){
                if (map.getString("XTSB").equalsIgnoreCase("1")){
                    object.put("group_no",81);
                }else {
                    object.put("group_no",82);
                }
            }
           /* object.put("ydyp",map.get("ydyp"));//药店药品
            object.put("ypmc2",map.get("ypmc2"));//药品名称2
            object.put("t",map.get("pzwh"));//药品批文*/
            array.add(object);
        }
        return array;
    }
    /**
     * 获取药品用法
     */
    public JSONArray getDrugUse(String pyKey,boolean demoFlag) throws Exception {
        JSONArray mapList = new JSONArray();
        mapList = tnyyEntranceService.findYpyf(pyKey);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("supply_code",map.get("YPYF"));
            object.put("supply_name",map.get("XMMC"));
            object.put("ypyf",map.get("YPYF"));
            array.add(object);
        }
        return array;
    }
    /**
     * 医院频次
     *
     * @return
     */
    public JSONArray getDrugFrequency(boolean demoFlag) throws Exception {
        JSONArray mapList = new JSONArray();
        mapList= tnyyEntranceService.findSypc(null);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("FREQ_CODE",map.get("PCBM"));
            object.put("FREQ_NAME",map.get("PCMC"));
            object.put("MRSC",map.get("MRCS"));
            array.add(object);
        }
        return array;
    }
   /* *//**
     * 获取检查检验
     *  "action": "select",
     "name": "丙型肝炎RNA测定(全自动荧光定量分析)",
     "charge_unit": "项",
     "charge_amount": "150",
     "py_code": "BXGYRNAC",
     "d_code": "GGEORNAI",
     "code": "393333",
     "exec_unit": "2160000",
     "win_no": "0",
     "exec_unit_name": "检验科"
     *
     * @return
     *//*
    public JSONArray getInspectionDictionary(String pyKey, String codes, String winNo) throws Exception {
        JSONArray mapList = ykyyEntranceService.findYkJcxm(pyKey);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("name",map.get("xmmc"));
            object.put("code",map.get("zlxmid"));
            object.put("py_code",map.get("pydm"));
            object.put("wbdm",map.get("wbdm"));
            object.put("jxdm",map.get("jxdm"));
            object.put("qtdm",map.get("qtdm"));
            object.put("ydyzlb",map.get("ydyzlb"));
            object.put("mlbh",map.get("mlbh"));
            object.put("zxpc",map.get("zxpc"));
            object.put("jfpc",map.get("jfpc"));
            object.put("jsfs",map.get("jsfs"));
            object.put("jszq",map.get("jszq"));
            object.put("charge_unit",map.get("jsdw"));
            object.put("syxb",map.get("syxb"));
            object.put("mxsy",map.get("mxsy"));
            object.put("zysy",map.get("zysy"));//住院使用
            object.put("tjsy",map.get("tjsy"));
            object.put("zxlb",map.get("zxlb"));//执行类别
            object.put("exec_unit",map.get("zxks"));//执行科室
            object.put("zxgzid",map.get("zxgzid"));//执行规则
            object.put("ywzx",map.get("ywzx"));
            object.put("zxap",map.get("zxap"));
            object.put("cpzx",map.get("cpzx"));
            object.put("szzx",map.get("szzx"));
            object.put("jjlx",map.get("jjlx"));
            object.put("ycxzsl",map.get("ycxzsl"));
            object.put("yblx",map.get("yblx"));
            object.put("zxbz",map.get("zxbz"));
            object.put("txid",map.get("txid"));
            object.put("bgbh",map.get("bgbh"));
            object.put("czsy",map.get("czsy"));
            object.put("lzsy",map.get("lzsy"));
            object.put("lccs",map.get("lccs"));
            object.put("bwbz",map.get("bwbz"));
            object.put("yblb",map.get("yblb"));
            array.add(object);
        }
        return array;
    }*/
    /**
     * 获取卡记录
     *  "PAT_NO": "P5616242-0  ",
     "CARD_NO": "D40136791",
     "CARD_STAT": "旧卡停用",
     "OP_DATE": "2011-09-27 15:35:57",
     "CARD_TYPE": "2",
     "CARD_TYPE_NAME": "社保卡",
     "social_no": "350211198411053024"
     * @param
     * @return
     * @throws Exception
     *//*
    public JSONArray findPatientCard(String patient)throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO!=null){
            //JSONArray res = ykyyEntranceService.findHisCard(patientDO.getIdcard(),demoFlag);
            JSONArray rs = new JSONArray();
            *//*if(res !=null){
                for (int i =0;i<res.size();i++){
                    JSONObject object = (JSONObject) res.get(i);
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("PAT_NO",object.get("pat_no"));
                    jsonObject.put("CARD_NO",object.get("card_no"));
                    jsonObject.put("OP_DATE",object.get("op_date"));
                    jsonObject.put("CARD_STAT",object.get("card_stat"));
                    jsonObject.put("CARD_TYPE",object.get("card_type"));
                    jsonObject.put("CARD_TYPE_NAME",object.get("card_type_name"));
                    rs.add(jsonObject);
                }
            }*//*
            List<PatientMedicareCardDO> list  = basePatientMedicareCardDao.findByPatientCode(patientDO.getId());
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patientDO.getId());
            if (list!=null&&list.size()>0){
                for (PatientMedicareCardDO patientMedicareCardDO :list){
                    JSONObject jsonObject = new JSONObject();
                    if (null!=patientMappingDO){
                        jsonObject.put("PAT_NO",patientMappingDO.getMappingCode());
                    }else {
                        JSONArray res = ykyyEntranceService.findPatientCodeByCardNo(patientMedicareCardDO.getCode(),false);
                        patientMappingDO = new PatientMappingDO();
                        if(res !=null&&res.size()>0){
                            JSONObject object = (JSONObject) res.get(0);
                            if (object.get("pat_no")!=null){
                                jsonObject.put("PAT_NO",object.get("pat_no").toString());
                            }
                            if (object.get("brid")!=null){
                                jsonObject.put("BRID",object.get("brid").toString());
                                patientMappingDO.setMappingCode(object.get("brid").toString());
                                patientMappingDO.setPatient(patient);
                                patientMappingDO.setPatientName(patientDO.getName());
                                patientMappingDO.setIdcard(patientDO.getIdcard());
                                patientMappingDO.setSource("1");
                                patientMappingDO.setCreateTime(new Date());
                                patientMappingDao.save(patientMappingDO);
                            }
                        }
                    }
                    jsonObject.put("CARD_NO",patientMedicareCardDO.getCode());
                    jsonObject.put("OP_DATE","");
                    jsonObject.put("CARD_STAT","正常");
                    jsonObject.put("CARD_TYPE","2");
                    jsonObject.put("CARD_TYPE_NAME","社保卡");
                    rs.add(jsonObject);
                }
                return rs;
            }
        }
        return null;
    }*/
    public JSONArray synYkICD10() throws Exception {
        JSONArray jsonArray = tnyyEntranceService.synYkICD10();
        return jsonArray;
    }
    /**
     *
     * 处方下单
     *
     * @return
     * @throws Exception
     */
    public Map<String,Object> savePrescriptionOrder(String code,Double price,String tradeType,String wechatId,String appletCode) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        Map<String,Object> map = new HashedMap();
        if(wxWechatDO==null){
            throw new Exception("can't find wechat:the wxId is "+wechatId);
        }
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(code);
        if (businessOrderDO!=null){
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            String openId = "";
            if (StringUtils.isNotBlank(appletCode)){
                logger.info("appletCode不为空"+appletCode);
                Map<String,Object> objectMap = checkApplets(appletCode,wxWechatDO.getApplets(),wxWechatDO.getAppletsSecret());
                if (objectMap!=null){
                    openId = objectMap.get("openid").toString();
                    logger.info("appletCode"+appletCode);
                    logger.info("openid"+openId);
                }
            }else {
                logger.info("appletCode为空"+appletCode);
                List<BasePatientWechatDo> patientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
                if (patientWechatDo!=null&&patientWechatDo.size()!=0){
                    openId = patientWechatDo.get(0).getOpenid();
                }
            }
            String url = wxWechatDO.getBaseUrl();
            String notifyUrl =url;
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";
            map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, tradeType,openId,businessOrderDO.getOrderNo(),notifyUrl,businessOrderDO.getPatient());
        }
        return map;
    }
    public Map<String, Object> checkApplets(String code,String appid,String appSecret) throws Exception {
        HttpUtils httpUtils = new HttpUtils();
        Map<String, Object> param = new HashedMap();
        param.put("appid", appid);
        param.put("secret", appSecret);
        param.put("js_code", code);
        param.put("grant_type", "authorization_code");
        HttpResponse response = httpUtils.doGet("https://api.weixin.qq.com/sns/jscode2session", param);
        org.json.JSONObject rs = new org.json.JSONObject(response.getContent());
        Map<String, Object> res = new HashedMap();
        logger.info("checkApplets:"+response.getContent());
        if (rs.has("openid")){
            res.put("openid", rs.getString("openid"));
            res.put("sessionKey", rs.getString("session_key"));
        }
        return res;
    }
    /**
     * 获取诊断
     *
     * @param pyKey
     * @return
     * @throws Exception
     */
    public JSONArray getICD10(String pyKey,boolean demoFlag) throws Exception {
        JSONArray array = tnyyEntranceService.findIcd10(pyKey,demoFlag);
        return array;
    }
}

+ 642 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java

@ -1,13 +1,48 @@
package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.hospital.dict.YkDictIcd10Dao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.signature.qual.IdentifierOrArray;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.yihu.jw.util.common.PwdUtil.randomString;
/**
 * Created by wangzhinan on 2020/12/24.
 */
@ -15,8 +50,615 @@ import java.util.Map;
@Transactional
public class TnyyEntranceService {
    private static Logger logger = LoggerFactory.getLogger(TnyyEntranceService.class);
    private final static String url="http://10.9.1.247:10023/ykyy/createSQLQuery";
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DictHospitalDeptDao hospitalDeptDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private YkDictIcd10Dao ykDictIcd10Dao;
    private final static String orgCode ="350211A5004";
    @Autowired
    private PatientMappingDao patientMappingDao;
    //同步科室
    public String updateTnyyDept() throws Exception {
        String sql = "select KSDM,KSMC,PYDM,PLSX,JGBM from GY_KSDM ";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("updateTnyyDept:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            JSONArray array = rs.getJSONArray("detailModelList");
            logger.info("dept size:"+array.size());
            for (int i=0;i<array.size();i++){
                JSONObject deptObj = array.getJSONObject(i);
                String ksdm = deptObj.getString("KSDM");
                String jgbm = deptObj.getString("JGBM");
                String ksmc = deptObj.getString("KSMC");
                List<DictHospitalDeptDO> list = hospitalDeptDao.findByOrgCodeAndCode(jgbm,ksdm);
                if (list!=null&&list.size()!=0){
                    DictHospitalDeptDO dictHospitalDeptDO = list.get(0);
                    dictHospitalDeptDO.setCode(ksdm);
                    dictHospitalDeptDO.setName(ksmc);
                    dictHospitalDeptDO.setOrgCode(jgbm);
                    hospitalDeptDao.save(dictHospitalDeptDO);
                }else {
                    //新增科室
                    DictHospitalDeptDO dictHospitalDeptDO = new DictHospitalDeptDO();
                    dictHospitalDeptDO.setCode(ksdm);
                    dictHospitalDeptDO.setName(ksmc);
                    dictHospitalDeptDO.setOrgCode(jgbm);
                    dictHospitalDeptDO.setCreateTime(new Date());
                    dictHospitalDeptDO.setConsultDeptFlag("1");
                    hospitalDeptDao.save(dictHospitalDeptDO);
                }
            }
        }
        return "success";
    }
    //更新泰安医生信息
    public String updateTnyyDoctor(String idCard)throws Exception{
        String sql ="select sfzh,LXDH,YGDM,KSDM,YGXM,YGXB,CSNY,YSJJ from GY_YGDM where ZFPB=1 and sfzh is not null ";
        if (StringUtils.isNoneBlank(idCard)){
            sql +=" and sfzh ='"+idCard+"' ";
        }
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            JSONArray array = rs.getJSONArray("detailModelList");
            logger.info("doctor size:"+array.size());
            if(array!=null&&array.size()>0) {
                for (int i = 0; i < array.size(); i++) {
                    JSONObject doctorJson = array.getJSONObject(i);
                    String idcard = doctorJson.getString("sfzh");
                    //过滤身份证脏数据
                    if(idcard.length()>=15){
                        List<BaseDoctorDO> doctorDOs = baseDoctorDao.findByIdcard(idcard);
                        if(doctorDOs!=null&&doctorDOs.size()>0){
                            BaseDoctorDO doctor = doctorDOs.get(0);
                            String salt = randomString(5);
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            /*doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
                            doctor.setJobTitleName(doctorJson.getString("jobTitleName"));*/
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);
                            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode(orgCode,doctorJson.getString("KSDM"),doctor.getId());
                            if(hospitalDOs!=null&&hospitalDOs.size()>0){
                                //机构信息部门信息
                                BaseDoctorHospitalDO hospitalDO = hospitalDOs.get(0);
                                hospitalDO.setDeptCode(doctorJson.getString("KSDM"));
                                hospitalDO.setDel("1");
                                baseDoctorHospitalDao.save(hospitalDO);
                            }
                        }else{
                            //新增医生
                            BaseDoctorDO doctor = new BaseDoctorDO();
                            doctor.setName(doctorJson.getString("YGXM"));
                            doctor.setIdcard(idcard);
                            doctor.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
                            doctor.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
                            doctor.setProvinceCode("350000");
                            doctor.setProvinceName("福建省");
                            doctor.setTownCode("350203");
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
                            //认证信息设置
                            String salt = randomString(5);
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            doctor.setDel("1");
                            doctor.setEnabled(1);
                            doctor.setLocked(0);
                            doctor.setCreateTime(new Date());
                    /*        doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
                            doctor.setJobTitleName(doctorJson.getString("jobTitleName"));*/
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);
                            //机构信息部门信息
                            BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
                            hospitalDO.setDoctorCode(temp.getId());
                            hospitalDO.setOrgCode(orgCode);
                            hospitalDO.setOrgName("泰安中医院");
                            hospitalDO.setDeptCode(doctorJson.getString("KSDM"));
                            hospitalDO.setDel("1");
                            baseDoctorHospitalDao.save(hospitalDO);
                            //保存角色
                            BaseDoctorRoleDO role = new BaseDoctorRoleDO();
                            role.setDoctorCode(temp.getId());
                            role.setRoleCode("specialist");
                            baseDoctorRoleDao.save(role);
                            //保存mapping
                            DoctorMappingDO mappingDO = new DoctorMappingDO();
                            mappingDO.setIdcard(idcard);
                            mappingDO.setDoctor(temp.getId());
                            mappingDO.setDoctorName(temp.getName());
                            mappingDO.setOrgCode(orgCode);
                            mappingDO.setOrgName("泰安中医院");
                            mappingDO.setMappingCode(doctorJson.getString("YGDM"));
                            mappingDO.setMappingName(temp.getName());
                            mappingDO.setCreateTime(new Date());
                            doctorMappingDao.save(mappingDO);
                        }
                    }
                }
            }
        }
        return "success";
    }
    public JSONArray selectPatientMappingCode(String idcard) throws Exception {
        String sql = "SELECT a.BRID,a.BRXM from MS_BRDA a WHERE a.SFZH = '"+idcard+"' ";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("selectPatientMappingCode:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        JSONArray array = new JSONArray();
        if(status!=null&&status == 200){
            array = rs.getJSONArray("detailModelList");
            logger.info("patient size:"+array.size());
        }
        return array;
    }
    /**
     * 查询药品信息
     * @param ypdm
     * @param ypmc
     * @param kusl
     * @return
     */
    public JSONArray findTnYpxx(String ypdm,String ypmc,String kusl,String pydm ,String hisCode) throws Exception {
        String sql ="SELECT yp.YPXH,yp.XTSB,yp.YPMC,yp.YPGG,yp.YFGG,yp.BFGG,yp.YPSX,yp.TSYP,yp.YPDW,yp.ZXDW,yp.ZXBZ,yp.YFBZ,yp.YFDW,yp.BFBZ," +
                "yp.BFDW,yp.ZFPB,yp.YLXZ,yp.FYFS,yp.PYDM,yp.YPBH,yp.MESS,yp.GYFF,yp.TYPE,yp.YPDM,yp.YPJL,yp.JLDW,yp.YKZF,yp.YFZF,yp.ZXCD,yp.YCYL," +
                "kc.YPCD,kc.LSJG,kc.KCSL  FROM  YK_TYPK yp,YK_KCMX kc where 1=1 and kc.YPXH=yp.YPXH ";
        if (StringUtils.isNoneBlank(ypdm)){
            sql+=" and lower(YPDM) like '%"+ypdm.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(ypmc)){
            sql+=" and lower(YPMC) like '%"+ypmc.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and lower(PYDM) like '%"+pydm.toLowerCase()+"%' ";
        }
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ypxx:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
       /* List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);*/
        return array;
    }
    /**
     * 获取频次
     * @return
     */
    public JSONArray findSypc(String pcbm) throws Exception {
        String sql = "select s.PCBM,s.PCMC,s.MRCS,s.MZCS,s.YFBM,s.JGRS  from GY_SYPC s where 1=1 ";
        if (StringUtils.isNoneBlank(pcbm)){
            sql+=" and lower(s.pcbm)='"+pcbm.toLowerCase()+"' ";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;*/
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sypc:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    /**
     * 获取用法
     * @return
     */
    public JSONArray findYpyf(String pydm) throws Exception {
        String sql = "select y.YPYF,y.PYDM,y.XMMC,y.XMLB,y.FYXH from ZY_YPYF y where 1=1  and y.PYDM is not null";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and lower(y.PYDM)='"+pydm.toLowerCase()+"' ";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;*/
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ypyf:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    /**
     * 获取icd10
     * @return
     * @throws Exception
     */
    public JSONArray synYkICD10() throws Exception {
        String sql = "select i.JBXH,i.JBMC,i.PYDM, from GY_JBBM i";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ICD10:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
            ykDictIcd10Dao.deleteAll();
            for (int i=0;i<array.size();i++){
                JSONObject object = array.getJSONObject(i);
                DictIcd10DO dictIcd10DO = new DictIcd10DO();
                dictIcd10DO.setCode(object.getString("JBXH"));
                dictIcd10DO.setName(object.getString("JBMC"));
                dictIcd10DO.setDescription(object.getString("PYDM"));
                ykDictIcd10Dao.save(dictIcd10DO);
            }
        }
        return array;
    }
    /**
     * 获取诊断
     * @param pyCode
     * @param demoFlag
     * @return
     * @throws Exception
     */
    public JSONArray findIcd10(String pyCode,boolean demoFlag) throws Exception {
        String sql = "select i.JBXH as code ,i.JBMC as name,i.PYDM as pydm from GY_JBBM i ";
        JSONArray array = new JSONArray();
        if (StringUtils.isNoneBlank(pyCode)){
            sql +="  where lower(i.PYDM) like '%"+pyCode.toLowerCase()+"%'";
        }
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ICD10:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    /**
     * HIS就诊患者历史查询
     * @throws Exception
     */
    public JSONArray findV_ZKSG_HZCX_HIS(String brid,String conNo,String startTime,String endTime,String ksdm) throws Exception{
        String sql = "SELECT h.JZXH,h.GHXH,h.BRBH,h.KSDM,h.YSDM,h.ZYZD,h.KSSJ,h.JSSJ,h.JZZT,h.FZRQ,h.GHFZ,ks.KSMC,yg.YGXM  from YS_MZ_JZLS h,GY_KSDM ks,GY_YGDM yg WHERE yg.YGDM=h.YSDM and ks.KSDM=h.KSDM and  h.BRBH = "+brid+" ";
        if(!StringUtil.isBlank(conNo)){
            sql += " and h.JZXH = " + conNo;
        }
        if(!StringUtil.isBlank(startTime)){
            sql += " and  h.KSSJ  >= '"+startTime+"' ";
        }
        if(!StringUtil.isBlank(endTime)){
            sql += " and h.KSSJ  <= '"+endTime+"' ";
        }if(!StringUtil.isBlank(ksdm)){
            sql += " and h.KSDM = " + ksdm;
        }
        sql += " order by h.KSSJ desc";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            return rs.getJSONArray("detailModelList");
        }
        return new JSONArray();
    }
    /**
     * 患者门诊就诊记录
     * 使用时间查询的话,很可能会超时。时间没有索引,所以超时时间需要加长
     *
     * @param PAT_NO    居民唯一号 一个居民在该医院只有一个号,该接口必须输入的参数
     * @param conNo     就诊次数,使用居民唯一号+就诊次数获取唯一一条就诊记录
     *                  // *  @param admNo 就诊唯一号 每一次就诊都有一个唯一号:居民号+就诊次数,查询确定的一条就诊记录时需要传,否则传null
     *                  // *  @param registerSn 挂号流水号,查询确定的一条就诊记录时需要传,否则传null
     * @param startTime 开始时间 (查询一段时间内就诊记录开始时间,查询就诊记录列表时需要传,否则传null)
     * @param endTime   结束时间 (查询一段时间内就诊记录结束时间,查询就诊记录列表时需要传,否则传null)
     * @return
     * @throws Exception
     */
    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag, String ksdm) throws Exception {
        String fid = "BS30025";
        logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
        String resp = "";
        String orgCode = "350211A5004";
        String orgName = "厦门大学附属厦门眼科中心";
        //居民id转化
        PatientMappingDO patientMappingDO = patientMappingDao.findByMappingCodeAndSource(PAT_NO,"1");
        if(patientMappingDO == null){
            return null;
        }
//KSSJ,h.BRID,h.BRXM,h.SJHM,h.JZKH,h.SFZH,h.BRXZ,h.YSDM,h.KDYS" +
//                ",h.KSDM,h.KSMC,h.ZDMC,h.JZXH
        JSONArray jsonArray = new JSONArray();
        jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime,ksdm);
        //查找眼科数据
        if (jsonArray.size() == 0) {
            return null;
        }
        List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>();
        for (int i = 0; i < jsonArray.size(); i++) {
            JSONObject jsonObjectMgsInfo = jsonArray.getJSONObject(i);
            if (null != jsonObjectMgsInfo) {
                WlyyOutpatientVO wlyyOutpatientVO = new WlyyOutpatientVO();
                wlyyOutpatientVO.setHospital(orgCode);
                wlyyOutpatientVO.setHospitalName(orgName);
                wlyyOutpatientVO.setWinNo("6");
                wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("JZXH") ? "" : jsonObjectMgsInfo.get("JZXH") + "");
                //wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + "");
                wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("KSDM") ? "" : jsonObjectMgsInfo.get("KSDM") + "");
                wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("KSMC") ? "" : jsonObjectMgsInfo.get("KSMC") + "");
                wlyyOutpatientVO.setPatient(patientMappingDO.getPatient());
                wlyyOutpatientVO.setPatientName(patientMappingDO.getPatientName());
                wlyyOutpatientVO.setConNo(null == jsonObjectMgsInfo.get("JZXH") ? "" : jsonObjectMgsInfo.get("JZXH") + "");
                String doctor = null == jsonObjectMgsInfo.get("YSDM") ? "" : jsonObjectMgsInfo.get("YSDM") + "";
                //转化医生
                String mappingCode = doctor.trim();
                String doctorCode = "";
                if (StringUtils.isNotBlank(mappingCode)) {
                    List<DoctorMappingDO> mappingDOs = doctorMappingDao.findByOrgCodeAndMappingCode(orgCode, mappingCode);
                    if (mappingDOs != null && mappingDOs.size() > 0) {
                        doctorCode = mappingDOs.get(0).getDoctor();
                    }
                }
                wlyyOutpatientVO.setDoctor(doctorCode);
                wlyyOutpatientVO.setDoctorName(null == jsonObjectMgsInfo.get("YGXM") ? "" : jsonObjectMgsInfo.get("YGXM") + "");
//                wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + "");
                String icdName = null == jsonObjectMgsInfo.get("ZYZD") ? "" : jsonObjectMgsInfo.get("ZYZD") + "";
//                wlyyOutpatientVO.setIcd10(icdcodes);
                wlyyOutpatientVO.setIcd10Name(icdName);
                String admDate = null == jsonObjectMgsInfo.get("KSSJ") ? "" : jsonObjectMgsInfo.get("KSSJ") + "";
                String conDate = null == jsonObjectMgsInfo.get("KSSJ") ? "" : jsonObjectMgsInfo.get("KSSJ") + "";
                wlyyOutpatientVO.setAdmDate(DateUtil.strToDate(admDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
                wlyyOutpatientVO.setConDate(DateUtil.strToDate(conDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
                List<WlyyInspectionVO> inspectionVOList = new ArrayList<>();
                /*JSONArray array = findV_ZKSG_JCCX(PAT_NO,wlyyOutpatientVO.getAdmNo(),demoFlag);
                for (int j=0;j<array.size();j++){
                    JSONObject object = array.getJSONObject(j);
                    String ksdm1 = object.getString("ksdm");//科室代码
                    String fymc = object.getString("fymc");//费用名称
                    String fydj = object.getString("fydj");//单价
                    String fysl = object.getString("fysl");//数量
                    String fyhj = object.getString("fyhj");//金额
                    String jzxh = object.getString("jzxh");//就诊序号
                    String zxks = object.getString("zxks");//执行科室
                    WlyyInspectionVO wlyyInspectionVO = new WlyyInspectionVO();
                    wlyyInspectionVO.setName(fymc);
                    wlyyInspectionVO.setDeptName(zxks);
                    wlyyInspectionVO.setDept(ksdm1);
                    wlyyInspectionVO.setQuantity(Integer.parseInt(fysl));
                    inspectionVOList.add(wlyyInspectionVO);
                }
                wlyyOutpatientVO.setInspectionVOS(inspectionVOList);*/
                wlyyOutpatientVOS.add(wlyyOutpatientVO);
            }
        }
        return wlyyOutpatientVOS;
    }
    /**
     * HIS处方记录
     * @throws Exception
     */
    public List<WlyyPrescriptionVO> findMS_CF01And02(String admNo, boolean demoFlag) throws Exception{
        List<WlyyPrescriptionVO> wlyyPrescriptionVOList = new ArrayList<>();
        //处方数据
        String msd01 = "SELECT d.CFLX,d.BRID,d.BRXM,d.FPHM,d.MZXH,d.JZKH,d.JZXH,d.CFSB,d.CFHM,d.KSDM  FROM MS_CF01 d WHERE d.JZXH = '"+admNo+"'";
        JSONObject rs = new JSONObject();
        String content="";
        Map<String,Object> params = new HashedMap();
        params.put("sql",msd01);
        HttpResponse response = HttpUtils.doGet(url,params);
        content = response.getContent();
        logger.info("response:"+content);
        rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            JSONArray array =rs.getJSONArray("detailModelList");
            logger.info("precription:"+rs.getJSONArray("detailModelList"));
            for (int j=0;j<array.size();j++){
                WlyyPrescriptionVO wlyyPrescriptionVO = new WlyyPrescriptionVO();
                JSONObject object = array.getJSONObject(j);
                wlyyPrescriptionVO.setType(object.getInteger("CFLX"));/*
                wlyyPrescriptionVO.setOrderNo(object.getString("scddh"));*//*
                wlyyPrescriptionVO.setPayStatus(object.getInteger("fkzt"));*/
                wlyyPrescriptionVO.setPatientName(object.getString("BRXM"));
                String brid = object.getString("BRID");
                if (StringUtils.isNoneBlank(brid)){
                    PatientMappingDO mappingDO = patientMappingDao.findByMappingCode(brid);
                    if (mappingDO!=null){
                        wlyyPrescriptionVO.setPatientCode(mappingDO.getPatient());
                    }
                }
                wlyyPrescriptionVO.setSsc(object.getString("JZKH"));/*
                wlyyPrescriptionVO.setOrderId(object.getString("guid"));*/
                wlyyPrescriptionVO.setAdmNo(object.getString("JZXH"));
                wlyyPrescriptionVO.setRealOrder(object.getString("CFSB"));
                wlyyPrescriptionVO.setDept(object.getString("KSDM"));
                wlyyPrescriptionVO.setOriginRealOrder(object.getString("CFHM"));
                String msd02 = "SELECT d.YPXH,d.YPCD,d.YPSL,d.YPDJ,d.YFDW,d.YFDW,d.MRCS,d.YFBZ,d.YPYF,d.YYTS,d.SBXH,d.YFGG  FROM V_MS_DD02 d WHERE d.CFSB = '"+wlyyPrescriptionVO.getRealOrder()+"'";
                JSONObject rs1 =new JSONObject();
                Map<String,Object> params1 = new HashedMap();
                params1.put("sql",msd02);
                HttpResponse response1 = HttpUtils.doGet(url,params1);
                String content1 = response1.getContent();
                logger.info("response:"+content);
                rs1 = JSON.parseObject(content1);
                Integer status1 = rs1.getInteger("status");
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
                if(status1!=null&&status1 == 200){
                    JSONArray array1 =  rs1.getJSONArray("detailModelList");
                    logger.info("info"+rs1.getJSONArray("detailModelList"));
                    for (int i =0;i<array1.size();i++){
                        JSONObject object1 = array1.getJSONObject(i);
                        WlyyPrescriptionInfoVO prescriptionInfoVO = new WlyyPrescriptionInfoVO();
                        String sql = "SELECT YPXH ,YPMC  from YK_TYPK WHERE YPXH='"+object1.getString("YPXH")+"' ";
                        JSONObject rs4 = new JSONObject();
                        Map<String,Object> params4 = new HashedMap();
                        params4.put("sql",sql);
                        HttpResponse response4 = HttpUtils.doGet(url,params4);
                        String content4 = response4.getContent();
                        logger.info("response:"+content4);
                        rs4 = JSON.parseObject(content4);
                        Integer status4 = rs4.getInteger("status");
                        if(status4!=null&&status4 == 200){
                            JSONArray array4 =  rs4.getJSONArray("detailModelList");
                            logger.info("info"+rs4.getJSONArray("detailModelList"));
                            if (array4!=null&&array4.size()!=0){
                                JSONObject jsonObject = array4.getJSONObject(0);
                                prescriptionInfoVO.setDrugName(jsonObject.getString("YPMC"));
                            }
                        }
                        prescriptionInfoVO.setDrugNo(object1.getString("YPXH"));
                        prescriptionInfoVO.setDrugPlace(object1.getString("YPCD"));
                        prescriptionInfoVO.setQuantity(object1.getString("YPSL"));
                        prescriptionInfoVO.setPackRetprice(object1.getDouble("YPDJ"));
                        prescriptionInfoVO.setPackUnitName(object1.getString("YFDW"));
                        prescriptionInfoVO.setUnitName(object1.getString("YFDW"));
                        prescriptionInfoVO.setDosage(object1.getString("MRCS"));
                        prescriptionInfoVO.setPackQuantity(object1.getInteger("YFBZ"));
                        prescriptionInfoVO.setUsageCode(object1.getString("YPYF"));
                        prescriptionInfoVO.setDays(object1.getString("YYTS"));
                     /*   prescriptionInfoVO.setYpyf(object1.getInteger("ypyf"));*/
                        prescriptionInfoVO.setHisCode(object1.getInteger("SBXH"));
                        prescriptionInfoVO.setSpecification(object1.getString("YFGG"));
                        wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
                    }
                }
                wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = new ArrayList<>();
                String mz = "SELECT ICD AS \"icd\",MSZD AS \"mszd\",JZXH AS \"jzxh\" FROM v_hlwys_mz_jbzd WHERE jzxh = '"+admNo+"'";
                JSONObject rs2 =new JSONObject();
                Map<String,Object> params2 = new HashedMap();
                params2.put("sql",mz);
                HttpResponse response2 = HttpUtils.doGet(url,params2);
                String content2 = response2.getContent();
                logger.info("response:"+content2);
                rs2 = JSON.parseObject(content2);
                Integer status2 = rs2.getInteger("status");
                if(status2!=null&&status2 == 200){
                    JSONArray array2 = rs2.getJSONArray("detailModelList");
                    for (int i=0;i<array2.size();i++){
                        JSONObject object2 = array2.getJSONObject(i);
                        WlyyPrescriptionDiagnosisVO diagnosisVO = new WlyyPrescriptionDiagnosisVO();
                        diagnosisVO.setCode(object2.getString("icd"));
                        diagnosisVO.setName(object2.getString("mszd"));
                        diagnosisVOS.add(diagnosisVO);
                    }
                }
                wlyyPrescriptionVO.setDiagnosisVOs(diagnosisVOS);
                wlyyPrescriptionVOList.add(wlyyPrescriptionVO);
            }
        }
        return wlyyPrescriptionVOList;
    }
    public List<Map<String,Object>> queryBySql(String sql){
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);

+ 5 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/useragent/BaseUserAgent.java

@ -32,7 +32,7 @@ public class BaseUserAgent {
            return json.getString("uid");
        } catch (Exception e) {
            return null;
            return e.getMessage();
        }
    }
@ -52,7 +52,7 @@ public class BaseUserAgent {
            String uname = java.net.URLDecoder.decode(info,"UTF-8");
            return uname;
        } catch (Exception e) {
            return null;
            return e.getMessage();
        }
    }
@ -72,7 +72,7 @@ public class BaseUserAgent {
            return json.getString("roleid");
        } catch (Exception e) {
            return null;
            return e.getMessage();
        }
    }
@ -83,8 +83,9 @@ public class BaseUserAgent {
            JSONObject user = JSON.parseObject(userAgent);
            return user;
        }catch (Exception e){
            return null;
            e.printStackTrace();
        }
        return null;
    }
}

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

+ 129 - 10
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.*;
@ -25,18 +24,20 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.CheckSumBuilder;
import com.yihu.jw.utils.RSAEncrypt;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.dao.WxTemplateDao;
import com.yihu.jw.wechat.dao.*;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -94,11 +95,15 @@ public class WxTemplateService {
    @Autowired
    private ConsultTeamOrderDao consultTeamOrderDao;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private WechatDao wechatDao;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private OutpatientDao outpatientDao;
    
@ -140,8 +145,33 @@ public class WxTemplateService {
                                "",miniprogramUrl,"wx53f6bb4ac081d840");
                    }else{
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_consult_notice","spthtx",1);
                        config.setFirst(config.getFirst().replace("key1",sender_name));
                        config.setPagepath(config.getPagepath()+""+reciver_id+"&doctorName="+sender_name+"&role=patient&roomID="+session_id+"&template=1v1&debugMode=false&cloudenv=PRO");
                        BaseDoctorDO doctorDO = doctorDao.findById(sender_id);
                        String titleName = "";
                        if (doctorDO!=null){
                            titleName = doctorDO.getJobTitleName();
                        }
                        String miniprogramUrl = "";
                        config.setFirst(config.getFirst().replace("key1",sender_name+titleName));
                        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                            String token = yxToken(reciver_id,reciver_name);
                            miniprogramUrl = "pages/room/yunxin?role=patient&token="+token+"&uid="+basePatientDO.getId();
                            config.setPagepath(miniprogramUrl);
                        }
                        ConsultTeamDo consultDo = consultTeamOrderDao.findByConsult(session_id);
                        WlyyOutpatientDO wlyyOutpatientDO = new WlyyOutpatientDO();
                        if (consultDo!=null){
                            wlyyOutpatientDO = outpatientDao.findById(consultDo.getRelationCode());
                        }
                        if (wlyyOutpatientDO!=null){
                            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(doctorDO.getName());
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                    }
                }
@ -155,6 +185,55 @@ public class WxTemplateService {
        return "success";
    }
    public String yxToken(String userId,String channelName){
        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/getToken.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("uid", userId));
        nvps.add(new BasicNameValuePair("channelName",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")){
                return jsonObject.getString("token");
            }
        }
        return null;
    }
    /**
     * 获取指定长度的随机数字字符串
     * @param length
     * @return
     */
    public String randomInt(int length) {
        String str = "0123456789";
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for(int i = 0; i < length; ++i) {
            int pos = random.nextInt(str.length());
            buffer.append(str.charAt(pos));
        }
        return buffer.toString();
    }
    /**
     * 查询HIS的01表中的审方状态,如果已审方,且未结算,则推送一条模板消息给居民,让居民进行支付结算。
     */
@ -436,4 +515,44 @@ public class WxTemplateService {
        }
        return "success";
    }
    /**
     * 发送微信模版消息
     * @param userName
     * @param senderName
     * @param idCard
     * @param phone
     * @param title
     * @param content
     * @param contentString
     * @param url
     */
    public String sendAppletWxTemple(String userName, String senderName,
                               String idCard, String phone, String title,
                               String content, String contentString,
                               String url,String pagePath) throws Exception{
        BasePatientDO basePatientDO = basePatientDao.findByIdcard(idCard);
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(basePatientDO!=null){
            List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,basePatientDO.getId());
            if(ps.isEmpty()){
                logger.info("该用户"+basePatientDO.getName()+"没有openid,无法推送模版消息,用户ID:"+basePatientDO.getId()+"wechatId:"+wechatId);
            }else{
                for (BasePatientWechatDo basePatientWechatDo:ps){
                    WxTemplateConfigDO config = new WxTemplateConfigDO();
                    config.setFirst(config.getFirst().replace("key1",userName));
                    config.setKeyword1(contentString);
                    config.setKeyword2(DateUtil.dateToStrLong(new Date()));
                    config.setUrl(url);
                    config.setAppid(wxWechatDO.getApplets());
                    config.setPagepath(pagePath);
                    weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                }
            }
        }else{
            throw new Exception("接收者ID错误,无法找到该账号");
        }
        return "success";
    }
}

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

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/DoctorRegistration.java

@ -4,6 +4,7 @@ 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;
@ -12,6 +13,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_doctor_registration")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_doctor_registration")
public class DoctorRegistration extends IdEntity {
    //登记服务一级模板编码
    private String code;

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/DoctorRegistrationTemp.java

@ -4,6 +4,7 @@ package com.yihu.jw.entity.door;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
@ -12,6 +13,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_doctor_registration_temp")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_doctor_registration_temp")
public class DoctorRegistrationTemp extends IdEntity {
    //二级模板标识
    private String code;

+ 2 - 4
common/common-entity/src/main/java/com/yihu/jw/entity/door/SignFamily.java

@ -3,10 +3,7 @@ package com.yihu.jw.entity.door;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.*;
import java.util.Date;
/**
@ -16,6 +13,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_sign_family")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_sign_family")
public class SignFamily extends IdEntity {
    private static final long serialVersionUID = 364799142991631092L;

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorCommentDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.IntegerIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.math.BigDecimal;
@ -17,6 +18,7 @@ import java.math.BigDecimal;
*/
@Entity
@Table(name = "wlyy_door_comment")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_comment")
public class WlyyDoorCommentDO extends IntegerIdentityEntityWithOperator {
    /**

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorCommentDoctorDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.IntegerIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.math.BigDecimal;
@ -17,6 +18,7 @@ import java.math.BigDecimal;
*/
@Entity
@Table(name = "wlyy_door_comment_doctor")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_comment_doctor")
public class WlyyDoorCommentDoctorDO extends IntegerIdentityEntityWithOperator {
    /**

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorOrderItemDO.java

@ -4,6 +4,7 @@ package com.yihu.jw.entity.door;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
@ -13,6 +14,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_door_order_item")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_order_item")
public class WlyyDoorOrderItemDO extends IdEntity {
    private String doctor;

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorPrescriptionDO.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
@ -18,6 +19,7 @@ import java.util.List;
 */
@Entity
@Table(name = "wlyy_door_prescription")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_prescription")
public class WlyyDoorPrescriptionDO extends IntegerIdentityEntity {
    private String code ;//业务标识

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorPrescriptionDetailDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@ -15,6 +16,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_door_prescription_detail")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_prescription_detail")
public class WlyyDoorPrescriptionDetailDO extends IntegerIdentityEntity {
    private String code;

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorPrescriptionDrugDO.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@ -16,6 +17,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_door_prescription_drug")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_prescription_drug")
public class WlyyDoorPrescriptionDrugDO extends IntegerIdentityEntity {
    private String code;                    //业务主键
    private String prescriptionCode;      //处方code 关联表wlyy_door_prescription code

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorProcessLogDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
@ -17,6 +18,7 @@ import java.util.Date;
*/
@Entity
@Table(name = "wlyy_door_process_log")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_process_log")
public class WlyyDoorProcessLogDO extends UuidIdentityEntity {
    /**

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceApplicationDo.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.BaseIdentityEntity;
import org.springframework.data.annotation.LastModifiedBy;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
@ -16,6 +17,7 @@ import java.util.List;
 */
@Entity
@Table(name = "wlyy_door_service_application")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_service_application")
public class WlyyDoorServiceApplicationDo extends BaseIdentityEntity {
    /**居民code*/
    private String patient;

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceConfigureDo.java

@ -4,6 +4,7 @@ package com.yihu.jw.entity.door;
import com.yihu.jw.entity.BaseIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
@ -11,6 +12,7 @@ import javax.persistence.Table;
 */
@Entity
@Table(name = "wlyy_door_service_configure")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_service_configure")
public class WlyyDoorServiceConfigureDo extends BaseIdentityEntity {
    /**内容类型:1上门服务资质限制*/
    private String contentType;

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceVoucherDo.java

@ -4,6 +4,7 @@ package com.yihu.jw.entity.door;
import com.yihu.jw.entity.BaseIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
@ -12,6 +13,7 @@ import javax.persistence.Table;
 */
@Entity
@Table(name = "wlyy_door_service_voucher")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_door_service_voucher")
public class WlyyDoorServiceVoucherDo extends BaseIdentityEntity {
    /**上门服务申请审核id*/
    private Long serviceId;

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyFeldsherCADO.java

@ -4,6 +4,7 @@ package com.yihu.jw.entity.door;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.util.Date;
@ -12,6 +13,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_feldsher_ca")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_feldsher_ca")
public class WlyyFeldsherCADO extends IdEntity {
    private String recipeNo;//医嘱号
    private String patient;//居民code

+ 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";
        /**
         * 查询所有机构

+ 1 - 1
gateway/ag-basic/pom.xml

@ -12,7 +12,7 @@
    <artifactId>ag-basic</artifactId>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <packaging>jar</packaging>
    <dependencies>
        <!-- 支持Tomcat启动 -->

+ 14 - 1
gateway/ag-basic/src/main/resources/application.yml

@ -211,4 +211,17 @@ spring:
    password: jkzlehr
  redis:
    host: 172.26.0.190 # Redis server host.
    port: 6379 # Redis server port.
    port: 6379 # Redis server port.
---
spring:
  profiles: tnJwprod
  datasource:
     url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
     username: wlyy
     password: qY#j2n5O
  redis:
     host: 10.9.1.247 # Redis server host.
     port: 6380  # Redis server port.
     password: Kb6wKDQP1W4

+ 9 - 0
gateway/ag-basic/src/main/resources/bootstrap.yml

@ -112,3 +112,12 @@ spring:
    config:
      uri: ${wlyy-spring.config.uri:http://172.26.0.194:1221}
      label: ${wlyy-spring.config.label:jwdev}
---
spring:
  profiles: tnJwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}

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) {

+ 157 - 99
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);
        }
    }
    /**
@ -1500,11 +1546,11 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            throw new InvalidRequestException("client_id is null");
        }
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
       /* if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
            //验证码正确
        } else {
            return ObjEnvelop.getError("验证码错误!");
        }
        }*/
        if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            try {
                List<BasePatientDO> basePatientDOS =basePatientDao.findByMobileAndDel(mobile,"1");
@ -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)){

+ 30 - 1
server/svr-authentication/src/main/resources/application.yml

@ -345,4 +345,33 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: tnJwprod
  datasource:
    url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: wlyy
    password: qY#j2n5O
  redis:
    host: 10.9.1.247 # Redis server host.
    port: 6380 # Redis server port.
    password: Kb6wKDQP1W4
  ##发现服务
iHealth:
  user-info-uri: http://www.xmtyw.cn/wlyy/iHealth/userInfo
zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://10.9.1.247:22122
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段

+ 10 - 1
server/svr-authentication/src/main/resources/bootstrap.yml

@ -113,4 +113,13 @@ spring:
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.194:1221}
      label: ${wlyy.spring.config.label:jwdev}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: tnJwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}

+ 15 - 1
server/svr-configuration/src/main/resources/bootstrap.yml

@ -164,4 +164,18 @@ spring:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.1.220:10080/Amoy2/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:jwdev}
        default-label: ${wlyy.spring.config.git.label:jwdev}
---
spring:
  profiles: tnJwprod
##git配置
  cloud:
    config:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://127.0.0.1:3001/jkzl/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:master}

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

+ 46 - 0
svr/svr-base/src/main/resources/application.yml

@ -540,3 +540,49 @@ wechat:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: tnJwprod
  datasource:
    url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: qY#j2n5O
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 192.0.33.26:9200 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://10.9.1.247:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://10.9.1.247:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 10.9.1.247 # Redis server host.
    port: 6380 # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: http://10.9.1.247:8888/
demo:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://10.9.1.247:3000/
---

+ 8 - 0
svr/svr-base/src/main/resources/bootstrap.yml

@ -94,3 +94,11 @@ spring:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.194:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: tnJwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}

+ 16 - 13
svr/svr-door-serivce/pom.xml

@ -10,10 +10,10 @@
        <relativePath>../../wlyy-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.door</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-door-service</artifactId>
    <packaging>jar</packaging>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <dependencies>
        <!-- 支持Tomcat启动 -->
@ -54,14 +54,6 @@
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-sleuth-zipkin</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
@ -127,6 +119,17 @@
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <!-- <scope>runtime</scope> -->
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
@ -158,10 +161,10 @@
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                </configuration>
            </plugin>
        </plugins>

File diff suppressed because it is too large
+ 724 - 0
svr/svr-door-serivce/sql/初始sql.sql


+ 57 - 57
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/config/jpa/DoorServiceJpa.java

@ -1,57 +1,57 @@
package com.yihu.jw.door.config.jpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
/**
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "doorServiceEntityManagerFactory",
        transactionManagerRef = "doorServiceTransactionManager",
        basePackages = {"com.yihu.jw.*"})   //设置Repository所在位置
public class DoorServiceJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
    @Bean(name = "doorServiceEntityManagerFactory")
    @Primary
    public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(DataSource dataSource) {
        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
        emfb.setDataSource(dataSource);
        emfb.setPackagesToScan("com.yihu.jw.*");
        emfb.setPersistenceUnitName("door");
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
//        Properties properties = hibernateProperties.hibProperties();
//        properties.put("hibernate.ejb.naming_strategy","org.hibernate.cfg.ImprovedNamingStrategy");
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        return emfb;
    }
    @Bean(name = "doorServiceTransactionManager")
    @Primary
    JpaTransactionManager transactionManagerSecondary(
            @Qualifier("doorServiceEntityManagerFactory") EntityManagerFactory builder) {
        return new JpaTransactionManager(builder);
    }
}
//package com.yihu.jw.door.config.jpa;
//
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
//import org.springframework.orm.jpa.JpaTransactionManager;
//import org.springframework.orm.jpa.JpaVendorAdapter;
//import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
//import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
//import org.springframework.transaction.annotation.EnableTransactionManagement;
//
//import javax.persistence.EntityManagerFactory;
//import javax.sql.DataSource;
//
///**
// * Created by chenweida on 2017/4/6.
// */
//@Configuration
//@EnableTransactionManagement
//@EnableJpaRepositories(
//        entityManagerFactoryRef = "doorServiceEntityManagerFactory",
//        transactionManagerRef = "doorServiceTransactionManager",
//        basePackages = {"com.yihu.jw.*"})   //设置Repository所在位置
//public class DoorServiceJpa {
//
//    @Autowired
//    private HibernateProperties hibernateProperties;
//
//    @Bean(name = "doorServiceEntityManagerFactory")
//    @Primary
//    public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(DataSource dataSource) {
//
//        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
//        emfb.setDataSource(dataSource);
//        emfb.setPackagesToScan("com.yihu.jw.*");
//        emfb.setPersistenceUnitName("door");
//        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
//        emfb.setJpaVendorAdapter(vendorAdapter);
////        Properties properties = hibernateProperties.hibProperties();
////        properties.put("hibernate.ejb.naming_strategy","org.hibernate.cfg.ImprovedNamingStrategy");
//        emfb.setJpaProperties(hibernateProperties.hibProperties());
//
//        return emfb;
//    }
//
//
//    @Bean(name = "doorServiceTransactionManager")
//    @Primary
//    JpaTransactionManager transactionManagerSecondary(
//            @Qualifier("doorServiceEntityManagerFactory") EntityManagerFactory builder) {
//        return new JpaTransactionManager(builder);
//    }
//}

+ 35 - 35
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/config/jpa/HibernateProperties.java

@ -1,35 +1,35 @@
package com.yihu.jw.door.config.jpa;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.Properties;
/**
 * Created by chenweida on 2017/4/6.
 */
@Component
@RefreshScope
public class HibernateProperties {
    @Value("${hibernate.dialect}")
    private String dialect;
    @Value("${hibernate.show_sql}")
    private String show_sql;
    @Value("${hibernate.ejb.naming_strategy}")
    private String naming_strategy;
    @Value("${hibernate.physical_naming_strategy}")
    private String physical_naming_strategy;
    @Value("${hibernate.implicit_naming_strategy}")
    private String implicit_naming_strategy;
    public  Properties hibProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.dialect",dialect);
        properties.put("hibernate.show_sql", show_sql);
//        properties.put("hibernate.ejb.naming_strategy", naming_strategy);
        properties.put("hibernate.physical_naming_strategy",physical_naming_strategy);
        properties.put("hibernate.implicit_naming_strategy",implicit_naming_strategy);
        return properties;
    }
}
//package com.yihu.jw.door.config.jpa;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.cloud.context.config.annotation.RefreshScope;
//import org.springframework.stereotype.Component;
//
//import java.util.Properties;
//
///**
// * Created by chenweida on 2017/4/6.
// */
//@Component
//@RefreshScope
//public class HibernateProperties {
//    @Value("${hibernate.dialect}")
//    private String dialect;
//    @Value("${hibernate.show_sql}")
//    private String show_sql;
//    @Value("${hibernate.ejb.naming_strategy}")
//    private String naming_strategy;
//    @Value("${hibernate.physical_naming_strategy}")
//    private String physical_naming_strategy;
//    @Value("${hibernate.implicit_naming_strategy}")
//    private String implicit_naming_strategy;
//
//    public  Properties hibProperties() {
//        Properties properties = new Properties();
//        properties.put("hibernate.dialect",dialect);
//        properties.put("hibernate.show_sql", show_sql);
////        properties.put("hibernate.ejb.naming_strategy", naming_strategy);
//        properties.put("hibernate.physical_naming_strategy",physical_naming_strategy);
//        properties.put("hibernate.implicit_naming_strategy",implicit_naming_strategy);
//        return properties;
//    }
//}

+ 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,"查询失败");
        }
    }
}

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

@ -0,0 +1,147 @@
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;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;
/**
 * Created by yeshijie on 2020/12/30.
 */
@RestController
@RequestMapping(value = "/doctor", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-基础信息")
public class DoctorController extends BaseController {
    @Autowired
    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, "查询失败");
        }
    }
    /**
     * 医生基本信息查询接口
     *
     * @return
     */
    @ApiOperation("医生基本信息查询接口")
    @GetMapping(value = "baseinfo")
    public String baseinfo(
            @RequestParam(required = false) String code) {
        try {
            if (StringUtils.isEmpty(code)) {
                code = getUID();
            }
            BaseDoctorDO temp = doctorDao.findById(code);
//            Integer leader = doctorAdminTeamDao.findLeader(code);
//            Hospital hospital = hospitalDao.findByCode(temp.getHospital());
            if (temp != null) {
                JSONObject json = new JSONObject();
                // 设置区县code
//                json.put("town", temp.getTown());
                // 设置医生手机号码
                json.put("mobile", temp.getMobile());
                // 设置医生标识
                json.put("code", temp.getId());
                // 设置医生姓名
                json.put("name", temp.getName());
                // 设置医生头像
                json.put("photo", temp.getPhoto());
                // 设置医生性别
                json.put("sex", temp.getSex());
                // 设置省名称
                json.put("provinceName", temp.getProvinceName());
                // 设置城市名称
                json.put("cityName", temp.getCityName());
                // 设置医院名称
//                json.put("hospitalName", temp.getHospitalName());
                // 设置医院
//                json.put("hospital", temp.getHospital());
                // 设置医院等级1.三甲,2.二甲,3.1级以下
//                json.put("hosLevel", hospital.getHosLevel());
                // 设置部门名称
//                json.put("deptName", StringUtils.isNotEmpty(temp.getDeptName()) ? temp.getDeptName() : "");
                // 设置职称code
                json.put("jobCode", StringUtils.isNotEmpty(temp.getJobTitleCode()) ? temp.getJobTitleCode() : "");
                // 设置职称
                json.put("jobName", StringUtils.isNotEmpty(temp.getJobTitleName()) ? temp.getJobTitleName() : "");
                // 设置医生专长
                json.put("expertise", StringUtils.isNotEmpty(temp.getExpertise()) ? temp.getExpertise() : "");
                // 设置医生简介
                json.put("introduce", StringUtils.isNotEmpty(temp.getIntroduce()) ? temp.getIntroduce() : "");
                // 二维码地址
                json.put("qrcode", temp.getQrcode());
                // 咨询统计
//                Map<String, Long> consultCount = consultTeamService.getAllCount(code);
                // 咨询总数
//                json.put("consultAmount", consultCount.get("all"));
//                // 当天咨询数
//                json.put("consultAmountToday", consultCount.get("today"));
                //身份类型
                json.put("level", "1");
                //身份证号
                json.put("idcard", temp.getIdcard());
                //是否认证
                json.put("isCertified", temp.getIscertified());
                //是否名医
                json.put("isFamous", temp.getIsFamous());
                //是否医生提示 提示过是1 其他都是0
                json.put("isPasswordPrompt", StringUtils.isEmpty(temp.getIsPasswordPrompt()) ? "0" : temp.getIsPasswordPrompt());
                //获取医生角色和区域权限
//                List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(temp.getCode());
//                json.put("userRole", roleMap);
                //获取医生后台管理员系统角色,用于判断是否是居民上门服务业务中的调度员
//                json.put("doctorRole",roleService.findManageUserRole(temp.getCode()));
//                是否团队长
//                json.put("isLeader", leader == null ? "0" : "1");
//                团队长所管辖的团队code 一个团队长只管辖一个团队
//                json.put("adminTeamCode", leader);
                return write(200, "医生信息查询成功!", "data", json);
            } else {
                return error(-1, "医生信息查询失败!");
            }
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -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,

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

@ -0,0 +1,112 @@
package com.yihu.jw.door.controller.patient;
import com.alibaba.fastjson.JSONObject;
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 com.yihu.jw.im.util.ImUtil;
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.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
/**
 * Created by yeshijie on 2020/12/29.
 */
@RestController
@RequestMapping(value = "/patient/consult", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "患者端-患者咨询")
public class ConsultController extends BaseController {
    private static final Logger logger = LoggerFactory.getLogger(ConsultController.class);
    @Autowired
    private ConsultTeamService consultTeamService;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
    private ImUtil imUtil;
    @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"));
    }
    /**
     * 网络咨询咨询日志查询
     *
     * @param consult  咨询标识
     * @param pagesize 每页显示数,默认为10
     * @return
     */
    @GetMapping(value = "loglist")
    @ApiOperation("网络咨询咨询日志查询")
    public String loglist(@RequestParam String consult, @RequestParam int page, @RequestParam int pagesize) {
        try {
            ConsultTeamDo consultModel = consultTeamDao.findByConsult(consult);
            if (consultModel == null) {
                return error(-1, "咨询记录不存在!");
            }
            JSONObject messageObj = imUtil.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getRepUID());
            return write(200, "查询成功", "list", messageObj);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "查询失败!");
        }
    }
    @GetMapping(value = "getTopic")
    public String getTopic(String consult){
        try{
            return success(imUtil.getTopic(consult).get("data").toString());
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    @GetMapping(value = "getConsult")
    public String getConsult(String consult){
        try{
            ConsultTeamDo consultTeam = consultTeamDao.findByConsult(consult);
            return write(200, "查询成功", "data", consultTeam);
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    @GetMapping(value = "queryByRelationCode")
    @ApiOperation("根据关联业务code查询咨询记录")
    public String queryByRelationCode(@ApiParam(name = "code", value = "咨询关联业务code") @RequestParam(value = "code", required = true) String code){
        try{
            ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(code);
            return write(200, "提交成功", "data", consultTeam);
        }catch (Exception e){
            error(e);
            return error(-1,"添加失败");
        }
    }
}

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

@ -10,14 +10,21 @@ 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;
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.RestController;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2020/12/28.
 */
@ -34,19 +41,87 @@ public class PatientController extends BaseController {
    private BaseOrgDao baseOrgDao;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @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}"));
    }
    /**
     * 患者基本信息查询接口
     *
     * @return
     */
    @RequestMapping(value = "baseinfo")
    @GetMapping(value = "baseinfo")
    @ApiOperation("患者基本信息查询接口")
    public String baseinfo() {
        try {
            BasePatientDO temp = patientDao.findById(getUID());
            SignFamily jiating = signFamilyDao.findByPatientAndType(getUID(), 2);
            SignFamily jiating;
            synchronized (temp.getId().intern()){
                jiating = signFamilyDao.findByPatientAndType(getUID(), 2);
                if(jiating == null){
                    //泰安业务,如果没有签约,默认签约一个医生
                    jiating = new SignFamily();
                    jiating.setStatus(1);
                    jiating.setCzrq(new Date());
                    jiating.setCode(getUID());
                    String sql = "SELECT" +
                            "        d.id," +
                            "                d.name," +
                            "                dh.org_code," +
                            "                dh.org_name" +
                            "        FROM" +
                            "        base_doctor d" +
                            "        LEFT JOIN base_doctor_hospital dh ON dh.doctor_code = d.id" +
                            "        WHERE" +
                            "        d.enabled = 1" +
                            "        AND dh.org_code = '350211A1002'" +
                            "        AND d.del = 1 limit 1";
                    List<Map<String,Object>> list =  jdbcTemplate.queryForList(sql);
                    jiating.setDoctor(list.get(0).get("id").toString());
                    jiating.setDoctorName(list.get(0).get("name").toString());
                    jiating.setExpensesStatus("1");
                    jiating.setHospital(list.get(0).get("org_code").toString());
                    jiating.setHospitalName(list.get(0).get("org_name").toString());
                    jiating.setSignYear("2020");
                    jiating.setIdcard(temp.getIdcard());
                    jiating.setMobile(temp.getMobile());
                    jiating.setPatient(temp.getId());
                    jiating.setName(temp.getName());
                    jiating.setType(2);
                    signFamilyDao.save(jiating);
                }
            }
            JSONObject json = new JSONObject();
            int prescription = 0;
            int sign = 0;

+ 1 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorCommentController.java

@ -30,7 +30,7 @@ import java.util.List;
*/
@RestController
@RequestMapping(value = "/wlyyDoorComment")
@Api(value = "服务工单评价管理", description = "服务工单评价管理服务接口") //, tags = {"健康商城-服务工单评价管理服务接口"}
@Api(value = "服务工单评价管理", description = "服务工单评价管理服务接口")
public class WlyyDoorCommentController extends EnvelopRestEndpoint {
    @Autowired

+ 1 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorCommentDoctorController.java

@ -30,7 +30,7 @@ import java.util.List;
*/
@RestController
@RequestMapping(value = "/wlyyDoorCommentDoctor")
@Api(value = "服务工单中的医生评价管理", description = "服务工单中的医生评价管理服务接口") //, tags = {"健康商城-服务工单中的医生评价管理服务接口"}
@Api(value = "服务工单中的医生评价管理", description = "服务工单中的医生评价管理服务接口")
public class WlyyDoorCommentDoctorController extends EnvelopRestEndpoint {
    @Autowired

+ 1 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorConclusionController.java

@ -30,7 +30,7 @@ import java.util.List;
*/
@RestController
@RequestMapping(value = "/wlyyDoorConclusion")
@Api(value = "工单服务小结管理", description = "工单服务小结管理服务接口") //, tags = {"健康商城-工单服务小结管理服务接口"}
@Api(value = "工单服务小结管理", description = "工单服务小结管理服务接口")
public class WlyyDoorConclusionController extends EnvelopRestEndpoint {
    @Autowired

+ 1 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorDoctorController.java

@ -30,7 +30,7 @@ import java.util.List;
*/
@RestController
@RequestMapping(value = "/wlyyDoorDoctor")
@Api(value = "服务工单关联的医护人员管理", description = "服务工单关联的医护人员管理服务接口") //, tags = {"健康商城-服务工单关联的医护人员管理服务接口"}
@Api(value = "服务工单关联的医护人员管理", description = "服务工单关联的医护人员管理服务接口")
public class WlyyDoorDoctorController extends EnvelopRestEndpoint {
    @Autowired

+ 1 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorDoctorFeeController.java

@ -30,7 +30,7 @@ import java.util.List;
*/
@RestController
@RequestMapping(value = "/wlyyDoorDoctorFee")
@Api(value = "医生出诊费用字典管理", description = "医生出诊费用字典管理服务接口") //, tags = {"健康商城-医生出诊费用字典管理服务接口"}
@Api(value = "医生出诊费用字典管理", description = "医生出诊费用字典管理服务接口")
public class WlyyDoorDoctorFeeController extends EnvelopRestEndpoint {
    @Autowired

+ 1 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorFeeDetailController.java

@ -30,7 +30,7 @@ import java.util.List;
*/
@RestController
@RequestMapping(value = "/wlyyDoorFeeDetail")
@Api(value = "服务工单价格明细(服务项价格,医生出诊费用)管理", description = "服务工单价格明细(服务项价格,医生出诊费用)管理服务接口") //, tags = {"健康商城-服务工单价格明细(服务项价格,医生出诊费用)管理服务接口"}
@Api(value = "服务工单价格明细(服务项价格,医生出诊费用)管理", description = "服务工单价格明细(服务项价格,医生出诊费用)管理服务接口")
public class WlyyDoorFeeDetailController extends EnvelopRestEndpoint {
    @Autowired

+ 1 - 1
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorPatientConfirmLogController.java

@ -30,7 +30,7 @@ import java.util.List;
*/
@RestController
@RequestMapping(value = "/wlyyDoorPatientConfirmLog")
@Api(value = "服务工单居民确认操作日志记录管理", description = "服务工单居民确认操作日志记录管理服务接口") //, tags = {"健康商城-服务工单居民确认操作日志记录管理服务接口"}
@Api(value = "服务工单居民确认操作日志记录管理", description = "服务工单居民确认操作日志记录管理服务接口")
public class WlyyDoorPatientConfirmLogController extends EnvelopRestEndpoint {
    @Autowired

+ 6 - 15
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/patient/WlyyDoorServiceOrderController.java

@ -12,8 +12,8 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
@ -33,7 +33,7 @@ import java.util.Map;
 */
@RestController
@RequestMapping(value = "/patient/wlyyDoorServiceOrder")
@Api(value = "上门服务工单管理", description = "上门服务工单管理服务接口") //, tags = {"健康商城-上门服务工单管理服务接口"}
@Api(value = "上门服务工单管理", description = "上门服务工单管理服务接口")
public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
    @Autowired
@ -45,13 +45,6 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
    private WlyyDoorPrescriptionService doorPrescriptionService;
    @Value("${wechat.appId}")
    private String appId;
    @Value("${wechat.appSecret}")
    private String appSecret;
    @Value("${wechat.accId}")
    private String accId;
    @PostMapping(value = "qucikSendIM")
    @ApiOperation(value = "通过IM向客户端推送消息")
    public Envelop qucikSendIM(
@ -62,7 +55,6 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
            @ApiParam(name = "content", value = "消息内容json", required = true) @RequestParam String content
    ) {
        int result = wlyyDoorServiceOrderService.qucikSendIM(orderId, sendId, sendName, contentType, content);
        if (result == -1) {
            return failed("发送失败!");
@ -170,12 +162,12 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
    @ApiOperation(value = "生成二维码接口")
    public Envelop twoDimensionalCode(
            @ApiParam(name = "id", value = "工单id") @RequestParam(value = "id", required = true) String id) {
/*        if (wlyyDoorServiceOrderService.twoDimensionalCode(id, weiXinAccessTokenUtils.getAccessToken()) != null){
            return success("获取二维码成功",200,wlyyDoorServiceOrderService.twoDimensionalCode(id, weiXinAccessTokenUtils.getAccessToken()));
        String url = wlyyDoorServiceOrderService.twoDimensionalCode(id);
       if (StringUtils.isNotEmpty(url)){
            return success("获取二维码成功",200,url);
        }else {
            return failed("获取二维码失败,请确认工单",-1);
        }*/
        return null;
        }
    }
    @PostMapping(value = "updateOrderInfo")
@ -253,7 +245,6 @@ public class WlyyDoorServiceOrderController extends EnvelopRestEndpoint {
        return success(result.get(ResponseContant.resultMsg));
    }
    @GetMapping(value = "queryDoctorList")

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

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

@ -271,7 +271,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;
    }
@ -615,13 +615,13 @@ public class DoorOrderService {
                                       StringBuffer status, String createTimeStart, String createTimeEnd, String serverDoctorName,
                                       String doctorCode, Integer examPaperStatus, Integer page, Integer pageSize, Integer type)throws Exception{
        String sqlList = "select DISTINCT o.id as orderId,o.status,f.hospital,f.hospital_name as hospitalName1,o.is_trans_other_org,o.transed_org_code,h.name as hospitalName2,o.patient_name," +
                " o.patient_phone,o.remark,o.serve_desc,o.create_time,o.patient as patientCode ,o.exam_paper_status as examPaperStatus,o.number as serverCode,o.total_fee,h.hos_level as hosLevel, " +
                " o.patient_phone,o.remark,o.serve_desc,o.create_time,o.patient as patientCode ,o.exam_paper_status as examPaperStatus,o.number as serverCode,o.total_fee,h.org_level as hosLevel, " +
                "o.doctor, o.doctor_name as doctorName, o.doctor_type as doctorType "
                ;
        String sqlCount = " select count(*) as total ";
        String sql = " from wlyy_door_service_order o " +
                " LEFT JOIN wlyy_sign_family f ON f.patient = o.patient AND f. STATUS = 1 AND f.expenses_status = 1 " +
                " LEFT JOIN dm_hospital h on h.code=o.hospital and h.del=1 "
                " LEFT JOIN base_org h on h.code=o.hospital and h.del=1 "
                +" LEFT JOIN wlyy_door_doctor d on d.order_id = o.id ";
        sql+= " where 1=1 ";
@ -777,7 +777,7 @@ public class DoorOrderService {
                    " o.transed_org_code,h.name as hospitalName2,o.patient_name,f.idcard,o.doctor_sign_time,o.total_fee," +
                    " o.patient_phone,o.remark,o.create_time,o.patient as patientCode from wlyy_door_service_order o " +
                    " LEFT JOIN wlyy_sign_family f ON f.patient = o.patient AND f. STATUS = 1 AND f.expenses_status = 1 " +
                    " LEFT JOIN dm_hospital h on h.code=o.transed_org_code and h.del=1 " ;
                    " LEFT JOIN base_org h on h.code=o.transed_org_code and h.del=1 " ;
            if(!StringUtils.isEmpty(serverDoctorName)){
                sql+=" RIGHT JOIN wlyy_door_doctor d on d.order_id = o.id";
            }
@ -1450,7 +1450,7 @@ public class DoorOrderService {
     */
    public Map<String,String> getAdministratorStatusBarNum(String hospital) {
        String sql = " select o.`status`,count(o.id) as num  from wlyy_door_service_order o  LEFT JOIN wlyy_sign_family f ON f.patient = o.patient " +
                "AND f. STATUS = 1 AND f.expenses_status = 1  LEFT JOIN dm_hospital h on h.code=o.hospital and h.del=1  ";
                "AND f. STATUS = 1 AND f.expenses_status = 1  LEFT JOIN base_org h on h.code=o.hospital and h.del=1  ";
        if(!"350200%".equals(hospital)){
            sql += " where  (f.hospital like '" + hospital + "' or o.transed_org_code like '" + hospital + "') GROUP BY o.`status` ";
        }else{
@ -1773,7 +1773,7 @@ public class DoorOrderService {
       String sqlList = "select DISTINCT o.id as orderId";
       String sql = " from wlyy_door_service_order o " +
               " LEFT JOIN wlyy_sign_family f ON f.patient = o.patient AND f. STATUS = 1 AND f.expenses_status = 1 " +
               " LEFT JOIN dm_hospital h on h.code=o.hospital and h.del=1 "
               " LEFT JOIN base_org h on h.code=o.hospital and h.del=1 "
               +" LEFT JOIN wlyy_door_doctor d on d.order_id = o.id ";
       sql+= " where 1=1 ";
       if(status == 6){//已完成状态

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

@ -315,7 +315,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";

+ 0 - 32
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorDoctorService.java

@ -78,13 +78,6 @@ public class WlyyDoorDoctorService extends BaseJpaService<WlyyDoorDoctorDO, Wlyy
        WlyyDoorDoctorDO wlyyDoorDoctor = new WlyyDoorDoctorDO();
        wlyyDoorDoctor = jsonToWlyyDoorDoctor(result, jsonObjectParam,jsonData);
         /*
        //新增#######关联关系
        if (roleWithMenu(result, jsonObjectParam, wlyyDoorDoctor)) return result;
        //新增#######关联关系
        if (roleWithFunction(result, jsonObjectParam, wlyyDoorDoctor)) return result;
        */
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultMsg,wlyyDoorDoctor);
        return result;
@ -113,31 +106,6 @@ public class WlyyDoorDoctorService extends BaseJpaService<WlyyDoorDoctorDO, Wlyy
        WlyyDoorDoctorDO wlyyDoorDoctor = new WlyyDoorDoctorDO();
        wlyyDoorDoctor = jsonToWlyyDoorDoctor(result, jsonObjectParam,jsonData);
        /*
        //修改时有更改到关联关系,则先删除原有关联关系,再新增关联关系
        //删除#######关联关系
        List relatedList1 = new ArrayList();
        roleMenuList = baseRoleMenuService.findByField("roleId",wlyyDoorDoctor.getId());
        Set roleMenuIdSet = new HashSet();
        if(!CollectionUtils.isEmpty(roleMenuList)){
            roleMenuList.forEach(one ->{roleMenuIdSet.add(one);});
        }
        baseRoleMenuService.delete(roleMenuIdSet);
        //新增#######关联关系
        if (roleWithMenu(result, jsonObjectParam, wlyyDoorDoctor)) return result;
        //删除#######关联关系
        List relatedList2 = new ArrayList();
        roleFunctionList = baseRoleMenuFunctionService.findByField("roleId",wlyyDoorDoctor.getId());
        Set roleFunctionIdSet = new HashSet();
        if(!CollectionUtils.isEmpty(roleFunctionList)){
            roleFunctionList.forEach(one ->{roleFunctionIdSet.add(one);});
        }
        baseRoleMenuFunctionService.delete(roleFunctionIdSet);
        //新增#######关联关系
        if (roleWithFunction(result, jsonObjectParam, wlyyDoorDoctor)) return result;
        */
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultMsg,wlyyDoorDoctor);
        return result;

+ 88 - 79
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -165,7 +165,6 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    private DoorServiceApplicationService doorServiceApplicationService;
    @Autowired
    private MessageUtil messageUtil;
    /**
     * 上门服务工单服务基本信息
     *
@ -498,7 +497,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    /**
     * 获取居民所签约的机构的调度员(一个机构可以有多个调度员)
     * wlyy_doctor中,level -- 11-- 调度员
     * doctor中,level -- 11-- 调度员
     * @param hospitalCode
     * @return
     */
@ -521,16 +520,17 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    }
    public List<Map<String,Object>> queryDispatcherInfoByHospital(String hospital){
        String sql ="SELECT " +
                " d.`code`, " +
                " d.`name`, " +
                " d.`hospital_name` as hospitalName " +
                " FROM " +
                " manage_role_user m " +
                " JOIN manage_roles r ON m.role_id = r.id " +
                " JOIN (select code,name,hospital_name from wlyy_doctor where hospital = '"+ hospital +"') as d ON m.user_code = d.code" +
                " WHERE " +
                " r.code = 'dispatcher'";
        String sql ="    SELECT" +
                "                 d.`code`, " +
                "                 d.`name`, " +
                "                 d.`hospital_name` as hospitalName " +
                "                 FROM " +
                "                 base_doctor_role m " +
                "                 JOIN base_doctor_role_dict r ON m.role_code = r.code " +
                "                 JOIN (select a.id code,a.name,o.org_name hospital_name from base_doctor_hospital o,base_doctor a " +
                " where a.id = o.doctor_code and o.del=1 and o.org_code = '"+hospital+"') as d ON m.doctor_code = d.code" +
                "                 WHERE " +
                "                 r.code = 'dispatcher'";
        return jdbcTemplate.queryForList(sql);
    }
@ -634,13 +634,34 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        //新增工单与服务项费用关联关系
        if (orderWithPackageItemFeeAdd(result, jsonObjectParam, orderDO)) {return result;}
        JSONObject dispatcherJson = queryDispatcherInfoByPatient(jsonObjectParam.getJSONObject("hospital").get("code").toString());
        if (dispatcherJson.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
            return dispatcherJson;
        if ( StringUtils.isNotBlank(orderDO.getDoctor())) {
            orderDO.setStatus(2);
            orderDO.setDoctorName(orderDO.getExpectedDoctorName());
            this.save(orderDO);
            WlyyDoorServiceOrderDO wlyyDoorServiceOrder = wlyyDoorServiceOrderDao.findOne(orderDO.getId());
            //新增工单医生关联关系
            if (orderWithDoctorAdd(result, jsonObjectParam, wlyyDoorServiceOrder)) {return result;}
            // 给服务医生发接单消息
            this.createMessage("服务工单待接单","407",orderDO.getProxyPatient(),orderDO.getProxyPatientName(), orderDO.getId(), orderDO.getDoctor(),orderDO.getDoctorName() ,null, "您有新的服务工单,请前往处理");
            //发送智能助手消息
//            sendWeixinMessage(4,orderDO.getDoctor(),orderDO.getPatient());
            //发送 预约卡片信息(2101类型)
            JSONObject orderInfoContent = this.queryOrderCardInfo(orderDO);
            orderInfoContent.put("re_msg_type",0);//居民预约
            this.qucikSendIM(orderDO.getId(), "system", "智能助手", "2101", orderInfoContent.toJSONString());
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg, consultTeam);
            return  result;
        }
        JSONObject dispatcherJson = queryDispatcherInfoByPatient(jsonObjectParam.getJSONObject("hospital").get("code").toString());
        List<Map<String,Object>> dispatcherInfoList = (List)dispatcherJson.get(ResponseContant.resultMsg);
        for(Map<String,Object> map: dispatcherInfoList){
            String dispatcher = map.get("code").toString();//·
            String dispatcher = map.get("code").toString();
            BaseDoctorDO doctorVO = doctorDao.findById(dispatcher);
            // 派单消息-首页
            this.createMessage("新增居民预约服务申请","402","system","system", orderDO.getId(), dispatcher,doctorVO.getName() ,doctorVO.getIdcard(), orderDO.getPatientName() + "提交了服务预约申请,请您前往处理");
@ -648,11 +669,15 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            this.createMessage("居民提交工单申请","430","system","system", orderDO.getId(), dispatcher,doctorVO.getName() ,doctorVO.getIdcard(), orderDO.getPatientName() + "提交了服务工单"+orderDO.getNumber()+"申请");
        }
        //给机构调度员发送医生助手消息
        String  dispatcherSql = "SELECT u.user_code FROM `manage_role_user` u ,wlyy_doctor d where u.role_id = 22 and u.user_code = d.`code` and d.hospital = '" +orderDO.getHospital() + "'";
/*        String  dispatcherSql = "SELECT m.doctor_code FROM base_doctor_role m " +
                "JOIN base_doctor_role_dict r ON m.role_code = r.code " +
                "JOIN base_doctor_hospital o ON m.doctor_code = o.doctor_code WHERE " +
                " r.code = 'dispatcher' and o.del=1 and o.org_code = '"+orderDO.getHospital()+"'";
        List<Map<String, Object>> dispatcherList = jdbcTemplate.queryForList(dispatcherSql);
        for(Map<String, Object> map : dispatcherList) {//·
            sendWeixinMessage(3, map.get("user_code") + "", orderDO.getPatient());
        }
        for(Map<String, Object> map : dispatcherList) {
            sendWeixinMessage(3, map.get("doctor_code") + "", orderDO.getPatient());
        }*/
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, consultTeam);
@ -661,7 +686,6 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        orderInfoContent.put("re_msg_type",0);//居民预约
        this.qucikSendIM(orderDO.getId(), "system", "智能助手", "2101", orderInfoContent.toJSONString());
        if(StringUtils.isNoneBlank(orderDO.getDoctor())){
            //服务医生修改,直接转派
            BaseDoctorDO transDoctor = doctorDao.findById(orderDO.getDoctor());
@ -674,7 +698,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    public void sendWeixinMessage(Integer type,String doctorCode,String patient){
        //提交资质审核
        if (type==1){//·
        if (type==1){
            try {
/*                WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","zztj");
                org.json.JSONObject sendJson = new org.json.JSONObject();
@ -908,6 +932,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);
@ -997,10 +1022,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    /**
     * 生成二維碼
     * @param id
     * @param token
     * @return
     */
    public String twoDimensionalCode(String id , String token) {
    public String twoDimensionalCode(String id ) {
        JSONObject orderJson = new JSONObject();
        List<WlyyDoorServiceOrderDO> orderList = this.findByField("id", id);
        if (orderList.size()>0){
@ -1016,7 +1040,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                try {
                    ObjectNode imgNode = fastDFSUtil.upload(ipt, "png", "plan_service_qrcode" + System.currentTimeMillis());
                    JSONObject json = JSONObject.parseObject(imgNode.toString());
                    tempPaths.add(json.getString("fid"));
                    tempPaths.add(json.getString("fileId"));
                    String urls = "";
                    for (String image : tempPaths) {
                        if (urls.length() == 0) {
@ -1123,8 +1147,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        String sql = "SELECT " +
                "  d.photo AS doctorPhoto, " +
                "  d.`name` AS doctorName, " +
                "  d.`job_name` AS doctorJobName, " +
                "  d.hospital_name AS hospitalName, " +
                "  d.job_title_name AS doctorJobName, " +
                "  dm.name AS hospitalName, " +
                "  d.mobile AS doctorPhone, " +
                "  o.id, " +
                "  o.number, " +
@ -1134,13 +1158,14 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                "  o.`status` AS status, " +
                "  o.`pay_way` AS payWay, o.type," +
                "  ifnull(de.order_id,concat(rand(),'_notExist')) AS feeOrderId, " +
                "  dm.phone AS hospitalPhone, " +
                "  dm.mobile AS hospitalPhone, " +
                "  count(de.number) as itemCount " +
                " FROM " +
                "  ( wlyy_door_service_order o " +
                " LEFT JOIN wlyy_doctor d ON o.doctor = d.`code`) " +
                " LEFT JOIN base_doctor d ON o.doctor = d.id " +
                " LEFT JOIN base_doctor_hospital dh ON o.doctor = dh.doctor_code) " +
                " LEFT JOIN wlyy_door_fee_detail de on o.id = de.order_id " +
                " LEFT JOIN dm_hospital dm on o.hospital = dm.code " +
                " LEFT JOIN base_org dm on o.hospital = dm.code " +
                " WHERE " +
                "  (o.patient = '{patient}' " +
                ") " +
@ -1158,9 +1183,10 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                "   count(DISTINCT o.id)  " +
                " FROM  " +
                "  ( wlyy_door_service_order o " +
                " LEFT JOIN wlyy_doctor d ON o.doctor = d.`code`) " +
                " LEFT JOIN base_doctor d ON o.doctor = d.id " +
                " LEFT JOIN base_doctor_hospital dh ON o.doctor = dh.doctor_code) " +
                " LEFT JOIN wlyy_door_fee_detail de on o.id = de.order_id " +
                " LEFT JOIN dm_hospital dm on o.hospital = dm.code " +
                " LEFT JOIN base_org dm on o.hospital = dm.code " +
                " WHERE  " +
                "  (o.patient = '{patient}' or o.proxy_patient = '{patient}') " +
                " AND (o.`status` = {status} or -100 = {status})";
@ -1370,7 +1396,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
//                );
//            }
//        }
        //如果是调度员取消,推送IM取消工单json消息,//·
        //如果是调度员取消,推送IM取消工单json消息,
/*        if(type == WlyyDoorServiceOrderDO.CancelType.dispatcher.getType()){
            JSONObject content = this.queryOrderCardInfo(orderDO);
            content.put("title","工单已取消");
@ -1777,11 +1803,11 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                "  o.serve_lat as lat, " +
                "  o.`status` as status, " +
                "  o.`dispatcher_name` as dispatcherName, " +
                "  concat( o.patient,'_' ,c.`code`, '_',o.`number`,'_11' ) as sessionId, " +
                "  concat( o.patient,'_' ,c.id, '_',o.`number`,'_11' ) as sessionId, " +
                "   t1.`type` as patientType " +
                " FROM " +
                " ( wlyy_door_service_order o " +
                "LEFT JOIN wlyy_patient p ON o.patient = p.`code` ) LEFT JOIN wlyy_consult c on o.id = c.relation_code" +
                " LEFT JOIN base_patient p ON o.patient = p.id ) LEFT JOIN wlyy_consult c on o.id = c.relation_code" +
                " JOIN ( " +
                "         select a.patient, group_concat(v.type) as type " +
                "         from wlyy_door_service_voucher v " +
@ -1809,7 +1835,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                "   count(o.id)  " +
                " FROM  " +
                "   wlyy_door_service_order o  " +
                " LEFT JOIN wlyy_patient p ON o.patient = p.`code` " +
                " LEFT JOIN base_patient p ON o.patient = p.id " +
                " JOIN  ( " +
                "         select a.patient, group_concat(v.type) as type " +
                "         from wlyy_door_service_voucher v " +
@ -1896,7 +1922,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, " +
@ -1907,21 +1935,21 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                "  when 1 then '男' " +
                "  when 2 then '女' " +
                "  end as sex, " +
                "  d.`job_name` AS jobName, " +
                "  d.job_title_name AS jobName, " +
                "  d.mobile as phone, " +
                "  IFNULL(ds.`status`,5) as status," +
                "  1 as sortFlag ,count(o.id) as count" +
                " FROM " +
                " base.base_doctor d " +
                " base_doctor d " +
                " LEFT JOIN wlyy_door_doctor_status ds ON d.id = ds.doctor " +
                " LEFT JOIN wlyy_door_service_order o on o.doctor = d.id and o.`status` in (2,3,4) " +
                " WHERE d.status = 1" +
                " AND d.level <> 11" +
                " AND d.hospital = '{hospital}' " +
                " LEFT JOIN base_doctor_hospital dh on dh.doctor_code = d.id " +
                " WHERE d.enabled = 1" +
                " AND dh.org_code = '{hospital}' "+
                " AND d.`name` like '%{doctorName}%' " +
                " AND (ds.`status` in ({status}) or '-100' = '{status}')" +
                " AND d.del=1  " +
                " GROUP BY d.`code` ORDER BY ds.create_time DESC " +
                " GROUP BY d.id ORDER BY ds.create_time DESC " +
                " LIMIT {start},{end}";
        String finalSql = sql.replace("{hospital}", hospital)
@ -1933,13 +1961,13 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        String countSql = "SELECT  " +
                "   count(d.id)  " +
                " FROM  " +
                "   base.base_doctor d  " +
                "   base_doctor d  " +
                " LEFT JOIN wlyy_door_doctor_status ds ON d.id = ds.doctor " +
                " WHERE d.status = 1" +
                " AND d.level <> 4" +
                " AND d.hospital = '{hospital}' "+
                " LEFT JOIN base_doctor_hospital dh on dh.doctor_code = d.id " +
                " WHERE d.enabled = 1" +
                " AND dh.org_code = '{hospital}' "+
                " AND d.`name` like '%{doctorName}%' " +
                " AND d.del=1 and d.status=1 " +
                " AND d.del=1 " +
                " AND (ds.`status` in ({status}) or '-100' = '{status}')";
        String finalCountSql = countSql.replace("{hospital}", hospital)
@ -1978,7 +2006,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            if(notFinish > 0 && StringUtils.isNotBlank(doctor)){
                String notFinishSql ="select o.id,o.number,o.patient,o.patient_name,o.patient_phone,o.patient_expected_serve_time,o.`status`, CASE p.sex when 1 then '男' when 2 THEN '女' END as sex,p.idcard, " +
                        "year(now()) - ((CASE LENGTH(p.idcard) WHEN 18 THEN substring(p.idcard, 7, 4) WHEN 15 THEN CONCAT('19',substring(p.idcard, 7, 2)) END )) as age , p.photo,o.serve_lat AS lat,o.serve_lon AS lon,o.id AS orderId " +
                        "from wlyy_door_service_order o LEFT JOIN wlyy_patient p on o.patient = p.`code` and p.`status`=1 " +
                        "from wlyy_door_service_order o LEFT JOIN base_patient p on o.patient = p.id and p.patient_status=1  " +
                        "where o.doctor ='"+doctor + "' and o.status in (2,3,4)";
                List<Map<String, Object>> notFinishList = jdbcTemplate.queryForList(notFinishSql);
                map.put("notFinishList", notFinishList);
@ -2059,13 +2087,13 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        String sql = "select ds.doctor,d.name, d.job_name as jobName, 1 as sortFlag " +
                " from wlyy_door_doctor_status ds " +
                "        JOIN (select * from wlyy_doctor where hospital = '" + hospital + "')  d on ds.doctor = d.code " +
                "        JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code='" + hospital + "')  d on ds.doctor = d.id " +
                " where ds.status in (1,2,3,4)" +
                " limit " + start + "," + end ;
        String countSql = "select count(ds.id) " +
                "from wlyy_door_doctor_status ds " +
                "         JOIN (select * from wlyy_doctor where hospital = '" + hospital + "') d on ds.doctor = d.code " +
                "         JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code= '" + hospital + "') d on ds.doctor = d.code " +
                "where ds.status in (1,2,3,4)";
        List<Map<String,Object>> doctorList = new ArrayList<>();
        try {
@ -2187,8 +2215,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        }else{
            this.createMessage("服务工单待接单","407",doorServiceOrderDO.getDispatcher(),doorServiceOrderDO.getDispatcherName(), orderId,doctor,doctorName, null,"您有新的服务工单,请前往处理");
        }
        //发送智能助手消息
        sendWeixinMessage(4,doctor,doorServiceOrderDO.getPatient());//·
        //发送智能助手消息//·
        sendWeixinMessage(4,doctor,doorServiceOrderDO.getPatient());
        // 派单时,把医生拉入会话,作为其中一个成员,医生拒单时,退出会话
        ConsultDo consult = consultDao.queryByRelationCode(orderId);
@ -2283,13 +2311,13 @@ 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("服务工单待接单","407",doorServiceOrderDO.getTransedDispatcher(),doorServiceOrderDO.getTransedDispatcherName(), orderId,doctor,doctorName, null,"您有新的服务工单,请前往处理");
        }else{
            this.createMessage("服务工单待接单","407",doorServiceOrderDO.getDispatcher(),doorServiceOrderDO.getDispatcherName(), orderId,doctor,doctorName, null,"您有新的服务工单,请前往处理");
        }
        //发送智能助手消息
        sendWeixinMessage(4,doctor,doorServiceOrderDO.getPatient());//·
        sendWeixinMessage(4,doctor,doorServiceOrderDO.getPatient());
        // 派单时,把医生拉入会话,作为其中一个成员,医生拒单时,退出会话
        ConsultDo consult = consultDao.queryByRelationCode(orderId);
@ -2397,6 +2425,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    /**
     * 添加【工单派单,转单】等系统消息
     */
    public void createMessage(String title,String type,String sender,String senderName,String relationCode,String Receiver,String ReceiverName,String idCard,String msg){
        SystemMessageDO messageDO = new SystemMessageDO();
@ -2607,7 +2636,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            sql += " union ";
        }
        sql += " SELECT s.patient,s.`name`,s.openid,s.idcard, s.mobile,h.town_code town,h.town_name townName, p.address,r.create_time createTime from wlyy_sign_family s, wlyy_door_service_order r ,base.base_org h,base.base_patient p " +
        sql += " SELECT s.patient,s.`name`,s.openid,s.idcard, s.mobile,h.town_code town,h.town_name townName, p.address,r.create_time createTime from wlyy_sign_family s, wlyy_door_service_order r ,base_org h,base_patient p " +
        "WHERE s.admin_team_code = " + teamCode + " AND ( s.doctor = '" + doctor + "' OR s.doctor_health = '" + doctor + "') and s.`status`= 1 and s.expenses_status=1 and s.doctor = '" + doctor + "' " +
                "and r.patient = s.patient and s.hospital = h.code and s.patient = p.id and p.patient_status = 1 ";
        if(StringUtils.isNotBlank(patientName)){
@ -2762,9 +2791,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        }else{
            // 给服务医生发接单消息
//            this.createMessage(orderDO.getId(),orderDO.getProxyPatient(),orderDO.getDoctor(),407,"服务工单待接单","您有新的服务工单,请前往处理");
            this.createMessage("服务工单待接单","407",orderDO.getProxyPatient(),orderDO.getProxyPatientName(), orderDO.getId(),orderDO.getDoctor(),orderDO.getDoctorName(), null,"您有新的服务工单,请前往处理");
            //发送智能助手消息
            sendWeixinMessage(4,orderDO.getDoctor(),orderDO.getPatient());//·
            sendWeixinMessage(4,orderDO.getDoctor(),orderDO.getPatient());
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
@ -2862,7 +2891,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    public List<Map<String,Object>> getProxyPatientList(String patient) {
        //根据代理人code查代理预约对象
        String sql = "SELECT o.patient,o.patient_name,o.patient_relation,p.photo, IFNULL(m.family_relation, -1) family_relation FROM `wlyy_door_service_order` o LEFT JOIN wlyy_patient_family_member m " +
                "on o.proxy_patient = m.patient and o.patient = m.family_member  JOIN wlyy_patient p on p.`code` = o.patient and p.`status` = 1 " +
                "on o.proxy_patient = m.patient and o.patient = m.family_member  JOIN base_patient p on p.id = o.patient and p.patient_status = 1 " +
                "where o.proxy_patient = '" + patient + "'  and o.type != 3 " +
                " GROUP BY o.patient ORDER BY family_relation ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
@ -2925,26 +2954,6 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            wlyyDoorServiceOrder.setDoctorArrivingTime(jsonObjectParam.getString("doctorArrivingTime"));
        }
//        //添加居民同意状态
//        wlyyDoorServiceOrder.setIsPatientConfirm(1);
//        wlyyDoorServiceOrder.setPatientConfirmTime(new Date());
//        wlyyDoorServiceOrder.setUpdateTime(new Date());
//        this.save(wlyyDoorServiceOrder);
//
//        //修改时有更改到关联关系,则先删除原有关联关系,再新增关联关系
//        //删除工单原来医生的关联关系
//        // 删除出诊医生或服务项
//        this.orderWithFeeDelete(jsonObjectParam,wlyyDoorServiceOrder);
        //新增工单医生关联关系
        if (orderWithDoctorAdd(result, jsonObjectParam, wlyyDoorServiceOrder)) {return result;}
//        //新增工单居民确认操作日志记录
//        if (orderWithConfirmLogAdd(result, jsonObjectParam, wlyyDoorServiceOrder.getId())) {return result;}
        //微信模板消息-反馈处理通知
//        pushMsgTask.putWxMsg(tokenUtils.getAccessToken(),30,);
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, wlyyDoorServiceOrder);
        return result;

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

+ 10 - 10
svr/svr-door-serivce/src/main/resource/application.yml

@ -72,7 +72,7 @@ spring:
  profiles: jwdev
  datasource:
    url: jdbc:mysql://172.26.0.104:3306/door_service?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://172.26.0.104:3306/base?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: root
    password: jkzlehr
  redis:
@ -105,9 +105,8 @@ wechat:
  flag: false #演示环境  true走Mysql数据库  false走Oracle
im:
  im_list_get: http://172.26.0.118:3000/
  #im_list_get: http://192.168.131.24:3000/
  data_base_name: ichat
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
@ -152,18 +151,18 @@ spring:
  profiles: jwtest
  datasource:
    url: jdbc:mysql://172.26.0.104/door_service?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://172.26.0.104/base?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg@jkzl2019
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.26.0.110:80/
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
  tracker-server: 172.26.0.110:22122
  public-server: http://172.26.0.110:80/
  public-server: http://172.26.0.110:8888/
server:
  server_url: http://ehr.yihu.com/wlyy/
@ -185,8 +184,9 @@ wechat:
  flag: false #演示环境  true走Mysql数据库  false走Oracle
im:
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im_new
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
@ -228,7 +228,7 @@ systemSetting:
spring:
  profiles: prod
  datasource:
    url: jdbc:mysql://59.61.92.90:9069/wlyy_specialist?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://59.61.92.90:9069/base?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: wlyy
    password: jkzlehr@123
  redis:

svr/svr-door-serivce/src/main/resource/banner.txt → svr/svr-door-serivce/src/main/resources/banner.txt


svr/svr-door-serivce/src/main/resource/bootstrap.yml → svr/svr-door-serivce/src/main/resources/bootstrap.yml


+ 1 - 1
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/TnyyController.java

@ -26,7 +26,7 @@ public class TnyyController extends EnvelopRestEndpoint {
    @GetMapping(value = "/queryBySql")
    @ApiOperation(value = "视图统一查询")
    public ListEnvelop createSQLQuery(@ApiParam(name = "sql", value = "sql语句", required = true)
    public ListEnvelop queryBySql(@ApiParam(name = "sql", value = "sql语句", required = true)
                                      @RequestParam(value = "sql",required = true)String sql){
        return success(tnyyEntranceService.queryBySql(sql));
    }

+ 51 - 2
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -369,9 +369,9 @@ express:
---
# sql前置機
# sqlserverce测试环境
spring:
  profiles: sqlServerProd
  profiles: sqlServerTest
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://192.168.131.125:1433;DatabaseName=base
@ -386,6 +386,55 @@ spring:
    database-platform: org.hibernate.dialect.SQLServer2008Dialect
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.16.1.42:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
---
# sqlserverce正式环境
spring:
  profiles: tnJwprod
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://10.9.1.246:1433;DatabaseName=tazyy
    username: sa
    password: jsjzx@1234
  jpa:
    properties:
      hibernate:
        default_schema: dbo
      naming:
        physical-strategy: com.ford.configuration.UpperTableStrategy
    database-platform: org.hibernate.dialect.SQLServer2008Dialect
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false

+ 41 - 0
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -339,3 +339,44 @@ express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code:
  sf_check_word:
---
spring:
  profiles: tnJwprod
  datasource:
    url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false #jdbc:mysql://192.0.33.27:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: qY#j2n5O
hlwyyEntrance:
  url: http://172.16.1.42:10023
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com #https://172.16.1.34
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://10.9.1.247:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://10.9.1.247:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  ids: sd_tnzyy_wx
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
jobs:
  schedule: 0 */30 * * * ?

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

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

@ -22,11 +22,9 @@ import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.InspectionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.WorkTimeService;
import com.yihu.jw.hospital.prescription.service.*;
import com.yihu.jw.hospital.prescription.service.entrance.DoctorPreSignService;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.dao.ConsultDao;
@ -117,6 +115,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private ConsultDao consultDao;
    @Autowired
    private HospitalSystemMessageService hospitalSystemMessageService;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private TnPrescriptionService tnPrescriptionService;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -141,7 +143,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                              @RequestParam(value = "cardNo",required = false)String cardNo) throws Exception {
        startTime = startTime+" 00:00:00";
        endTime =endTime+" 23:59:59";
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm,cardNo);
        List<WlyyOutpatientVO> vos = new ArrayList<>();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm,cardNo);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            vos = tnPrescriptionService.findOutpatientList(patient, cardNo,startTime, endTime, demoFlag,ksdm);
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
        return success(vos);
    }
    
@ -151,7 +161,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "patient",required = false) String patient,
                                         @ApiParam(name = "conNo", value = "就诊次数")
                                         @RequestParam(value = "conNo",required = false) String conNo)throws Exception{
        WlyyOutpatientVO obj = prescriptionService.findOutpatientInfo(patient,conNo);
        WlyyOutpatientVO obj = new WlyyOutpatientVO();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            obj = prescriptionService.findOutpatientInfo(patient,conNo);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            obj = tnPrescriptionService.findOutpatientInfo(patient,conNo,demoFlag,null);
        }else {
            return ObjEnvelop.getError("尚未开发!");
        }
        return success(obj);
    }
    
@ -166,7 +183,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "admNo",required = false) String admNo,
            @ApiParam(name = "realOrder", value = "处方号")
            @RequestParam(value = "realOrder",required = false) String realOrder) throws Exception {
        List<WlyyPrescriptionVO> obj = prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        List<WlyyPrescriptionVO> obj = new ArrayList<>();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            obj= prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            obj= tnPrescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
        return success(obj);
    }
    
@ -396,6 +421,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(prescriptionService.getICD10(pyKey));
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectIcd10Dict(pyKey));
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnPrescriptionService.getICD10(pyKey,false));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -418,6 +445,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(prescriptionService.getDrugDictionary(drugNo,pyKey,winNo,groupNo));
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectDrugDict(pyKey));
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnPrescriptionService.getDrugDictionary(drugNo,pyKey,null,null,null));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -434,6 +463,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(prescriptionService.getDrugUse(drugNo,pyKey));
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectMedicineUsed(pyKey));
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnPrescriptionService.getDrugUse(pyKey,demoFlag));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -448,6 +479,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(prescriptionService.getDrugFrequency());
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectFrequencyDict());
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnPrescriptionService.getDrugFrequency(demoFlag));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -1211,7 +1244,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));
    }
    
@ -2311,10 +2349,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();

+ 52 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/tnyy/TnyyController.java

@ -0,0 +1,52 @@
package com.yihu.jw.hospital.endpoint.tnyy;
import com.yihu.jw.hospital.prescription.service.TnPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
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.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;
/**
 * Created by Trick on 2020/1/19.
 */
@RestController
@RequestMapping(value ="/tnyy")
@Api(value = "泰安中医院", description = "泰安中医院", tags = {"泰安中医院"})
public class TnyyController extends EnvelopRestEndpoint {
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private TnPrescriptionService prescriptionService;
    @GetMapping(value = "/getDeptInfo")
    @ApiOperation(value = "获取部门信息", notes = "获取部门信息")
    public ObjEnvelop getDeptInfo(@ApiParam(name = "code", value = "code", required = false)
                                  @RequestParam(value = "code",required = false)String code)throws Exception{
        return ObjEnvelop.getSuccess("ok",tnyyEntranceService.updateTnyyDept());
    }
    @GetMapping(value = "/updateTnyyDoctor")
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    public ObjEnvelop updateTnyyDoctor(@ApiParam(name = "idcard", value = "idcard", required = false)
                                  @RequestParam(value = "idcard",required = false)String idcard)throws Exception{
        return ObjEnvelop.getSuccess("ok",tnyyEntranceService.updateTnyyDoctor(idcard));
    }
    @GetMapping(value = "/synYkICD10")
    @ApiOperation(value = "获取icd10信息", notes = "获取icd10信息")
    public ObjEnvelop synYkICD10()throws Exception{
        return ObjEnvelop.getSuccess("ok",prescriptionService.synYkICD10());
    }
}

+ 91 - 0
svr/svr-internet-hospital/src/main/resources/application.yml

@ -864,5 +864,96 @@ express:
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
  profiles: tnJwprod
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: wlyy
    password: qY#j2n5O
#  elasticsearch:
#    cluster-name: jkzl #集群名 默认elasticsearch
#    cluster-nodes: 192.0.33.26:9200 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#    client-transport-sniff: false
#    jest:
#      uris: http://192.0.33.26:9300
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://59.61.92.90:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 10.9.1.247 # Redis server host.
    port: 6380 # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: https://hlwyy.xmzsh.com/fastdfs/
fast-dfs:
  tracker-server: 10.9.1.247:22122 #服务器地址
wechat:
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: true #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP #todo 待配置
myFamily:
  qrCodeFailurTime: 2
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://10.9.1.247:3000/
  data_base_name: im
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_prod
  type:
    Statistics: hlw_quota_prod
  host:  http://10.9.1.247:9200
  tHost: 10.9.1.247:9300
  clusterName: jkzl
  user: lion
  password: jkzlehr
  securityUser: lion:jkzlehr
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
qywx:
  url: https://hlwyy.xmzsh.com/hlwyy
  id: zsyy
express:
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000102
  sf_check_word: TGUQASFNAZyjt9112
---

+ 9 - 1
svr/svr-internet-hospital/src/main/resources/bootstrap.yml

@ -88,4 +88,12 @@ spring:
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.194:1221}
      label: ${wlyy.spring.config.label:jwdev}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: tnJwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}