wangjun 4 anni fa
parent
commit
1c7347b124

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java

@ -91,7 +91,7 @@ public class PatientMappingService {
        if(patientMappingDO!=null){
        if(patientMappingDO!=null){
            return patientMappingDO.getMappingCode();
            return patientMappingDO.getMappingCode();
        }
        }
        com.alibaba.fastjson.JSONArray rs = ykyyEntranceService.findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        com.alibaba.fastjson.JSONArray rs = ykyyEntranceService.findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(rs!=null&&rs.size()>0){
        if(rs!=null&&rs.size()>0){
            //获取居民信息
            //获取居民信息

+ 22 - 11
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
@ -15,6 +16,7 @@ import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
@ -39,6 +41,8 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
    private BaseDoctorDao baseDoctorDao;
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    @Autowired
    private YkyySMSService ykyySMSService;
    private YkyySMSService ykyySMSService;
    @Value("${wechat.id}")
    private String wechatId;
    /**
    /**
@ -122,20 +126,27 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
        }
        }
        return null;
        return null;
    }
    }
    public String  sendDoctorRemindSms(String outpatienId){
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatienId);
    public String  sendDoctorRemindSms(ConsultDo consultDo){
        String msg = "";
        String msg = "";
        if (wlyyOutpatientDO!=null){
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(wlyyOutpatientDO.getDoctor());
            if (baseDoctorDO!=null){
                ykyySMSService.sendSmsByTempcode("message_remind_paitent",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
                msg="发送成功";
            }else{
                msg="发送失败,医生不存在";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if (consultDo!=null){
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(consultDo.getRelationCode());
                if (wlyyOutpatientDO!=null){
                    BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(wlyyOutpatientDO.getDoctor());
                    if (baseDoctorDO!=null){
                        ykyySMSService.sendSmsByTempcode("message_remind_paitent",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
                        msg="发送成功";
                    }else{
                        msg="发送失败,医生不存在";
                    }
                }else {
                    msg="发送失败,门诊不存在";
                }
            }else {
                msg="发送失败,consult不存在";
            }
            }
        }else {
            msg="发送失败,门诊不存在";
        }
        }
        return msg;
        return msg;
    }
    }

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

@ -6991,8 +6991,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                    }
                    msg = "您的视频咨询已预约成功。\n" +
                    msg = "您的视频咨询已预约成功。\n" +
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", "");
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", "");
                }
                }
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
@ -7028,6 +7028,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "16", "videoOrderRemind", "");
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "16", "videoOrderRemind", "");
                }
                }
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
@ -7063,6 +7064,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        systemMessageDO.setTitle("支付提醒");
        systemMessageDO.setTitle("支付提醒");
        systemMessageDO.setType("11");
        systemMessageDO.setType("11");
        JSONObject data = new JSONObject();
        JSONObject data = new JSONObject();
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatient.getId());
        if (outpatient!=null){
        if (outpatient!=null){
            if("1".equalsIgnoreCase(outpatient.getOutpatientType())){
            if("1".equalsIgnoreCase(outpatient.getOutpatientType())){
                if ("1".equals(outpatient.getType())) {
                if ("1".equals(outpatient.getType())) {
@ -7100,7 +7102,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } catch (Exception e) {
            } catch (Exception e) {
                e.printStackTrace();
                e.printStackTrace();
            }
            }
            sendWxTemplateMsg(wechatId, outpatient.getId(),null, type, "payRemind", "");
            if (businessOrderDO!=null&&0!=businessOrderDO.getPayPrice()){
                sendWxTemplateMsg(wechatId, outpatient.getId(),null, type, "payRemind", "");
            }
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
                BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
@ -7137,7 +7141,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } catch (Exception e) {
            } catch (Exception e) {
                e.printStackTrace();
                e.printStackTrace();
            }
            }
            sendWxTemplateMsg(wechatId, "",consultTeamDo, type, "payRemind", "");
            if (businessOrderDO!=null&&0!=businessOrderDO.getPayPrice()){
                sendWxTemplateMsg(wechatId, "",consultTeamDo, type, "payRemind", "");
            }
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                ykyyService.pushNotificationToYktPatient(patientDO.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
                ykyyService.pushNotificationToYktPatient(patientDO.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
            }
            }

+ 68 - 6
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -1584,6 +1584,65 @@ public class YkyyEntranceService {
        return array;
        return array;
    }
    }
    /**
     * 获取his病人信息--身份证/卡号
     * @param ssc
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatientBySscAndIdcard(String ssc,String idcard,boolean demoFlag) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
                "\tx.brxm AS \"brxm\",\n" +
                "\tx.sfzh AS \"sfzh\",\n" +
                "\tx.brxz AS \"brxz\",\n" +
                "\tx.brxb AS \"brxb\",\n" +
                "\tx.csny as \"csny\",\n" +
                "\tx.jzkh AS \"jzkh\",\n" +
                "\tx.jdsj AS \"jdsj\",\n" +
                "\tx.sjhm AS \"sjhm\",\n" +
                "\tx.fzxmc AS \"fzxmc\",\n" +
                "\tx.gzztmc AS \"gzztmc\",\n" +
                "\tx.lxdz AS \"lxdz\"\n" +
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.jzkh = '"+ssc+"' and x.sfzh ='"+idcard+"'";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","1168517");
            jsonObject.put("mzhm","0502452155");
            jsonObject.put("brxm","于小童");
            jsonObject.put("sfzh","450521199405092535");
            jsonObject.put("brxz","自费");
            jsonObject.put("brxb","男");
            jsonObject.put("csny","1994-05-09");
            jsonObject.put("jzkh","2396501");
            jsonObject.put("jdsj","2020-06-28 15:15:35");
            jsonObject.put("gzztmc","一般");
            jsonObject.put("lxdz","厦门市五缘湾");
            array.add(jsonObject);
        }else  {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }
    /**
    /**
     * 获取his病人信息
     * 获取his病人信息
     * @param idcard
     * @param idcard
@ -1969,6 +2028,7 @@ public class YkyyEntranceService {
        //挂号
        //挂号
        Map<String,Object> map = findYkDoctor(natAppointmentDO.getHospitalFlag());
        Map<String,Object> map = findYkDoctor(natAppointmentDO.getHospitalFlag());
        BasePatientDO patientDO = basePatientDao.findById(natAppointmentDO.getPatientId());
        //PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(natAppointmentDO.getPatientId());
        //PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(natAppointmentDO.getPatientId());
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",natAppointmentDO.getPatientId(),"1");
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",natAppointmentDO.getPatientId(),"1");
        Integer brid= 0;
        Integer brid= 0;
@ -1976,7 +2036,7 @@ public class YkyyEntranceService {
        Integer GHXH = 0;
        Integer GHXH = 0;
        //挂号明细表HLW_GHMX
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
            JSONObject json = jsonArray.getJSONObject(0);
@ -2163,7 +2223,7 @@ public class YkyyEntranceService {
        Integer kdks = 0;
        Integer kdks = 0;
        /*Integer brid=0;*/
        /*Integer brid=0;*/
        String mzhm="0";
        String mzhm="0";
        JSONArray jsonArray3 = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray3 = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        Map<String,Object> resultMap = new HashMap();
        Map<String,Object> resultMap = new HashMap();
        if(jsonArray3!=null&&jsonArray3.size()>0){
        if(jsonArray3!=null&&jsonArray3.size()>0){
            //获取居民信息
            //获取居民信息
@ -2277,7 +2337,7 @@ public class YkyyEntranceService {
        hlwGhmxDO.setYSDM(doctorMappingDO.getMappingCode());//医生代码
        hlwGhmxDO.setYSDM(doctorMappingDO.getMappingCode());//医生代码
        hlwGhmxDO.setJZYS(doctorMappingDO.getMappingCode());//接诊医生
        hlwGhmxDO.setJZYS(doctorMappingDO.getMappingCode());//接诊医生
        //病人性质
        //病人性质
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
            JSONObject json = jsonArray.getJSONObject(0);
@ -2870,6 +2930,7 @@ public class YkyyEntranceService {
    }
    }
    //门诊开单操作
    //门诊开单操作
    public Map<String,Object> outPatientOrder(List<YkEmrJcsqDO> surveys,Boolean demoFlag,String doctor,String patient) throws Exception{
    public Map<String,Object> outPatientOrder(List<YkEmrJcsqDO> surveys,Boolean demoFlag,String doctor,String patient) throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
        if (StringUtils.isNoneBlank(doctor)){
        if (StringUtils.isNoneBlank(doctor)){
            doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
            doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
@ -2883,7 +2944,7 @@ public class YkyyEntranceService {
        String doctorHis="";
        String doctorHis="";
        Integer kdks = 0;
        Integer kdks = 0;
        Integer brid=0;
        Integer brid=0;
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        Map<String,Object> resultMap = new HashMap();
        Map<String,Object> resultMap = new HashMap();
        if(jsonArray!=null&&jsonArray.size()>0){
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            //获取居民信息
@ -2994,6 +3055,7 @@ public class YkyyEntranceService {
    public String outPatientOrderYk(String jsonDate,Boolean demoFlag,String doctor,String patient) throws Exception{
    public String outPatientOrderYk(String jsonDate,Boolean demoFlag,String doctor,String patient) throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        List<YkEmrJcsqDO> surveys = EntityUtils.jsonToList(jsonDate,YkEmrJcsqDO.class);
        List<YkEmrJcsqDO> surveys = EntityUtils.jsonToList(jsonDate,YkEmrJcsqDO.class);
        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
        if (StringUtils.isNotEmpty(doctor)){
        if (StringUtils.isNotEmpty(doctor)){
@ -3007,7 +3069,7 @@ public class YkyyEntranceService {
        String doctorHis="";
        String doctorHis="";
        Integer kdks = 0;
        Integer kdks = 0;
        Integer brid=0;
        Integer brid=0;
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
            JSONObject json = jsonArray.getJSONObject(0);
@ -3148,7 +3210,7 @@ public class YkyyEntranceService {
    public void updatePatientJd(String patient,String address,String phone,Float zy, boolean demoFlag) throws Exception {
    public void updatePatientJd(String patient,String address,String phone,Float zy, boolean demoFlag) throws Exception {
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),basePatientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
            JSONObject json = jsonArray.getJSONObject(0);

+ 110 - 11
business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java

@ -5,9 +5,12 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.wx.WxPushLogDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.WlyyInspectionDao;
import com.yihu.jw.hospital.prescription.dao.WlyyInspectionDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
@ -15,6 +18,7 @@ import com.yihu.jw.sms.util.ykyy.client.SmsClient;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
@ -24,6 +28,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -45,6 +50,10 @@ public class YkyySMSService {
    private WlyyInspectionDao inspectionDao;
    private WlyyInspectionDao inspectionDao;
    @Autowired
    @Autowired
    private BasePatientDao basePatientDao;
    private BasePatientDao basePatientDao;
    @Autowired
    private WxPushLogDao wxPushLogDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    /**
    /**
     * 发送短信验证码
     * 发送短信验证码
@ -61,6 +70,21 @@ public class YkyySMSService {
        String content="";
        String content="";
        String sex = "先生/女士";
        String sex = "先生/女士";
        String mobile = "";
        String mobile = "";
        //由于审方情况比较特殊单独标记下
        WxPushLogDO wxPushLogDO = null;
        WxPushLogDO wxPushLogDODoctor = null;
        //新增字典判断是否发送短信
        String sendMesControl = "1";//1 开启发送短信 0 关闭
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("ykSmsControl");
        if (wlyyHospitalSysDictDO!=null){
            sendMesControl = wlyyHospitalSysDictDO.getDictValue();
        }
        if("check_failed".equalsIgnoreCase(temlateCode)){
            wxPushLogDO = wxPushLogDao.findByTempNameAndOpenidAndReceiver(temlateCode,wlyyOutpatientDO.getId(),wlyyOutpatientDO.getPatient());
            wxPushLogDODoctor = wxPushLogDao.findByTempNameAndOpenidAndReceiver(temlateCode,wlyyOutpatientDO.getId(),wlyyOutpatientDO.getDoctor());
        }else {
            wxPushLogDO = wxPushLogDao.findByTempNameAndOpenid(temlateCode,wlyyOutpatientDO.getId());
        }
        if (wlyyOutpatientDO!=null){
        if (wlyyOutpatientDO!=null){
            if (StringUtils.isNoneBlank(wlyyOutpatientDO.getIdcard())){
            if (StringUtils.isNoneBlank(wlyyOutpatientDO.getIdcard())){
                String sexNo = IdCardUtil.getSexForIdcard_new(wlyyOutpatientDO.getIdcard());
                String sexNo = IdCardUtil.getSexForIdcard_new(wlyyOutpatientDO.getIdcard());
@ -84,48 +108,115 @@ public class YkyySMSService {
                if (smsTemplateDO!=null){
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);
                            .replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                    }
                }
                }
            }else if ("outpatient_remind".equalsIgnoreCase(temlateCode)){//患者发起复诊给医生发送消息
            }else if ("outpatient_remind".equalsIgnoreCase(temlateCode)){//患者发起复诊给医生发送消息
                smsTemplateDO = smsTemplateDao.findByClientId("outpatient_remind");
                smsTemplateDO = smsTemplateDao.findByClientId("outpatient_remind");
                if (smsTemplateDO!=null){
                if (smsTemplateDO!=null){
                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent();
                        content = smsTemplateDO.getContent();
                        ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                        if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                            ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                            wxPushLogDO = new WxPushLogDO();
                            wxPushLogDO.setTempName(temlateCode);
                            wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                            wxPushLogDO.setReceiver(wlyyOutpatientDO.getDoctor());
                            wxPushLogDO.setCreateTime(new Date());
                            wxPushLogDao.save(wxPushLogDO);
                        }
                    }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                    }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent().replace("图文","视频");
                        content = smsTemplateDO.getContent().replace("图文","视频");
                        ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                        if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                            ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                            wxPushLogDO = new WxPushLogDO();
                            wxPushLogDO.setTempName(temlateCode);
                            wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                            wxPushLogDO.setReceiver(wlyyOutpatientDO.getDoctor());
                            wxPushLogDO.setCreateTime(new Date());
                            wxPushLogDao.save(wxPushLogDO);
                        }
                    }
                    }
                }
                }
            }else if ("message_remind_paitent".equalsIgnoreCase(temlateCode)){//医生发消息发送短信提醒
            }else if ("message_remind_paitent".equalsIgnoreCase(temlateCode)){//医生发消息发送短信提醒
                content = smsTemplateDO.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                smsTemplateDO = smsTemplateDao.findByClientId("message_remind_paitent");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                    }
                }
            }else if ("oneself_pick".equalsIgnoreCase(temlateCode)){//病人自取
            }else if ("oneself_pick".equalsIgnoreCase(temlateCode)){//病人自取
                smsTemplateDO = smsTemplateDao.findByClientId("oneself_pick");
                smsTemplateDO = smsTemplateDao.findByClientId("oneself_pick");
                if (smsTemplateDO!=null){
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime())).replace("{{门诊号码}}",wlyyOutpatientDO.getRealOrder())
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime())).replace("{{门诊号码}}",wlyyOutpatientDO.getRealOrder())
                    .replace("{{性别}}",sex);;
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    .replace("{{性别}}",sex);
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                    }
                }
                }
            }else if("check_failed".equalsIgnoreCase(temlateCode)){//处方审核失败
            }else if("check_failed".equalsIgnoreCase(temlateCode)){//处方审核失败
                smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                if (smsTemplateDO!=null){
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    }
                }
                }
                SmsTemplateDO smsTemplateDO1 = smsTemplateDao.findByClientId("check_failed_doctor");
                SmsTemplateDO smsTemplateDO1 = smsTemplateDao.findByClientId("check_failed_doctor");
                if (smsTemplateDO1!=null){
                if (smsTemplateDO1!=null){
                    String contentDoctor = smsTemplateDO1.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                    String contentDoctor = smsTemplateDO1.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder());
                            .replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder());
                    ykyySendSMS(doctorMobile,smsTemplateDO1.getHeader()+contentDoctor);
                    if (wxPushLogDODoctor==null&&"1".equalsIgnoreCase(sendMesControl)){
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getDoctor());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                        ykyySendSMS(doctorMobile,smsTemplateDO1.getHeader()+contentDoctor);
                    }
                }
                }
            }else if ("check_success_patient".equalsIgnoreCase(temlateCode)){//处方审核通过
            }else if ("check_success_patient".equalsIgnoreCase(temlateCode)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("check_success_patient");
                smsTemplateDO = smsTemplateDao.findByClientId("check_success_patient");
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    }
                }
                }
            }else if ("inspection_remind".equalsIgnoreCase(temlateCode)){//处方审核通过
            }else if ("inspection_remind".equalsIgnoreCase(temlateCode)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("inspection_remind");
                smsTemplateDO = smsTemplateDao.findByClientId("inspection_remind");
@ -165,7 +256,15 @@ public class YkyySMSService {
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",createTime).replace("{{门诊号码}}",mzhm)
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",createTime).replace("{{门诊号码}}",mzhm)
                                .replace("{{社保卡号}}","【到收费处,凭此条短信中的门诊号码换卡充值预缴金做检查】").replace("{{性别}}",sex);;
                                .replace("{{社保卡号}}","【到收费处,凭此条短信中的门诊号码换卡充值预缴金做检查】").replace("{{性别}}",sex);;
                    }
                    }
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    }
                }
                }
            }
            }
            logger.info("发送后:temlateCode"+temlateCode+"==mobile:"+mobile+"content"+content+"doctorMobile"+doctorMobile);
            logger.info("发送后:temlateCode"+temlateCode+"==mobile:"+mobile+"content"+content+"doctorMobile"+doctorMobile);

+ 5 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxPushLogDao.java

@ -2,10 +2,15 @@ package com.yihu.jw.wechat.dao;
import com.yihu.jw.entity.base.wx.WxPushLogDO;
import com.yihu.jw.entity.base.wx.WxPushLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
/**
 * Created by yeshijie on 2020/4/27.
 * Created by yeshijie on 2020/4/27.
 */
 */
public interface WxPushLogDao extends PagingAndSortingRepository<WxPushLogDO, String>, JpaSpecificationExecutor<WxPushLogDO> {
public interface WxPushLogDao extends PagingAndSortingRepository<WxPushLogDO, String>, JpaSpecificationExecutor<WxPushLogDO> {
    WxPushLogDO findByTempNameAndOpenid(String tempName,String openId);
    WxPushLogDO findByTempNameAndOpenidAndReceiver(String tempName,String openId,String reciver);
}
}

+ 9 - 9
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java

@ -261,16 +261,16 @@ public class UnSettledHISPrescriptionService {
                                        logger.info("=======setUrl========"+newConfig.getUrl());
                                        logger.info("=======setUrl========"+newConfig.getUrl());
                                        weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),one.getOpenid(),newConfig);
                                        weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),one.getOpenid(),newConfig);
                                    });
                                    });
                                    //保存发送模板记录,
                                    WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                    wxPushLogDO.setCreateTime(new Date());
                                    wxPushLogDO.setOpenid(prescriptionId);
                                    wxPushLogDO.setReceiver(patientDO.getId());
                                    wxPushLogDO.setWechatId(wechatId);
                                    wxPushLogDO.setReceiverName(patientDO.getName());
                                    wxPushLogDO.setScene("djsxxtz");
                                    wxPushLogDao.save(wxPushLogDO);
                                }
                                }
                                //保存发送模板记录,
                                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                wxPushLogDO.setCreateTime(new Date());
                                wxPushLogDO.setOpenid(prescriptionId);
                                wxPushLogDO.setReceiver(patientDO.getId());
                                wxPushLogDO.setWechatId(wechatId);
                                wxPushLogDO.setReceiverName(patientDO.getName());
                                wxPushLogDO.setScene("djsxxtz");
                                wxPushLogDao.save(wxPushLogDO);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                                wlyyPrescriptionDO.setPrescribeTime(new Date());
                                wlyyPrescriptionDO.setPrescribeTime(new Date());
                                wlyyPrescriptionDO.setCheckStatus(0);
                                wlyyPrescriptionDO.setCheckStatus(0);

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

@ -10,6 +10,7 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
@ -36,6 +37,7 @@ import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
import com.yihu.jw.hospital.service.consult.KnowledgeCategoryService;
import com.yihu.jw.hospital.service.consult.KnowledgeCategoryService;
import com.yihu.jw.hospital.service.consult.QrcodeService;
import com.yihu.jw.hospital.service.consult.QrcodeService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -191,6 +193,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private BasePatientWechatDao basePatientWechatDao;
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    @Autowired
    private SystemMessageService systemMessageService;
    private SystemMessageService systemMessageService;
    @Autowired
    private ConsultDao consultDao;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
@ -1553,7 +1557,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        ykyyINSMSService.ykyySendSMS(mobile,contet);
        ykyyINSMSService.ykyySendSMS(mobile,contet);
    }
    }
    @GetMapping("/smsToDoctor")
    @GetMapping("/smsToDoctor")
    public Envelop sentMessageRemindSms(String outpatientId){
        return  success(systemMessageService.sendDoctorRemindSms(outpatientId));
    public Envelop sentMessageRemindSms(@RequestParam(value = "consult", required = true)String consult){
        ConsultDo consultDo = consultDao.findOne(consult);
        return  success(systemMessageService.sendDoctorRemindSms(consultDo));
    }
    }
}
}