Ver código fonte

咨询改动

wangjun 4 anos atrás
pai
commit
e352d62a4a
18 arquivos alterados com 767 adições e 120 exclusões
  1. 3 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorDao.java
  2. 4 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorHospitalDao.java
  3. 2 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorRoleDao.java
  4. 141 78
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 8 7
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  6. 1 1
      business/base-service/src/main/java/com/yihu/jw/internet/service/ykyy/YkyyInternetService.java
  7. 42 3
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  8. 1 1
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  9. 288 0
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  10. 15 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java
  11. 20 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/WlyyChargeDictDO.java
  12. 3 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  13. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyChargeDictVO.java
  14. 123 15
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  15. 5 6
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java
  16. 35 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  17. 58 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  18. 4 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

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

@ -39,4 +39,7 @@ public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO,
    void updateStatus(String doctorId,String status);
    List<BaseDoctorDO> findByIdcard(String idcard);
    @Query("from BaseDoctorDO d where d.idcard = ?1 AND d.del ='1'")
    BaseDoctorDO findByIdcardAndDel(String id);
}

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorHospitalDao.java

@ -30,4 +30,8 @@ public interface BaseDoctorHospitalDao extends PagingAndSortingRepository<BaseDo
    @Query("select bdo from BaseDoctorHospitalDO bdo where bdo.orgCode=?1 and bdo.deptCode=?2 and bdo.doctorCode = ?3 and bdo.del=1")
    List<BaseDoctorHospitalDO> findByOrgCodeAndDeptCodeAndDoctorCode(String orgCode,String deptCode,String doctorCode);
    @Query("select bdo from BaseDoctorHospitalDO bdo where bdo.orgCode=?1 and bdo.deptCode=?2 and bdo.doctorCode = ?3 and bdo.del=1")
    BaseDoctorHospitalDO findByOrgCodeAndDeptCodeAndDoctorCodeOnly(String orgCode,String deptCode,String doctorCode);
}

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

@ -30,4 +30,6 @@ public interface BaseDoctorRoleDao extends PagingAndSortingRepository<BaseDoctor
    Set<Object> findIdListByDoctorCode(String doctorCode);
    List<BaseDoctorRoleDO> findByDoctorCode(String doctorCode);
    @Query("from BaseDoctorRoleDO where doctorCode = ?1 and roleCode = ?2")
    BaseDoctorRoleDO findByDoctorCodeAndroleCode(String doctorCode,String roleCode);
}

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

@ -368,13 +368,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param size
     * @return
     */
    public MixEnvelop findReOutpatientList(String patient, Integer status, String startTime, String endTime, Integer page, Integer size) {
    public MixEnvelop findReOutpatientList(String patient, Integer status, String startTime, String endTime,String outpatientType, Integer page, Integer size) {
        String totalSql = "SELECT " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.patient =:patient AND o.outpatient_type != '2' ";
                " o.patient =:patient  ";
        Map<String, Object> totalParams = new HashedMap();
        totalParams.put("patient", patient);
        if (status != null) {
@ -390,6 +390,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            totalParams.put("endTime", DateUtil.strToDateLong(endTime + " 23:59:59"));
        }
        if (StringUtils.isNotBlank(outpatientType)){
            totalSql+=" AND o.outpatient_type = :outpatientType ";
            totalParams.put("outpatientType", outpatientType);
        }
       /* totalParams.add(patient);
        if(status!=null){
            totalSql +=  " AND o.status = ? ";
@ -430,6 +434,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.hospital_name AS \"hospitalName\"," +
                " o.win_no AS \"winNo\"," +
                " o.type AS  \"type\"," +
                " o.outpatient_type AS  \"outpatientType\"," +
                " o.dept AS \"dept\", " +
                " o.dept_name AS \"deptName\", " +
                " o.patient AS \"patient\", " +
@ -482,10 +487,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            params.put("endTime", DateUtil.strToDateLong(endTime + " 23:59:59"));
        }
        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC ";
        if (StringUtils.isNotBlank(outpatientType)){
            sql+=" AND o.outpatient_type = '"+outpatientType+"' ORDER BY o.create_time DESC ";
        }
        logger.info("sql="+sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, size);
        if(list!=null&&list.size()>0){
            for(Map<String, Object> map:list){
                String outpatientId = map.get("id").toString();
                String status2 = map.get("status")==null?"":map.get("status").toString();
                String consultSql = "select t.id as \"id\" from wlyy_consult t where t.relation_code ='"+outpatientId+"'";
                List<Map<String, Object>> consultList = hibenateUtils.createSQLQuery(consultSql);
                if (consultList!=null&&consultList.size()>0){
                    if (status2.equalsIgnoreCase("0")&&null!=consultList.get(0).get("id")){
                        map.put("haveConsult","1");
                    }else {
                        map.put("haveConsult","1");
                    }
                }else {
                    map.put("haveConsult","0");
                }
            }
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
@ -1143,7 +1166,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Map<String, Object> checkOutpatient(String patient,String wxId,boolean flag,String outpatientType) throws Exception {
        //-1卡余额不足,,-2 存在未结束的诊断热 1成功
        Map<String, Object> rs = new HashedMap();
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("consultAccount");
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("consultAccount");
        String accountControl = "0";
        if (null!=wlyyHospitalSysDictDO){
            accountControl = wlyyHospitalSysDictDO.getDictValue();
@ -1559,7 +1582,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        chargeTypeList = chargeType.replace(",","','");
                    }
                    String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                            "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " +
                            "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
                            " from wlyy_charge_dict where 1=1";
                    sqlCharge+=" and charge_type in ( '"+chargeTypeList+"')";
                    if (StringUtils.isNoneBlank(deptTyepCode)){
@ -3475,7 +3498,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    chargeType = chargeType.replace(",","','");
                }
                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                        "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " +
                        "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
                        " from wlyy_charge_dict where 1=1";
                sqlCharge+=" and charge_type in ( '"+chargeType+"')";
                if (StringUtils.isNoneBlank(deptTyepCode)){
@ -3742,7 +3765,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    chargeType = chargeType.replace(",","','");
                }
                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                        "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " +
                        "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
                        " from wlyy_charge_dict where 1=1";
                sqlCharge+=" and charge_type in ( '"+chargeType+"')";
                if(StringUtils.isNoneBlank(deptTyepCode)){
@ -4039,12 +4062,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if ("1".equals(type)) {
                contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = consPatientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
                msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
                if (StringUtils.isNotBlank(outpatientId)){
                    msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                }else{
                    msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
                }
                logger.info("图文咨询订单待支付微信消息模板推送开始");
            } else if ("17".equals(type)) {
                contentMsg = "您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first =  consPatientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
                msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
                if (StringUtils.isNotBlank(outpatientId)){
                    msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                }else{
                    msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
                }
                logger.info("视频咨询订单待支付微信消息模板推送开始");
            }
@ -4059,7 +4090,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            contentMsg = "" + remindMsg;
            remark = "请您尽快回复";
        } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
          if (StringUtils.isNotEmpty(outpatientId)){
              if ("16".equals(type)) {
                  first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
                  contentMsg = "您的视频复诊已开始,错过将重新排队";
@ -4067,8 +4098,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                  msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=16&outpatientId="+outpatientId;
                  logger.info("视频问诊已接诊提醒微信模板消息发送开始");
              }
          }
          if (consultTeam!=null){
              if ("17".equals(type)) {
                  first = consDoctorDO.getName() + consDoctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
                  contentMsg = "您的视频咨询已开始,错过将重新排队";
                  remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
                  if (StringUtils.isNotEmpty(outpatientId)){
                      msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=17&outpatientId="+outpatientId;
                  }else{
                      msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
                  }
                  logger.info("视频咨询已接诊提醒微信模板消息发送开始");
              }
          /*if (consultTeam!=null){
              if ("17".equals(type)) {
                  first = consDoctorDO.getName() + consDoctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
                  contentMsg = "您的视频咨询已开始,错过将重新排队";
@ -4076,7 +4117,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                  msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
                  logger.info("视频咨询已接诊提醒微信模板消息发送开始");
              }
          }
          }*/
        } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
@ -4088,7 +4129,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } else if ("17".equals(type)) {
                first = "您的视频咨询已预约成功。";
                contentMsg = "预计" + consDoctorDO.getName() + "医生将于" + DateUtil.dateToStrLong(consultTeam.getCzrq()) + " 与您进行视频咨询。请留意微信公众号消息。";
                msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
                if (StringUtils.isNotEmpty(outpatientId)){
                    msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=17&outpatientId="+outpatientId;
                }else{
                    msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
                }
                logger.info("视频咨询已预约成功微信消息模板推送开始");
            }
            remark = "咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
@ -4166,17 +4211,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
                        newConfig.setKeyword1( "视频复诊支付");
                    }
                    newConfig.setKeyword2(outpatientDO.getHospitalName());
                    newConfig.setKeyword3(outpatientDO.getDoctorName());
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 就诊支付提醒开始");
                }
                //咨询支付
                if (consultTeam!=null){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_zx", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()));
                    if ("1".equals(type)) {
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                        newConfig.setKeyword1("图文咨询支付");
@ -4184,13 +4218,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                        newConfig.setKeyword1("视频咨询支付");
                    }
                    newConfig.setKeyword2( hospitalDO.getOrgName());
                    newConfig.setKeyword3( consDoctorDO.getName());
                    newConfig.setKeyword2(outpatientDO.getHospitalName());
                    newConfig.setKeyword3(outpatientDO.getDoctorName());
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                    logger.info("眼科微信消息模板推送 咨询支付提醒开始");
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 就诊支付提醒开始");
                }else {
                    //咨询支付
                    if (consultTeam!=null){
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_zx", scene, 1);
                        BeanUtils.copyProperties(config, newConfig);
                        newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()));
                        if ("1".equals(type)) {
                            newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
                            newConfig.setKeyword1("图文咨询支付");
                        } else if ("17".equals(type)) {
                            newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
                            newConfig.setKeyword1("视频咨询支付");
                        }
                        newConfig.setKeyword2( hospitalDO.getOrgName());
                        newConfig.setKeyword3( consDoctorDO.getName());
                        //发起微信消息模板推送
                        newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                        logger.info("眼科微信消息模板推送 咨询支付提醒开始");
                    }
                }
            } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
                scene = "cfzfts";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_prescription_pay_notice", scene, 1);
@ -4226,42 +4278,46 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    newConfig.setKeyword4( outpatientDO.getIcd10Name());
                    if ("16".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
                        newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    } else if ("17".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
                        newConfig.setUrl(newConfig.getUrl().replace("type=16","type=17") + "" + outpatientDO.getId());
                    }
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 视频问诊接诊提醒开始");
                }
                if (consultTeam!=null){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_zx", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()).replace("key2", consDoctorDO.getJobTitleName()));
                    newConfig.setKeyword1( consDoctorDO.getName());
                    newConfig.setKeyword2(DateUtil.dateToStrLong(consultTeam.getCzrq()));//咨询暂无挂号时间
                    newConfig.setKeyword3( hospitalDO.getDeptName());
                    newConfig.setKeyword4( consultTeam.getSymptoms());
                    if ("16".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
                    } else if ("17".equals(type)) {
                        newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
                    logger.info("眼科微信消息模板推送 视频问诊接诊提醒开始");
                }else {
                    if (consultTeam!=null){
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_zx", scene, 1);
                        BeanUtils.copyProperties(config, newConfig);
                        newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()).replace("key2", consDoctorDO.getJobTitleName()));
                        newConfig.setKeyword1( consDoctorDO.getName());
                        newConfig.setKeyword2(DateUtil.dateToStrLong(consultTeam.getCzrq()));//咨询暂无挂号时间
                        newConfig.setKeyword3( hospitalDO.getDeptName());
                        newConfig.setKeyword4( consultTeam.getSymptoms());
                        if ("16".equals(type)) {
                            newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
                        } else if ("17".equals(type)) {
                            newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
                        }
                        //发起微信消息模板推送
                        newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                        logger.info("眼科微信消息模板推送 视频咨询接诊提醒开始");
                    }
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
                    logger.info("眼科微信消息模板推送 视频咨询接诊提醒开始");
                }
            } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
                scene = "spwzyytx";
                if (StringUtils.isNotEmpty(outpatientId)){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice_fz", scene, 1);
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    if ("16".equals(type)) {
                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊"));
                    }
                    if ("17".equals(type)) {
                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                    }
                    newConfig.setKeyword1( outpatientDO.getConsumerName());
                    newConfig.setKeyword2( outpatientDO.getDeptName());
                    newConfig.setKeyword3( outpatientDO.getDoctorName());
@ -4270,24 +4326,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 视频问诊预约提醒开始");
                }
                if (consultTeam!=null){
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice_zx", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    if ("17".equals(type)) {
                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                }else {
                    if (consultTeam!=null){
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
                        BeanUtils.copyProperties(config, newConfig);
                        if ("17".equals(type)) {
                            newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
                        }
                        newConfig.setKeyword1(consPatientDO.getName());
                        newConfig.setKeyword2(hospitalDO.getDeptName());
                        newConfig.setKeyword3(consDoctorDO.getName());
                        newConfig.setKeyword4(DateUtil.dateToStrLong(consultTeam.getCzrq()));
                        newConfig.setKeyword5(generalDoctorWaitingNumber(consDoctorDO.getId(), wxId, outpatientId));
                        //发起微信消息模板推送
                        newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                        logger.info("眼科微信消息模板推送 视频咨询预约提醒开始");
                    }
                    newConfig.setKeyword1(consPatientDO.getName());
                    newConfig.setKeyword2(hospitalDO.getDeptName());
                    newConfig.setKeyword3(consDoctorDO.getName());
                    newConfig.setKeyword4(DateUtil.dateToStrLong(consultTeam.getCzrq()));
                    newConfig.setKeyword5(generalDoctorWaitingNumber(consDoctorDO.getId(), wxId, outpatientId));
                    //发起微信消息模板推送
                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                    logger.info("眼科微信消息模板推送 视频咨询预约提醒开始");
                }
            } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
                scene = "fwqjtx";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_evaluate_notice", scene, 1);
@ -4539,10 +4594,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql += " AND room.reservation_type=2 ";
        } else if (4==type){
            //专家咨询
            sql += " AND room.reservation_type=3 AND room.consult_type in (1,2,3)";
        } else {
            sql += " AND room.reservation_type=3 AND room.consult_type =1";
        } else if (1==type) {
            //在线复诊
            sql += " AND room.reservation_type=1 AND room.consult_type=" + type;
            sql += " AND room.reservation_type=1 AND room.consult_type =1";
        }else {
            sql += "  AND  room.consult_type =1";
        }
        if (StringUtils.isNoneBlank(dept)) {
@ -4551,7 +4608,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNoneBlank(sex)){
            sql += " AND patient.sex=" + sex + " ";
        }if(StringUtils.isNoneBlank(keyword)){
            sql += " AND patient.name like '%" + keyword + "%' ";
            sql += " AND outpatient.patient_name like '%" + keyword + "%' ";
        }
        if(StringUtils.isNoneBlank(ageGroup)){
            String[] age = ageGroup.split(",");
@ -5251,7 +5308,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    chargeType = chargeType.replace(",","','");
                }
                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                        "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " +
                        "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
                        " from wlyy_charge_dict where 1=1";
                sqlCharge+=" and charge_type in ( '"+chargeType+"')";
                if (StringUtils.isNoneBlank(deptTyepCode)){
@ -5840,6 +5897,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND room.outpatient_id=outpatient.id " +
                "AND consult.relation_code=outpatient.id " +
                "AND outpatient.pay_status=1 " +
                "AND outpatient.outpatient_type!=3 " +
                "AND consult.status = 0 ";
        if (StringUtils.isNoneBlank(doctor)) {
            sql = sql + "AND room.doctor='" + doctor + "' " +
@ -5944,7 +6002,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return waitCount.toString();
    }
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId,String outpatientType) {
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId,String outpatientType,String keyWord) {
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
            if(flag){
@ -5993,10 +6051,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND room.reservation_time is not null ";/* +
                "AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time ASC ";
//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";*/
        if(StringUtils.isNotBlank(outpatientType)){
            sql+=" AND outpatient.type= 2 and outpatient.outpatient_type ="+outpatientType;
        }else {
            sql+=" AND room.consult_type= 2 ";
        if(StringUtils.isNotBlank(outpatientType)&&"1".equalsIgnoreCase(outpatientType)){
            sql+="  AND room.consult_type= 2 and room.reservation_type in (1,2)";
        } else if (StringUtils.isNotBlank(outpatientType)&&"4".equalsIgnoreCase(outpatientType)) {
            sql+="  AND room.consult_type= 2 and room.reservation_type = 3";
        } else {
            sql += " AND room.consult_type= 2 ";
        }
        if (StringUtils.isNotBlank(keyWord)){
            sql += " AND outpatient.patient_name like '%"+keyWord+"%'";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if(flag){

+ 8 - 7
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -41,6 +41,7 @@ import sun.misc.BASE64Encoder;
import java.io.*;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -649,10 +650,11 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                " e.relation_code AS \"relationCode\" "+
                "FROM " +
                " base_evaluate_score a " +
                "JOIN base_evaluate e ON a.id = e.relation_code " +
                "JOIN base_doctor d ON d.id = a.doctor " +
                " JOIN base_evaluate e ON a.id = e.relation_code " +
                " JOIN base_doctor d ON d.id = a.doctor  " +
                " JOIN wlyy_consult m ON m.id = a.relation_code  " +
                "WHERE " +
                " e.score_type = '4' ";
                " e.score_type = '4' and m.id != '' and m.id is not null ";
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
@ -1520,11 +1522,11 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                " WHERE 1=1" ;
        if(StringUtils.isNotBlank(startDate)){
            yyghSql =  yyghSql + "  and p.create_time >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
            params.put("startDate",DateUtil.stringToDate(startDate+" 00:00:00","yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(endDate)){
            yyghSql =  yyghSql +  "  and p.create_time <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
            params.put("endDate",DateUtil.stringToDate(endDate+" 00:00:00","yyyy-MM-dd HH:mm:ss"));
        }
        List<Map<String,Object>> yygh = hibenateUtils.createSQLQuery(yyghSql,params);
@ -1686,8 +1688,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
            jb.put("dzcf_upload_count", dzcftotal);
            jb.put("ypmx_upload_count", infototal);
            jb.put("gctp_upload_count", gctptotal);
            jb.put("ywsj", DateUtil.dateToStr(new Date(),"yyyy-MM-dd"));
            jb.put("ywsj", startDate);
            jb.put("crt_time", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/internet/service/ykyy/YkyyInternetService.java

@ -788,7 +788,7 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                    "\tM .\"TIMESTAMP\" AS \"timestamp\",\n" +
                    "\tM . \"CONTENT\" AS \"content\",\n" +
                    "\tM . \"CONTENT_TYPE\" AS \"content_type\",\n" +
                    "\tT . \"ID\" AS \"id\"\n" +
                    "\tT . \"ID\" AS \"id\",\n" +
                    "\tM . \"SESSION_ID\" AS \"session_id\"\n" +
                    "FROM\n" +
                    "\tTOPICS T \n" +

+ 42 - 3
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1228,13 +1228,52 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    public BusinessOrderDO updatePayStatusByRelation(String relationCode) throws Exception {
        logger.info("入参:"+relationCode);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        WlyyHospitalSysDictDO changeMethod = hospitalSysDictDao.findById("consultPay");
        String changeflag="0";
        if(null!=changeMethod){
            changeflag = changeMethod.getDictValue();
        }
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
            consultDo.setPayStatus(1);
            consultOrderDao.save(consultDo);
            if ("0".equalsIgnoreCase(changeflag)){
                ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                consultDo.setPayStatus(1);
                consultOrderDao.save(consultDo);
            }else {
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                wlyyOutpatientDO.setPayStatus(1);
                WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
                if (businessOrderDO.getStatus()!=null&&businessOrderDO.getStatus()!=1){
                    //发送企业模板消息给医生
                    BasePatientDO patientDO = new BasePatientDO();
                    patientDO = patientDao.findById(outpatientDO.getPatient());
                    String msg = "";
                    String name=outpatientDO.getPatientName();
                    String sex = "";
                    String age="";
                    String date = "";
                    String title = "";
                    String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    if (patientDO!=null){
                        sex= IdCardUtil.getSexForIdcard(patientDO.getIdcard());
                        age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
                    }
                    if (outpatientDO!=null){
                        if (outpatientDO.getType().equalsIgnoreCase("1")){
                            title = "图文咨询";
                            msg = name+"("+sex+" "+age+"岁)向您发起了图文咨询,点击查看";
                        }else if (outpatientDO.getType().equalsIgnoreCase("2")){
                            title = "视频咨询";
                            date = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
                            msg = name+"("+sex+" "+age+"岁)预约了"+date+"的视频咨询,点击查看";
                        }
                    }
                    enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                    System.out.println("发送企业模板消息成功");
                }
            }
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
            wlyyOutpatientDO.setPayStatus(1);

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

@ -95,7 +95,7 @@ public class StatisticsEsService {
        String lastDay = DateUtil.getNextDay(endDate, -7);//上周的今天
        String weekFirstDay = DateUtil.getMondayOfThisWeek();//周一
        String weekLastDay = DateUtil.getSundayOfThisWeek();//周日
        JSONArray array = dateTotalStatistics2(weekFirstDay,weekLastDay,area,level,indexes[2],null,SaveModel.timeLevel_ZL,null);//本周量
        JSONArray array = dateTotalStatistics2(weekFirstDay,weekLastDay,area,level,indexes[2]+",21",null,SaveModel.timeLevel_ZL,null);//本周量
        Double prices = 0.0;
        for (int i=0;i<array.size();i++){
            JSONObject jsonObject = array.getJSONObject(i);

+ 288 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -2634,6 +2634,10 @@ public class ImService {
						"base_patient d," +
						"wlyy_consult a   " +
						"left join wlyy_outpatient op on  a.relation_code = op.id " +
						/*"FROM wlyy_outpatient op left join wlyy_consult_team b," +
						"base_patient d," +
						"wlyy_consult a   " +
						" on  a.relation_code = op.id " +*/
						"WHERE a.id=b.consult " +
						"AND b.patient=d.id ";
				if (status == 1) {
@ -3883,5 +3887,289 @@ public class ImService {
			}
		}
	}
	/**
	 * 查询医生所有的咨询记录
	 * @param doctor 医生标识
	 * @param id 会话ID(等同IM表topicId)
	 * @param type 咨询会话类型 : 0 全部
	 * @param status 咨询状态:0全部,1候诊中,2就诊中,3结束
	 * @param pagesize 分页大小
	 * @param title 标题关键字
	 * @param start_time 开始时间
	 * @param end_time 结束时间
	 * @return
	 */
	public List<Map<String,Object>>  findConsultRecordByDoctorNew(String doctor, String id,
															   String type, Integer status,
															   int page,int pagesize,
															   String title,String start_time,String end_time) {
		String  sql = "";
		sql = "SELECT " +
				"a.id AS \"id\"," +
				"op.pay_status AS \"payStatus\"," +
				"op.type as \"type\"," +
				"op.outpatient_type as \"outpatientType\"," +
				"op.description AS \"title\"," +
				"op.description AS \"symptoms\",";
		if ("xm_ykyy_wx".equals(wxId)) {
			if (flag) {
				sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			} else {
				sql = sql + "to_char(op.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
			}
		} else {
			sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
		}
		sql = sql + "op.status AS \"status\"," +
				"b.evaluate AS \"evaluate\"," +
				"d.name AS \"patientName\"," +
				"d.id as \"patientId\"," +
				"d.idcard as \"patientIdcard\"," +
				"d.sex as \"patientSex\"," +
				"op.consumer as \"consumer\"," +
				"op.consumer_name as \"consumerName\"," +
				"op.consumer_mobile as \"consumerMobile\"," +
				"op.id as \"outpatientId\"," +
				"op.type as \"consultType\"," +
				"op.general_doctor as \"generalDoctor\"," +
				"op.icd10_name as \"icd10Name\"," +
				"d.photo AS \"patientPhoto\" , " +
				"op.doctor as \"doctor\" ," +
				"op.source as \"source\"  " +
				"FROM wlyy_outpatient op LEFT JOIN wlyy_consult a  ON a.relation_code = op.id \n" +
				" LEFT join wlyy_consult_team b on a.id = b.consult" +
				" LEFT JOIN base_patient d on op.patient = d.id " +
				" WHERE 1=1 ";
		if (status == 1) {
			sql += " and op.status = 0";
		}else if (status==0){
		}else if (status==2) {
			sql += " and op.status = 1";
		}else{
			sql += " and op.status = "+status;
		}
		if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)) {
			sql += " AND op.doctor='" + doctor + "' ";
		}
		if (!StringUtils.isEmpty(title)) {
			title = "%" + title + "%";
			sql += " and op.description like '" + title + "'";
		}
		if (!StringUtils.isEmpty(start_time)) {
			if ("xm_ykyy_wx".equals(wxId)) {
				if (flag) {
					sql += " and op.create_time >= str_to_date('" + start_time + "','YYYY-MM-DD HH24:MI:SS')";
				} else {
					sql += " and op.create_time >= to_date('" + start_time + "','YYYY-MM-DD HH24:MI:SS')";
				}
			} else {
				sql += " and op.create_time >= '" + start_time + "'";
			}
		}
		if (!StringUtils.isEmpty(end_time)) {
			if ("xm_ykyy_wx".equals(wxId)) {
				if (flag) {
					sql += " and op.create_time <= str_to_date('" + end_time + "','YYYY-MM-DD HH24:MI:SS')";
				} else {
					sql += " and op.create_time <= to_date('" + end_time + "','YYYY-MM-DD HH24:MI:SS')";
				}
			} else {
				sql += " and op.create_time <= '" + end_time + "'";
			}
		}
		//咨询类型
		if(!StringUtils.isEmpty(type)){
			if (type.equalsIgnoreCase("9")){
				sql +=" AND op.type =1 and op.outpatient_type = 1";
			}else if (type.equalsIgnoreCase("16")){
				sql +=" AND op.type =2 and op.outpatient_type = 1";
			}else if (type.equalsIgnoreCase("1")){
				sql +=" AND op.type =1 and op.outpatient_type = 3";
			}else if (type.equalsIgnoreCase("15")){
				sql +=" AND op.type =3 and op.outpatient_type = 3";
			}else if (type.equalsIgnoreCase("17")){
				sql +=" AND op.type =2 and op.outpatient_type = 3";
			}else if (type.equalsIgnoreCase("12")){
				sql +=" AND op.outpatient_type = 2";
			} else {
				sql +=" AND op.type in (1,2,3) ";
			}
		}
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY op.create_time desc ";
		List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pagesize);
		for (Map<String,Object> map:mapList){
			if (map.get("patientIdcard")!=null){
				String idcard = map.get("patientIdcard").toString();
				Integer age = IdCardUtil.getAgeForIdcard(idcard);
				map.put("patientAge",age);
			}else {
				map.put("patientAge",null);
			}
			if (map.get("doctor")!=null){
				String doctorId = map.get("doctor").toString();
				BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
				List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
				if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
					map.put("deptName",doctorHospitalDOS.get(0).getDeptName());
				}
				if (baseDoctorDO!=null){
					map.put("doctorName",baseDoctorDO.getName());
				}
			}
			if (map.get("outpatientType")!=null){
				if ("3".equalsIgnoreCase(map.get("outpatientType").toString())&&"1".equalsIgnoreCase(map.get("type").toString())){
					map.put("type",1);
				}
				if ("3".equalsIgnoreCase(map.get("outpatientType").toString())&&"2".equalsIgnoreCase(map.get("type").toString())){
					map.put("type",17);
				}
				if ("3".equalsIgnoreCase(map.get("outpatientType").toString())&&"3".equalsIgnoreCase(map.get("type").toString())){
					map.put("type",15);
				}
				if ("1".equalsIgnoreCase(map.get("outpatientType").toString())&&"1".equalsIgnoreCase(map.get("type").toString())){
					map.put("type",9);
				}
				if ("1".equalsIgnoreCase(map.get("outpatientType").toString())&&"2".equalsIgnoreCase(map.get("type").toString())){
					map.put("type",16);
				}
				if ("2".equalsIgnoreCase(map.get("outpatientType").toString())){
					map.put("type",12);
				}
			}
			if (map.get("id")!=null){
				if("1".equals(type) || "15".equals(type) || type.contains(",")|| "17".equals(type)){
					String consultCode = map.get("id").toString();
					List<WlyyConsultAdvice> consultAdvices = wlyyConsultAdviceDao.getByConsult(consultCode);
					StringBuffer content = new StringBuffer();
					for (WlyyConsultAdvice consultAdvice:consultAdvices){
						content.append(consultAdvice.getAdviceValue()+",");
					}
					if (content!=null&&content.length()>0){
						System.out.println("content+====="+content);
						content.deleteCharAt(content.length()-1);
					}
					map.put("icd10Name",content);
				}else if ("0".equals(type)&&null!=map.get("outpatientType")&&"3".equalsIgnoreCase(map.get("outpatientType").toString())){
					String consultCode = map.get("id").toString();
					List<WlyyConsultAdvice> consultAdvices = wlyyConsultAdviceDao.getByConsult(consultCode);
					StringBuffer content = new StringBuffer();
					for (WlyyConsultAdvice consultAdvice:consultAdvices){
						content.append(consultAdvice.getAdviceValue()+",");
					}
					if (content!=null&&content.length()>0){
						System.out.println("content+====="+content);
						content.deleteCharAt(content.length()-1);
					}
					map.put("icd10Name",content);
				}
			}
		}
		return mapList;
	}
	/**
	 * 查询患者所有的咨询记录总数
	 * 	 * @param doctor 患者标识
	 * 	 * @param id 会话ID(等同IM表topicId)
	 * 	 * @param type 咨询会话类型
	 * 	 * @param status 咨询状态:0全部,1候诊中,2就诊中,3结束
	 * 	 * @param title 标题关键字
	 * 	 * @param start_time 开始时间
	 * 	 * @param end_time 结束时间
	 * @return
	 */
	public Long countConsultRecordByDoctor2(String doctor, String id,String type, Integer status,String title,String start_time,String end_time) {
		String  sql = "";
		sql = "SELECT " +
				" COUNT(1) AS \"total\" "+
				"FROM wlyy_outpatient op LEFT JOIN wlyy_consult a  ON a.relation_code = op.id \n" +
				" LEFT join wlyy_consult_team b on a.id = b.consult" +
				" LEFT JOIN base_patient d on op.patient = d.id " +
				" WHERE 1=1 ";
		if (status == 1) {
			sql += " and op.status = 0";
		}else if (status==0){
		}else if (status==2) {
			sql += " and op.status = 1";
		}else{
			sql += " and op.status = "+status;
		}
		if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)) {
			sql += " AND op.doctor='" + doctor + "' ";
		}
		if (!StringUtils.isEmpty(title)) {
			title = "%" + title + "%";
			sql += " and op.description like '" + title + "'";
		}
		if (!StringUtils.isEmpty(start_time)) {
			if ("xm_ykyy_wx".equals(wxId)) {
				if (flag) {
					sql += " and op.create_time >= str_to_date('" + start_time + "','YYYY-MM-DD HH24:MI:SS')";
				} else {
					sql += " and op.create_time >= to_date('" + start_time + "','YYYY-MM-DD HH24:MI:SS')";
				}
			} else {
				sql += " and op.create_time >= '" + start_time + "'";
			}
		}
		if (!StringUtils.isEmpty(end_time)) {
			if ("xm_ykyy_wx".equals(wxId)) {
				if (flag) {
					sql += " and op.create_time <= str_to_date('" + end_time + "','YYYY-MM-DD HH24:MI:SS')";
				} else {
					sql += " and op.create_time <= to_date('" + end_time + "','YYYY-MM-DD HH24:MI:SS')";
				}
			} else {
				sql += " and op.create_time <= '" + end_time + "'";
			}
		}
		//咨询类型
		if(!StringUtils.isEmpty(type)){
			if (type.equalsIgnoreCase("9")){
				sql +=" AND op.type =1 and op.outpatient_type = 1";
			}else if (type.equalsIgnoreCase("16")){
				sql +=" AND op.type =2 and op.outpatient_type = 1";
			}else if (type.equalsIgnoreCase("1")){
				sql +=" AND op.type =1 and op.outpatient_type = 3";
			}else if (type.equalsIgnoreCase("15")){
				sql +=" AND op.type =3 and op.outpatient_type = 3";
			}else if (type.equalsIgnoreCase("17")){
				sql +=" AND op.type =2 and op.outpatient_type = 3";
			}else if (type.equalsIgnoreCase("12")){
				sql +=" AND op.outpatient_type = 2";
			} else {
				sql +=" AND op.type in (1,2,3) ";
			}
		}
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY op.create_time desc ";
		List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql);
		Long count = 0L;
		if (mapList != null && mapList.size() > 0) {
			count = Long.parseLong(mapList.get(0).get("total").toString());
		}
		return count;
	}
}

+ 15 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorHospitalDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.base.doctor;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.*;
import java.util.Date;
/**
@ -66,8 +67,21 @@ public class BaseDoctorHospitalDO extends IntegerIdentityEntity {
     *
     */
	private String hisId;
    /**
     * hisid
     *
     */
    private Date createTime;
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
	public BaseDoctorHospitalDO(){}
    public BaseDoctorHospitalDO(){}
	public BaseDoctorHospitalDO(String orgCode, String orgName, String doctorDutyCode, String doctorDutyName){
	    this.orgCode = orgCode;

+ 20 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/dict/WlyyChargeDictDO.java

@ -22,6 +22,26 @@ public class WlyyChargeDictDO extends UuidIdentityEntity {
    private Date createTime;
    /**6总部7金榜8夏禾*/
    private String deptTypeCode;
    /**专家咨询费*/
    private double zjFee;
    /**协同费*/
    private double xtFee;
    public double getZjFee() {
        return zjFee;
    }
    public void setZjFee(double zjFee) {
        this.zjFee = zjFee;
    }
    public double getXtFee() {
        return xtFee;
    }
    public void setXtFee(double xtFee) {
        this.xtFee = xtFee;
    }
    public String getChargeType() {
        return chargeType;

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

@ -933,9 +933,11 @@ public class BaseHospitalRequestMapping {
     */
    public static class DodtorIM extends Basic{
        public static final String PREFIX  = "/im/doctor";
    
        //医生咨询记录查询
        public static final String records ="/records";
        //医生咨询记录查询
        public static final String records2 ="/records2";
        
        //添加(复诊咨询,协同门诊)
        public static final String addPrescriptionConsult ="/addPrescriptionConsult";

+ 14 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyChargeDictVO.java

@ -26,6 +26,20 @@ public class WlyyChargeDictVO {
    /**6总部7金榜8夏禾*/
    @ApiModelProperty(value = "6总部7金榜8夏禾", example = "模块1")
    private String deptTypeCode;
    /**专家咨询费*/
    @ApiModelProperty(value = "专家咨询费", example = "模块1")
    private double zjFee;
    /**协同费*/
    @ApiModelProperty(value = "协同费", example = "模块1")
    private double xtFee;
    public double getZjFee() {
        return zjFee;
    }
    public void setZjFee(double zjFee) {
        this.zjFee = zjFee;
    }
    public String getChargeType() {
        return chargeType;

+ 123 - 15
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -3,6 +3,7 @@ package com.yihu.jw.base.service.doctor;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.tools.corba.se.idl.ExceptionEntry;
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
import com.yihu.jw.base.service.dict.DictDoctorDutyService;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
@ -14,6 +15,7 @@ import com.yihu.jw.dict.dao.DictDoctorDutyDao;
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.DictDoctorDutyDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
@ -21,17 +23,28 @@ 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.base.org.BaseOrgDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@ -89,9 +102,26 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    private DictDoctorDutyService dictDoctorDutyService;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Value("${wechat.flag}")
    private boolean flag;
    @Value("${wechat.id}")
    private String  wxId;
    public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    /**
@ -189,6 +219,9 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "\ttb.idcard AS \"idcard\",\n" +
                "\ttb.name AS \"name\",\n" +
                "\ttb.sex AS \"sex\",\n" +
                "\ttb.orgName AS \"orgName\",\n" +
                "\ttb.deptname AS \"deptname\",\n" +
                "\ttb.doctorDutyName AS \"doctorDutyName\",\n" +
                "\ttb.mobile AS \"mobile\",";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if (flag){
@ -219,6 +252,9 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "\t\tEND AS sex,\n" +
                "\t\tdoc.mobile,\n" +
                "\t\thos.org_name || '/' || dept. NAME || '/' || hos.doctor_duty_name AS org,\n" +
                "\t\thos.org_name as orgName,\n" +
                "\t\tdept.NAME as deptname,\n" +
                "\t\thos.doctor_duty_name as doctorDutyName,\n" +
                "\t\tdoc.job_title_name,\n" +
                "\t\tCASE\n" +
                "\tWHEN doc.del = 0 THEN\n" +
@ -254,7 +290,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "\ttb.sex,\n" +
                "\ttb.mobile,\n" +
                "\ttb.job_title_name,\n" +
                "\ttb.status,\n" +
                "\ttb.status,\n" +"\ttb.orgName,\n" +"\ttb.deptname,\n" +"\ttb.doctorDutyName,\n" +
                "  tb.create_time\n" +
                "ORDER BY\n" +
                "\ttb.create_time DESC";
@ -341,6 +377,12 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
//        List<Map<String,Object>> list = jdbcTemplate.queryForList(finalSql);
        Logger.getAnonymousLogger().info("finalCountSql="+countSql);
        int count = jdbcTemplate.queryForObject(countSql,Integer.class);
        for (Map<String,Object> map:list){
            String orgname = map.get("orgName")==null?"":map.get("orgName").toString();
            String deptname = map.get("deptname")==null?"":map.get("deptname").toString();
            String doctorDutyName = map.get("doctorDutyName")==null?"":map.get("doctorDutyName").toString();
            map.put("orgInfo",orgname+"/"+deptname+"/"+doctorDutyName);
        }
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        return result;
@ -370,35 +412,81 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        //组装医生信息
        BaseDoctorDO baseDoctorDO = null;
        BaseDoctorDO baseDoctorvo = null;
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(), BaseDoctorDO.class);
            baseDoctorvo = objectMapper.readValue(doctor.toJSONString(), BaseDoctorDO.class);
            baseDoctorDO =  baseDoctorDao.findByIdcardAndDel(baseDoctorvo.getIdcard());
            if (null==baseDoctorDO){
                baseDoctorvo.setSalt(randomString(5));
                baseDoctorvo.setEnabled(1);
                baseDoctorvo.setLocked(0);
                baseDoctorvo.setChargeType("12");
                baseDoctorvo.setBirthday(IdCardUtil.getBirthdayForIdcard(baseDoctorvo.getIdcard()));
                baseDoctorvo.setPassword(MD5.md5Hex(baseDoctorvo.getIdcard().substring(12, 18) + "{" + baseDoctorvo.getSalt() + "}"));
                baseDoctorDO = baseDoctorDao.save(baseDoctorvo);
                if ("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                }else if("xm_xzzx_wx".equalsIgnoreCase(wxId)){
                    String url = entranceUrl+"selectDoctorInfo?idCard="+baseDoctorDO.getIdcard();
                    String response = httpClientUtil.get(url,"GBK");
                    JSONObject object = JSONObject.parseObject(response);
                    String mappingCode = "";
                    if(object.getInteger("status")==200){
                        String obj = object.getString("obj");
                        JSONArray array = JSONArray.parseArray(obj);
                        if (array!=null&&array.size()!=0){
                            JSONObject jsonObjectDoctor = array.getJSONObject(0);
                            mappingCode = jsonObjectDoctor.getString("code");
                        }else {
                        }
                    }
                    DoctorMappingDO doctorMappingDO =doctorMappingDao.findByDoctor(baseDoctorDO.getId());
                    if (null==doctorMappingDO){
                        doctorMappingDO = new DoctorMappingDO();
                        doctorMappingDO.setMappingCode(mappingCode);
                        doctorMappingDO.setDoctor(baseDoctorDO.getId());
                        doctorMappingDO.setDoctorName(baseDoctorDO.getName());
                        doctorMappingDO.setOrgCode("350211A5010");
                        doctorMappingDO.setOrgName("厦门大学附属心血管病医院");
                        doctorMappingDO.setCreateTime(new Date());
                        doctorMappingDao.save(doctorMappingDO);
                    }
                }
            }
        } catch (IOException e) {
            result.put("msg", "convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        } catch (Exception e) {
            result.put("msg", "convert doctor birth failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        baseDoctorDO.setSalt(randomString(5));
        baseDoctorDO.setEnabled(1);
        baseDoctorDO.setLocked(0);
        baseDoctorDO.setPassword(MD5.md5Hex(baseDoctorDO.getIdcard().substring(12, 18) + "{" + baseDoctorDO.getSalt() + "}"));
        this.save(baseDoctorDO);
        //组装医生角色关联关系,医生默认可以没有角色,没有机构/部门信息等
        if (!CollectionUtils.isEmpty(role)) {
            BaseDoctorRoleDO baseDoctorRoleDO = null;
            List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
            List<BaseDoctorRoleDO> list = baseDoctorRoleDao.findByDoctorCode(baseDoctorDO.getId());
            if (list!=null&&list.size()>0){
                for (BaseDoctorRoleDO baseDoctorRoleDO2 : list){
                    baseDoctorRoleDao.delete(baseDoctorRoleDO2.getId());
                }
            }
            try {
                for (Object object : role) {
                    baseDoctorRoleDO = objectMapper.readValue(object.toString(), BaseDoctorRoleDO.class);
                    baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                    baseDoctorRoleDOList.add(baseDoctorRoleDO);
                    BaseDoctorRoleDO baseDoctorRoleDO1 = baseDoctorRoleDao.findByDoctorCodeAndroleCode(baseDoctorDO.getId(),baseDoctorRoleDO.getRoleCode());
                    if (null==baseDoctorRoleDO1){
                        baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                        baseDoctorRoleDao.save(baseDoctorRoleDO);
                    }
                }
            } catch (IOException e) {
                result.put("msg", "convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
                result.put("response", ConstantUtils.FAIL);
                return result.toJSONString();
            }
            baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
        }
        // 组装医生任职机构及职业信息,医生默认可以没有角色,没有机构/部门信息等
@ -408,15 +496,32 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            try {
                for (Object object : hospital) {
                    baseDoctorHospitalDO = objectMapper.readValue(object.toString(), BaseDoctorHospitalDO.class);
                    baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                    hospitalDOList.add(baseDoctorHospitalDO);
                    BaseDoctorHospitalDO baseDoctorHospitalDO1 =  baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCodeOnly(baseDoctorHospitalDO.getOrgCode(),baseDoctorHospitalDO.getDeptCode(),baseDoctorDO.getId());
                    if (baseDoctorHospitalDO1 == null) {
                        baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                        baseDoctorHospitalDO.setDel("1");
                        baseDoctorHospitalDO.setCreateTime(new Date());
                        DictHospitalDeptDO dictHospitalDeptDO = dictHospitalDeptDao.findByCode(baseDoctorHospitalDO.getDeptCode());
                        if (null!=dictHospitalDeptDO){
                            baseDoctorHospitalDO.setDeptName(dictHospitalDeptDO.getName());
                        }
                        baseDoctorHospitalDao.save(baseDoctorHospitalDO);
                    }else {
                        try {
                            throw new Exception("添加失败,该医生以添加过相同的部门信息");
                        }catch (Exception e){
                            result.put("msg", "添加失败,该医生以添加过相同的部门信息");
                            result.put("response", ConstantUtils.FAIL);
                            return result.toJSONString();
                        }
                    }
                }
            } catch (IOException e) {
                result.put("msg", "convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
                result.put("response", ConstantUtils.FAIL);
                return result.toJSONString();
            }
            baseDoctorHospitalService.batchInsert(hospitalDOList);
        }
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", baseDoctorDO);
@ -458,6 +563,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
            BaseDoctorDO oldDoctor = baseDoctorDao.findOne(baseDoctorDO.getId());
            baseDoctorDO.setPassword(oldDoctor.getPassword());
            baseDoctorDO.setEnabled(baseDoctorDO.getDel().equalsIgnoreCase("1")?1:0);
        } catch (IOException e) {
            result.put("msg","convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
@ -523,6 +629,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",baseDoctorDO);
        return result.toJSONString();
    }
    /**
@ -545,6 +652,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            return result.toJSONString();
        }
        baseDoctorDO.setDel(del);
        baseDoctorDO.setEnabled(Integer.parseInt(del));
        this.save(baseDoctorDO);
        result.put("response",ConstantUtils.SUCCESS);
        return result.toJSONString();

+ 5 - 6
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java

@ -99,11 +99,6 @@ public class TimeoutOverDueService {
                            String outPatientId = wlyyOutpatientDO.getId();
                            String consultCode ="";
                            try {
                                consultCode = imService.getConsultCodeByOutpatientId(outPatientId);
                                logger.info("consultCode"+consultCode);
                                if(StringUtils.isNoneBlank(consultCode)) {
                                    imService.cancelRevisit(consultCode, "admin", 2);
                                }
                                    /*//医生未回复可以退费
                                    businessOrderService.consultRefund(consultCode,wechatId);
                                    wlyyOutpatientDO.setDoctorCancelRemark(cancelRemark);
@ -188,7 +183,11 @@ public class TimeoutOverDueService {
                                }
                                outpatientDao.save(wlyyOutpatientDO);
                                logger.info(wlyyOutpatientDO.getId()+"的门诊记录设置为取消");
                                consultCode = imService.getConsultCodeByOutpatientId(outPatientId);
                                logger.info("consultCode"+consultCode);
                                if(StringUtils.isNoneBlank(consultCode)) {
                                    imService.cancelRevisit(consultCode, "admin", 2);
                                }
                                }catch(Exception e)  {
                                    e.printStackTrace();
                                    logger.info("自动结束咨询报错 consultCode: "+consultCode);

+ 35 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -16,6 +16,7 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.channel.PrescriptionStatusUpdateService;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.*;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.web.BaseController;
import com.yihu.jw.wechat.service.WxTemplateService;
import io.swagger.annotations.Api;
@ -28,6 +29,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
@ -599,7 +603,14 @@ public class JobController extends BaseController {
                    break; //可选
                case "2.14" :
                    //语句
                    internetCommonService.upNsInvokeTotal(startDate,endDate);
                    long days = getDaySub(startDate,endDate);
                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                    for (int i = 0;i<days;i++){
                        endDate = format.format(com.yihu.jw.util.date.DateUtil.getPreDays(format.parse(startDate),1));
                        internetCommonService.upNsInvokeTotal(startDate,endDate);
                        startDate = endDate;
                    }
                    break; //可选
                default : //可选
                    //语句
@ -611,6 +622,29 @@ public class JobController extends BaseController {
        }
    }
    public static void main(String[] args) throws Exception {
        String startDate = "2020-08-19";
        String endDate = "2020-12-01";
        long days = getDaySub(startDate,endDate);
        System.out.println(days);
    }
    public static long getDaySub(String beginDateStr,String endDateStr) throws Exception {
        long day = 0;
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Date beginDate;
        Date endDate;
        try {
            beginDate = format.parse(beginDateStr);
            endDate = format.parse(endDateStr);
            day = (endDate.getTime()-beginDate.getTime())/(24*60*60*1000);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        System.out.println("day:"+day);
        return day;
    }
    @RequestMapping(value = "/testImg", method = RequestMethod.GET)
    @ApiOperation("测试图片")

+ 58 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -125,7 +125,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "doctor", value = "医生CODE",defaultValue = "1cd15ffe6b3a11e69f7c005056850d66")
			@RequestParam(value = "doctor",required = true) String doctor,
			@ApiParam(name = "type", value = "图文诊室:1、视频:2")
			@RequestParam(value = "type",required = true) Integer type,
			@RequestParam(value = "type",required = false) Integer type,
			@ApiParam(name = "query_status", value = "0:图文复诊候诊 1:图文复诊抢单列表")
			@RequestParam(value = "",required = false) Integer query_status,
			@ApiParam(name = "dept", value = "部门")
@ -581,8 +581,13 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "获取等待就诊的视频复诊/协同门诊", notes = "获取等待就诊的视频复诊/协同门诊")
	public ListEnvelop getWaitingForVisitVideoPrescriptionByDoctor(
			@ApiParam(name = "doctor", value = "医生CODE")
			@RequestParam(value = "doctor",required = true) String doctor)throws Exception{
		return success("请求成功",prescriptionService.getWaitingForVisitVideoPrescriptionByDoctor(doctor,wxId,""));
			@RequestParam(value = "doctor",required = true) String doctor,
			@ApiParam(name = "type", value = "1在线复诊2协同3专家咨询")
			@RequestParam(value = "type",required = false) String type,
            @ApiParam(name = "keyWord", value = "病人姓名")
            @RequestParam(value = "keyWord",required = false) String keyWord
            )throws Exception{
		return success("请求成功",prescriptionService.getWaitingForVisitVideoPrescriptionByDoctor(doctor,wxId,type,keyWord));
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.pickVideoPrescripitonWaitingPeople)
@ -673,7 +678,56 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		result.put("list",data);
		return success(result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.records2)
	@ApiOperation(value = "医生咨询记录查询")
	public Envelop records2(
			@ApiParam(name = "doctor", value = "医生id")
			@RequestParam(value = "doctor",required = false) String doctor,
			@ApiParam(name = "title", value = "咨询标题关键字")
			@RequestParam(value = "title",required = false) String title,
			@ApiParam(name = "id", value = "咨询ID")
			@RequestParam(value = "id",required = false) String id,
			@ApiParam(name = "type", value = "咨询类型")
			@RequestParam(value = "type",required = true) String type,
			@ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
			@RequestParam(value = "status",required = true) Integer status,
			@ApiParam(name = "start_time", value = "开始时间 YYYY-MM-DD HH:MM:SS")
			@RequestParam(value = "start_time",required = false) String start_time,
			@ApiParam(name = "end_time", value = "结束时间 YYYY-MM-DD HH:MM:SS")
			@RequestParam(value = "end_time",required = false) String end_time,
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = false) int page,
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		List<Map<String,Object>>  data = imService.findConsultRecordByDoctorNew(doctor, id,type,status, page,pagesize, title,start_time,end_time);
		if (data != null) {
			for(Map<String,Object> consult :data){
				//如果是协同门诊,多返回全科医生的详细信息
				if(12 == Integer.parseInt(consult.get("type").toString()) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById((String)consult.get("generalDoctor"));
					List<BaseDoctorHospitalDO> baseDoctorHospitalDOList = baseDoctorHospitalDao.findByDoctorCode((String)consult.get("generalDoctor"));
					if(baseDoctorDO!=null){
						consult.put("generalDoctorName", baseDoctorDO.getName());
					}
					if (baseDoctorHospitalDOList!=null&&baseDoctorHospitalDOList.size()!=0){
						BaseDoctorHospitalDO baseDoctorHospitalDO = baseDoctorHospitalDOList.get(0);
						consult.put("generalOrgName",baseDoctorHospitalDO.getOrgName());
						consult.put("generalDeptName",baseDoctorHospitalDO.getDeptName());
					}
				}
			}
		}
		Long total = imService.countConsultRecordByDoctor2(doctor, id,type,status,title,start_time,end_time);
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",data);
		return success(result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.testSendPrescriptionIM)
	@ApiOperation(value = "测试发送处方消息", notes = "测试发送处方消息")

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

@ -212,11 +212,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                                              @RequestParam(value = "startTime", required = false)String startTime,
                                                                              @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd’")
                                                                              @RequestParam(value = "endTime", required = false)String endTime,
                                                                              @ApiParam(name = "outpatientType", value = "1复诊2协同3咨询")
                                                                                  @RequestParam(value = "outpatientType", required = false)String outpatientType,
                                                                              @ApiParam(name = "page", value = "第几页,1开始’")
                                                                              @RequestParam(value = "page", required = false)Integer page,
                                                                              @ApiParam(name = "size", value = "每页大小")
                                                                              @RequestParam(value = "size", required = true) Integer size) {
        return prescriptionService.findReOutpatientList(patient,status,startTime,endTime,page,size);
        return prescriptionService.findReOutpatientList(patient,status,startTime,endTime,outpatientType,page,size);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientInfo)
@ -907,7 +909,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updatePatientInfo)
        @PostMapping(value = BaseHospitalRequestMapping.Prescription.updatePatientInfo)
    @ApiOperation(value = "修改居民信息", notes = "修改居民信息")
    public ObjEnvelop findPatientInfo(@ApiParam(name = "patient", value = "居民ID")
                                      @RequestParam(value = "patient", required = true)String patient,