Преглед изворни кода

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

humingfen пре 5 година
родитељ
комит
db0973bcfe
19 измењених фајлова са 443 додато и 163 уклоњено
  1. 5 1
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  2. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/DoctorWorkTimeDao.java
  3. 7 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/WorkTimeService.java
  5. 31 2
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  6. 62 21
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  7. 30 0
      business/base-service/src/main/java/com/yihu/jw/order/dao/ConsultOrderDao.java
  8. 115 107
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  9. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultDo.java
  10. 11 9
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyDoctorWorkTimeDO.java
  11. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  12. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  13. 20 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  14. 6 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  15. 3 3
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java
  16. 1 1
      server/svr-authentication/src/main/resources/bootstrap.yml
  17. 35 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  18. 92 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  19. 2 2
      svr/svr-internet-hospital/src/main/resources/application.yml

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

@ -367,5 +367,9 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
        redisTemplate.opsForValue().set(key,valueJson.toJSONString());
        redisTemplate.opsForValue().set(key,valueJson.toJSONString());
        return true;
        return true;
    }
    }
    
    public List<BaseDoctorDO> findDoctorsByIdcard(String idcard){
        List<BaseDoctorDO> doctors = baseDoctorDao.findByIdcard(idcard);
        return doctors;
    }
}
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/DoctorWorkTimeDao.java

@ -16,7 +16,7 @@ public interface DoctorWorkTimeDao extends PagingAndSortingRepository<WlyyDoctor
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.endTime > ?2 and a.endTime < ?3 order by a.startTime asc")
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.endTime > ?2 and a.endTime < ?3 order by a.startTime asc")
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTime(String doctor, Date startTime, Date endTime);
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTime(String doctor, Date startTime, Date endTime);
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.workDate like ?2 order by a.startTime asc")
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.date like ?2 order by a.startTime asc")
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTimeByMonth(String doctor, String date);
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTimeByMonth(String doctor, String date);
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.startTime >= ?2 and a.startTime <= ?3 order by a.startTime asc")
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.startTime >= ?2 and a.startTime <= ?3 order by a.startTime asc")

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

@ -3399,13 +3399,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                                                          String jobTitleNameKey, String outpatientType,
                                                                          String jobTitleNameKey, String outpatientType,
                                                                          String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,Integer page,Integer pagesize) {
                                                                          String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,Integer page,Integer pagesize) {
        if(page >=1){
      /*  if(page >=1){
            page --;
            page --;
        }
        }
    
        if (pagesize <= 0) {
        if (pagesize <= 0) {
            pagesize = 10;
            pagesize = 10;
        }
        }*/
    
    
        String sql ="SELECT " +
        String sql ="SELECT " +
                " d.id AS \"id\", " +
                " d.id AS \"id\", " +
@ -3673,7 +3673,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    t.setTimeType(time.getTimeType());
                    t.setTimeType(time.getTimeType());
                    t.setStartTime(time.getStartTime());
                    t.setStartTime(time.getStartTime());
                    t.setEndTime(time.getEndTime());
                    t.setEndTime(time.getEndTime());
                    t.setWorkDate(time.getWorkDate());
                    t.setDate(time.getDate());
                    t.setTimeInterval(time.getTimeInterval());
                    t.setTimeInterval(time.getTimeInterval());
                    t.setSourceNumber(time.getSourceNumber());
                    t.setSourceNumber(time.getSourceNumber());
                    rs.add(t);
                    rs.add(t);
@ -3697,11 +3697,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            for(WlyyDoctorWorkTimeDO time : workTimeDOs){
            for(WlyyDoctorWorkTimeDO time : workTimeDOs){
                //医生工作月份
                //医生工作月份
                String workMonth = time.getDoctor()+","+time.getWorkDate().substring(0,7);
                String workMonth = time.getDoctor()+","+time.getDate().substring(0,7);
                //判断是否是首次插入医生月份数据,如果是首次,则删除该医生当前月份排班数据数据
                //判断是否是首次插入医生月份数据,如果是首次,则删除该医生当前月份排班数据数据
                if(!workMonths.contains(workMonth)){
                if(!workMonths.contains(workMonth)){
                    workMonths.add(workMonth);
                    workMonths.add(workMonth);
                    List<WlyyDoctorWorkTimeDO> oldTimes = doctorWorkTimeDao.findDoctorWorkTimeByMonth(time.getDoctor(),"%"+time.getWorkDate().substring(0,7)+"%");
                    List<WlyyDoctorWorkTimeDO> oldTimes = doctorWorkTimeDao.findDoctorWorkTimeByMonth(time.getDoctor(),"%"+time.getDate().substring(0,7)+"%");
                    doctorWorkTimeDao.delete(oldTimes);
                    doctorWorkTimeDao.delete(oldTimes);
                }
                }
            }
            }
@ -4127,7 +4127,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
    
        Long waitVideoCount = 0l;
        Long waitVideoCount = 0l;
        if (rstotal != null && rstotal.size() > 0) {
        if (rstotal != null && rstotal.size() > 0) {
            waitVideoCount = (Long) rstotal.get(0).get("total");
            waitVideoCount = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        }
    
    
        return waitVideoCount;
        return waitVideoCount;

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/WorkTimeService.java

@ -242,7 +242,7 @@ public class WorkTimeService {
        String workDate = date+"-"+day;
        String workDate = date+"-"+day;
        logger.info("workDate:"+workDate);
        logger.info("workDate:"+workDate);
        workTimeDO.setWorkDate(workDate);
        workTimeDO.setDate(workDate);
        workTimeDO.setCreateTime(new Date());
        workTimeDO.setCreateTime(new Date());
        //上午
        //上午

+ 31 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -5,13 +5,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.charts.LineChartSeries;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
@ -26,6 +26,8 @@ import java.util.Map;
@Service
@Service
public class YkyyService {
public class YkyyService {
    private Logger logger = LoggerFactory.getLogger(YkyyService.class);
    @Autowired
    @Autowired
    private HttpClientUtil httpClientUtil;
    private HttpClientUtil httpClientUtil;
    @Autowired
    @Autowired
@ -102,6 +104,7 @@ public class YkyyService {
        String response="";
        String response="";
        String url = yktUrl+"verification_code/short_message?type="+type+"&telephone="+phone;
        String url = yktUrl+"verification_code/short_message?type="+type+"&telephone="+phone;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通验证码:"+response);
        return response;
        return response;
    }
    }
@ -120,6 +123,7 @@ public class YkyyService {
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
                "&equipment_guid="+equipmentGuid;
                "&equipment_guid="+equipmentGuid;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通用户注册:"+response);
        return response;
        return response;
    }
    }
@ -135,6 +139,7 @@ public class YkyyService {
        param.put("user_id",userId);
        param.put("user_id",userId);
        String url = yktUrl+"patient/get_patient_card_list?user_id="+userId;
        String url = yktUrl+"patient/get_patient_card_list?user_id="+userId;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取就诊卡数据接口:"+response);
        return response;
        return response;
    }
    }
@ -151,6 +156,7 @@ public class YkyyService {
        String url = yktUrl+"patient/add_card?user_id="+userId+"&patient_name="+patientName+"&card="+card+"&hospital_id="+hospitalId+
        String url = yktUrl+"patient/add_card?user_id="+userId+"&patient_name="+patientName+"&card="+card+"&hospital_id="+hospitalId+
                "&hospital_name="+hospitalName+"&type="+type+"&hos_num="+hosNum;
                "&hospital_name="+hospitalName+"&type="+type+"&hos_num="+hosNum;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("添加就诊卡接口:"+response);
        return response;
        return response;
    }
    }
@ -184,6 +190,7 @@ public class YkyyService {
            url+="&app_callback_url="+appCallbackUrl;
            url+="&app_callback_url="+appCallbackUrl;
        }
        }
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通新增订单接口:"+response);
        return response;
        return response;
    }
    }
@ -198,6 +205,7 @@ public class YkyyService {
        String response="";
        String response="";
        String url = yktUrl+"doc_jkzl/update_order_state?order_no="+orderNo+"&state="+state;
        String url = yktUrl+"doc_jkzl/update_order_state?order_no="+orderNo+"&state="+state;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("更新订单支付状态:"+response);
        return response;
        return response;
    }
    }
@ -218,14 +226,34 @@ public class YkyyService {
        String url = yktUrl+"doc_jkzl/add_family?ass_user_id="+userId+"&id_card="+idcard+"&name="+name+"&sex="+sex
        String url = yktUrl+"doc_jkzl/add_family?ass_user_id="+userId+"&id_card="+idcard+"&name="+name+"&sex="+sex
                +"&birth="+birth+"&age="+age+"&tel="+tel+"&medical_card=&illness=本人&clinic_id=";
                +"&birth="+birth+"&age="+age+"&tel="+tel+"&medical_card=&illness=本人&clinic_id=";
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("增加家庭成员:"+response);
        return response;
        return response;
    }
    }
    /**
     * 获取userId
     * @param tel
     * @return
     */
    public String getUserId(String tel){
    public String getUserId(String tel){
        String response="";
        String response="";
        String url = yktUrl+"doc_jkzl/get_user_id_by_tel?tel="+tel;
        String url = yktUrl+"doc_jkzl/get_user_id_by_tel?tel="+tel;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取userId:"+response);
        return response;
    }
    /**
     * 获取医生code
     * @param doctorMapping
     * @return
     */
    public String getYktDoctor(String doctorMapping){
        String response="";
        String url = yktUrl+"doc_jkzl/get_ykt_doctorid_by_doctorcode?doctor_code="+doctorMapping;
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取userId:"+response);
        return response;
        return response;
    }
    }
@ -249,6 +277,7 @@ public class YkyyService {
            url+="user_id="+userId;
            url+="user_id="+userId;
        }
        }
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取家庭成员信息:"+response);
        return response;
        return response;
    }
    }

+ 62 - 21
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1,8 +1,10 @@
package com.yihu.jw.order;
package com.yihu.jw.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
@ -15,26 +17,21 @@ import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.jw.wechat.service.WxPayLogService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
@ -49,6 +46,8 @@ import java.util.*;
@Service
@Service
public class BusinessOrderService {
public class BusinessOrderService {
    private Logger logger = LoggerFactory.getLogger(BusinessOrderService.class);
    @Autowired
    @Autowired
    private BusinessOrderDao businessOrderDao;
    private BusinessOrderDao businessOrderDao;
    @Autowired
    @Autowired
@ -67,6 +66,9 @@ public class BusinessOrderService {
    private DoctorMappingDao doctorMappingDao;
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private ConsultOrderDao consultOrderDao;
    /**
    /**
@ -79,6 +81,14 @@ public class BusinessOrderService {
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(0);
        businessOrderDO.setStatus(0);
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setUploadStatus(0);
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/zjzx");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/consult");
        }else {
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/twzs");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/review");
        }
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        String patient = businessOrderDO.getPatient();
        String patient = businessOrderDO.getPatient();
        BasePatientDO basePatientDO = patientDao.findById(patient);
        BasePatientDO basePatientDO = patientDao.findById(patient);
@ -94,7 +104,21 @@ public class BusinessOrderService {
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorMappingDO.getMappingCode(),payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
        String yktDoctor ="";
        JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
        if (jsonObject.getInteger("code")==200){
            JSONArray array = jsonObject.getJSONArray("data");
            if (array!=null&&array.size()!=0){
                yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
            }
        }
        String response=ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,yktDoctor,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("code")==200){
            businessOrderDO.setUploadStatus(1);
            businessOrderDao.save(businessOrderDO);
        }
        return businessOrderDO;
        return businessOrderDO;
    }
    }
@ -136,7 +160,7 @@ public class BusinessOrderService {
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String url = wxWechatDO.getBaseUrl();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url+"/ykyy"+BaseHospitalRequestMapping.WxPay.Notify;
        String notifyUrl =url;
        Map<String,Object> map = unifiedorder(wechatId,description,businessOrderDO.getPayPrice().toString(),WeChatConfig.TRADE_TYPE_JSAPI,openId,orderNo,notifyUrl);
        Map<String,Object> map = unifiedorder(wechatId,description,businessOrderDO.getPayPrice().toString(),WeChatConfig.TRADE_TYPE_JSAPI,openId,orderNo,notifyUrl);
        String doctorId = "";
        String doctorId = "";
        if (doctorMappingDO!=null){
        if (doctorMappingDO!=null){
@ -197,7 +221,7 @@ public class BusinessOrderService {
        String ourTradeNo = businessOrderDO.getOrderNo();
        String ourTradeNo = businessOrderDO.getOrderNo();
        String url = wxWechatDO.getBaseUrl();
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url+"/ykyy"+BaseHospitalRequestMapping.WxPay.Notify;
        String notifyUrl =url;
        Map<String,Object> map = unifiedorder(wechatId,body,totalFee,WeChatConfig.TRADE_TYPE_JSAPI,openid,ourTradeNo,notifyUrl);
        Map<String,Object> map = unifiedorder(wechatId,body,totalFee,WeChatConfig.TRADE_TYPE_JSAPI,openid,ourTradeNo,notifyUrl);
        return map;
        return map;
    }
    }
@ -214,7 +238,6 @@ public class BusinessOrderService {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    @Transactional(rollbackFor = Exception.class)
    public  Map<String,Object> unifiedorder(String wechatId,String body,String totalFee,String tradeType,String openId,String ourTradeNo,String notifyUrl) throws Exception {
    public  Map<String,Object> unifiedorder(String wechatId,String body,String totalFee,String tradeType,String openId,String ourTradeNo,String notifyUrl) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(wxWechatDO==null){
        if(wxWechatDO==null){
@ -240,6 +263,7 @@ public class BusinessOrderService {
        map.put("mch_id",wxWechatDO.getMchId());
        map.put("mch_id",wxWechatDO.getMchId());
        map.put("body",body);
        map.put("body",body);
        map.put("out_trade_no",ourTradeNo);
        map.put("out_trade_no",ourTradeNo);
        map.put("fee_type","CNY");
        map.put("total_fee",totalFee);
        map.put("total_fee",totalFee);
        map.put("spbill_create_ip",getServerIp());
        map.put("spbill_create_ip",getServerIp());
        map.put("notify_url",notifyUrl);
        map.put("notify_url",notifyUrl);
@ -257,6 +281,7 @@ public class BusinessOrderService {
            String result1 = HttpUtil.sendGet(openidList_url, params1);
            String result1 = HttpUtil.sendGet(openidList_url, params1);
            JSONObject json1 = new JSONObject(result1);
            JSONObject json1 = new JSONObject(result1);
        }*/
        }*/
        logger.info("map:"+map.toString());
        Map<String, Object> pay = unifiedorder(map, wxWechatDO.getAppKey());
        Map<String, Object> pay = unifiedorder(map, wxWechatDO.getAppKey());
        String returnCode = pay.get("return_code").toString();
        String returnCode = pay.get("return_code").toString();
@ -267,12 +292,11 @@ public class BusinessOrderService {
            String prepayId = pay.get("prepay_id").toString();
            String prepayId = pay.get("prepay_id").toString();
            Map<String,String> param = new HashedMap();
            Map<String,String> param = new HashedMap();
            param.put("appid",appid);
            param.put("partnerid",mchId);
            param.put("prepayid",prepayId);
            param.put("package","Sign=WXPay");
            param.put("noncestr",nonceStr);
            param.put("timestamp",getTimeStamp());
            param.put("appId",appid);
            param.put("package","prepay_id="+prepayId);
            param.put("nonceStr",nonceStr);
            param.put("signType","MD5");
            param.put("timeStamp",getTimeStamp());
            param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
            param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
            pay.put("jsapi",param);
            pay.put("jsapi",param);
        }
        }
@ -421,6 +445,7 @@ public class BusinessOrderService {
    public Map<String,String> getWxPayResultNotify(String result) {
    public Map<String,String> getWxPayResultNotify(String result) {
        Map<String,String> rs = new HashedMap();
        Map<String,String> rs = new HashedMap();
        Map<String,Object> wxrs =  XMLUtil.xmltoMap(result);
        Map<String,Object> wxrs =  XMLUtil.xmltoMap(result);
        logger.info("回调参数");
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
            // 我方 订单号+时间差
            // 我方 订单号+时间差
            String seqNo = wxrs.get("out_trade_no")+"";
            String seqNo = wxrs.get("out_trade_no")+"";
@ -433,6 +458,13 @@ public class BusinessOrderService {
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            businessOrderDO.setPayTime(DateUtil.strToDate(timeEnd,DateUtil.YYYY_MM_DD_HH_MM_SS));
            businessOrderDO.setPayTime(DateUtil.strToDate(timeEnd,DateUtil.YYYY_MM_DD_HH_MM_SS));
            businessOrderDO.setStatus(1);
            businessOrderDO.setStatus(1);
            if (businessOrderDO!=null){
                if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
                    ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                    consultDo.setPayStatus(1);
                    consultOrderDao.save(consultDo);
                }
            }
            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),businessOrderDO.getStatus().toString());
            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),businessOrderDO.getStatus().toString());
            //操作微信日志表记录
            //操作微信日志表记录
            List<WxPayLogDO> wxPayLogDOs = wxPayLogDao.findBySeqNo(seqNo);
            List<WxPayLogDO> wxPayLogDOs = wxPayLogDao.findBySeqNo(seqNo);
@ -468,7 +500,16 @@ public class BusinessOrderService {
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String response = ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorMappingDO.getMappingCode(),payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
        String yktDoctor ="";
        JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
        if (jsonObject.getInteger("code")==200){
            JSONArray array = jsonObject.getJSONArray("data");
            if (array!=null&&array.size()!=0){
                yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
            }
        }
        String response = ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,yktDoctor,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        return response;
        return response;
    }
    }

+ 30 - 0
business/base-service/src/main/java/com/yihu/jw/order/dao/ConsultOrderDao.java

@ -0,0 +1,30 @@
package com.yihu.jw.order.dao;
import com.yihu.jw.entity.base.im.ConsultDo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 咨询表DAO类
 * @author huangwenjie
 */
public interface ConsultOrderDao extends PagingAndSortingRepository<ConsultDo, String>, JpaSpecificationExecutor<ConsultDo> {
	
//	@Query("from ConsultDo a where a.relationCode = ?1")
//	ConsultDo findByRelationCode(String outpatientid);
//	// 查询患者咨询记录
//	Page<Object> findByPatient(String patient, String title, String id, PageRequest pageRequest);
//
//	// 查询患者咨询记录
//	Page<Object> findByPatient(String patient, String title, PageRequest pageRequest);
//
//	// 查询患者咨询记录
//	@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team,b.evaluate,a.signCode  from ConsultDo a,ConsultTeamDo b where a.code = b.consult and a.patient = ?1 and a.id < ?2 and a.del = '1' and a.type<>8 order by a.czrq desc")
//	Page<Object> findByPatient(String patient, String id, Pageable pageRequest);
//
//	// 查询患者咨询记录
//	@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team,b.evaluate,a.signCode  from ConsultDo a,ConsultTeamDo b where a.code = b.consult and a.patient = ?1 and a.del = '1' and a.type<>8 order by a.czrq desc")
//	Page<Object> findByPatient(String patient, Pageable pageRequest);
}

+ 115 - 107
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -45,6 +45,7 @@ import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.apache.http.NameValuePair;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.message.BasicNameValuePair;
@ -157,6 +158,9 @@ public class ImService {
	
	
	@Autowired
	@Autowired
	private StringRedisTemplate redisTemplate;
	private StringRedisTemplate redisTemplate;
	@Autowired
	private HibenateUtils hibenateUtils;
	
	
	
	
	
	
@ -170,35 +174,36 @@ public class ImService {
	 * @param status 状态
	 * @param status 状态
	 * @return
	 * @return
	 */
	 */
	public List<ConsultVO>  findConsultRecordByPatient(String patient, String id,String type, int page,int pagesize, String title,Integer status) {
	public List<Map<String,Object>>  findConsultRecordByPatient(String patient, String id,String type, int page,int pagesize, String title,Integer status,Integer payStatus) {
		if(page >=1){
	/*	if(page >=1){
			page --;
			page --;
		}
		}
		
		
		if (pagesize <= 0) {
		if (pagesize <= 0) {
			pagesize = 10;
			pagesize = 10;
		}
		}*/
		
		
		String  sql = "SELECT " +
		String  sql = "SELECT " +
				"a.id AS id," +
				"a.type AS type," +
				"a.title AS title," +
				"a.symptoms AS symptoms," +
				"a.czrq AS czrq," +
				"b.status AS status," +
				"b.evaluate AS evaluate," +
				"d.name AS doctorName," +
				"d.photo AS doctorphoto," +
				"d.job_title_name AS jobTitleName, " +
				"h.dept_name AS deptName " +
				"a.id AS \"id\"," +
				"a.type AS \"type\"," +
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\"," +
				"a.czrq AS \"czrq\"," +
				"b.status AS \"status\"," +
				"b.evaluate AS \"evaluate\"," +
				"d.name AS \"doctorName\"," +
				"d.photo AS \"doctorphoto\"," +
				"d.job_title_name AS \"jobTitleName\", " +
				"h.dept_name AS \"deptName\" " +
				"a.pay_status AS \"payStatus\","+
				"FROM wlyy_consult a," +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"wlyy_consult_team b," +
				"base_doctor d, " +
				"base_doctor d, " +
				"base_doctor_hospital h " +
				"base_doctor_hospital h " +
				"WHERE a.id=b.consult and d.id = h.doctor_code " +
				"WHERE a.id=b.consult and d.id = h.doctor_code " +
				"AND b.doctor=d.id AND a.patient='"+patient+"' AND a.type in ("+type+")";
				"AND b.doctor=d.id AND a.patient='"+patient+"' AND a.type in ("+type+")";
		List<ConsultVO> result = new ArrayList<>();
		/*List<ConsultVO> result = new ArrayList<>();*/
		
		
		if(!StringUtils.isEmpty(title)){
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			title="%"+title+"%";
@ -219,10 +224,13 @@ public class ImService {
		if (!StringUtils.isEmpty(id)) {
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
			sql += " and a.id = '" + id + "'";
		}
		}
		if (!StringUtils.isEmpty(payStatus)) {
			sql += " and a.pay_status = " + payStatus + "";
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		
		List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pagesize);
		/*result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));*/
		return result;
		return result;
	}
	}
	
	
@ -237,7 +245,7 @@ public class ImService {
	public Long countConsultRecordByPatient(String patient, String id,String type, String title) {
	public Long countConsultRecordByPatient(String patient, String id,String type, String title) {
		
		
		String  sql = "SELECT " +
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"wlyy_consult_team b," +
				"base_doctor d " +
				"base_doctor d " +
@ -271,7 +279,7 @@ public class ImService {
	 */
	 */
	public String  getUnfinishedConsult(String patient, String doctor) {
	public String  getUnfinishedConsult(String patient, String doctor) {
		
		
		String totalSql = "SELECT a.consult as consultCode " +
		String totalSql = "SELECT a.consult as \"consultCode\" " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"WHERE a.consult=b.consult " +
				"WHERE a.consult=b.consult " +
				"AND a.patient= '" +patient+"' "+
				"AND a.patient= '" +patient+"' "+
@ -309,7 +317,7 @@ public class ImService {
	public JSONObject  getUnfinishedConsultByActualSender(String patient, String general_doctor) {
	public JSONObject  getUnfinishedConsultByActualSender(String patient, String general_doctor) {
		JSONObject result = new JSONObject();
		JSONObject result = new JSONObject();
		
		
		String totalSql = "SELECT a.consult as consultCode,a.doctor as specialDoctor " +
		String totalSql = "SELECT a.consult as \"consultCode\",a.doctor as \"specialDoctor\"  " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"WHERE a.consult=b.consult " +
				"WHERE a.consult=b.consult " +
				"AND a.patient= '" +patient+"' "+
				"AND a.patient= '" +patient+"' "+
@ -938,6 +946,7 @@ public class ImService {
		re.put("patient",patient);
		re.put("patient",patient);
		re.put("patientName",tempPatient.getName());
		re.put("patientName",tempPatient.getName());
		re.put("patient_idcard",tempPatient.getIdcard());
		re.put("patient_idcard",tempPatient.getIdcard());
		re.put("consult",consult.getId());
		return re;
		return re;
		
		
	}
	}
@ -959,6 +968,7 @@ public class ImService {
		consult.setSymptoms(symptoms);
		consult.setSymptoms(symptoms);
		consult.setImages(images);
		consult.setImages(images);
		consult.setType(type);
		consult.setType(type);
		consult.setPayStatus(0);
		return consultDao.save(consult);
		return consultDao.save(consult);
	}
	}
	
	
@ -1485,7 +1495,7 @@ public class ImService {
	 * @return
	 * @return
	 */
	 */
	public String getOutpatientidByConsoultCode(String consult) {
	public String getOutpatientidByConsoultCode(String consult) {
		String totalSql = "SELECT relation_code FROM wlyy_consult WHERE id='"+consult+"' ";
		String totalSql = "SELECT relation_code as \"relation_code\" FROM wlyy_consult WHERE id='"+consult+"' ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		String id = "";
		String id = "";
		if (rstotal != null && rstotal.size() > 0) {
		if (rstotal != null && rstotal.size() > 0) {
@ -1582,15 +1592,15 @@ public class ImService {
	public List<Map<String,Object>> getEvaluationByConsultCode(String consult) {
	public List<Map<String,Object>> getEvaluationByConsultCode(String consult) {
		//查询评价明细
		//查询评价明细
		String sqlScoreList = "SELECT " +
		String sqlScoreList = "SELECT " +
				"a.score as score," +
				"a.score_type as score_type," +
				"a.content as content," +
				"b.create_time as create_time," +
				"c.type as type," +
				"c.name as patientname," +
				"b.id as id," +
				"c.photo as patientphoto," +
				"b.type as niming " +
				"a.score as \"score\"," +
				"a.score_type as \"score_type\"," +
				"a.content as \"content\"," +
				"b.create_time as \"create_time\"," +
				"c.type as \"type\"," +
				"c.name as \"patientname\"," +
				"b.id as \"id\"," +
				"c.photo as \"patientphoto\"," +
				"b.type as \"niming\" " +
				"FROM " +
				"FROM " +
				"base_evaluate a " +
				"base_evaluate a " +
				"LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
				"LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
@ -1700,18 +1710,18 @@ public class ImService {
		//专家咨询
		//专家咨询
		if("1".equals(type) || "15".equals(type) || type.contains(",")){
		if("1".equals(type) || "15".equals(type) || type.contains(",")){
			sql = "SELECT " +
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"wlyy_consult_team b," +
					"base_patient d " +
					"base_patient d " +
@ -1720,22 +1730,22 @@ public class ImService {
		}else{
		}else{
			
			
			sql = "SELECT " +
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"op.id as outpatientid," +
					"op.type as consultType," +
					"op.general_doctor as generalDoctor," +
					"op.icd10_name as icd10Name," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"op.id as \"outpatientid\"," +
					"op.type as \"consultType\"," +
					"op.general_doctor as \"generalDoctor\"," +
					"op.icd10_name as \"icd10Name\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"wlyy_consult_team b," +
					"base_patient d, " +
					"base_patient d, " +
@ -1802,7 +1812,7 @@ public class ImService {
	public Long countConsultRecordByDoctor(String doctor, String id,String type, Integer status,String title,String start_time,String end_time) {
	public Long countConsultRecordByDoctor(String doctor, String id,String type, Integer status,String title,String start_time,String end_time) {
		
		
		String  sql = "SELECT " +
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"wlyy_consult_team b," +
				"base_patient d," +
				"base_patient d," +
@ -2091,20 +2101,20 @@ public class ImService {
		}
		}
		
		
		String  sql = "SELECT " +
		String  sql = "SELECT " +
				"a.id AS id," +
				"a.type AS type," +
				"a.title AS title," +
				"a.symptoms AS symptoms," +
				"a.czrq AS czrq," +
				"b.status AS status," +
				"b.evaluate AS evaluate," +
				"d.name AS patientName," +
				"d.id as patientId," +
				"d.idcard as patientIdcard," +
				"d.sex as patientsex," +
				"d.photo AS patientphoto, " +
				"doctor.name AS doctorName, " +
				"doctor.job_title_name AS jobTitleName " +
				"a.id AS \"id\"," +
				"a.type AS \"type\"," +
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\"," +
				"a.czrq AS \"czrq\"," +
				"b.status AS \"status\"," +
				"b.evaluate AS \"evaluate\"," +
				"d.name AS \"patientName\"," +
				"d.id as \"patientId\"," +
				"d.idcard as \"patientIdcard\"," +
				"d.sex as \"patientsex\"," +
				"d.photo AS \"patientphoto\", " +
				"doctor.name AS \"doctorName\", " +
				"doctor.job_title_name AS \"jobTitleName\" " +
				"FROM wlyy_consult a," +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"wlyy_consult_team b," +
				"base_doctor doctor," +
				"base_doctor doctor," +
@ -2170,7 +2180,7 @@ public class ImService {
	public Long findexpertConsultRecordByDoctor(String doctor, String id,Integer type, Integer status,String title,String start_time,String end_time,String patient) {
	public Long findexpertConsultRecordByDoctor(String doctor, String id,Integer type, Integer status,String title,String start_time,String end_time,String patient) {
		
		
		String  sql = "SELECT " +
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"wlyy_consult_team b," +
				"base_patient d " +
				"base_patient d " +
@ -2250,7 +2260,7 @@ public class ImService {
				break;
				break;
		}
		}
		
		
		String sql = "select id, session_id, sender_id, sender_name, content_type, content, timestamp from " + data_base_name + "." +
		String sql = "id AS \"id\",session_id AS \"session_id\",sender_id AS \"sender_id\",sender_name AS \"sender_name\",content_type AS \"content_type\",content AS \"content\",timestamp AS \"timestamp\"  from " + data_base_name + "." +
				tableName + " where id in(" + content + ") order by timestamp desc ";
				tableName + " where id in(" + content + ") order by timestamp desc ";
		List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
		List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
		com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
		com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
@ -2388,28 +2398,26 @@ public class ImService {
	 * 医生待办事项列表
	 * 医生待办事项列表
	 * @param doctorCode
	 * @param doctorCode
	 * @param type
	 * @param type
	 * @param page
	 * @param pagesize
	 * @return
	 * @return
	 */
	 */
	public List<ConsultVO> doctorUpcomingList(String doctorCode, String type) {
	public List<ConsultVO> doctorUpcomingList(String doctorCode, String type) {
		String sql = "";
		String sql = "";
		if("1,15".equals(type)) {
		if("1,15".equals(type)) {
			sql = "SELECT " +
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"b.doctor AS doctorCode," +
					"b.actual_sender AS generalDoctor," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"b.doctor AS \"doctorCode\"," +
					"b.actual_sender AS \"generalDoctor\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"wlyy_consult_team b," +
					"base_patient d  " +
					"base_patient d  " +
@ -2419,20 +2427,20 @@ public class ImService {
		}
		}
		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
			sql = "SELECT " +
			sql = "SELECT " +
					"op.description AS title," +
					"op.description AS symptoms," +
					"op.create_time AS czrq," +
					"op.status AS status," +
					"op.evaluate_status AS evaluate," +
					"op.doctor AS doctorCode," +
					"op.general_doctor AS generalDoctor," +
					"patient.NAME AS patientName," +
					"patient.id AS patientId," +
					"patient.idcard AS patientIdcard," +
					"patient.sex AS patientsex," +
					"patient.photo AS patientphoto," +
					"op.id AS outpatientid," +
					"op.register_date AS registerDate," +
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\"," +
					"op.create_time AS \"czrq\"," +
					"op.status AS \"status\"," +
					"op.evaluate_status AS \"evaluate\"," +
					"op.doctor AS \"doctorCode\"," +
					"op.general_doctor AS \"generalDoctor\"," +
					"patient.NAME AS \"patientName\"," +
					"patient.id AS \"patientId\"," +
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\"," +
					"op.id AS \"outpatientid\"," +
					"op.register_date AS \"registerDate\"," +
					"op.status AS outpatientstatus " +
					"op.status AS outpatientstatus " +
					"FROM wlyy_outpatient op," +
					"FROM wlyy_outpatient op," +
					"base_patient patient " +
					"base_patient patient " +
@ -2483,7 +2491,7 @@ public class ImService {
	public List<Map<String,Object>>  getDoctorConsultCount(String doctorids) throws Exception{
	public List<Map<String,Object>>  getDoctorConsultCount(String doctorids) throws Exception{
		//医生角色
		//医生角色
		String sql = "SELECT " +
		String sql = "SELECT " +
				"count(id) AS total," +
				"count(id) AS \"total\"," +
				"doctor " +
				"doctor " +
				"FROM wlyy_consult_team " +
				"FROM wlyy_consult_team " +
				"WHERE doctor IN ("+doctorids+") AND (type=1 OR type=15) and status = 0 GROUP BY doctor";
				"WHERE doctor IN ("+doctorids+") AND (type=1 OR type=15) and status = 0 GROUP BY doctor";

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultDo.java

@ -36,6 +36,8 @@ public class ConsultDo extends UuidIdentityEntity {
	private Date endTime;
	private Date endTime;
	//关联业务表的code
	//关联业务表的code
	private String relationCode;
	private String relationCode;
	//支付状态
	private Integer payStatus;
	
	
	public String getPatient() {
	public String getPatient() {
		return patient;
		return patient;
@ -117,4 +119,12 @@ public class ConsultDo extends UuidIdentityEntity {
	public void setRelationCode(String relationCode) {
	public void setRelationCode(String relationCode) {
		this.relationCode = relationCode;
		this.relationCode = relationCode;
	}
	}
	public Integer getPayStatus() {
		return payStatus;
	}
	public void setPayStatus(Integer payStatus) {
		this.payStatus = payStatus;
	}
}
}

+ 11 - 9
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyDoctorWorkTimeDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.hospital.doctor;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Table;
import java.util.Date;
import java.util.Date;
@ -27,7 +28,7 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
    private String timeType;//1.上午00:00~12:00之前;2.下午12:00~00:00;',
    private String timeType;//1.上午00:00~12:00之前;2.下午12:00~00:00;',
    private Date startTime;//开始时间',
    private Date startTime;//开始时间',
    private Date endTime;//结束时间',
    private Date endTime;//结束时间',
    private String workDate;//排班日期',
    private String date;//排班日期',
    private Integer timeInterval;//号源间隔
    private Integer timeInterval;//号源间隔
    private Integer sourceNumber;//号源数目
    private Integer sourceNumber;//号源数目
    private Date createTime;//创建时间',
    private Date createTime;//创建时间',
@ -139,14 +140,6 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
        this.endTime = endTime;
        this.endTime = endTime;
    }
    }
    public String getWorkDate() {
        return workDate;
    }
    public void setWorkDate(String workDate) {
        this.workDate = workDate;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
    public Date getCreateTime() {
        return createTime;
        return createTime;
@ -171,4 +164,13 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
    public void setSourceNumber(Integer sourceNumber) {
    public void setSourceNumber(Integer sourceNumber) {
        this.sourceNumber = sourceNumber;
        this.sourceNumber = sourceNumber;
    }
    }
    
    @Column(name = "work_date")
    public String getDate() {
        return date;
    }
    
    public void setDate(String date) {
        this.date = date;
    }
}
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -35,6 +35,7 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private Integer status;//0待支付1支付成功2支付失败3取消
    private Integer status;//0待支付1支付成功2支付失败3取消
    private String pcCallbackUrl;//Pc端查看当前订单的会话信息
    private String pcCallbackUrl;//Pc端查看当前订单的会话信息
    private String appCallbackUrl;//App端查看当前订单的会话信息
    private String appCallbackUrl;//App端查看当前订单的会话信息
    private Integer uploadStatus;//上传状态1上传0未上传
    private Date createTime;
    private Date createTime;
    private String createUser;
    private String createUser;
    private String createUserName;
    private String createUserName;
@ -236,4 +237,13 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    public void setAppCallbackUrl(String appCallbackUrl) {
    public void setAppCallbackUrl(String appCallbackUrl) {
        this.appCallbackUrl = appCallbackUrl;
        this.appCallbackUrl = appCallbackUrl;
    }
    }
    @Column(name = "upload_status")
    public Integer getUploadStatus() {
        return uploadStatus;
    }
    public void setUploadStatus(Integer uploadStatus) {
        this.uploadStatus = uploadStatus;
    }
}
}

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

@ -724,6 +724,7 @@ public class BaseHospitalRequestMapping {
        public static final String getJobBySaasId ="/getJobBySaasId";
        public static final String getJobBySaasId ="/getJobBySaasId";
        public static final String findWorkTimeInfo="/findWorkTimeInfo";
        public static final String findWorkTimeInfo="/findWorkTimeInfo";
        public static final String findLevelOneDoctorUpcoming="/findLevelOneDoctorUpcoming";
        public static final String findLevelOneDoctorUpcoming="/findLevelOneDoctorUpcoming";
        public static final String getUpcomingByDoctor="/getUpcomingByDoctor";
    }
    }
    /**
    /**

+ 20 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -1,7 +1,9 @@
package com.yihu.jw.security.core.userdetails.jdbc;
package com.yihu.jw.security.core.userdetails.jdbc;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.model.WlyyUserSimple;
@ -72,6 +74,9 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    @Value("${iHealth.user-info-uri}")
    @Value("${iHealth.user-info-uri}")
    private String iHealthUserInfoUrl;//失败重试次数
    private String iHealthUserInfoUrl;//失败重试次数
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    @Autowired
    private ClientDetailsService clientDetailsService;
    private ClientDetailsService clientDetailsService;
@ -573,6 +578,21 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        this.getJdbcTemplate().update("update base_patient p set p.openid = ? where p.id= ?", openid, userId);
        this.getJdbcTemplate().update("update base_patient p set p.openid = ? where p.id= ?", openid, userId);
    }
    }
    public void updateOpenIdAndWechatId(String openid, String userId,String wechatId) {
        List<BasePatientWechatDo> patientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,userId);
        if (patientWechatDos!=null&&patientWechatDos.size()!=0){
            this.getJdbcTemplate().update("update base_patient_wechat p set p.openid = ? where p.patient_id= ? and p.wechat_id= ? ", openid, userId,wechatId);
        }else {
            BasePatientWechatDo basePatientWechatDo=new BasePatientWechatDo();
            basePatientWechatDo.setCreateTime(new Date());
            basePatientWechatDo.setOpenid(openid);
            basePatientWechatDo.setPatientId(userId);
            basePatientWechatDo.setWechatId(wechatId);
            basePatientWechatDao.save(basePatientWechatDo);
        }
    }
    public String getSynPath(String wxId){
    public String getSynPath(String wxId){
        String sql = "SELECT w.syn_path AS sysPath FROM wx_wechat w WHERE w.id ='"+wxId+"'";
        String sql = "SELECT w.syn_path AS sysPath FROM wx_wechat w WHERE w.id ='"+wxId+"'";

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

@ -31,6 +31,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.*;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -50,6 +51,7 @@ import org.springframework.security.oauth2.provider.request.DefaultOAuth2Request
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import org.springframework.util.*;
import org.springframework.util.*;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestContextHolder;
@ -219,11 +221,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        wlyyUserSimple.setState(parameters.get("state"));
        wlyyUserSimple.setState(parameters.get("state"));
        String loginType = parameters.get("login_type");
        String loginType = parameters.get("login_type");
        String openid = parameters.get("openid");
        String openid = parameters.get("openid");
        String wechatId = parameters.get("wechatId");
        //更新患者openId
        //更新患者openId
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && "3".equals(loginType)) {
        if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && "3".equals(loginType)) {
            baseLoginLogDO.setOpenid(openid);
            baseLoginLogDO.setOpenid(openid);
            userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
            userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
            if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
            }
        }
        }
        if (parameters.get("password") != null) {
        if (parameters.get("password") != null) {
            //使用密码登录成功后, 更新失败次数为 0
            //使用密码登录成功后, 更新失败次数为 0

+ 3 - 3
server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java

@ -19,15 +19,15 @@ public class YkyyService {
    @Autowired
    @Autowired
    private HttpClientUtil httpClientUtil;
    private HttpClientUtil httpClientUtil;
    private static String yktUrl = "http://www.yanketong.com:133/api/";
    private static String yktUrl = "http://www.yanketong.com:90/";
    /**
    /**
     * 眼科医院单点登录接口
     * 眼科医院单点登录接口
     * @return
     * @return
     */
     */
    public String getDoctorInfoByVerifycode(String verifyCode){
    public String getDoctorInfoByVerifycode(String verifyCode){
        String url = "Doctor/GetDoctorInfoByverifycode";
        return httpClientUtil.get(url,"GBK");
        String url = "api/Doctor/GetDoctorInfoByverifycode";
        return httpClientUtil.get(yktUrl+url+"?verifyCode="+verifyCode,"GBK");
    }
    }
}
}

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

@ -1,6 +1,6 @@
spring:
spring:
  application:
  application:
    name: svr-authentication-ysj
    name: svr-authentication
  cloud:
  cloud:
    config:
    config:
      failFast: true
      failFast: true

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

@ -8,10 +8,12 @@ import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.im.ConsultVO;
@ -86,6 +88,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	
	
	@Autowired
	@Autowired
	FileUploadService fileUploadService;
	FileUploadService fileUploadService;
	@Autowired
	private BusinessOrderService businessOrderService;
	
	
	public FileUtil fileUtil;
	public FileUtil fileUtil;
	
	
@ -100,6 +105,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	
	
	@Value("${qywx.id}")
	@Value("${qywx.id}")
	private String qywxId;
	private String qywxId;
	@Value("${wechat.id}")
	private String wxId;
	
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
	@ApiOperation(value = "患者咨询记录查询")
	@ApiOperation(value = "患者咨询记录查询")
@ -114,15 +122,17 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
								@RequestParam(value = "type",required = true) String type,
								@RequestParam(value = "type",required = true) String type,
								@ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
								@ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
								@RequestParam(value = "status",required = false) Integer status,
								@RequestParam(value = "status",required = false) Integer status,
								@ApiParam(name = "payStatus", value = "支付状态0支付1已支付")
								@RequestParam(value = "payStatus",required = false) Integer payStatus,
								@ApiParam(name = "page", value = "第几页")
								@ApiParam(name = "page", value = "第几页")
								@RequestParam(value = "page",required = false) int page,
								@RequestParam(value = "page",required = false) int page,
								@ApiParam(name = "pagesize", value = "分页大小")
								@ApiParam(name = "pagesize", value = "分页大小")
								@RequestParam(value = "pagesize",required = false) int pagesize
								@RequestParam(value = "pagesize",required = false) int pagesize
								)throws Exception{
								)throws Exception{
		JSONArray array = new JSONArray();
		JSONArray array = new JSONArray();
		List<ConsultVO>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status);
		List<Map<String,Object>>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status,payStatus);
		
		
		if (data != null) {
		/*if (data != null) {
			for (ConsultVO consult : data) {
			for (ConsultVO consult : data) {
				if (consult == null) {
				if (consult == null) {
					continue;
					continue;
@ -152,7 +162,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				
				
				array.add(json);
				array.add(json);
			}
			}
		}
		}*/
		
		
		Long total = imService.countConsultRecordByPatient(patient, id,type,title);
		Long total = imService.countConsultRecordByPatient(patient, id,type,title);
		
		
@ -412,9 +422,30 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			data.put("type",1);
			data.put("type",1);
			systemMessageDO.setData(data.toString());
			systemMessageDO.setData(data.toString());
			hospitalSystemMessageService.saveMessage(systemMessageDO);
			hospitalSystemMessageService.saveMessage(systemMessageDO);
			BaseDoctorDO d = baseDoctorDao.findById(re.getString("doctor"));
			BaseDoctorDO d = baseDoctorDao.findById(re.getString("doctor"));
			BasePatientDO p = basePatientDao.findById(re.getString("patient"));
			BasePatientDO p = basePatientDao.findById(re.getString("patient"));
			//眼科支付订单
			if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
				if (type==1||type==2){
					BusinessOrderDO businessOrderDO = new BusinessOrderDO();
					businessOrderDO.setDoctor(doctor);
					businessOrderDO.setPatient(patient);
					businessOrderDO.setPatientName(re.getString("patientName"));
					businessOrderDO.setDescription("专家咨询费");
					businessOrderDO.setOrderCategory("1");
					if (type==1){
						businessOrderDO.setOrderType(1);
					}else if (type==17){
						businessOrderDO.setOrderType(3);
						businessOrderDO.setRelationCode(re.getString("consult"));
						businessOrderDO.setRelationName("新增专家咨询");
					}
					businessOrderService.saveOrder(businessOrderDO);
				}
			}
			//发送企业号推送
			//发送企业号推送
			try{
			try{
				
				

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

@ -8,12 +8,17 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.service.WechatInfoService;
import com.yihu.jw.wechat.service.WxUrlConfigService;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
@ -21,14 +26,17 @@ import org.apache.axis.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
/**
 * @author zmk
 * @author zmk
@ -41,6 +49,8 @@ import java.util.Map;
public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private static final Logger logger = LoggerFactory.getLogger(PatientNoLoginEndPoint.class);
    private static final Logger logger = LoggerFactory.getLogger(PatientNoLoginEndPoint.class);
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    @Autowired
@ -54,6 +64,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    private BaseDoctorInfoService baseDoctorService;
    @Autowired
    private WechatInfoService wechatInfoService;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
@ -213,4 +230,75 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
        }
        return success("请求成功",result);
        return success("请求成功",result);
    }
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.getUpcomingByDoctor)
    @ApiOperation(value = "获取医生待办详情", notes = "获取医生待办详情")
    public Envelop getUpcomingByDoctor(@ApiParam(name = "doctorIdcard", value = "doctorIdcard", required = true)
                                       @RequestParam(value = "doctorIdcard",required = true)String doctorIdcard){
        JSONObject result = new JSONObject();
        List<BaseDoctorDO> doctors = baseDoctorService.findDoctorsByIdcard(doctorIdcard);
        BaseDoctorDO doctor = new BaseDoctorDO();
        if(!doctors.isEmpty()){
            doctor = doctors.get(0);
        }else{
            return success("该身份证无法找到医生",-1);
        }
        //专家咨询
        if("412821198807284025".equals(doctorIdcard)){//测试用写死的数据
            result.put("zxCount",2);//咨询数量
            result.put("fzCount",4);//图文复诊数量
        }else{
            result.put("zxCount",imService.sessionCountByType(doctor.getId(),1,0));//咨询数量
            result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1"));//图文复诊数量
        }
        return success("请求成功",result);
    }
    /**
     * 获取微信openid
     *
     * @param code
     * @return
     */
    @RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public Envelop getOpenidByCode(String code) throws Exception {
        //通过redis获取openid, 获取不到,则调用微信接口去取
        String key = wxId+":code";
        String openid = redisTemplate.opsForValue().get(key);
        if(!StringUtils.isEmpty(openid)){
            return success(PatientRequestMapping.Wechat.api_success,openid);
        }
        openid = wechatInfoService.getOpenidByCode(code, wxId);
        redisTemplate.opsForValue().set(key,openid);
        redisTemplate.expire(key,10, TimeUnit.SECONDS);
        return success(PatientRequestMapping.Wechat.api_success,openid);
    }
    /**
     * 微信支付异步回调
     * @param request
     * @param response
     * @return
     * @throws IOException
     */
    @ResponseBody
    @ApiOperation("微信支付结果通知")
    @RequestMapping(value = "/notify", method = {RequestMethod.GET, RequestMethod.POST})
    public Map<String, String> wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String result = "";
        String inputLine;
        while ((inputLine = request.getReader().readLine()) != null) {
            result += inputLine;
        }
        request.getReader().close();
        Map<String, String> map = businessOrderService.getWxPayResultNotify(result);
        return map;
    }
}
}

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

@ -414,8 +414,8 @@ spring:
    user: admin
    user: admin
    password: admin
    password: admin
  redis:
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
    host: 192.168.33.198 # Redis server host.
    port: 6380 # Redis server port.
fastDFS:
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
fast-dfs: