Explorar el Código

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

# Conflicts:
#	business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
wangzhinan hace 4 años
padre
commit
6f93d73275

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

@ -682,7 +682,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public WlyyPrescriptionDO findPrescriptionDo(String prescriptionId){
        return prescriptionDao.findOne(prescriptionId);
    }
    
    public Map<String,Object> findPrescriptionInfo(String prescriptionId){
        //续方信息
        Map<String,Object> rs = new HashedMap();
@ -746,7 +746,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        Double price = 0.0;
        if(doctorDO!=null&&StringUtils.isNoneBlank(doctorDO.getFee())){
             price = Double.parseDouble(doctorDO.getFee());
            price = Double.parseDouble(doctorDO.getFee());
        }
        if(price==0.0){
            outpatientDO.setPayStatus(1);
@ -2475,7 +2475,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            sql =sql+  "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
                sql=sql+" e.name as \"name\", " +
        sql=sql+" e.name as \"name\", " +
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
@ -3001,21 +3001,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //机构科室信息
            List<BaseDoctorHospitalDO> hospitalDOs =  baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
            if(hospitalDOs!=null&&hospitalDOs.size()>0){
               rs.put("hospital",hospitalDOs.get(0));
               BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
               rs.put("winNo",org.getWinNo());
               rs.put("deptName",hospitalDOs.get(0).getDeptName());
               rs.put("dept",hospitalDOs.get(0).getDeptCode());
               if(StringUtils.isNotBlank(withWork)&&"1".equals(withWork)){
                  List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor,hospitalDOs.get(0).getOrgCode());
                  rs.put("workTime",times);
               }
                rs.put("hospital",hospitalDOs.get(0));
                BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
                rs.put("winNo",org.getWinNo());
                rs.put("deptName",hospitalDOs.get(0).getDeptName());
                rs.put("dept",hospitalDOs.get(0).getDeptCode());
                if(StringUtils.isNotBlank(withWork)&&"1".equals(withWork)){
                    List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor,hospitalDOs.get(0).getOrgCode());
                    rs.put("workTime",times);
                }
            }else{
               rs.put("hospital",null);
               rs.put("winNo",null);
               rs.put("deptName",null);
               rs.put("dept",null);
                rs.put("hospital",null);
                rs.put("winNo",null);
                rs.put("deptName",null);
                rs.put("dept",null);
                rs.put("workTime",null);
            }
@ -3066,13 +3066,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //专家咨询
            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
            List<Map<String,Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
    
            if(zjList!=null&&zjList.size()>0){
                rs.put("zjCount",zjList.size());
            }else{
                rs.put("zjCount",0);
            }
    
            //查询医生各项评价平均分
            String sqlscore = "SELECT " +
                    "AVG(a.score) AS \"score\"," +
@ -3083,9 +3083,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "AND b.doctor='"+doctor+"' " +
                    "GROUP BY a.score_type ORDER BY  a.score_type ASC ";
            List<Map<String,Object>> listscore = jdbcTemplate.queryForList(sqlscore);
    
            Double doctorScore = new Double("0");
    
            if(listscore!=null&&listscore.size()>0){
                for(Map<String,Object> _listscore :listscore){
                    doctorScore += Double.parseDouble(_listscore.get("score").toString());
@ -3093,13 +3093,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            doctorScore = doctorScore/3;
            rs.put("doctorScore",doctorScore);
    
            if(listscore!=null&&listscore.size()>0){
                rs.put("scoreDoctor",listscore);
            }else{
                rs.put("scoreDoctor",null);
            }
    
            //查询评价明细
            String sqlScoreList = "SELECT " +
                    "a.score as \"score\"," +
@ -3118,21 +3118,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='"+doctor+"' " +
                    "WHERE a.relation_code=b.id AND b.doctor='"+doctor+"' ";
            List<Map<String,Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
    
            if(scoreList!=null&&scoreList.size()>0){
    
//                Set<String> datelist = new HashSet<>();
    
                HashMap<String,List<Map<String,Object>>> waitinglist = new HashMap<>();
    
                if(scoreList!=null&&scoreList.size()>0){
                    for(Map<String,Object> scorepatient :scoreList){
                        String id = (String)scorepatient.get("id");
            
                        if(id == null){
                            continue;
                        }
                        
                        if(waitinglist.keySet().contains(id)){
                            waitinglist.get(id).add(scorepatient);
                        }else{
@ -3229,7 +3229,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
    
    /**
     * 居民取消复诊或者医生拒绝接诊
     * @param outPatientId
@ -3294,8 +3294,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String msg="";
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    data.put("type","9");
                   msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
                   sendWxTemplateMsg(wechatId,wlyyOutpatientDO,"9");
                    msg+=wlyyOutpatientDO.getPatientName()+",您好! 您有一个图文复诊已被医生取消,取消原因:"+cancelValue+"。取消说明:"+cancelRemark+"。";
                    sendWxTemplateMsg(wechatId,wlyyOutpatientDO,"9");
                }
                if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    data.put("type","16");
@ -3487,7 +3487,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return times;
    }
    
    /**
     * 医生可接单列表(图文复诊、视频复诊、协同门诊)
     * @param doctor
@ -3497,7 +3497,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public List<Map<String,Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type,Integer query_status,String dept) {
        
        String sql ="SELECT " +
                "room.outpatient_id AS \"id\"," +
                "room.patient_id AS \"patient_id\"," +
@ -3537,9 +3537,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //图文复诊医生抢单列表
                sql +=  "AND room.doctor IS NULL  ";
            }
            
        }
        
        //协同门诊
        if(3 == type){
            sql += " AND room.reservation_type=2 ";
@ -3547,13 +3547,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //在线复诊
            sql += " AND room.reservation_type=1 AND room.consult_type="+type ;
        }
        
        if(StringUtils.isNoneBlank(dept)){
            sql += " AND outpatient.dept='"+dept+"' ";
        }
        
        
        
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
            //根据身份证计算年龄
@ -3562,12 +3562,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
            }
        }
        
        return list;
    }
    
    public List<Map<String,Object>> findWaitingRoomPatient(String dept, Integer type) {
        
        String sql ="SELECT " +
                "patient.id AS \"id\"," +
                "patient.name AS \"name\"," +
@ -3581,7 +3581,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "wlyy_hospital_waiting_room waitingroom," +
                "base_patient patient " +
                "WHERE waitingroom.consult_type=2 AND doctor IS NOT NULL ";
        
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
            //根据身份证计算年龄
@ -3590,12 +3590,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                roompatient.put("age",DateUtil.getAgeForIdcard(idcard));
            }
        }
        
        return list;
    }
    
    public JSONObject findWaitingRoomStatusCount(String dept,String wxId) {
        
        String totalSql = "SELECT count(id) AS \"total\" FROM wlyy_hospital_waiting_room WHERE visit_status=1 ";
        if("xm_ykyy_wx".equals(wxId)){
            totalSql +=" and reservation_time >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
@ -3609,38 +3609,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
        }
        
        JSONObject result = new JSONObject();
        result.put("waiting_count",count);
        result.put("outpatient_count",count);
        result.put("waiting_count_difference",count);
        result.put("outpatient_count_difference",count);
        result.put("yesterday_waiting_count",count);
        
        return result;
    }
    
    public List<JSONObject> findClinicRoomList(String dept,String date,String consult_status,String wxId) {
        if(StringUtils.isBlank(date)){
            date = DateUtil.getStringDateShort();
        }
        
        //获取今天的排班列表
        String doctorsql ="SELECT doctor AS \"doctor\",doctor_name as \"doctor_name\",dept as \"dept\",dept_name as \"dept_name\" FROM wlyy_doctor_work_time WHERE work_date='"+date+"'";
        
        if(StringUtils.isNoneBlank(dept)){
            doctorsql = doctorsql + " and dept = '"+dept+"' ";
        }
        doctorsql = doctorsql+ " GROUP BY doctor,doctor_name,dept,dept_name";
    
        List<Map<String,Object>> doctorlist = jdbcTemplate.queryForList(doctorsql);
    
        HashMap<String ,JSONObject> result = new HashMap<>();
    
        for (int i = 0; i < doctorlist.size(); i++) {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("id",(String)doctorlist.get(0).get("doctor"));
    
            if(StringUtils.isNoneBlank((String)doctorlist.get(0).get("doctor_name"))){
                jsonObject.put("doctor_name",(String)doctorlist.get(0).get("doctor_name"));
                jsonObject.put("dept_name",(String)doctorlist.get(0).get("dept_name"));
@ -3654,10 +3654,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            jsonObject.put("waiting_count",0);
            jsonObject.put("patient_name","");
            jsonObject.put("time_cost",0);
            
            result.put((String)doctorlist.get(0).get("doctor"),jsonObject);
        }
        
        //获取预约了今天的候诊居民
        String waitingSql ="SELECT count(op.id) AS \"waitCount\"," +
                "room.doctor AS \"doctor\", " +
@ -3702,7 +3702,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }
        }
        
        //获取进行中的居民
        String onlineSql ="SELECT " +
                "room.outpatient_id AS \"id\"," +
@ -3718,7 +3718,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            onlineSql = onlineSql + "date_format(room.reservation_time,'%Y-%m-%d %H:%i:%S' )  AS \"time\",TIMESTAMPDIFF(MINUTE, room.reservation_time,NOW()) AS \"time_cost\",";
        }
                onlineSql=onlineSql+"room.doctor AS \"doctor\", " +
        onlineSql=onlineSql+"room.doctor AS \"doctor\", " +
                "room.doctor_name AS \"doctorName\" " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
@ -3771,7 +3771,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }else{
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("id",doctor);
    
                        if(StringUtils.isNoneBlank((String) onlineObj.get("doctorName"))){
                            jsonObject.put("doctor_name",(String) onlineObj.get("doctorName"));
                        }else{
@ -3786,15 +3786,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }
        }
        
        List<JSONObject> finalresult  = new ArrayList<>();
    
        for (JSONObject jsonObject : result.values()) {
            //离线:在线状态=离线
            //空闲:在线状态=在线 and 接诊状态=空闲
            //接诊中:在线状态=在线 and 接诊状态=接诊中
            
            //过滤空闲或者接诊中的居民
            if(StringUtils.isBlank(consult_status)){
                finalresult.add(jsonObject);
@ -3821,10 +3821,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            jsonObject.put("room_name",roomname);
            room_no ++;
        }
        
        return finalresult;
    }
    
    public WlyyDoctorClinicRoomDO findClinicRoomStatus(String id) {
        return wlyyDoctorClinicRoomDao.findOne(id);
    }
@ -3858,7 +3858,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return times;
    }
    
    /**
     * 根据疾病名称,热门部门查询医生
     * @param orgCode 机构码
@ -3883,7 +3883,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (pagesize <= 0) {
            pagesize = 10;
        }*/
    
        String sql ="SELECT " +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
@ -3965,28 +3965,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql+=" AND sp.disease_name like :diseaseKey";
            params.put("diseaseKey","%"+diseaseKey+"%");
        }
    
        if(StringUtils.isNotBlank(doctorNameKey)){
            sql+=" AND d.name like :doctorNameKey";
            params.put("doctorNameKey","%"+doctorNameKey+"%");
        }
        
        if(StringUtils.isNotBlank(dept)){
            sql+=" AND h.dept_code = :dept ";
            params.put("dept",dept);
        }
    
        if(StringUtils.isNotBlank(jobTitleNameKey)){
            sql+=" AND d.job_title_name  = :jobTitleNameKey ";
            params.put("jobTitleNameKey",jobTitleNameKey);
        }
    
        if(StringUtils.isNotBlank(outpatientType)){
            if(outpatientType.contains("or")){
                String[] outpatientTypeArray = outpatientType.split("or");
                sql+= " AND ( ";
            
                for (int i = 0; i < outpatientTypeArray.length; i++) {
                    sql +=" d.outpatient_type like'%"+outpatientTypeArray[i]+"%'";
                    if(i != outpatientTypeArray.length -1){
@ -4000,23 +4000,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            sql+=" AND d.outpatient_type is not null ";
        }
    
        if(StringUtils.isNotBlank(keyName)){
            sql+=" AND (h.dept_name like '%"+keyName+"%' or d.name like '%"+keyName+"%' or d.expertise like '%"+keyName+"%' )";
        }
    
        if(StringUtils.isNotBlank(workingTime)){
            sql+=" AND wk.work_date = :workingTime ";
            params.put("workingTime",workingTime);
        }
    
    
        if(StringUtils.isNotBlank(consultStatus)){
            sql+=" AND d.consult_status = :consultStatus ";
            params.put("consultStatus",consultStatus);
        }
    
        sql += " and d.del='1' order by a.total "+ consutlSort;
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pagesize);
@ -4097,7 +4097,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
            List<WlyyDoctorWorkTimeDO> workTimeDOs =makeDoctorWorkTimeDOList(doctors,wlyyDoctorWorkTimeDOs);
            saveDoctorWorkTime(workTimeDOs,date,doctors);
        //科室
            //科室
        }else if("2".equals(type)){
            String sql ="SELECT " +
@ -4513,7 +4513,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    
    /**
     * 获取正在进行中的视频复诊/协同门诊
     * @param doctor
@ -4560,8 +4560,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql = sql +"AND room.general_doctor='"+general_doctor+"' " +
                    "AND room.consult_type= 2";
        }else{}
        
    
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
            //根据身份证计算年龄
@ -4569,19 +4569,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String idcard = (String)outpatient.get("idcard");
                String patient_id = (String)outpatient.get("patient_id");
                outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
    
                String outpatient_id = (String)outpatient.get("id");
	
	            String isAlert = redisTemplate.opsForValue().get("patient_alert_"+patient_id);
	            if(StringUtils.isBlank(isAlert)){
		            outpatient.put("alert_tag",0);//已提醒
	            }else{
		            outpatient.put("alert_tag",1);//未提醒
	            }
                String isAlert = redisTemplate.opsForValue().get("patient_alert_"+patient_id);
                if(StringUtils.isBlank(isAlert)){
                    outpatient.put("alert_tag",0);//已提醒
                }else{
                    outpatient.put("alert_tag",1);//未提醒
                }
                outpatient.put("online_tag",1);//未提醒
            }
        }
    
        return list;
    }
@ -4642,7 +4642,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return waitCount.toString();
    }
    
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor,String wxId) {
        String condition = "";
        if("xm_ykyy_wx".equals(wxId)){
@ -4690,20 +4690,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql+=" order by room.reservation_time ASC ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        
        Set<String> datelist = new HashSet<>();
        
        HashMap<String,List<Map<String,Object>>> waitinglist = new HashMap<>();
        
        if(list!=null&&list.size()>0){
            //根据身份证计算年龄
            for(Map<String,Object> outpatient :list){
                String idcard = (String)outpatient.get("idcard");
                String patient_id = (String)outpatient.get("patient_id");
                outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
    
                String group_date = (String)outpatient.get("group_date");
                
                if(waitinglist.keySet().contains(group_date)){
                    waitinglist.get(group_date).add(outpatient);
                }else{
@ -4711,7 +4711,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    _cu.add(outpatient);
                    waitinglist.put(group_date,_cu);
                }
    
                //全科医生来源
                outpatient.put("general_doctor_info","");//全科医生名字
                outpatient.put("general_doctor_hospital","");//全科医生社区
@ -4721,24 +4721,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }else{
                    outpatient.put("alert_tag",1);//未提醒
                }
                
                outpatient.put("online_tag",1);//在线状态
    
                String outpatient_mobile = (String)outpatient.get("outpatient_mobile");
                if(StringUtils.isNoneBlank(outpatient_mobile)){
                    outpatient.put("mobile",outpatient_mobile);//复诊有手机号,传递复诊手机号
                }
            }
        }
    
        Collection<String> keyset= waitinglist.keySet();
        List<String> _list = new ArrayList<String>(keyset);
    
        //对key键值按字典升序排序
        Collections.sort(_list);
        com.alibaba.fastjson.JSONArray result = new com.alibaba.fastjson.JSONArray();
    
    
        for (int i = 0; i < _list.size(); i++) {
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            if(_list.get(i).equals(DateUtil.getStringDateShort())){
@ -4751,7 +4751,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return result;
    }
    
    /**
     * 医生抢单(视频)
     * @param outpatientCode
@ -4762,9 +4762,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outpatientCode);
        if(roomDOs!=null&&roomDOs.size()>0){
            for(WlyyHospitalWaitingRoomDO roomDO:roomDOs){
                    roomDO.setDoctor(doctor);
                    roomDO.setDoctorName(baseDoctorDO.getName());
                    hospitalWaitingRoomDao.save(roomDO);
                roomDO.setDoctor(doctor);
                roomDO.setDoctorName(baseDoctorDO.getName());
                hospitalWaitingRoomDao.save(roomDO);
            }
        }
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outpatientCode);
@ -4773,7 +4773,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        outpatientDao.save(wlyyOutpatientDO);
    }
    
    /**
     * 复诊视频咨询人数, 协同门诊人数
     * @param doctor
@ -4781,8 +4781,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public Long doctorIndexConsultCount(String doctor,String outpatient_type) {
    
    
        String sql ="SELECT " +
                "count(room.outpatient_id) AS total " +
                "FROM " +
@ -4801,19 +4801,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql = sql + " AND room.consult_type= 2 ";
        }else if("2".equals(outpatient_type)){
        }else{}
        
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
    
        Long videoOnlineCount = 0l;
        if (rstotal != null && rstotal.size() > 0) {
            videoOnlineCount = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
    
        return videoOnlineCount;
        
    }
    
    
    /**
     * 根据门诊唯一号,处方号,到顺丰下单,下单成功返回面单信息
     * @param admNo 门诊唯一号
@ -4821,14 +4821,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public Object getSFExpressInfo(String admNo,String realOrder,String wxId)throws Exception {
    
        //根据门诊唯一号取就诊记录
//        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByAdmNo(admNo);
        WlyyPrescriptionDO wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo,realOrder);
        
        Object result = "";
    
        System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null="+wlyyPrescriptionDOS != null);
        if(wlyyPrescriptionDOS != null){
            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId",wlyyPrescriptionDOS.getOutpatientId());
@ -4861,19 +4861,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//                    }
                    //--2020.05.20--顺丰V2.0接口已不提供查询接口,直接单下单--END
                        //请求顺丰接口下单,成功下单后,返回快递单号
                    //请求顺丰接口下单,成功下单后,返回快递单号
                    sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
                    System.out.println("获取顺丰物流面单信息:5");
                    //保存快递单号和增加处方物流记录为配送
                    sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
                    System.out.println("获取顺丰物流面单信息:6");
                    
                }
                
                if(sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())){
                    System.out.println("获取顺丰物流面单信息:7");
                    com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject();
    
                    sfJsonObject.put("mailno", sfexpress_obj.getMailno());
                    sfJsonObject.put("mailtype", "标准快递");
                    sfJsonObject.put("destcode", "592");
@ -4909,7 +4909,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        System.out.println("获取顺丰物流面单信息:9");
        return result;
    }
    
    /**
     * 根据类型获取候诊居民数量
     * @param doctor
@ -4947,12 +4947,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
    
        Long waitVideoCount = 0l;
        if (rstotal != null && rstotal.size() > 0) {
            waitVideoCount = Long.parseLong(rstotal.get(0).get("total").toString());
        }
    
        return waitVideoCount;
    }
@ -5485,10 +5485,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public com.alibaba.fastjson.JSONObject findWaitingRoomOutpatientNumberByDoctor(String doctor,String dept) {
    
        com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
        
    
        //总数
        String sqlAll = "SELECT " +
                " COUNT(room.outpatient_id) AS \"total\" " +
@ -5498,16 +5498,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND outpatient.dept='"+dept+"' ";
    
        List<Map<String, Object>> alltotal = jdbcTemplate.queryForList(sqlAll);
    
        Long totalsqlAll = 0l;
        if (alltotal != null && alltotal.size() > 0) {
            totalsqlAll = Long.parseLong(alltotal.get(0).get("total").toString());
        }
    
        object.put("all",totalsqlAll);
    
        //图文复诊
        String imgAll = "SELECT " +
                " COUNT(room.outpatient_id) AS \"total\" " +
@ -5517,16 +5517,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=1 AND outpatient.dept='"+dept+"' ";
    
        List<Map<String, Object>> imgtotal = jdbcTemplate.queryForList(imgAll);
    
        Long twCount = 0l;
        if (imgtotal != null && imgtotal.size() > 0) {
            twCount = Long.parseLong(imgtotal.get(0).get("total").toString());
        }
    
        object.put("twCount",twCount);
    
        //视频复诊
        String spsql = "SELECT " +
                " COUNT(room.outpatient_id) AS \"total\" " +
@ -5536,17 +5536,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=2 AND outpatient.dept='"+dept+"' ";
    
        List<Map<String, Object>> sptotal = jdbcTemplate.queryForList(spsql);
    
        Long spcount = 0l;
        if (sptotal != null && sptotal.size() > 0) {
            spcount = Long.parseLong(sptotal.get(0).get("total").toString());
        }
    
        object.put("spCount",spcount);
    
        
        //协同门诊
        String xtsql = "SELECT " +
                " COUNT(room.outpatient_id) AS \"total\" " +
@ -5556,21 +5556,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=2 AND outpatient.dept='"+dept+"' ";
    
        List<Map<String, Object>> xttotal = jdbcTemplate.queryForList(xtsql);
    
        Long xtcount = 0l;
        if (xttotal != null && xttotal.size() > 0) {
            xtcount = Long.parseLong(xttotal.get(0).get("total").toString());
        }
    
        object.put("xtCount",xtcount);
        
        
        return object;
    }
	
	public Map<String,Object> refuseOutpatientByDoctor(String outPatientId, String cancelType, String cancelValue, String cancelRemark) {
    public Map<String,Object> refuseOutpatientByDoctor(String outPatientId, String cancelType, String cancelValue, String cancelRemark) {
        Map<String,Object> rs = new HashedMap();
        //判断医生是否接诊
        List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outPatientId);
@ -5586,7 +5586,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
            }
        }
        
        //更改门诊状态
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outPatientId);
        wlyyOutpatientDO.setStatus("-1");
@ -5594,26 +5594,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        wlyyOutpatientDO.setDoctorCancelType(cancelType);
        wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
        outpatientDao.save(wlyyOutpatientDO);
        
        //删除门诊号源
        List<WlyyPatientRegisterTimeDO> list = patientRegisterTimeDao.findByOutpatientId(wlyyOutpatientDO.getId());
        if(list!=null&&list.size()>0){
            patientRegisterTimeDao.delete(list);
        }
        
        rs.put("code",1);
        rs.put("mes","取消成功");
        return  rs;
	}
    
    }
    /**
     * 获取居民当日就诊列表
     * @param patient
     * @return
     */
	public List<Map<String,Object>> getTodayOutpatinetList(String patient,String wxId) {
    public List<Map<String,Object>> getTodayOutpatinetList(String patient,String wxId) {
	    String condition = "";
        String condition = "";
        if("xm_ykyy_wx".equals(wxId)){
            condition = "to_char(p.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
        }else{
@ -5631,7 +5631,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
	}
    }
    /**
     * 获取doctormappingcode
@ -5678,10 +5678,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        ArchiveVO archiveVO = objectMapper.readValue(json,ArchiveVO.class);
        if(archiveVO!=null){
            if(StringUtils.isBlank(archiveVO.getBrnl00())){
               archiveVO.setBrnl00(IdCardUtil.getAgeForIdcard(archiveVO.getSfzhao())+"");
                archiveVO.setBrnl00(IdCardUtil.getAgeForIdcard(archiveVO.getSfzhao())+"");
            }
            if(StringUtils.isBlank(archiveVO.getCsrq00())){
               archiveVO.setCsrq00(DateUtil.dateToStr(IdCardUtil.getBirthdayForIdcard(archiveVO.getSfzhao()),"yyyyMMdd"));
                archiveVO.setCsrq00(DateUtil.dateToStr(IdCardUtil.getBirthdayForIdcard(archiveVO.getSfzhao()),"yyyyMMdd"));
            }
            //1为需要同步建档
            if("1".equals(type)){
@ -5738,7 +5738,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNotBlank(patient)){
            patientId = patientMappingService.findHisPatNoByPatient(patient);
        }
       return entranceService.BS10008(idcard,patientId,admitNum,ybcard,demoFlag);
        return entranceService.BS10008(idcard,patientId,admitNum,ybcard,demoFlag);
    }
    /**
@ -5844,7 +5844,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return list;
    }
    
    public void followOrgByPatient(String patientid, String doctorid, String type) {
        List<BaseDoctorPatientFollowDO> list =baseOrgPatientDao.findByDoctorAndPatient(doctorid,patientid);
        if("1".equals(type)){//关注
@ -5863,9 +5863,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
    }
    
    public List<Map<String,Object>> findDeptByKeyWord(String keyWord,Integer page,Integer pagesize) {
    
        String sql ="SELECT " +
                "dept.code AS \"deptCode\"," +
                "dept.name AS \"deptName\"," +
@ -5876,7 +5876,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "base_org org " +
                "WHERE org.CODE=dept.org_code " +
                "AND org.del=1 ";
        
        if(StringUtils.isNoneBlank(keyWord)){
            sql = sql + "AND dept.NAME LIKE '%"+keyWord+"%' ";
        }
@ -5949,10 +5949,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
                sql +="\tp.status as \"status\",\n" +
                        "\tp.check_status as \"checkStatus\",\n" +
                        "\tp.check_reason as \"checkReason\",\n" +
                        "\tp.pay_type as \"payType\"\n" +
        sql +="\tp.status as \"status\",\n" +
                "\tp.check_status as \"checkStatus\",\n" +
                "\tp.check_reason as \"checkReason\",\n" +
                "\tp.pay_type as \"payType\"\n" +
                "FROM\n" +
                "\twlyy_prescription P\n" +
                "WHERE\n" +
@ -6105,7 +6105,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        String realerOrder = prescriptionDO.getRealOrder();
                        String free  = prescriptionDO.getDrugFee()+"";
                        String recipeTime = DateUtil.dateToStr(prescriptionDO.getCreateTime(),"yyyyMMddHHmmss");
                        String applyDepaName = prescriptionDO.getDeptName();
                        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(prescriptionDO.getDoctor());
                        String applyDepaName = null;
                        if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                            applyDepaName = doctorHospitalDOS.get(0).getDeptName();
                        }
                        String applyDoctorName = prescriptionDO.getDoctorName();
                        BasePatientDO patientDO = basePatientDao.findById(patientCode);
                        String userName = null;

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

@ -561,7 +561,7 @@ public class YkyyService {
        jsonObject.put("total_fee",total_fee);
        jsonObject.put("spbill_create_ip",spbill_create_ip);
        jsonObject.put("notify_url",notify_url);
        String url = "http://www.yanketong.com/api/Doctor/GetPayCDATA4Jkzl";
        String url = "http://www.yanketong.com:90/api/Doctor/GetPayCDATA4Jkzl";
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("眼科通支付:"+response);
        return response;

+ 7 - 1
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1111,6 +1111,12 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     * 眼科通app支付
     * @param relationCode
     * @return
     * @throws UnknownHostException
     */
    public String yktAppPayJson(String relationCode) throws UnknownHostException {
        String serverIp = getServerIp();
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKT_NOTIFY_URL");
@ -1120,7 +1126,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        businessOrderDO.setPayType(5);
        businessOrderDao.save(businessOrderDO);
        String totalFee = businessOrderDO.getPayPrice().intValue()+"";
        return ykyyService.getPayCDATA4Jkzl(businessOrderDO.getDescription(),businessOrderDO.getOrderNo(),totalFee,serverIp,url);
        return ykyyService.getPayCDATA4Jkzl(businessOrderDO.getDescription(),businessOrderDO.getOrderNo(),totalFee,serverIp,notifyUrl);
    }
}

+ 14 - 6
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -782,12 +782,18 @@ public class ImService {
	 */
	public InputStream getInputStream(String mediaId,String wechat_appid) throws Exception {
		String accessToken = "";
//		//中山医院互联网医院
//		if("xm_zsyy_wx".equals(wechat_appid)){
//			accessToken = entranceService.getAccessToken("100033");
//		}else{
//			accessToken = wxAccessTokenService.getWxAccessTokenById(wechat_appid).getAccessToken();
//		}
		//中山医院互联网医院
		if("xm_zsyy_wx".equals(wechat_appid)){
			accessToken = entranceService.getAccessToken("100033");
			net.sf.json.JSONObject object1 = net.sf.json.JSONObject.fromObject(accessToken);
			if (null != object1&&null!=object1.get("respCode") && "00".equals(object1.get("respCode"))) {
				accessToken  = object1.getJSONObject("respEntity").getString("access_token");
			} else {
				throw new Exception("获取ACCESSTOKEN失败");
			}
		}else{
			accessToken = wxAccessTokenService.getWxAccessTokenById(wechat_appid).getAccessToken();
		}
		InputStream is = null;
		String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=" + accessToken + "&media_id=" + mediaId;
//		String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=30_OBJbMMPW9TnyGHKf32bcjkXtxWnzBrtqWlSMBnNk8MWpJ6qis2TnsecRYNZImgahdx30WrsI1bGco6K67-j4sT1QkDxYKBrVvjaYF6QgbY8dgBMzuoARKoaxtX3ehiYvdCLSUHvogrpF3n0GANIfCHAHUP&media_id=R_060hnyXAFyHD9HaOLl15xhDIzDvcA61-Wz34GkXmCakdrsFJqxrPEBHewmAEK9";
@ -817,6 +823,8 @@ public class ImService {
					} else {
						throw new Exception("获取ACCESSTOKEN失败");
					}
					is = getInputStreamReLoad(mediaId,wechat_appid,accessToken);
					return is;
				}else{
					wxAccessTokenService.deleteByWechatId(wechat_appid);
					accessToken = wxAccessTokenService.updateAccessToken(wechat_appid);

+ 11 - 0
svr/svr-internet-hospital/pom.xml

@ -126,6 +126,17 @@
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <!-- <scope>runtime</scope> -->
        </dependency>
        <!--<dependency>-->
            <!--<groupId>com.yihu</groupId>-->