Browse Source

Merge branch 'dev' of wangjun/wlyy2.0 into dev

wangzhinan 4 years ago
parent
commit
4274232e75
20 changed files with 961 additions and 92 deletions
  1. 6 0
      business/base-service/pom.xml
  2. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  3. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java
  4. 40 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java
  5. 25 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  6. 147 9
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  7. 25 6
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  8. 389 0
      business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java
  9. 1 1
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java
  10. 5 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxPushLogDao.java
  11. 266 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyyINSMSService.java
  12. 0 29
      business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyySMSService.java
  13. 4 4
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  14. 8 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  15. 16 30
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java
  16. 6 0
      svr/svr-internet-hospital/pom.xml
  17. 3 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  18. 15 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  19. 1 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/wechat/WechatCoreController.java
  20. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/wechat/WeiXinEventProcess.java

+ 6 - 0
business/base-service/pom.xml

@ -191,6 +191,12 @@
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>sms-service</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -132,6 +132,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                        mixEnvelop.setMessage("您所添加的家属的名称有误,无法添加");
                        return mixEnvelop;
                    }
                    basePatientDO.setMobile(phoneNum);
                    familyId= jsonObject.getString("brid");
                    birth= jsonObject.getString("csny");
                    long lt = new Long(birth);
@ -178,7 +179,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                        }
                    }else {
                        if (null!=basePatientDO1){
                            res = ykyyService.addYktFamily(familyName,idCard, familySex,familyAge,phoneNum,medicare,relationName,"1",basePatientDO1.getUserId(),birth);
                            res = ykyyService.addYktFamily(familyName,idCard, familySex,familyAge,phoneNum,medicare,relationName,clinicId,basePatientDO1.getUserId(),birth);
                        }
                        if (StringUtils.isNotEmpty(res)){
                            JSONObject jsonObject1 = JSONObject.parseObject(res);

+ 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){
            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){
            //获取居民信息

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

@ -2,12 +2,21 @@ package com.yihu.jw.hospital.message.service;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
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.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -26,6 +35,14 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
    private SystemMessageDao systemMessageDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Value("${wechat.id}")
    private String wechatId;
    /**
@ -109,6 +126,29 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
        }
        return null;
    }
    public String  sendDoctorRemindSms(ConsultDo consultDo){
        String 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不存在";
            }
        }
        return msg;
    }
}

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

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.BaseDictJobTitleDao;
import com.yihu.jw.dict.dao.BaseJobCategoryDao;
import com.yihu.jw.dict.dao.DictDeptDescDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
@ -17,8 +18,10 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
@ -74,6 +77,7 @@ import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
@ -91,6 +95,7 @@ import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.yx.dao.YxTokenMappingDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.pinyin.PinyinUtil;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
@ -126,6 +131,8 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import static javafx.scene.input.KeyCode.L;
/**
 * Created by Trick on 2019/5/17.
 */
@ -276,6 +283,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private BaseJobCategoryDao jobCategoryDao;
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
@ -975,6 +986,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            outpatientDO.setPayStatus(1);
        } else {
            outpatientDO.setPayStatus(0);
            outpatientDO.setFee(price);
            outpatient = outpatientDao.save(outpatientDO);
        }
        if (outpatient.getOutpatientType().equalsIgnoreCase("1")){
@ -2610,8 +2623,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        } else {
                            ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(), wlyyPrescriptionDO.getOrderId(), wlyyPrescriptionDO.getRealOrder());
                        }
                        ykyySMSService.sendSmsByTempcode("prescription_remind",outpatientDO,wlyyPrescriptionDO,"");
                    }
                }
                result.put("code", 1);
@ -2635,6 +2648,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
                }
                result.put("code", 1);
                result.put("mes", "诊断完成");
                result.put("prescriptionId",prescription.getId());
@ -2792,6 +2806,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        try {
            BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
            WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getChargeType(), "6");
            return chargeDictDO.getReqFee();
        } catch (Exception e) {
            logger.error("getChargeFee:" + e.toString());
@ -7001,8 +7016,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                    msg = "您的视频咨询已预约成功。\n" +
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", "");
                }
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
@ -7038,6 +7053,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "16", "videoOrderRemind", "");
                }
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
@ -7073,6 +7089,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        systemMessageDO.setTitle("支付提醒");
        systemMessageDO.setType("11");
        JSONObject data = new JSONObject();
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatient.getId());
        if (outpatient!=null){
            if("1".equalsIgnoreCase(outpatient.getOutpatientType())){
                if ("1".equals(outpatient.getType())) {
@ -7110,7 +7127,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } catch (Exception e) {
                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)) {
                BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
@ -7147,7 +7166,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } catch (Exception e) {
                e.printStackTrace();
            }
            sendWxTemplateMsg(wechatId, "",consultTeamDo, type, "payRemind", "");
            if (businessOrderDO!=null&&0!=businessOrderDO.getPayPrice()){
                sendWxTemplateMsg(wechatId, "",consultTeamDo, type, "payRemind", "");
            }
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                ykyyService.pushNotificationToYktPatient(patientDO.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
            }

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

@ -38,6 +38,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
@ -150,6 +151,8 @@ public class YkyyEntranceService {
    private FileUploadService fileUploadService;
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
@ -1581,6 +1584,121 @@ public class YkyyEntranceService {
        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病人信息
     * @param idcard
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatientByIdCard(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.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病人信息
     * @param medicare
@ -1743,6 +1861,13 @@ public class YkyyEntranceService {
            //同步检查检验
            if(null!=inspectionDOS&&inspectionDOS.size()>0){
                synInspect(inspectionDOS);
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
                //向患者发送检查提醒短信
                if (wlyyOutpatientDO!=null){
                    ykyySMSService.sendSmsByTempcode("inspection_remind",wlyyOutpatientDO,null,"");
                }
            }
        }
@ -1903,6 +2028,7 @@ public class YkyyEntranceService {
        //挂号
        Map<String,Object> map = findYkDoctor(natAppointmentDO.getHospitalFlag());
        BasePatientDO patientDO = basePatientDao.findById(natAppointmentDO.getPatientId());
        //PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(natAppointmentDO.getPatientId());
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",natAppointmentDO.getPatientId(),"1");
        Integer brid= 0;
@ -1910,7 +2036,7 @@ public class YkyyEntranceService {
        Integer GHXH = 0;
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
@ -2070,11 +2196,16 @@ public class YkyyEntranceService {
        YkEmrJcsqDO ykEmrJcsqDO = new YkEmrJcsqDO();
        ykEmrJcsqDO.setJzxh(jzxh);
        ykEmrJcsqDO.setXmid(Integer.valueOf("12220"));
        JSONArray jsonArray1 = this.findZlxm(null, "12220");
        String deptNo = null;
        /*JSONArray jsonArray1 = this.findZlxm(null, "12220");
        if (jsonArray1 != null && jsonArray1.size() > 0) {
            JSONObject deptobject = jsonArray1.getJSONObject(0);
            deptNo = deptobject.getString("dept");
        }*/
        if ("3".equalsIgnoreCase(natAppointmentDO.getHospitalFlag())){
            deptNo = "96";
        }else {
            deptNo="1111";
        }
        ykEmrJcsqDO.setZxks(deptNo == null ? 0 : Integer.parseInt(deptNo));
        ykEmrJcsqDO.setJcxm("新冠病毒核酸检测");
@ -2092,7 +2223,7 @@ public class YkyyEntranceService {
        Integer kdks = 0;
        /*Integer brid=0;*/
        String mzhm="0";
        JSONArray jsonArray3 = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray3 = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        Map<String,Object> resultMap = new HashMap();
        if(jsonArray3!=null&&jsonArray3.size()>0){
            //获取居民信息
@ -2138,6 +2269,8 @@ public class YkyyEntranceService {
            String yjxh = object.getString("yjxh");
            natAppointmentDO.setRealOrder(yjxh);
            natAppointmentDO.setIsSuccess("1");
            natAppointmentDO.setDoctorId(map.get("doctorCode").toString());
            natAppointmentDO.setDoctorName(map.get("doctorName").toString());
            baseNatAppointmentDao.save(natAppointmentDO);
        }else {
        }
@ -2204,7 +2337,7 @@ public class YkyyEntranceService {
        hlwGhmxDO.setYSDM(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){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
@ -2680,7 +2813,7 @@ public class YkyyEntranceService {
        String sql = "select t.ztmc as\"ztmc\",t.ztid as\"ztid\"," +
                "t.gslb as\"gslb\",t.gsdm as\"gsdm\"," +
                "t.pydm as\"pydm\",t.Mzsy as\"Mzsy\"" +
                "from portal_his.emr_yzzt@ykzxtest t where 1=1";
                "from portal_his.emr_yzzt@xec_link t where 1=1";
        if(StringUtils.isNotEmpty(gslb)){
            sql+=" and t.gslb = "+Integer.valueOf(gslb);
            }
@ -2704,7 +2837,7 @@ public class YkyyEntranceService {
    public JSONArray findZtmxByid(String ztId) throws Exception{
        String sql = "select t.ztid as \"ztid\",t.xmdm as \"code\"," +
                "t.xmmc as \"name\",t.mrsl as \"quantity\",t.zxks as \"dept\"" +
                "from portal_his.emr_ztmx@ykzxtest t where 1=1";
                "from portal_his.emr_ztmx@xec_link t where 1=1";
        if (StringUtils.isNotEmpty(ztId)){
            sql += " and t.ztid = '"+ztId+"'";
        }
@ -2797,6 +2930,7 @@ public class YkyyEntranceService {
    }
    //门诊开单操作
    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();
        if (StringUtils.isNoneBlank(doctor)){
            doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
@ -2810,7 +2944,7 @@ public class YkyyEntranceService {
        String doctorHis="";
        Integer kdks = 0;
        Integer brid=0;
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        Map<String,Object> resultMap = new HashMap();
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
@ -2921,6 +3055,7 @@ public class YkyyEntranceService {
    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);
        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
        if (StringUtils.isNotEmpty(doctor)){
@ -2934,7 +3069,7 @@ public class YkyyEntranceService {
        String doctorHis="";
        Integer kdks = 0;
        Integer brid=0;
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
@ -3075,7 +3210,7 @@ public class YkyyEntranceService {
    public void updatePatientJd(String patient,String address,String phone,Float zy, boolean demoFlag) throws Exception {
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        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){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
@ -3107,6 +3242,9 @@ public class YkyyEntranceService {
    public String updateJzkh(Float brid,String jzkh){
        return  hibenateUtils.updateJzkh(brid,jzkh);
    }
    public String updateSfzh(Float brid,String sfzh){
        return  hibenateUtils.updateSfzh(brid,sfzh);
    }
    public String findInfoBysql(String sql) throws Exception {
        Map<String,Object> params = new HashedMap();

+ 25 - 6
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -7,6 +7,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
@ -34,6 +35,7 @@ import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
@ -41,6 +43,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
@ -50,6 +53,7 @@ import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -127,6 +131,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private YkyySMSService ykyySMSService;
@ -453,12 +461,14 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    public Map<String,Object> selectOrderByRelationCode(String relationCode,String tradeType,String wechatId,boolean payFlag,String appletCode) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.parseInt(relationCode));
        if (baseNatAppointmentDO!=null&&"-1".equalsIgnoreCase(baseNatAppointmentDO.getIsSuccess())){
            throw new Exception("订单已取消");
        }
        if (businessOrderDO!=null&&businessOrderDO.getStatus()==1){
            throw new Exception("订单已支付");
        if (NumberUtils.isDigits(relationCode) ){
            BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.valueOf(relationCode));
            if (baseNatAppointmentDO!=null&&"-1".equalsIgnoreCase(baseNatAppointmentDO.getIsSuccess())){
                throw new Exception("订单已取消");
            }
            if (businessOrderDO!=null&&businessOrderDO.getStatus()==1){
                throw new Exception("订单已支付");
            }
        }
        String body = businessOrderDO.getDescription();
        String totalFee = businessOrderDO.getPayPrice().intValue()+"";
@ -848,6 +858,12 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                    wlyyOutpatientDO.setPayStatus(1);
                    outpatientDao.save(wlyyOutpatientDO);
                    if (StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
                        BaseDoctorDO baseDoctorDO= doctorDao.findById(wlyyOutpatientDO.getDoctor());
                        if (baseDoctorDO!=null){
                            ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
                        }
                    }
                }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
                    if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
@ -877,6 +893,9 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                                            " where "+condition+" t.CFSB ='"+wlyyPrescriptionDO.getRealOrder()+"'";
                                    ykyyEntranceService.updateHisStatus(updatesql);
                                    logger.info("自取写入更新his");
                                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
                                    ykyySMSService.sendSmsByTempcode("oneself_pick",wlyyOutpatientDO,wlyyPrescriptionDO,"");
                                }else {
                                    //向顺丰下单
                                    logger.info("向顺丰快递下单");

+ 389 - 0
business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java

@ -0,0 +1,389 @@
package com.yihu.jw.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
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.WlyyOutpatientDO;
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.patient.dao.BasePatientDao;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.sms.util.ykyy.client.SmsClient;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.util.common.IdCardUtil;
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.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2020/3/19.
 */
@Service
public class YkyySMSService {
    private static final Logger logger = LoggerFactory.getLogger(YkyySMSService.class);
    private final String usrCode ="300643";
    private final String pw ="T9IHN69DDF";
    private final String urlSms ="https://smsapp.wlwx.com";
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private WlyyInspectionDao inspectionDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private WxPushLogDao wxPushLogDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    /**
     * 发送短信验证码
     * @param mobile
     * @param content
     * @return
     */
    public ResultMsg ykyySendSMS(String mobile, String content){
        SmsClient smsClient = new SmsClient();
        return smsClient.sendSms("ykyy",usrCode, content,mobile,"yes","","8",urlSms,pw);
    }
    public void sendSmsByTempcode(String temlateCode, WlyyOutpatientDO wlyyOutpatientDO, WlyyPrescriptionDO wlyyPrescriptionDO,String doctorMobile){
        SmsTemplateDO smsTemplateDO =  null;
        String content="";
        String sex = "先生/女士";
        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 (StringUtils.isNoneBlank(wlyyOutpatientDO.getIdcard())){
                String sexNo = IdCardUtil.getSexForIdcard_new(wlyyOutpatientDO.getIdcard());
                if ("1".equalsIgnoreCase(sexNo)){
                    sex = "先生";
                }else if ("2".equalsIgnoreCase(sexNo)){
                    sex = "女士";
                }
            }
            BasePatientDO basePatientDO = basePatientDao.findById(wlyyOutpatientDO.getPatient());
            if (basePatientDO!=null&&StringUtils.isNoneBlank(basePatientDO.getMobile())){
                mobile = basePatientDO.getMobile();
            }else {
                mobile=wlyyOutpatientDO.getMobile();
            }
        }
        logger.info("temlateCode"+temlateCode+"==mobile:"+mobile);
        try {
            if ("prescription_remind".equalsIgnoreCase(temlateCode)){//开具处方提醒
                smsTemplateDO = smsTemplateDao.findByClientId("prescription_remind");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).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 ("outpatient_remind".equalsIgnoreCase(temlateCode)){//患者发起复诊给医生发送消息
                smsTemplateDO = smsTemplateDao.findByClientId("outpatient_remind");
                if (smsTemplateDO!=null){
                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent();
                        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())){
                        content = smsTemplateDO.getContent().replace("图文","视频");
                        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)){//医生发消息发送短信提醒
                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)){//病人自取
                smsTemplateDO = smsTemplateDao.findByClientId("oneself_pick");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime())).replace("{{门诊号码}}",wlyyOutpatientDO.getRealOrder())
                    .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)){//处方审核失败
                smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    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");
                if (smsTemplateDO1!=null){
                    String contentDoctor = smsTemplateDO1.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder());
                    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)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("check_success_patient");
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    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)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("inspection_remind");
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                    String medicard = "";
                    Integer brxb = 0;
                    String mzhm ="0";
                    //如果患者医保卡不为空则用社保卡 否则用mzhm
                    if(StringUtils.isNoneBlank(wlyyOutpatientDO.getCardNo())){
                        medicard = wlyyOutpatientDO.getCardNo();
                        JSONArray jsonArray3 = findHisPatient(medicard,false);
                        if(jsonArray3!=null&&jsonArray3.size()>0){
                            //获取居民信息
                            JSONObject json = jsonArray3.getJSONObject(0);
                            mzhm = json.getString("mzhm");
                        }else {
                            medicard="";
                        }
                    }else {
                        JSONArray jsonArray3 = findHisPatientByIdCard(wlyyOutpatientDO.getIdcard(),false);
                        if(jsonArray3!=null&&jsonArray3.size()>0){
                            //获取居民信息
                            JSONObject json = jsonArray3.getJSONObject(0);
                            mzhm = json.getString("mzhm");
                        }
                    }
                    List<WlyyInspectionDO> list = inspectionDao.findByOutpatientId(wlyyOutpatientDO.getId());
                    String createTime = "";
                    if (list!=null&&list.size()>0){
                        createTime = DateUtil.dateToStrLong(list.get(0).getCreateTime());
                    }
                    if (StringUtils.isNoneBlank(medicard)){
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",createTime).replace("{{门诊号码}}",mzhm)
                        .replace("{{社保卡号}}","【凭社保卡/就诊卡"+medicard+"到院充值预缴金做检查】").replace("{{性别}}",sex).replace("{{时间}}",createTime);
                    }else {
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",createTime).replace("{{门诊号码}}",mzhm)
                                .replace("{{社保卡号}}","【到收费处,凭此条短信中的门诊号码换卡充值预缴金做检查】").replace("{{性别}}",sex);;
                    }
                    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);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(temlateCode+"模板发送失败");
        }
    }
    /**
     * 获取his病人信息
     * @param ssc
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatient(String ssc,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+"' ";
        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病人信息
     * @param idcard
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatientByIdCard(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.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;
    }
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java

@ -253,7 +253,7 @@ public class HibenateUtils {
                .registerStoredProcedureParameter("P_SFZH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_ERRMSG", String.class, ParameterMode.INOUT)
                .setParameter("P_BRID", brid)
                .setParameter("P_YBKH", sfzh);
                .setParameter("P_SFZH", sfzh);
        query.execute();
        String priceStr = (String) query.getOutputParameterValue("P_ERRMSG"); // 获取存储过程中的返回值
        return priceStr;

+ 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 org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2020/4/27.
 */
public interface WxPushLogDao extends PagingAndSortingRepository<WxPushLogDO, String>, JpaSpecificationExecutor<WxPushLogDO> {
    WxPushLogDO findByTempNameAndOpenid(String tempName,String openId);
    WxPushLogDO findByTempNameAndOpenidAndReceiver(String tempName,String openId,String reciver);
}

+ 266 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyyINSMSService.java

@ -0,0 +1,266 @@
package com.yihu.jw.sms.service;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.sms.util.ykyy.client.SmsClient;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by Trick on 2020/3/19.
 */
@Service
public class YkyyINSMSService {
    private static final Logger logger = LoggerFactory.getLogger(YkyyINSMSService.class);
    private final String usrCode ="300643";
    private final String pw ="T9IHN69DDF";
    private final String urlSms ="https://smsapp.wlwx.com";
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    /**
     * 发送短信验证码
     * @param mobile
     * @param content
     * @return
     */
    public ResultMsg ykyySendSMS(String mobile, String content){
        SmsClient smsClient = new SmsClient();
        return smsClient.sendSms("ykyy",usrCode, content,mobile,"yes","","8",urlSms,pw);
    }
   /* public void sendSmsByTempcode(String temlateCode, WlyyOutpatientDO wlyyOutpatientDO, WlyyPrescriptionDO wlyyPrescriptionDO,String doctorMobile){
        SmsTemplateDO smsTemplateDO =  null;
        String content="";
        String sex = "先生/女士";
        String mobile = "";
        if (wlyyOutpatientDO!=null){
            if (StringUtils.isNoneBlank(wlyyOutpatientDO.getIdcard())){
                String sexNo = IdCardUtil.getSexForIdcard_new(wlyyOutpatientDO.getIdcard());
                if ("1".equalsIgnoreCase(sexNo)){
                    sex = "先生";
                }else if ("2".equalsIgnoreCase(sexNo)){
                    sex = "女士";
                }
            }
            BasePatientDO basePatientDO = basePatientDao.findById(wlyyOutpatientDO.getPatient());
            if (basePatientDO!=null&&!StringUtils.isNoneBlank(basePatientDO.getMobile())){
                mobile = basePatientDO.getMobile();
            }else {
                mobile=wlyyOutpatientDO.getMobile();
            }
        }
        logger.info("temlateCode"+temlateCode+"==mobile:"+mobile);
        try {
            if ("prescription_remind".equalsIgnoreCase(temlateCode)){//开具处方提醒
                smsTemplateDO = smsTemplateDao.findByClientId("prescription_remind");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
            }else if ("outpatient_remind".equalsIgnoreCase(temlateCode)){//患者发起复诊给医生发送消息
                smsTemplateDO = smsTemplateDao.findByClientId("outpatient_remind");
                if (smsTemplateDO!=null){
                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent();
                        ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                    }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent().replace("图文","视频");
                        ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                    }
                }
            }else if ("message_remind_paitent".equalsIgnoreCase(temlateCode)){//医生发消息发送短信提醒
                content = smsTemplateDO.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
            }else if ("oneself_pick".equalsIgnoreCase(temlateCode)){//病人自取
                smsTemplateDO = smsTemplateDao.findByClientId("oneself_pick");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime())).replace("{{门诊号码}}",wlyyOutpatientDO.getRealOrder())
                    .replace("{{性别}}",sex);;
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
            }else if("check_failed".equalsIgnoreCase(temlateCode)){//处方审核失败
                smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
                SmsTemplateDO smsTemplateDO1 = smsTemplateDao.findByClientId("check_failed_doctor");
                if (smsTemplateDO1!=null){
                    content = smsTemplateDO.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder());
                    ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                }
            }else if ("check_success_patient".equalsIgnoreCase(temlateCode)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("check_success_patient");
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
            }else if ("inspection_remind".equalsIgnoreCase(temlateCode)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("inspection_remind");
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                    String medicard = "";
                    Integer brxb = 0;
                    String mzhm ="0";
                    //如果患者医保卡不为空则用社保卡 否则用mzhm
                    if(StringUtils.isNoneBlank(wlyyOutpatientDO.getCardNo())){
                        medicard = wlyyOutpatientDO.getCardNo();
                        JSONArray jsonArray3 = findHisPatient(medicard,false);
                        if(jsonArray3!=null&&jsonArray3.size()>0){
                            //获取居民信息
                            JSONObject json = jsonArray3.getJSONObject(0);
                            mzhm = json.getString("mzhm");
                        }else {
                            medicard="";
                        }
                    }else {
                        JSONArray jsonArray3 = findHisPatientByIdCard(wlyyOutpatientDO.getIdcard(),false);
                        if(jsonArray3!=null&&jsonArray3.size()>0){
                            //获取居民信息
                            JSONObject json = jsonArray3.getJSONObject(0);
                            mzhm = json.getString("mzhm");
                        }
                    }
                    List<WlyyInspectionDO> list = inspectionDao.findByOutpatientId(wlyyOutpatientDO.getId());
                    String createTime = "";
                    if (list!=null&&list.size()>0){
                        createTime = DateUtil.dateToStrLong(list.get(0).getCreateTime());
                    }
                    if (StringUtils.isNoneBlank(medicard)){
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",createTime).replace("{{门诊号码}}",mzhm)
                        .replace("{{社保卡号}}","【凭社保卡"+medicard+"到院充值预缴金做检查】").replace("{{性别}}",sex);;
                    }else {
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",createTime).replace("{{门诊号码}}",mzhm)
                                .replace("{{社保卡号}}","【到收费处,凭此条短信中的门诊号码换卡充值预缴金做检查】").replace("{{性别}}",sex);;
                    }
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
            }
            logger.info("发送后:temlateCode"+temlateCode+"==mobile:"+mobile+"content"+content);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(temlateCode+"模板发送失败");
        }
    }
    *//**
     * 获取his病人信息
     * @param ssc
     * @return
     * @throws Exception
     *//*
    public JSONArray findHisPatient(String ssc,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+"' ";
        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病人信息
     * @param idcard
     * @return
     * @throws Exception
     *//*
    public JSONArray findHisPatientByIdCard(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.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;
    }*/
}

+ 0 - 29
business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyySMSService.java

@ -1,29 +0,0 @@
package com.yihu.jw.sms.service;
import com.yihu.jw.sms.util.ykyy.client.SmsClient;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import org.springframework.stereotype.Service;
/**
 * Created by Trick on 2020/3/19.
 */
@Service
public class YkyySMSService {
    private final String usrCode ="300643";
    private final String pw ="T9IHN69DDF";
    private final String url ="https://smsapp.wlwx.com";
    /**
     * 发送短信验证码
     * @param mobile
     * @param content
     * @return
     */
    public ResultMsg ykyySendSMS(String mobile, String content){
        SmsClient smsClient = new SmsClient();
        return smsClient.sendSms("ykyy",usrCode, content,mobile,"yes","","8",url,pw);
    }
}

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

@ -29,7 +29,7 @@ import com.yihu.jw.security.utils.AES;
import com.yihu.jw.security.utils.DateUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.security.utils.SerializeUtil;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
@ -139,7 +139,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @Autowired
    private OauthSsoService oauthSsoService;
    @Autowired
    private YkyySMSService ykyySMSService;
    private YkyyINSMSService ykyyINSMSService;
    @Autowired
    private RegisterService registerService;
    @Autowired
@ -805,9 +805,9 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                        return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
                    }
                }else if("1".equals(type)){
                    result = ykyySMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
                    result = ykyyINSMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
                }else if("2".equals(type)) {
                    result = ykyySMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
                    result = ykyyINSMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
                }
                if (result.isSuccess()) {
                    Captcha _captcha = new Captcha();

+ 8 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java

@ -409,4 +409,12 @@ public class YkyyController extends EnvelopRestEndpoint {
                              @RequestParam(value = "jzkh",required = false)String jzkh){
        return success(ykyyEntranceService.updateJzkh(brid,jzkh));
    }
    @GetMapping(value = "/updateSfzh")
    @ApiOperation(value = "更新患者身份证号")
    public Envelop updateSfzh(@ApiParam(name = "brid", value = "病人id", required = true)
                              @RequestParam(value = "brid",required = true)Float brid,
                              @ApiParam(name = "sfzh", value = "身份证号", required = false)
                              @RequestParam(value = "sfzh",required = false)String sfzh){
        return success(ykyyEntranceService.updateSfzh(brid,sfzh));
    }
}

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

@ -35,11 +35,11 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.RSAEncrypt;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
@ -189,7 +189,7 @@ public class UnSettledHISPrescriptionService {
                    JSONObject json = jsonArray.getJSONObject(i);
                    String cfsb = json.getString("CFSB");
                    //查找对应的处方
                    String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR,w.DOCTOR_NAME,to_char(w.CREATE_TIME,'YYYY-MM-DD hh24:mi:ss')  AS \"CREATE_TIME\" from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' and status <> 11 ORDER BY w.CREATE_TIME desc";
                    String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR,w.DOCTOR_NAME from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' and status <> 11 ORDER BY w.CREATE_TIME desc";
                    List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                    if(pre!=null && pre.size()>0){
                        String prescriptionId = pre.get(0).get("ID").toString();
@ -209,17 +209,10 @@ public class UnSettledHISPrescriptionService {
                        System.out.println("发送诊断消息成功:"+immsg);
                        //发送短信提醒
                        String content = "";
                        SmsTemplateDO smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                        if (smsTemplateDO!=null){
                            content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",cfsb);
                            ykyySMSService.ykyySendSMS(wlyyOutpatientDO.getConsumerMobile(),content);
                        }
                        SmsTemplateDO smsTemplateDO1 = smsTemplateDao.findByClientId("check_failed_doctor");
                        if (smsTemplateDO1!=null){
                            content = smsTemplateDO.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",pre.get(0).get("CREATE_TIME").toString())
                                    .replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",cfsb);
                            ykyySMSService.ykyySendSMS(wlyyOutpatientDO.getConsumerMobile(),content);
                        }
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findByRealOrder(cfsb);
                        BaseDoctorDO baseDoctorDO = doctorDao.findById(doctor);
                        ykyySMSService.sendSmsByTempcode("check_failed",wlyyOutpatientDO,prescriptionDO,baseDoctorDO.getMobile());
                    }
                }
            }
@ -268,16 +261,16 @@ public class UnSettledHISPrescriptionService {
                                        logger.info("=======setUrl========"+newConfig.getUrl());
                                        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.setPrescribeTime(new Date());
                                wlyyPrescriptionDO.setCheckStatus(0);
@ -305,14 +298,7 @@ public class UnSettledHISPrescriptionService {
                                }
                                prescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
                                imService.pushPrescriptionImMessage(prescriptionVO);
                                //发送审核成功短信提醒
                                //发送短信提醒
                                String content = "";
                                SmsTemplateDO smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",cfsb);
                                    ykyySMSService.ykyySendSMS(wlyyOutpatientDO.getConsumerMobile(),content);
                                }
                                ykyySMSService.sendSmsByTempcode("check_success_patient",wlyyOutpatientDO,wlyyPrescriptionDO,"");
                            }
                        }
                    }

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

@ -261,6 +261,12 @@
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>sms-service</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>

+ 3 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -15,7 +15,7 @@ import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
@ -55,7 +55,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private YkyySMSService ykyySMSService;
    private YkyyINSMSService ykyyINSMSService;
    private final String KEY_SUFFIX = ":code";
    @Autowired
    private ZhongShanSMSService zhongShanSMSService;
@ -195,7 +195,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
            if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                System.out.println("发送眼科验证码开始");
                ResultMsg result= null;
                result = ykyySMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                result = ykyyINSMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                if (result.isSuccess()){
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");

+ 15 - 3
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.doctor.BaseDoctorDO;
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.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
@ -26,6 +27,7 @@ import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.service.WlyyHttpLogService;
import com.yihu.jw.hospital.message.service.BaseBannerDoctorService;
import com.yihu.jw.hospital.message.service.BaseUserMsgService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
@ -35,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.QrcodeService;
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.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -49,7 +52,7 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
@ -185,9 +188,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    private YkyyINSMSService ykyyINSMSService;
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    private SystemMessageService systemMessageService;
    @Autowired
    private ConsultDao consultDao;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
@ -1547,6 +1554,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    }
    @GetMapping("/testsms")
    public void testsms(String mobile ,String contet){
        ykyySMSService.ykyySendSMS(mobile,contet);
        ykyyINSMSService.ykyySendSMS(mobile,contet);
    }
    @GetMapping("/smsToDoctor")
    public Envelop sentMessageRemindSms(@RequestParam(value = "consult", required = true)String consult){
        ConsultDo consultDo = consultDao.findOne(consult);
        return  success(systemMessageService.sendDoctorRemindSms(consultDo));
    }
}

+ 1 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/wechat/WechatCoreController.java

@ -156,6 +156,7 @@ public class WechatCoreController extends EnvelopRestEndpoint {
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (validate(signature, timestamp, nonce)) {
                String xmlStr = weiXinCoreService.messageProcess(request, wxAccessTokenDO.getAccessToken());
                logger.info("返回xml:"+xmlStr);
                // 判断返回值是xml、json格式(取关是空串)
                Boolean flag = weiXinCoreService.isXML(xmlStr);
                if (xmlStr == "error") {

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/wechat/WeiXinEventProcess.java

@ -130,7 +130,7 @@ public class WeiXinEventProcess {
            String url = null;
            // 医生二维码跳转URL
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3a%2f%2fintel.yanketong.com%2fims-wx%2f%23%2fpersonal%2ffamilyMember%2findex%3ftype%3dnucleicTest&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
                url = "https://intel.yanketong.com/ims-wx/redirect.html";
                picUrl = "https://intel.yanketong.com/group1/M00/00/13/wKghxmAZD-iAEyHgAAA-zHpYNyg537.png";
                article.put("Url", url);
                article.put("Title", "核酸检测预约");