Przeglądaj źródła

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

zdm 5 lat temu
rodzic
commit
d98c8d2bd1

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

@ -4,6 +4,8 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 *
 * 医生基础信息 数据库访问层
@ -20,5 +22,4 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO, String>, JpaSpecificationExecutor<BaseDoctorDO>  {
    BaseDoctorDO findById(String id);
}

+ 11 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OauthYlzConfigDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2019/7/26.
 */
public interface OauthYlzConfigDao extends PagingAndSortingRepository<OauthYlzConfigDO, String>, JpaSpecificationExecutor<OauthYlzConfigDO> {
}

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

@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
/**
@ -21,4 +22,10 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    WlyyOutpatientDO findById(String id);
    List<WlyyOutpatientDO> findByAdmNo(String admNo);
    @Query("from WlyyOutpatientDO a where a.generalDoctor = ?1 and a.registerDate >=?2 and a.registerDate <=?3 and a.doctor is not null order by registerDate ASC")
    List<WlyyOutpatientDO> findByGeneralDoctor(String generalDoctor, Date startDate,Date endDate);
    @Query("from WlyyOutpatientDO a where a.generalDoctor = ?1 and a.registerDate >=?2 and a.registerDate <=?3 and a.status = ?4 and a.doctor is not null order by registerDate ASC")
    List<WlyyOutpatientDO> findByGeneralDoctor(String generalDoctor, Date startDate,Date endDate,String status);
}

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

@ -21,6 +21,7 @@ import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
@ -49,6 +50,7 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.trans.TransRequest;
@ -75,7 +77,7 @@ import java.lang.Boolean;
import java.util.*;
/**
 * Created by Trick on 2019/5/17.
 * Created by Trick on 2019/5/17
 */
@Service
@Transactional
@ -135,7 +137,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PrescriptionExpressageService sfexpressService;
    @Autowired
    private WlyyDoctorOnlineTimeDao wlyyDoctorOnlineTimeDao;
    @Autowired
    private OauthYlzConfigDao oauthYlzConfigDao;
    
    @Value("${demo.flag}")
@ -533,7 +536,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    public WlyyOutpatientDO appointmentRevisit(String outpatientJson,String expressageJson,String registerJson)throws Exception{
    public WlyyOutpatientDO appointmentRevisit(String outpatientJson,String expressageJson,String registerJson,String chargeType)throws Exception{
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
@ -570,7 +573,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionExpressageDao.save(expressageDO);
        //3.创建候诊室
        createRoom(outpatient);
        createRoom(outpatient,chargeType);
        return outpatient;
    }
@ -581,7 +584,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param outpatientDO
     * @return
     */
    public Boolean createRoom(WlyyOutpatientDO outpatientDO){
    public Boolean createRoom(WlyyOutpatientDO outpatientDO,String chargeType){
        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
@ -611,6 +614,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        waitingRoom.setOutpatientId(outpatientDO.getId());
        waitingRoom.setCreateTime(new Date());
        if(StringUtils.isNotBlank(chargeType)){
            waitingRoom.setChargeType(chargeType);
        }
        hospitalWaitingRoomDao.save(waitingRoom);
        return true;
@ -1008,16 +1016,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            throw new RuntimeException("未找到医生映射信息");
        }
        //判断是否已经挂号,如果已经挂号
        if(StringUtils.isNotBlank(outpatientDO.getConNo())&&StringUtils.isNotBlank(outpatientDO.getRegisterNo())){
            net.sf.json.JSONObject res = new JSONObject();
            res.put("@RESULT","0");
            return res;
        }
        net.sf.json.JSONObject rs = entranceService.BS10111(outpatientDO.getCardNo(),doctorMappingDO.getMappingCode(),outpatientDO.getDept(),null,outpatientDO.getWinNo(),demoFlag);
        String rsCode = (String)rs.get("@RESULT");
        net.sf.json.JSONObject res = rs.getJSONObject("resquest");
        logger.info("res: " +res.toString());
        String rsCode = res.getString("@RESULT");
        if("0".equals(rsCode)){
            //存储挂号号
            String serialNo = (String)rs.get("serial_no");
            outpatientDO.setRegisterNo(serialNo);
            String conNo = (String)rs.get("@times");
            outpatientDO.setConNo(conNo);
            outpatientDao.save(outpatientDO);
        }
        //保存日志
            //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
        log.setCode("registerOutPatient");
        log.setName("挂号");
@ -1028,7 +1046,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        log.setStatus(rsCode);
        log.setCreateTime(new Date());
        wlyyHttpLogDao.save(log);
        return rs;
        return res;
    }
    /**
@ -1183,13 +1201,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    json.put("days",info.getDays());
                    json.put("frequency",info.getFrequency());
                    jsonData.add(json);
                    logger.info("json:" +json.toString());
                }
                //保存处方
                prescriptionInfoDao.save(infoDOs);
                
                //调用his开方接口
                net.sf.json.JSONObject jsonObject = entranceService.BS10112(jsonData.toJSONString(),demoFlag);
                logger.info("调用his开方接口: "+jsonObject.toString());
                //判断返回结果
                String rs = jsonObject.getString("@RESULT");
@ -1547,7 +1566,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @throws Exception
     */
    public net.sf.json.JSONObject getCardInfo(String cardNo, boolean demoFlag) throws Exception {
        return entranceService.qutpatientBalance(cardNo,true);
        return entranceService.qutpatientBalance(cardNo,demoFlag);
    }
    public List<Map<String,Object>> findWorkTimeInfo(String id){
@ -2204,6 +2223,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType," +
                " h.dept_name AS deptName," +
                " d.consult_status AS consultStatus," +
                " a.total as consultTotal" +
                " FROM " +
                " base_doctor d " +
@ -2461,6 +2481,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
    public Map<String,Object> getPatientInfoMap(BasePatientDO basePatientDO){
        Map<String,Object> rs = new HashedMap();
        rs.put("id",basePatientDO.getId());
        rs.put("name",basePatientDO.getName());
        rs.put("sex",basePatientDO.getSex());
        rs.put("provinceCode",basePatientDO.getProvinceCode());
        rs.put("provinceName",basePatientDO.getProvinceName());
        rs.put("cityCode",basePatientDO.getCityCode());
        rs.put("cityName",basePatientDO.getCityName());
        rs.put("townCode",basePatientDO.getTownCode());
        rs.put("townName",basePatientDO.getTownName());
        rs.put("idcard",basePatientDO.getIdcard());
        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        rs.put("mobile",basePatientDO.getMobile());
        return rs;
    }
    @Autowired
    private FileUploadService fileUploadService;
@ -2833,12 +2870,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    /**
     * 发起图文和视频复诊
     * 发起图文和视频协同门诊复诊
     * @param outpatientJson
     * @return
     * @throws Exception
     */
    public WlyyOutpatientDO cooperativeOutpatient(String outpatientJson,String registerJson)throws Exception{
    public WlyyOutpatientDO cooperativeOutpatient(String outpatientJson,String registerJson,String chargeType)throws Exception{
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
@ -2868,8 +2905,259 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        //3.创建候诊室
        createRoom(outpatient);
        createRoom(outpatient,chargeType);
        return outpatient;
    }
    /**
     * 验证电子健康卡授权
     * @param authorizeNo
     * @return
     */
    public Map<String,Object> checkOauthQRCode(String authorizeNo){
        Map<String,Object> rsMap = new HashedMap();
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config");
        try {
            TransRequest e = new TransRequest();
            e.setMethod("ehc.ehealthcard.auth.query");
            e.setApp_id(oauthYlzConfigDO.getAppId());
            e.setTerm_id(oauthYlzConfigDO.getTermId());
            e.setVersion(oauthYlzConfigDO.getVersion());
            e.setTimestamp(DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss"));
            e.setSign_type(oauthYlzConfigDO.getSignType());
            e.setEnc_type(oauthYlzConfigDO.getEncType());
            com.alibaba.fastjson.JSONObject bizContent = new com.alibaba.fastjson.JSONObject();
            bizContent.put("out_authorize_no", authorizeNo);
            e.setBiz_content(JSON.toJSONString(bizContent));
            EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
            TransResponse re = ehcHandler.execute(e);
            String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
            com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
            logger.info("checkOauthQRCode:"+rs);
            String ret_code = json.getString("ret_code");
            if("0000".equals(ret_code)){
                logger.info("biz_content: "+json.getString("biz_content"));
                String strBiz = json.getString("biz_content");
                com.alibaba.fastjson.JSONObject biz = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(strBiz);
//                com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
                String  auth_status = biz.getString("auth_status");
                if("succ".equals(auth_status)){
                    String idcard = biz.getString("id_no");
                    BasePatientDO patientDO =  basePatientDao.findByIdcardAndDel(idcard,"1");
                    if(patientDO == null){
                        BasePatientDO patient = new BasePatientDO();
                        String salt = UUID.randomUUID().toString().substring(0,5);
                        String mobile = biz.getString("mobile_phone");
                        String pw = idcard.substring(mobile.length()-6);
                        patient.setIdcard(idcard);
                        patient.setName(biz.getString("user_name"));
                        patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                        patient.setSalt(salt);
                        patient.setMobile(mobile);
                        patient.setDel("1");
                        patient.setEnabled(1);
                        patient.setLocked(0);
                        patient.setCreateTime(new Date());
                        patient.setUpdateTime(new Date());
                        patient.setBirthday(DateUtil.strToDate(biz.getString("birthday"),"yyyyMMdd"));
                        basePatientDao.save(patient);
                        rsMap.put("sCode",auth_status);
                        rsMap.put("sMes","success");
                        rsMap.put("patient",getPatientInfoMap(patient));
                        return rsMap;
                    }else{
                        rsMap.put("sCode",auth_status);
                        rsMap.put("sMes","success");
                        rsMap.put("patient",getPatientInfoMap(patientDO));
                        return rsMap;
                    }
                }else if("ing".equals(auth_status)){
                    rsMap.put("sCode",auth_status);
                    rsMap.put("sMes","正在授权");
                    return rsMap;
                }else if("fail".equals(auth_status)){
                    rsMap.put("sCode",auth_status);
                    rsMap.put("sMes","授权失败");
                    return rsMap;
                }else if("cancel".equals(auth_status)){
                    rsMap.put("sCode",auth_status);
                    rsMap.put("sMes","取消授权");
                    return rsMap;
                }
            }
            rsMap.put("sCode","err");
            rsMap.put("sMes","请求失败");
            return rsMap;
        }catch (Exception e){
            e.printStackTrace();
        }
        rsMap.put("sCode","err");
        rsMap.put("sMes","请求失败");
        return rsMap;
    }
    /**
     * 查询协同门诊记录
     * @param generalDoctor
     * @param startDate
     * @param endDate
     * @param status
     * @return
     */
    public Envelop findByGeneralDoctor(String generalDoctor,String startDate,String endDate,String status,Integer page,Integer size){
        String sqlTotal ="SELECT " +
                " count(1) AS total "+
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.general_doctor = '"+generalDoctor+"'";
        if(StringUtils.isNotBlank(startDate)){
            sqlTotal += " AND o.register_date >='"+startDate+" 00:00:00' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            sqlTotal += " AND o.register_date <='"+endDate+" 23:59:59' ";
        }
        if(StringUtils.isNotBlank(status)){
            sqlTotal += " AND o.status ='"+status+"'";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sqlTotal);
        logger.info("findByGeneralDoctor:  "+sqlTotal);
        Long total = 0l;
        if (rstotal != null && rstotal.size() > 0) {
            total = (Long) rstotal.get(0).get("total");
        }
        String sql ="SELECT " +
                " o.id AS id, " +
                " o.adm_no AS admNo, " +
                " o.origin_adm_no AS originAdmNo, " +
                " o.register_no AS registerNo, " +
                " o.origin_register_no AS originRegisterNo, " +
                " o.origin_con_no AS originConNo, " +
                " o.con_no AS conNo, " +
                " o.outpatient_type AS outpatientType, " +
                " o.type AS type, " +
                " o.hospital AS hospital, " +
                " o.hospital_name AS hospitalName, " +
                " o.win_no AS winNo, " +
                " o.dept AS dept, " +
                " o.dept_name AS deptName, " +
                " o.patient AS patient, " +
                " o.patient_name AS patientName, " +
                " o.doctor AS doctor, " +
                " o.doctor_name AS doctorName, " +
                " o.general_doctor AS generalDoctor, " +
                " o.general_doctor_name AS generalDoctorName, " +
                " o.idcard AS idcard, " +
                " o.card_no AS cardNo, " +
                " o.mjz AS mjz, " +
                " o.icd10 AS icd10, "+
                " o.icd10_name AS icd10Name, " +
                " o.advice AS advice, " +
                " o.adm_date AS admDate, " +
                " o.description AS description, " +
                " o.disease_img AS diseaseImg, " +
                " o.create_time AS createTime, " +
                " o.con_date AS conDate, " +
                " o.patient_cancel_type AS patientCancelType, " +
                " o.patient_cancel_value AS patientCancelValue, " +
                " o.patient_cancel_remark AS patientCancelRemark, " +
                " o.register_date AS registerDate, " +
                " o.`status` AS STATUS, " +
                " o.evaluate_status AS evaluateStatus " +
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.general_doctor = '"+generalDoctor+"'";
        if(StringUtils.isNotBlank(startDate)){
            sql+=" AND o.register_date >='"+startDate+" 00:00:00'";
        }
        if(StringUtils.isNotBlank(endDate)){
            sql+=" AND o.register_date <='"+endDate+" 23:59:59'";
        }
        if(StringUtils.isNotBlank(status)){
            sql+=" AND o.status ='"+status+"'";
        }
        sql += " ORDER BY o.register_date ASC LIMIT " + (page - 1) * size + "," + size + "";
        logger.info("findByGeneralDoctor:  "+sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        //List<WlyyOutpatientDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientDO.class));
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, total);
    }
    /**
     * 全科医生首页协同门诊统计列表
     * @param generalDoctor
     * @return
     */
    public Map<String,Object> findGeneralDoctorInfo(String generalDoctor){
        Map<String,Object> rs = new HashedMap();
        Calendar endTime = Calendar.getInstance();
        endTime.setTime(new Date());
        endTime.set(endTime.get(Calendar.YEAR),endTime.get(Calendar.MONTH),endTime.get(Calendar.DAY_OF_MONTH),23,59,59);
        //今天协同门诊列表
        List<WlyyOutpatientDO> todayList = outpatientDao.findByGeneralDoctor(generalDoctor,new Date(),endTime.getTime());
        rs.put("todayList",todayList);
        Calendar tomorrowTime = Calendar.getInstance();
        tomorrowTime.setTime(new Date());
        tomorrowTime.add(Calendar.DAY_OF_MONTH,1);
        tomorrowTime.set(endTime.get(tomorrowTime.YEAR),endTime.get(tomorrowTime.MONTH),endTime.get(tomorrowTime.DAY_OF_MONTH),00,00,00);
        endTime.add(Calendar.DAY_OF_MONTH,1);
        //明天协同门诊列表
        List<WlyyOutpatientDO> tomorrowList = outpatientDao.findByGeneralDoctor(generalDoctor,tomorrowTime.getTime(),endTime.getTime());
        rs.put("tomorrowList",tomorrowList);
        //统计科预约医生
        String sql = "SELECT " +
                " COUNT(1) AS total " +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_role r ON d.id = r.doctor_code " +
                " WHERE " +
                " r.role_code ='specialist'";
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long doctorTotal = 0l;
        if (rstotal != null && rstotal.size() > 0) {
            doctorTotal = (Long) rstotal.get(0).get("total");
        }
        rs.put("doctorTotal",doctorTotal);
        //统计在线医生
        String onlineSql="SELECT " +
                " COUNT(1) AS total " +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_role r ON d.id = r.doctor_code " +
                " WHERE " +
                " r.role_code ='specialist' " +
                " AND d.consult_status ='1'";
        List<Map<String, Object>> oltotal = jdbcTemplate.queryForList(onlineSql);
        Long onlineTotal = 0l;
        if (oltotal != null && oltotal.size() > 0) {
            onlineTotal = (Long) oltotal.get(0).get("total");
        }
        rs.put("onlineTotal",onlineTotal);
        return rs;
    }
}

+ 27 - 27
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -157,26 +157,26 @@ public class EntranceService {
        }else{
            //先调用银医通获取下载余额到his,再查询his中卡余额
            net.sf.json.JSONObject jsonObject= callYYTServerService(cardNo);
           if(null!=jsonObject && "1".equals(jsonObject.get("code").toString())){
               JSONObject msg=new JSONObject();
               msg.put("endNum","20000");
               msg.put("Msg", new net.sf.json.JSONArray() );
               JSONObject query=new JSONObject();
               query.put("@compy","=");
               query.put("@item","CARD_NO");
               query.put("@splice","and");
               query.put("@value",cardNo);
               msg.put("query",query);
               msg.put("startNum",1);
               List<String> stringList=new ArrayList<>();
               stringList.add(cardNo);
               //获取消息
               resp = MqSdkUtil.putReqAndGetResp(msg.toString(), fid, "1",stringList);
               //解析
               resp= MqSdkUtil.xml2jsonObject(resp);
           }else {
               return jsonObject;
           }
            if(null!=jsonObject && "1".equals(jsonObject.get("code").toString())){
                JSONObject msg=new JSONObject();
                msg.put("endNum","20000");
                msg.put("Msg", new net.sf.json.JSONArray() );
                JSONObject query=new JSONObject();
                query.put("@compy","=");
                query.put("@item","CARD_NO");
                query.put("@splice","and");
                query.put("@value",cardNo);
                msg.put("query",query);
                msg.put("startNum",1);
                List<String> stringList=new ArrayList<>();
                stringList.add(cardNo);
                //获取消息
                resp = MqSdkUtil.putReqAndGetResp(msg.toString(), fid, "1",stringList);
                //解析
                resp= MqSdkUtil.xml2jsonObject(resp);
            }else {
                return jsonObject;
            }
        }
        return  ConvertUtil.convertObjectEnvelopByString(resp);
@ -485,7 +485,7 @@ public class EntranceService {
        wlyyPrescriptionDiagnosisVO.setCreateTime(new Date());
        wlyyPrescriptionDiagnosisVO.setType(type);
       return wlyyPrescriptionDiagnosisVO;
        return wlyyPrescriptionDiagnosisVO;
    }
    /**
@ -751,7 +751,7 @@ public class EntranceService {
            sbs.append("<ESBEntry><AccessControl><Fid>" + fid + "</Fid><UserName>"+mqUser+"</UserName><Password>"+mqPwd+"</Password></AccessControl>");
            //MessageHeader :固定值 消费方系统编号 S60,提供方系统编号 S01
            sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>"+sourceSysCode+"</SourceSysCode><TargetSysCode>"+targetSysCode+"</TargetSysCode></MessageHeader>");
           //查询信息拼接
            //查询信息拼接
            sbs.append("<MsgInfo><endNum>20000</endNum><Msg><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root>");
            sbs.append("<resquest card_no=\"" + card_no + "\" doctor=\"" + doctor + "\" dept=\"" + dept + "\" charge_type=\"" + charge_type + "\"   win_no=\"" + win_no + "\" >");
            sbs.append("</resquest></root>]]></Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
@ -782,7 +782,7 @@ public class EntranceService {
            sbs.append("<ESBEntry><AccessControl><Fid>" + fid + "</Fid><UserName>"+mqUser+"</UserName><Password>"+mqPwd+"</Password></AccessControl>");
            //MessageHeader :固定值 消费方系统编号 S60,提供方系统编号 S01
            sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>"+sourceSysCode+"</SourceSysCode><TargetSysCode>"+targetSysCode+"</TargetSysCode></MessageHeader>");
           sbs.append("<MsgInfo><endNum>20000</endNum><Msg><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root>");
            sbs.append("<MsgInfo><endNum>20000</endNum><Msg><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root>");
            for(WlyyHisPrescriptionVO vo:patientSubscribeJkedus){
                //必输字段
                sbs.append("<resquest card_no=\"" + vo.getCardNo() + "\" doctor=\"" + vo.getDoctor() + "\" dept=\"" + vo.getDept() + "\" charge_code=\"" + vo.getChargeCode() + "\" win_no=\"" + vo.getWinNo() + "\" charge_flag=\"" + vo.getChargeFlag() + "\" ");
@ -1222,7 +1222,7 @@ public class EntranceService {
            if (StringUtils.isNotBlank(conNo)) {
                sbs.append("<query compy=\"=\" item=\"times\" splice=\"and\" value=\"'" + conNo + "'\"/>");
            }
             sbs.append("<order item=\"apply_date\" sort=\"desc\"/>");
            sbs.append("<order item=\"apply_date\" sort=\"desc\"/>");
            sbs.append("<startNum>1</startNum></MsgInfo></ESBEntry>");
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
@ -1601,10 +1601,10 @@ public class EntranceService {
                            }
                        }
                }
                    }
            }
        }}
                }
            }}
//            net.sf.json.JSONArray jsonArray = ConvertUtil.convertListEnvelopInBodyRowMS02003(resp);
//            for (Object object : jsonArray) { }
//        }

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/consult/WlyyHospitalWaitingRoomDO.java

@ -99,6 +99,11 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
	 * 咨询类型: 1图文 2视频 3图文+视频
	 */
	private Integer consultType;
    /**
     * 号别,多号别用“,”分割
     */
    private String chargeType;
	
	/**
	 * 门诊记录ID
@ -265,4 +270,13 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "charge_type")
    public String getChargeType() {
        return chargeType;
    }
    public void setChargeType(String chargeType) {
        this.chargeType = chargeType;
    }
}

+ 2 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -162,6 +162,7 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;
    /**
	 * 就诊时间
@ -187,6 +188,7 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    /**
     * 预约时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date registerDate;
    /**
	 * -1 取消;0 候诊中 ;1 就诊中 ;2 已诊

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

@ -221,6 +221,21 @@ public class BaseHospitalRequestMapping {
         */
        public static final String cooperativeOutpatient = "/cooperativeOutpatient";
        /**
         * 验证授权
         */
        public static final String checkOauthQRCode = "/checkOauthQRCode";
        /**
         * 全科医生协同门诊列表
         */
        public static final String findByGeneralDoctor = "/findByGeneralDoctor";
        /**
         * 全科医生首页统计信息
         */
        public static final String findGeneralDoctorInfo = "/findGeneralDoctorInfo";
        //=================end=======================================
        /**

+ 3 - 0
server/svr-authentication/pom.xml

@ -10,7 +10,10 @@
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-authentication</artifactId>
    <packaging>jar</packaging>
    <version>${parent.version}</version>
    <dependencies>
        <!-- 支持Tomcat启动 -->

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

@ -639,16 +639,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        try{
            OauthKeypairDO keypairDO = oauthKeypairDao.findByCode("hwlyyKey");
            KeyPair keyPair = (KeyPair)SerializeUtil.unSerialize(keypairDO.getKeyPair());
            logger.info("keyPair : "+keyPair.getPublic().toString());
            //解密idcard,中山医院id通过openid获取,i健康通过直接加密传输
            if(org.apache.commons.lang3.StringUtils.isNotBlank(idcard)){
                rs.put("idcard",com.yihu.jw.security.utils.RSAUtils.decryptBase64(idcard, keyPair));
            }else {
                rs.put("idcard",idcard);
            }
            logger.info("参数 code : "+code);
            //解析code
            if(org.apache.commons.lang3.StringUtils.isNotBlank(code)){
                rs.put("code",com.yihu.jw.security.utils.RSAUtils.decryptBase64(code, keyPair));
                logger.info("解析前code : "+code);
                String c = com.yihu.jw.security.utils.RSAUtils.decryptBase64(code, keyPair);
                logger.info("解析前code : "+c);
                rs.put("code",c);
            }else {
                rs.put("code",code);
            }
@ -757,9 +761,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (StringUtils.isEmpty(code)) {
            throw new InvalidRequestException("doctor is null");
        }
        logger.info("origin doctorCode :"+code);
        KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
        String doctorCode = com.yihu.jw.security.utils.RSAUtils.decryptBase64(code, keyPair);
        logger.info("after doctorCode :"+doctorCode);
        JSONObject map = null;
        try{
            map= oauthWlyyConfigService.checkWlyyDoctor(doctorCode);

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

@ -49,7 +49,7 @@ public class OauthWlyyConfigService {
        //token获取accesstoken
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("appid", oauthWlyyConfigDO.getAppId()));
        params.add(new BasicNameValuePair("appSecret", oauthWlyyConfigDO.getAppSecret()));
        params.add(new BasicNameValuePair("appSecret",oauthWlyyConfigDO.getAppSecret()));
        String res = httpClientUtil.post(oauthWlyyConfigDO.getTokenUrl(),params,"UTF-8");
        String token = null;
        JSONObject rsjson = JSONObject.parseObject(res);
@ -69,11 +69,11 @@ public class OauthWlyyConfigService {
            headerMap.put("accesstoken",token);
            String rs = httpClientUtil.headerPost(oauthWlyyConfigDO.getUrl(),p,"UTF-8",headerMap);
            logger.info("checkWlyyDoctor doctorInfo :"+rs);
            JSONObject auth = JSONObject.parseObject(rs);
            Integer s = auth.getInteger("status");
            logger.info("checkWlyyDoctor doctorInfo :"+s.toString());
            if(s == 200){
                JSONObject data = auth.getJSONObject("data");
                String authCode =  data.getString("authCode");

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

@ -60,8 +60,8 @@ spring:
  profiles: jwtest
  datasource:
    url: jdbc:mysql://172.26.0.104/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: root
    password: jkzlehr
    username: ssgg
    password: ssgg@jkzl2019
  redis:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.

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

@ -11,6 +11,8 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -23,6 +25,8 @@ import org.springframework.web.bind.annotation.*;
@Api(value = "医生端-咨询IM&诊室&导诊台相关接口", description = "医生端-咨询IM&诊室&导诊台相关接口", tags = {"医生端-咨询IM&诊室&导诊台相关接口"})
public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	
	private static final Logger logger = LoggerFactory.getLogger(DoctorConsultEndpoint.class);
	
	@Autowired
	private ImService imService;
	
@ -104,12 +108,15 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			JSONObject result = new JSONObject();
			synchronized (outpatientCode.intern()){
				
//				//1.调用挂号接口
//				net.sf.json.JSONObject rs = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
//				String rsCode = (String)rs.get("@RESULT");
//				if(!"0".equals(rsCode)){
//					return failed("挂号失败,无法发起咨询");
//				}
				//1.调用挂号接口
				logger.info("调用挂号接口====START");
				net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
				String rsCode = (String)res.get("@RESULT");
				if(!"0".equals(rsCode)){
					return failed("挂号失败,无法发起咨询");
				}
				logger.info("调用挂号接口====END");
				
				//2.
				result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type);

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

@ -220,8 +220,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @ApiParam(name = "expressageJson", value = "居民物流json")
                                         @RequestParam(value = "expressageJson", required = false)String expressageJson,
                                         @ApiParam(name = "registerJson", value = "预约时间")
                                         @RequestParam(value = "registerJson", required = false)String registerJson)throws Exception {
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson));
                                         @RequestParam(value = "registerJson", required = false)String registerJson,
                                         @ApiParam(name = "chargeType", value = "预约实体json")
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getICD10)
@ -493,14 +495,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorOnlineWork)
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorOnlineWork)
    @ApiOperation(value = "保存在线排班", notes = "保存在线排班")
    public Envelop saveDoctorOnlineWork(@ApiParam(name = "onlineWorkJson", value = "保存在线排班json")
                                        @RequestParam(value = "onlineWorkJson", required = true)String onlineWorkJson)throws Exception {
        return prescriptionService.saveDoctorOnlineWork(onlineWorkJson);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.delDoctorOnlineWork)
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.delDoctorOnlineWork)
    @ApiOperation(value = "删除在线排班", notes = "删除在线排班")
    public Envelop delDoctorOnlineWork(@ApiParam(name = "id", value = "保存在线排班ID")
                                       @RequestParam(value = "id", required = true)String id)throws Exception {
@ -518,15 +520,48 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(prescriptionService.findDoctorOnlineWorkList(doctor,startDate,endDate));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.cooperativeOutpatient)
    @ApiOperation(value = "发起图文和视频复诊", notes = "发起图文和视频复诊")
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.cooperativeOutpatient)
    @ApiOperation(value = "发起协同门诊", notes = "发起协同门诊")
    public ObjEnvelop cooperativeOutpatient(@ApiParam(name = "outpatientJson", value = "复诊实体json")
                                            @RequestParam(value = "outpatientJson", required = true)String outpatientJson,
                                            @ApiParam(name = "registerJson", value = "预约实体json")
                                            @RequestParam(value = "registerJson", required = false)String registerJson)throws Exception {
        return success(prescriptionService.cooperativeOutpatient(outpatientJson,registerJson));
                                            @RequestParam(value = "registerJson", required = false)String registerJson,
                                            @ApiParam(name = "chargeType", value = "号别")
                                            @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        return success(prescriptionService.cooperativeOutpatient(outpatientJson,registerJson,chargeType));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOauthQRCode)
    @ApiOperation(value = "验证授权", notes = "验证授权")
    public ObjEnvelop checkOauthQRCode(@ApiParam(name = "authorizeNo", value = "流水编号")
                                       @RequestParam(value = "authorizeNo", required = true)String authorizeNo)throws Exception {
        return success(prescriptionService.checkOauthQRCode(authorizeNo));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByGeneralDoctor)
    @ApiOperation(value = "全科医生协同门诊列表", notes = "全科医生协同门诊列表")
    public Envelop findByGeneralDoctor(@ApiParam(name = "generalDoctor", value = "全科医生")
                                           @RequestParam(value = "generalDoctor", required = true)String generalDoctor,
                                           @ApiParam(name = "startDate", value = "开始时间")
                                           @RequestParam(value = "startDate", required = false)String startDate,
                                           @ApiParam(name = "endDate", value = "结束时间")
                                           @RequestParam(value = "endDate", required = false)String endDate,
                                           @ApiParam(name = "status", value = "状态")
                                           @RequestParam(value = "status", required = false)String status,
                                           @ApiParam(name = "page", value = "第几页")
                                           @RequestParam(value = "page", required = true)Integer page,
                                           @ApiParam(name = "size", value = "每页大小")
                                           @RequestParam(value = "size", required = true)Integer size) {
        return prescriptionService.findByGeneralDoctor(generalDoctor,startDate,endDate,status,page,size);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findGeneralDoctorInfo)
    @ApiOperation(value = "全科医生首页统计信息", notes = "全科医生首页统计信息")
    public ObjEnvelop findGeneralDoctorInfo(@ApiParam(name = "generalDoctor", value = "全科医生")
                                            @RequestParam(value = "generalDoctor", required = true)String generalDoctor) {
        return success(prescriptionService.findGeneralDoctorInfo(generalDoctor));
    }
    //===========