wangjun преди 4 години
родител
ревизия
0317dad186

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

@ -6700,12 +6700,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param outpatient
     * @return
     */
    public SystemMessageDO sendOutPatientMes(WlyyOutpatientDO outpatient,boolean payFlag) {
    public SystemMessageDO sendOutPatientMes(WlyyOutpatientDO outpatient,boolean payFlag)  {
        System.out.println("发送新增门诊信息");
        SystemMessageDO systemMessageDO = new SystemMessageDO();
        String msg = "";
        JSONObject data = new JSONObject();
        try {
            JSONObject data = new JSONObject();
            //1.在线复诊2.协同门诊
            if ("2".equals(outpatient.getOutpatientType())) {
                systemMessageDO.setTitle("协同门诊");
@ -6718,81 +6718,85 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    if (payFlag){
                        saveInquirySystemMessage(outpatient,null);
                    }
                    msg="图文咨询";
                } else if("3".equals(outpatient.getType())){
                    systemMessageDO.setTitle("家医咨询");
                    systemMessageDO.setType("15");
                    msg="家医咨询";
                    if (payFlag){
                        saveInquirySystemMessage(outpatient,null);
                    }
                }else {
                    systemMessageDO.setTitle("视频咨询预约成功");
                    systemMessageDO.setType("2");
                    systemMessageDO.setType("17");
                    if (payFlag){
                        saveInquirySystemMessage(outpatient,null);
                    }
                    msg = "您的视频咨询已预约成功。\n" +
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    systemMessageDO.setReceiver(outpatient.getDoctor());
                    systemMessageDO.setReceiverName(outpatient.getDoctorName());
                    systemMessageDO.setRelationCode(outpatient.getId());
                    systemMessageDO.setSender(outpatient.getPatient());
                    systemMessageDO.setSenderName(outpatient.getPatientName());
                    systemMessageDO.setRelationCode(outpatient.getId());
                    data.put("name", outpatient.getPatientName());
                    data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
                    data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
                    data.put("question", outpatient.getDescription());
                    data.put("msg", msg);
                    systemMessageDO.setData(data.toString());
                    systemMessageService.saveMessage(systemMessageDO);
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", "");
                }
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
                systemMessageDO.setRelationCode(outpatient.getId());
                systemMessageDO.setSender(outpatient.getPatient());
                systemMessageDO.setSenderName(outpatient.getPatientName());
                systemMessageDO.setRelationCode(outpatient.getId());
                data.put("name", outpatient.getPatientName());
                data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
                data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
                data.put("question", outpatient.getDescription());
                data.put("msg", msg);
                systemMessageDO.setData(data.toString());
                logger.info("添加模板消息4");
                systemMessageService.saveMessage(systemMessageDO);
            } else if ("1".equals(outpatient.getOutpatientType()))  {//在线复诊
                    //1.图文 2.视频
                    if ("1".equals(outpatient.getType())) {
                        systemMessageDO.setTitle("图文复诊");
                        systemMessageDO.setType("1");
                        if (payFlag){
                            saveInquirySystemMessage(outpatient,null);
                        }
                    } else {
                        systemMessageDO.setTitle("视频复诊预约成功");
                        systemMessageDO.setType("2");
                        if (payFlag){
                            saveInquirySystemMessage(outpatient,null);
                        }
                        msg = "您的视频复诊已预约成功。\n" +
                                "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                        systemMessageDO.setReceiver(outpatient.getDoctor());
                        systemMessageDO.setReceiverName(outpatient.getDoctorName());
                        systemMessageDO.setRelationCode(outpatient.getId());
                        systemMessageDO.setSender(outpatient.getPatient());
                        systemMessageDO.setSenderName(outpatient.getPatientName());
                        systemMessageDO.setRelationCode(outpatient.getId());
                        data.put("name", outpatient.getPatientName());
                        data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
                        data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
                        data.put("question", outpatient.getDescription());
                        data.put("msg", msg);
                        systemMessageDO.setData(data.toString());
                        systemMessageService.saveMessage(systemMessageDO);
                        sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", "");
                //1.图文 2.视频
                if ("1".equals(outpatient.getType())) {
                    systemMessageDO.setTitle("图文复诊");
                    systemMessageDO.setType("1");
                    if (payFlag){
                        saveInquirySystemMessage(outpatient,null);
                    }
                    msg="图文复诊";
                } else {
                    systemMessageDO.setTitle("视频复诊预约成功");
                    systemMessageDO.setType("2");
                    if (payFlag){
                        saveInquirySystemMessage(outpatient,null);
                    }
                    msg = "您的视频复诊已预约成功。\n" +
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "16", "videoOrderRemind", "");
                }
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
                systemMessageDO.setRelationCode(outpatient.getId());
                systemMessageDO.setSender(outpatient.getPatient());
                systemMessageDO.setSenderName(outpatient.getPatientName());
                systemMessageDO.setRelationCode(outpatient.getId());
                logger.info("添加模板消息5");
                data.put("name", outpatient.getPatientName());
                data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
                data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
                data.put("question", outpatient.getDescription());
                data.put("msg", msg);
                systemMessageDO.setData(data.toString());
                systemMessageService.saveMessage(systemMessageDO);
            }
            BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
            }
        } catch (Exception e) {
            logger.error("sendOutPatientMes :" + e.toString());
            return null;
            return systemMessageDO;
        }catch (Exception e){
            e.printStackTrace();
            logger.info("sendOutPatientMes"+e.getMessage());
            return  null;
        }
        return systemMessageDO;
    }
    public void saveInquirySystemMessage(WlyyOutpatientDO outpatient,ConsultTeamDo consultTeamDo) {
@ -9400,6 +9404,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return null;
    }
    public static void main(String[] args) {
        String ss = DateUtil.getStringDateShort();
        System.out.println(ss);
    }
    public com.alibaba.fastjson.JSONObject selectHospitalInfo(String doctorId,String orgCode){
        /**
         * 1、今日待就诊:今日当前家庭医生在当前医院的未完成的协同门诊书
@ -9430,22 +9438,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            jsonObject.put("nextTime",null);
        }
        //3、服务评分:当前医院的综合服务评分
        //在线医生:当前医院在班的专科医生数
        String sql ="SELECT d.id as \"id\",d.name as \"name\" FROM base_doctor d WHERE (EXISTS (SELECT 1 FROM wlyy_doctor_work_time t WHERE t.doctor = d.id AND t.start_time >=:startTime AND t.end_time <=:endTime ) OR  d.consult_status = '1')";
        Map<String, Object> params = new HashedMap();
        String timeCondition="";
        if("xm_ykyy_wx".equals(wechatId)){
            if (flag){
                params.put("startTime",DateUtil.dateToStrLong(startTime));
                params.put("endTime",DateUtil.dateToStrLong(endTime));
                timeCondition+="AND t.start_time >= '"+nowDate+" 00:00:00'";
                timeCondition+="AND t.start_time <= '"+nowDate+" 23:59:59'";
            }else {
                params.put("startTime","to_date('"+nowDate+" 00:00:00','yyyy-mm-dd hh24:mi:ss')");
                params.put("endTime","to_date('"+nowDate+" 23:59:59','yyyy-mm-dd hh24:mi:ss')");
                timeCondition+="AND t.start_time >= to_date('"+nowDate+" 00:00:00','yyyy-mm-dd hh24:mi:ss')";
                timeCondition+="AND t.start_time <= to_date('"+nowDate+" 23:59:59','yyyy-mm-dd hh24:mi:ss')";
            }
        }else{
            params.put("startTime",DateUtil.dateToStrLong(startTime));
            params.put("endTime",DateUtil.dateToStrLong(endTime));
            timeCondition+="AND t.start_time >= '"+nowDate+" 00:00:00'";
            timeCondition+="AND t.start_time <= '"+nowDate+" 23:59:59'";
        }
        String sql ="SELECT d.id as \"id\",d.name as \"name\" FROM base_doctor d WHERE (EXISTS (SELECT 1 FROM wlyy_doctor_work_time t WHERE t.doctor = d.id "+timeCondition+"  ) OR  d.consult_status = '1')";
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params);
        jsonObject.put("onlineDoctors",list.size());

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

@ -116,7 +116,7 @@ public class StatisticsEsService {
        object.put("prescriptionRate",prescriptionRate);//开方率
        String startTime = DateUtil.getStringDateShort()+" 00:00:00";
        String endTime = DateUtil.getStringDateShort() +" 23:59:59";
        String sql = "select count(*) as \"total\" from base.wlyy_consult_oupatient_info o where  o.create_time >='"+startTime+"' and o.create_time <='"+endTime+"'";
        String sql = "select count(*) as \"total\" from wlyy_consult_oupatient_info o where  o.create_time >='"+startTime+"' and o.create_time <='"+endTime+"'";
        if (level==4){
            sql += " and o.doctor IN (SELECT doctor_code as \"doctor_code\" FROM `base_doctor_hospital` dh where dh.org_code ='"+area+"' and dh.del=1)";
        }if (level==2){

+ 3 - 1
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1595,7 +1595,7 @@ public class ImService {
			JSONObject object = new JSONObject();
			object.put("socket_sms_type",5);
			object.put("relation_code",wlyyOutpatientDO.getId());
			imUtil.sendMessage(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getPatient(),"1",object.toString());
			imUtil.sendMessage(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getConsumer(),"1",object.toString());
			//医生接诊发送导诊护士外层消息
			this.sendOutpatientGuaidanceMessage(wlyyOutpatientDO);
		}else if("2".equals(wlyyOutpatientDO.getOutpatientType())){
@ -3747,6 +3747,7 @@ public class ImService {
					"op.general_doctor AS \"generalDoctor\"," +
					"patient.NAME AS \"patientName\"," +
					"patient.id AS \"patientId\"," +
					"op.consumer AS \"consumer\"," +
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\",";
@ -3831,6 +3832,7 @@ public class ImService {
					"op.evaluate_status AS \"evaluate\"," +
					"op.doctor AS \"doctorCode\"," +
					"op.general_doctor AS \"generalDoctor\"," +
					"op.consumer AS \"consumer\"," +
					"patient.NAME AS \"patientName\"," +
					"patient.id AS \"patientId\"," +
					"patient.idcard AS \"patientIdcard\"," +

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

@ -1253,21 +1253,21 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                if("1,15,17".equals(type)){//专家咨询
                    Integer consultType =  Integer.parseInt(consult.get("type").toString());
                    if(1 == consultType){//专家咨询
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("outpatientId").toString()+"_1");
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_1");
                    }else if(15 == consultType){//家医求助
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("outpatientId").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                    }else if (17==consultType){//视频咨询
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("outpatientId").toString()+"_17");
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_17");
                    }
                }else if("9".equals(type)){//图文复诊
                    consult.put("session_id", consult.get("patientId").toString()+"_"+consult.get("outpatientId").toString()+"_9");
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_9");
                    consult.put("type",type);
                }else if("16".equals(type)){//视频复诊
                    consult.put("session_id", consult.get("patientId").toString()+"_"+consult.get("outpatientId").toString()+"_16");
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_16");
                    consult.put("type",type);
                }else if("12".equals(type)){//协同门诊
                    consult.put("session_id", consult.get("patientId").toString()+"_"+consult.get("outpatientId").toString()+"_12");
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_12");
                    consult.put("type",type);
                }else{}
                

+ 8 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

@ -1,6 +1,8 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.YkyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.order.BusinessOrderService;
@ -33,12 +35,16 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private PrescriptionService commenPrescriptionService;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.id}")
    private String wxId;
    @Value("${pay.flag}")
    private boolean payFlag;
    @GetMapping(value = "vlisReportMasterlist")
    @ApiOperation(value = "检验信息列表")
@ -161,7 +167,7 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
        if (wlyyOutpatientDO!=null&&null==wlyyOutpatientDO.getId()){
        if (wlyyOutpatientDO!=null&&null==wlyyOutpatientDO.getId()&&!wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")){
            ObjEnvelop objEnvelop =new ObjEnvelop();
            String msg = "";
            if (1==wlyyOutpatientDO.getRemindCount()){
@ -173,6 +179,7 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
            objEnvelop.setStatus(300);
            return objEnvelop;
        }
        SystemMessageDO systemMessageDO = commenPrescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
       /* //发送系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
        //发送IM消息