Browse Source

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

liubing 4 years ago
parent
commit
ef2c8cda7a
27 changed files with 1119 additions and 117 deletions
  1. 2 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseJobCategoryDao.java
  2. 34 11
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  3. 204 54
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 122 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  5. 417 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  6. 21 0
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  7. 52 0
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java
  8. 3 0
      business/sms-service/src/main/java/com/yihu/jw/sms/dao/BaseSmsTemplateDao.java
  9. 3 4
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  10. 27 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java
  11. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkEmrJcsqDO.java
  12. 4 0
      common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java
  13. 0 8
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java
  14. 5 3
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java
  15. 46 2
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  16. 6 0
      svr/svr-internet-hospital-job/pom.xml
  17. 20 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java
  18. 30 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java
  19. 1 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/CancelNotPay.java
  20. 47 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/DownLoadYxJob.java
  21. 9 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  22. 21 17
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  23. 33 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  24. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  25. 5 0
      svr/svr-internet-hospital/src/main/resources/wechat/weixin_menu.txt
  26. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java
  27. 4 4
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/dict/dao/BaseJobCategoryDao.java

@ -12,4 +12,6 @@ public interface BaseJobCategoryDao extends PagingAndSortingRepository<BaseJobCa
    List<BaseJobCategoryDO> findFirstCategoryList();
    @Query("from BaseJobCategoryDO t where t.pid = ?1 and t.del = 1")
    List<BaseJobCategoryDO> findSecondCategoryList(String pid);
    @Query("from BaseJobCategoryDO t where t.name = ?1 and t.del = 1")
    BaseJobCategoryDO findByName(String name);
}

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

@ -1,6 +1,8 @@
package com.yihu.jw.hospital.family.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dict.dao.BaseJobCategoryDao;
import com.yihu.jw.entity.base.dict.BaseJobCategoryDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.hospital.family.BasePatientMemberDictDO;
@ -62,6 +64,8 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
    private YkyyService ykyyService;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private BaseJobCategoryDao baseJobCategoryDao;
    //添加关联家属
    @Transactional
@ -71,7 +75,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
        BasePatientDO basePatientDO = basePatientDao.findByIdcard(idCard);
        List<BasePatientDO> list = basePatientDao.findByMobile(phoneNum);
        if (!"xm_zsyy_wx".equalsIgnoreCase(wxId)){
        if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
            if (list!=null&&list.size()>0&&basePatientDO!=null){
                if (basePatientDO.getMobile().equalsIgnoreCase(phoneNum)){
@ -103,6 +107,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        WlyyPatientFamilyMemberDO result = new WlyyPatientFamilyMemberDO();
        if (StringUtils.isNotBlank(id)){
            result = wlyyPatientFamilyMemberDao.findOne(id);
            basePatientDO = basePatientDao.findById(result.getFamilyMember());
        }
        String dictName = "";
@ -324,21 +329,17 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
            mixEnvelop.setMessage("添加成功");
            mixEnvelop.setDetailModelList(resultList);
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByCode(medicare);
                //PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByCode(medicare);
                PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",sucessPatient.getId(),"1");
                if (patientMedicareCardDO==null){
                    patientMedicareCardDO = new PatientMedicareCardDO();
                }
                if (null!=patientMedicareCardDO){
                    if (!patientMedicareCardDO.getPatientCode().equalsIgnoreCase(sucessPatient.getId())){
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("请确认该就诊卡为当前家人的就诊卡");
                        return mixEnvelop;
                    }
                }
                patientMedicareCardDO.setCode(medicare);
                //patientMedicareCardDO.setType(medicareType);
                patientMedicareCardDO.setPatientCode(patientNewId);
                patientMedicareCardDO.setDel("1");
                patientMedicareCardDO.setParentType("A");
                patientMedicareCardDO.setType("A_01");
                basePatientMedicareCardDao.save(patientMedicareCardDO);
            }
@ -495,7 +496,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                        System.out.println("birthday:"+map.get("birthday").toString());
                    }
                    List<PatientMedicareCardDO> list1 = basePatientMedicareCardDao.findByPatientCode(patientId);
                    if (null!=list1&&list.size()>0){
                    if (null!=list1&&list1.size()>0){
                        map.put("card",list1.get(0));
                    }else {
                        map.put("card","");
@ -575,6 +576,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                    envelop.setStatus(-1);
                    return envelop;
                }
            }
            wlyyPatientFamilyMemberDao.save(wlyyPatientFamilyMemberDO);
            envelop.setMessage("删除成功");
@ -586,7 +588,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        }
    }
    //获取单个亲属详细信息
    public List<Map<String,Object>>  findMemberById(String id) throws ParseException {
    public List<Map<String,Object>>  findMemberById(String id) throws Exception {
        String sql="select t.id as \"id\",t.card_type as \"cardType\"," +
                "t.family_member as \"familyMember\",t.patient as \"patient\"," +
                "b.name as \"name\",b.idcard as \"idcard\",b.mobile as \"mobile\",t.clinicid as \"clinicid\"," +
@ -610,9 +612,30 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                        List<PatientMedicareCardDO> list1 = basePatientMedicareCardDao.findByPatientCode(map.get("familyMember").toString());
                        if (list1!=null&&list1.size()!=0){
                            map.put("card",list1.get(0));
                            JSONObject object = ykyyEntranceService.selectByAddress(list1.get(0).getCode());
                            if (object!=null){
                                map.put("address",object.getString("address"));
                                map.put("zydm",object.getString("zydm"));
                                if (StringUtils.isNotBlank(object.getString("zydm"))){
                                    BaseJobCategoryDO jobCategoryDO = baseJobCategoryDao.findOne(Integer.parseInt(object.getString("zydm")));
                                    if (jobCategoryDO!=null){
                                        map.put("zydmName",jobCategoryDO.getName());
                                    }
                                }else {
                                    map.put("zydmName","");
                                }
                                map.put("jtdh",object.getString("jtdh"));
                            }
                        }else {
                            map.put("card","");
                            map.put("address","");
                            map.put("zydm","");
                            map.put("jtdh","");
                            map.put("zydmName","");
                        }
                    }
                }
            }

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

@ -2,12 +2,15 @@ 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;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.area.BaseDrugStoreDO;
import com.yihu.jw.entity.base.dict.BaseJobCategoryDO;
import com.yihu.jw.entity.base.dict.DictDeptDescDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -15,6 +18,7 @@ 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.wx.*;
@ -126,6 +130,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.
 */
@ -273,6 +279,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @Autowired
    private PayInfoNoticeService payInfoNoticeService;
    @Autowired
    private BaseJobCategoryDao jobCategoryDao;
@ -4403,7 +4411,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
                newConfig.setKeyword1( "处方支付");
                newConfig.setKeyword2(outpatientDO.getHospitalName());
                newConfig.setKeyword3( outpatientDO.getDoctorName());
                newConfig.setKeyword3(outpatientDO.getDoctorName());
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 处方支付提醒开始");
@ -10457,7 +10465,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return null;
    }
    public Map saveNatAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
                                   String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName,String pm,String pushChannel,String pushFlag,String cardNoType) throws Exception {
                                   String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName,String pm,String pushChannel,String pushFlag,String cardNoType,String consumer) throws Exception {
        Map returnMap = new HashMap();
        if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
            net.sf.json.JSONObject jsondate = new JSONObject();
@ -10688,7 +10696,45 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            baseNatAppointmentDO.setDept("3150000");
            baseNatAppointmentDO.setDeptName("感染疾病科");
            baseNatAppointmentDO.setAmpm(pm);
            baseNatAppointmentDO.setHospitalFlag(pushFlag);
            baseNatAppointmentDO.setConsumer(consumer);
            BasePatientDO basePatientDO = basePatientDao.findById(consumer);
            baseNatAppointmentDO.setConsumerName(basePatientDO.getName());
            baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
            //添加订单
            BusinessOrderDO businessDO = new BusinessOrderDO();
            businessDO.setPatient(consumer);
            businessDO.setPatientName(basePatientDO.getName());
            businessDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessDO.setCreateTime(new Date());
            businessDO.setStatus(0);
            businessDO.setRelationCode(baseNatAppointmentDO.getId()+"");
            businessDO.setRelationName("核酸检测订单");
            businessDO.setOrderCategory("6");
            businessDO.setOrderType(12);
            businessDO.setPayPrice(8000.0);
            businessDO.setRematk("核酸检测订单");
            businessDO.setDescription("核酸检测订单");
            businessDO.setPayType(1);
            businessDO.setUpdateTime(new Date());
            businessOrderDao.save(businessDO);
            logger.info("建档开始");
            com.alibaba.fastjson.JSONObject jdObject = ykyyEntranceService.patientJDKH(patientId, cardNo,name,mobile,mediaCard);
            logger.info("建档结束");
            logger.info("更新建档信息");
            BaseJobCategoryDO jobCategoryDO =jobCategoryDao.findByName(firstJobName);
            Float zy= 0f;
            if (jobCategoryDO!=null){
                zy=Float.parseFloat(jobCategoryDO.getId()+"");
            }
            ykyyEntranceService.updatePatientJd(patientId,address,mobile,zy,demoFlag);
            //同步眼科医院
            logger.info("开始同步眼科医院");
            ykyyEntranceService.saveKsjc(baseNatAppointmentDO,demoFlag);
            //预约成功后发送支付模板消息
            sendYktemplateMessage(baseNatAppointmentDO.getId(),false);
            logger.info("结束同步眼科医院");
            returnMap.put("msg","预约成功");
            returnMap.put("status","200");
            returnMap.put("id",baseNatAppointmentDO.getId());
@ -10706,7 +10752,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (!StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
            throw new Exception("核酸项目不存在");
        }
        logger.info("模板消息推送标识pushFlag"+pushFlag);
        if (!StringUtils.isNoneBlank(pushFlag)){
            String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
@ -10775,16 +10820,101 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                logger.info("支付宝模板消息"+reponse);
            }
         }
         return "发送成功!";
    }
    public MixEnvelop getNatRecords(String patientId,String id,String payStatus,String appointmentTime, String isSuccess,Integer page ,Integer pageSize){
        try {
            savePayStatusByHis(patientId);
            logger.info("同步结束");
        } catch (Exception e) {
            e.printStackTrace();
    public String sendYktemplateMessage(Integer id,boolean isPayed)  {
        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
        if (baseNatAppointmentDO==null){
            return "核酸项目不存在,发送失败";
        }
        List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
        BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId());
        String userName = "";
        if (patientDO != null) {
            userName = patientDO.getName();
        }
        if (StringUtils.isNotEmpty(baseNatAppointmentDO.getConsumer())){
            ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, baseNatAppointmentDO.getConsumer());
        }
        if (ps.isEmpty()) {
            logger.info("该用户没有openid,无法推送模版消息,用户ID:" + baseNatAppointmentDO.getConsumer() + "wechatId:" + wechatId);
        }
        Map<String,Object> map = ykyyEntranceService.findYkDoctor(baseNatAppointmentDO.getHospitalFlag());
        WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
        for (BasePatientWechatDo one : ps) {
            try {
                if (isPayed){
                    //眼科预约成功后消息提醒
                    WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                    String scene = "hsyycgtx";
                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_hsyycg_notice", scene, 1);
                    BeanUtils.copyProperties(config, newConfig);
                    newConfig.setFirst(config.getFirst().replace("key1",userName));
                    newConfig.setKeyword1("核酸检测预约单支付");
                    if ("3".equalsIgnoreCase(baseNatAppointmentDO.getHospitalFlag())){
                        newConfig.setKeyword2("厦门大学附属厦门眼科中心思北院区");
                    }else {
                        newConfig.setKeyword2("厦门大学附属厦门眼科中心五缘院区");
                    }
                    newConfig.setKeyword3(map.get("doctorName")==null?"":map.get("doctorName").toString());
                    newConfig.setKeyword4(userName);
                    newConfig.setKeyword5(DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()));
                    newConfig.setRemark(config.getRemark().replace("key1",userName).replace("key2",DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime())));
                    newConfig.setUrl(newConfig.getUrl()+baseNatAppointmentDO.getId());
                    logger.info("=======setUrlhsyycgtx========" + newConfig.getUrl());
                    logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newConfig));
                    logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid());
                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig);
                    //保存发送模板记录,
                    WxPushLogDO wxPushLogDO = new WxPushLogDO();
                    wxPushLogDO.setCreateTime(new Date());
                    wxPushLogDO.setOpenid(one.getOpenid());
                    wxPushLogDO.setReceiver(baseNatAppointmentDO.getPatientId());
                    wxPushLogDO.setWechatId(wechatId);
                    wxPushLogDO.setScene(scene);
                    wxPushLogDao.save(wxPushLogDO);
                }else {
                    WxTemplateConfigDO newPayNotice = new WxTemplateConfigDO();
                    String scenePayNotice= "hszftx";
                    //眼科核酸预约成功后支付提醒
                    WxTemplateConfigDO configPayNotice = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_hszf_notice", scenePayNotice, 1);
                    BeanUtils.copyProperties(configPayNotice, newPayNotice);
                    newPayNotice.setFirst(configPayNotice.getFirst().replace("key1",userName));
                    newPayNotice.setKeyword1("核酸检测预约单支付");
                    if ("3".equalsIgnoreCase(baseNatAppointmentDO.getHospitalFlag())){
                        newPayNotice.setKeyword2("厦门大学附属厦门眼科中心思北院区");
                    }else {
                        newPayNotice.setKeyword2("厦门大学附属厦门眼科中心五缘院区");
                    }
                    newPayNotice.setKeyword3(map.get("doctorName")==null?"":map.get("doctorName").toString());
                    newPayNotice.setRemark(configPayNotice.getRemark());
                    newPayNotice.setUrl(configPayNotice.getUrl()+baseNatAppointmentDO.getId());
                    logger.info("=======setUrlhszftx========" + newPayNotice.getUrl());
                    logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newPayNotice));
                    logger.info("发送核酸预约模板消息成功");
                    logger.info("调用眼科微信模板消息支付提醒接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid());
                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newPayNotice);
                    //保存发送模板记录,
                    WxPushLogDO wxPushLogDO = new WxPushLogDO();
                    wxPushLogDO.setCreateTime(new Date());
                    wxPushLogDO.setOpenid(one.getOpenid());
                    wxPushLogDO.setReceiver(baseNatAppointmentDO.getPatientId());
                    wxPushLogDO.setWechatId(wechatId);
                    wxPushLogDO.setScene(scenePayNotice);
                    wxPushLogDao.save(wxPushLogDO);
                    logger.info("发送核酸预约模板消息支付提醒成功");
                }
            } catch (Exception e) {
                e.printStackTrace();
                logger.info("发送核酸预约模板消息失败,error="+e.getMessage());
            }
        }
        return "发送成功!";
    }
    public MixEnvelop getNatRecords(String patientId,String id,String payStatus,String appointmentTime, String isSuccess,Integer page ,Integer pageSize){
        String sql = "select t.name as \"name\"," +
                "t.card_no as \"cardNo\"," +
                "t.card_type as \"cardType\"," +
@ -10796,12 +10926,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "t.pay_status as \"payStatus\"," +
                "t.medicare as \"medicare\","+
                "t.voucher_no as \"voucherNo\","+
                "t.dept as \"dept\","+
                "t.dept_name as \"deptName\","+
                "t.id as \"id\"," +
                "t.card_no_type as \"cardNoType\"," +
                "t.HOSPITAL_FLAG as \"hospitalFlag\"," +
                "t.appointment_time as \"appointmentTime\" " +
                " from base_nat_appointment t where 1=1 ";
        if (StringUtils.isNoneBlank(patientId)){
            sql+=" and t.patient_id ='"+patientId+"'";
            sql+=" and t.consumer ='"+patientId+"'";
        }
        if (StringUtils.isNoneBlank(id)){
            sql+=" and t.id ='"+id+"'";
@ -10905,54 +11038,71 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            try {
                BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
                if (null!=baseNatAppointmentDO){
                    res = entranceService.BS10145("3150000","0001",DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),demoFlag);
                    logger.info("核酸检测预约取消"+res);
                    com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
                    Boolean flag = false;
                    if (jsonObject!=null){
                        com.alibaba.fastjson.JSONObject object = jsonObject.getJSONObject("MsgInfo");
                        String Msg = object.getString("Msg");
                        if (Msg.contains("Error")){
                            throw new Exception(Msg);
                        }else {
                            baseNatAppointmentDO.setIsSuccess("-1");
                            baseNatAppointmentDO.setCancelReson("患者本人取消");
                            baseNatAppointmentDO.setCancelTime(new Date());
                            baseNatAppointmentDO.setCancelBy(patientId);
                            baseNatAppointmentDao.save(baseNatAppointmentDO);
                            if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                                //删除处方
                                logger.info("删除处方开始");
                                net.sf.json.JSONObject jsondate = new JSONObject();
                                jsondate.put("checkPart","鼻/咽拭子");
                                jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
                                jsondate.put("chargeFlag","2");
                                jsondate.put("chargeCode","361322");
                                jsondate.put("icdCode","Z00.000");
                                jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
                                jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
                                jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
                                jsondate.put("address2",baseNatAppointmentDO.getCityName());
                                jsondate.put("address3",baseNatAppointmentDO.getTownName());
                                jsondate.put("address4",baseNatAppointmentDO.getStreetName());
                                jsondate.put("address5",2);
                                jsondate.put("area",baseNatAppointmentDO.getAddress());
                                jsondate.put("winNo",6);
                                jsondate.put("target",2);
                                jsondate.put("quantity",1);
                                jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
                                jsondate.put("dept",baseNatAppointmentDO.getDept());
                                jsondate.put("doctor",baseNatAppointmentDO.getDoctorId());
                                jsondate.put("realOrder",baseNatAppointmentDO.getRealOrder());
                                JSONArray array = new JSONArray();
                                array.add(jsondate);
                                JSONObject object1  = entranceService.BS10112(array.toString(),demoFlag);
                                logger.info("删除处方结束");
                            }
                    if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                        res = entranceService.BS10145("3150000","0001",DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),demoFlag);
                        logger.info("核酸检测预约取消"+res);
                        com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
                        Boolean flag = false;
                        if (jsonObject!=null){
                            com.alibaba.fastjson.JSONObject object = jsonObject.getJSONObject("MsgInfo");
                            String Msg = object.getString("Msg");
                            if (Msg.contains("Error")){
                                throw new Exception(Msg);
                            }else {
                                baseNatAppointmentDO.setIsSuccess("-1");
                                baseNatAppointmentDO.setCancelReson("患者本人取消");
                                baseNatAppointmentDO.setCancelTime(new Date());
                                baseNatAppointmentDO.setCancelBy(patientId);
                                baseNatAppointmentDao.save(baseNatAppointmentDO);
                                if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                                    //删除处方
                                    logger.info("删除处方开始");
                                    net.sf.json.JSONObject jsondate = new JSONObject();
                                    jsondate.put("checkPart","鼻/咽拭子");
                                    jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
                                    jsondate.put("chargeFlag","2");
                                    jsondate.put("chargeCode","361322");
                                    jsondate.put("icdCode","Z00.000");
                                    jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
                                    jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
                                    jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
                                    jsondate.put("address2",baseNatAppointmentDO.getCityName());
                                    jsondate.put("address3",baseNatAppointmentDO.getTownName());
                                    jsondate.put("address4",baseNatAppointmentDO.getStreetName());
                                    jsondate.put("address5",2);
                                    jsondate.put("area",baseNatAppointmentDO.getAddress());
                                    jsondate.put("winNo",6);
                                    jsondate.put("target",2);
                                    jsondate.put("quantity",1);
                                    jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
                                    jsondate.put("dept",baseNatAppointmentDO.getDept());
                                    jsondate.put("doctor",baseNatAppointmentDO.getDoctorId());
                                    jsondate.put("realOrder",baseNatAppointmentDO.getRealOrder());
                                    JSONArray array = new JSONArray();
                                    array.add(jsondate);
                                    JSONObject object1  = entranceService.BS10112(array.toString(),demoFlag);
                                    logger.info("删除处方结束");
                                }
                            }
                        }
                    }else if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                        baseNatAppointmentDO.setIsSuccess("-1");
                        baseNatAppointmentDO.setCancelReson("患者本人取消");
                        baseNatAppointmentDO.setCancelTime(new Date());
                        baseNatAppointmentDO.setCancelBy(patientId);
                        baseNatAppointmentDao.save(baseNatAppointmentDO);
                        if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                            logger.info("同步his订单状态"+baseNatAppointmentDO.getRealOrder());
                            String updateJcsq = "update V_EMR_JCSQ set ZFBZ = 1 where yjxh = "+baseNatAppointmentDO.getRealOrder();
                            ykyyEntranceService.updateHisStatus(updateJcsq);
                            String update01sq = "update V_MS_YJ01 set ZFPB = 1 where yjxh = "+baseNatAppointmentDO.getRealOrder();
                            ykyyEntranceService.updateHisStatus(update01sq);
                        }
                    }
                }
            } catch (Exception e) {

+ 122 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -51,6 +51,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.CheckSumBuilder;
import com.yihu.jw.utils.FileUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
@ -66,6 +67,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -919,7 +922,62 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        return array;
    }
    public String findYxVideoList(){
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
        Long endTime = new Date().getTime();
        Long startTime = new Date().getTime()-24*60*60*1000;
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce =  randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://vcloud.163.com/app/vod/video/list";
        Map<String,Object> httpPost = new HashedMap();
        // 设置请求的header
        httpPost.put("AppKey", appKey);
        httpPost.put("Nonce", nonce);
        httpPost.put("CurTime", curTime);
        httpPost.put("CheckSum", checkSum);
        httpPost.put("Content-Type", "application/json");
        JSONObject object = new JSONObject();
        object.put("currentPage",500);
        object.put("pageSize",1);
        object.put("status",40);
        object.put("type",0);
        object.put("beginTime",startTime);
        object.put("endTime",endTime);
        logger.info("入参"+object.toJSONString());
        String response = httpClientUtil.postBodyHead(url,object,httpPost);
        logger.info("返回日志"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){
                JSONObject object1 = jsonObject.getJSONObject("ret");
                if (object1!=null){
                    JSONArray jsonArray = object1.getJSONArray("list");
                    if (jsonArray!=null&&jsonArray.size()>0){
                        for (int i=0;i<jsonArray.size();i++){
                            JSONObject object2 = jsonArray.getJSONObject(i);
                            if (object2!=null){
                                String vedioUrl =object2.getString("origUrl");
                                String vedioName = object2.getString("videoName");
                                String filePath = "/Projects/Video/"+DateUtil.getStringDate("yyyyMMdd");
                                logger.info("filePath:"+filePath);
                                logger.info("vedioUrl"+vedioUrl);
                                FileUtil.saveUrlAs(vedioUrl,filePath,"GET",vedioName);
                            }
                        }
                    }
                }
            }
        }
        return null;
    }
    public String saveVideoFile(String vip){
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
@ -959,6 +1017,70 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        }
        return null;
    }
    public String saveVideoFileList(String startTime,String endTime,Integer status,Integer page ,Integer pageSize){
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
        JSONObject object = new JSONObject();
        if (StringUtils.isNoneBlank(startTime)){
            Long start = DateUtil.strToDate(startTime).getTime();
            object.put("beginTime",start);
        }
        if (StringUtils.isNoneBlank(endTime)){
            Long end = DateUtil.strToDate(endTime).getTime();
            object.put("endTime",end);
        }
        if (status!=null){
            object.put("status",40);
        }
        object.put("type",0);
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce =  randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://vcloud.163.com/app/vod/video/list";
        Map<String,Object> httpPost = new HashedMap();
        // 设置请求的header
        httpPost.put("AppKey", appKey);
        httpPost.put("Nonce", nonce);
        httpPost.put("CurTime", curTime);
        httpPost.put("CheckSum", checkSum);
        httpPost.put("Content-Type", "application/json");
        object.put("currentPage",page);
        object.put("pageSize",pageSize);
        logger.info("入参"+object.toJSONString());
        String response = httpClientUtil.postBodyHead(url,object,httpPost);
        logger.info("返回日志"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){
                JSONObject object1 = jsonObject.getJSONObject("ret");
                if (object1!=null){
                    JSONArray jsonArray = object1.getJSONArray("list");
                    if (jsonArray!=null&&jsonArray.size()>0){
                        for (int i=0;i<jsonArray.size();i++){
                            JSONObject object2 = jsonArray.getJSONObject(i);
                            if (object2!=null){
                                String vedioUrl =object2.getString("origUrl");
                                String vedioName = object2.getString("videoName");
                                String filePath = "/Projects/Video/"+DateUtil.getStringDate("yyyyMMdd");
                                //String filePath = "D:\\Backup\\桌面\\配置及相关文档\\"+DateUtil.getStringDate("yyyyMMdd");
                                logger.info("filePath:"+filePath);
                                logger.info("vedioUrl"+vedioUrl);
                                FileUtil.saveUrlAs(vedioUrl,filePath,"GET",vedioName);
                            }
                        }
                    }
                }
            }
        }
        return null;
    }
}

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

@ -8,6 +8,7 @@ import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.dict.BaseJobCategoryDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -41,8 +42,10 @@ import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import jxl.write.DateTime;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.helper.DataUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -77,10 +80,14 @@ public class YkyyEntranceService {
    private final static String jdbcUrl="http://192.168.20.55:10023/ykyy/jdbcSQLQuery";
    private final static String updateJdxx="http://192.168.20.55:10023/ykyy/updateJdxx";
    private final static String orgCode ="350211A5004";
    private final static String orgName ="厦门大学附属厦门眼科中心";
    private final static String saveJdxxUrl="http://192.168.20.55:10023/ykyy/saveJdxx";
    @Autowired
    private DictHospitalDeptDao hospitalDeptDao;
@ -129,8 +136,6 @@ public class YkyyEntranceService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DictDoctorDutyDao dictDoctorDutyDao;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private WlyyInspectionDao wlyyInspectionDao;
@ -141,6 +146,8 @@ public class YkyyEntranceService {
    private PrescriptionEmrDao prescriptionEmrDao;
    @Autowired
    private FileUploadService fileUploadService;
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
@ -1890,6 +1897,266 @@ public class YkyyEntranceService {
    }
    public void saveKsjc(BaseNatAppointmentDO natAppointmentDO,Boolean demoFlag) throws Exception {
        //挂号
        Map<String,Object> map = findYkDoctor(natAppointmentDO.getHospitalFlag());
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(natAppointmentDO.getPatientId());
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",natAppointmentDO.getPatientId(),"1");
        Integer GHXH = 0;
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
        hlwGhmxDO.setSBXH(0);
        hlwGhmxDO.setGHCS(1);
        hlwGhmxDO.setGHJE(0);
        hlwGhmxDO.setZLJE(0);
        hlwGhmxDO.setZJFY(0);
        hlwGhmxDO.setBLJE(0);
        hlwGhmxDO.setXJJE(0);
        hlwGhmxDO.setZPJE(0);
        hlwGhmxDO.setZHJE(0);
        hlwGhmxDO.setHBWC(0);
        hlwGhmxDO.setQTYS(0);
        hlwGhmxDO.setTHBZ(0);
        hlwGhmxDO.setCZPB(0);
        hlwGhmxDO.setMZLB(0);
        hlwGhmxDO.setYSPB(0);
        hlwGhmxDO.setSFFS(0);
        hlwGhmxDO.setJZZT(2);
        hlwGhmxDO.setJZXH(0);
        hlwGhmxDO.setKSDM(map.get("deptCode").toString());
        hlwGhmxDO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
        hlwGhmxDO.setGHSJ(new Date());//挂号时间
        hlwGhmxDO.setGHLB(1);//挂号类别
        hlwGhmxDO.setYSDM(map.get("doctorCode").toString());//医生代码
        hlwGhmxDO.setJZYS(map.get("doctorCode").toString());//接诊医生
        //病人性质
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
            hlwGhmxDO.setBRXZ(json.getInteger("brxz"));
        }
        //获取医生信息
        hlwGhmxDO.setCZGH(map.get("doctorMappingCode").toString());
        // 同一个医生同一个病人,一天一条挂号记录。
        JSONArray ja = fingHlwGhmx(patientMappingDO.getMappingCode(),map.get("doctorCode").toString());
        if(ja!=null&&ja.size()>0){
            //更新
            JSONObject json = ja.getJSONObject(0);
            hlwGhmxDO.setSBXH(json.getInteger("SBXH"));
            hlwGhmxDO.setGHSJ(DateUtil.strToDate(json.getString("GHSJ")));
            GHXH = json.getInteger("SBXH");
            String jsonString = JSONObject.toJSONString(hlwGhmxDO);
            Map<String,Object> params = new HashedMap();
            params.put("json",jsonString);
            params.put("table","HlwGhmxDO");
            logger.info("HlwGhmxDO:"+jsonString);
            HttpResponse response = HttpUtils.doGet(updateEntityUrl,params);
            if (response.getStatus()==200){
                logger.info("content"+response.getContent());
                logger.info("表hlwGhmxDo更新成功!");
            }else {
                logger.info("表hlwGhmxDo更新失败!"+response.getErrorMsg());
            }
        }else{
            //新增
            String jsonString = JSONObject.toJSONString(hlwGhmxDO);
            Map<String,Object> params = new HashedMap();
            params.put("json",jsonString);
            params.put("table","HlwGhmxDO");
            logger.info("HlwGhmxDO:"+jsonString);
            HttpResponse response = HttpUtils.doGet(saveUrl,params);
            if (response.getStatus()==200){
                String content = response.getContent();
                logger.info("content"+content);
                JSONObject jsonObject = JSONObject.parseObject(content);
                JSONObject object = jsonObject.getJSONObject("obj");
                if (object!=null){
                    GHXH = object.getInteger("sbxh");
                    logger.info("GHXH=========="+GHXH);
                }
                logger.info("表hlwGhmxDo新增成功!");
            }
        }
        Integer icd10Flag = 0;
        //就诊历史表HLWYS_MZ_JZLS
        HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
        hlwYsMzJzLsDO.setJZXH(0);
        hlwYsMzJzLsDO.setGHXH(GHXH);
        hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
        hlwYsMzJzLsDO.setKSDM(Integer.parseInt(map.get("deptCode").toString()));
        hlwYsMzJzLsDO.setYSDM(map.get("doctorCode").toString());
        hlwYsMzJzLsDO.setKSSJ(DateUtil.getNowDate());
        hlwYsMzJzLsDO.setJSSJ(DateUtil.getNight23());
        hlwYsMzJzLsDO.setJZZT(9);
        hlwYsMzJzLsDO.setJZLX(3);//就诊类型
        hlwYsMzJzLsDO.setZDMC("健康查体");
        hlwYsMzJzLsDO.setMQZD("健康查体");
        /*if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
            hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
        }*/
        //V_HLW_ICD10.FLAG
        JSONArray jsonArray2 = findHisIcd10("Z00.001");
        if(jsonArray2!=null&&jsonArray2.size()>0){
            //获取居民信息
            JSONObject json = jsonArray2.getJSONObject(0);
            icd10Flag = json.getInteger("FLAG");
        }
        hlwYsMzJzLsDO.setZYZD(icd10Flag);
        String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
        Map<String,Object> params2 = new HashedMap();
        params2.put("json",jsonString2);
        params2.put("table","HlwYsMzJzLsDO");
        logger.info("HlwYsMzJzLsDO:"+jsonString2);
        HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
        Integer jzxh = null;
        if (response2.getStatus()==200) {
            String content = response2.getContent();
            logger.info("content" + content);
            //获取就诊序号,更新处方表数据
            JSONObject jsonObject = JSONObject.parseObject(content);
            JSONObject object = jsonObject.getJSONObject("obj");
            if (object != null) {
                jzxh = object.getInteger("jzxh");
                logger.info("JZXH==========" + jzxh);
            }
            logger.info("表hlwYsMzJzLsDO同步成功!");
            //疾病诊断表HLWYS_MZ_JBZD
            HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
            //hlwYsMzJbzdDO.setJLBH(0);
            hlwYsMzJbzdDO.setYSDM(map.get("doctorCode").toString());
            hlwYsMzJbzdDO.setICD("Z00.001");
            hlwYsMzJbzdDO.setMSZD("健康查体");
            hlwYsMzJbzdDO.setJBBH(icd10Flag);
            hlwYsMzJbzdDO.setBRBH(Integer.valueOf(patientMappingDO.getMappingCode()));
            hlwYsMzJbzdDO.setZDLB(11);//诊断类别
            hlwYsMzJbzdDO.setZDSJ(DateUtil.getNowDate());//诊断时间
            hlwYsMzJbzdDO.setZFPB(0);//作废标志
            hlwYsMzJbzdDO.setQZBZ(0);//确诊标志
            hlwYsMzJbzdDO.setQZSJ(DateUtil.getNowDate());//确诊时间
            hlwYsMzJbzdDO.setJBMC("健康查体");//诊断名称
            hlwYsMzJbzdDO.setZDLX(1);//诊断类型
            hlwYsMzJbzdDO.setTJBZ(1);//提交标志
            hlwYsMzJbzdDO.setJZXH(jzxh);
            String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
            Map<String, Object> params1 = new HashedMap();
            params1.put("json", jsonString1);
            params1.put("table", "HlwYsMzJbzdDO");
            logger.info("HlwYsMzJbzdDO:" + jsonString1);
            HttpResponse response1 = HttpUtils.doGet(saveUrl, params1);
            if (response1.getStatus() == 200) {
                String content1 = response1.getContent();
                logger.info("content" + content1);
                logger.info("表hlwYsMzJbzdDO同步成功!");
            }
        }
        //同步核酸检验
        List<YkEmrJcsqDO> ykEmrJcsqDOS = new ArrayList<>();
        YkEmrJcsqDO ykEmrJcsqDO = new YkEmrJcsqDO();
        ykEmrJcsqDO.setJzxh(jzxh);
        ykEmrJcsqDO.setXmid(Integer.valueOf("12220"));
        JSONArray jsonArray1 = this.findZlxm(null, "12220");
        String deptNo = null;
        if (jsonArray1 != null && jsonArray1.size() > 0) {
            JSONObject deptobject = jsonArray1.getJSONObject(0);
            deptNo = deptobject.getString("dept");
        }
        ykEmrJcsqDO.setZxks(deptNo == null ? 0 : Integer.parseInt(deptNo));
        ykEmrJcsqDO.setJcxm("新冠病毒核酸检测");
        ykEmrJcsqDO.setXmdj(new BigDecimal("80"));
        ykEmrJcsqDO.setSqsl(1);
        ykEmrJcsqDO.setJclx(1);
        ykEmrJcsqDO.setXmdw("人次");
        ykEmrJcsqDO.setKdsj(new Date());
        Integer brxb = 0;
        String brxm = "";
        Date csny =null;
        Integer brnl =0;
        String doctorHis="";
        Integer kdks = 0;
        Integer brid=0;
        String mzhm="0";
        JSONArray jsonArray3 = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        Map<String,Object> resultMap = new HashMap();
        if(jsonArray3!=null&&jsonArray3.size()>0){
            //获取居民信息
            JSONObject json = jsonArray3.getJSONObject(0);
            brxb = json.getInteger("brxb");
            brxm = json.getString("brxm");
            csny = json.getDate("csny");
            brnl = this.getBrnl(csny);
            brid=json.getInteger("brid");
            mzhm = json.getString("mzhm");
        }
        //操作医生信息
        doctorHis=map.get("doctorCode").toString();
        kdks = Integer.parseInt(map.get("deptCode").toString());
        ykEmrJcsqDO.setBrid(brid);
        ykEmrJcsqDO.setJjbz(0);
        ykEmrJcsqDO.setJczt(1);
        ykEmrJcsqDO.setZfbz(0);
        ykEmrJcsqDO.setQxbz(0);
        ykEmrJcsqDO.setBrxb(brxb);
        ykEmrJcsqDO.setBrxm(natAppointmentDO.getName());
        ykEmrJcsqDO.setBrnl(brnl);
        ykEmrJcsqDO.setKdys(doctorHis);
        ykEmrJcsqDO.setBrks(kdks);
        ykEmrJcsqDO.setTjys(doctorHis);
        ykEmrJcsqDO.setJzhm(mzhm);
        ykEmrJcsqDOS.add(ykEmrJcsqDO);
        String jsonString = JSONObject.toJSONString(ykEmrJcsqDOS);
        Map<String,Object> params = new HashedMap();
        params.put("json",jsonString);
        params.put("table","ykEmrJcsqDO");
        logger.info("ykEmrJcsqDO:"+jsonString);
        HttpResponse response = HttpUtils.doGet(orderUrl,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        JSONArray array= new JSONArray();
        if (status==200){
            array = rs.getJSONArray("detailModelList");
            JSONObject object = array.getJSONObject(0);
            String yjxh = object.getString("yjxh");
            natAppointmentDO.setRealOrder(yjxh);
            natAppointmentDO.setIsSuccess("1");
            baseNatAppointmentDao.save(natAppointmentDO);
        }else {
        }
    }
    public Map<String,Object> findYkDoctor(String hospitalFlag){
        String sql = "select t.id as \"id\"," +
                "t.doctor_mapping_code as \"doctorMappingCode\"," +
                "t.doctor_code as \"doctorCode\"," +
                "t.dept_code as \"deptCode\"," +
                "t.start_time as \"startTime\"," +
                "t.end_time as \"endTime\"," +
                "t.doctor_name as \"doctorName\"," +
                "t.dept_name  as \"deptName\" from base_doctor_time_mapping t where 1=1 ";
        if (StringUtils.isNoneBlank(hospitalFlag)){
            sql+=" and t.hospital_flag = '"+hospitalFlag+"'";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        if (list!=null&&list.size()>0){
            return list.get(0);
        }
        return null;
    }
    /**
     * 诊断
     * @param wlyyPrescriptionVO
@ -2763,6 +3030,74 @@ public class YkyyEntranceService {
    }
    public JSONObject selectByAddress(String cardNo) throws Exception {
        JSONObject jsonObject = new JSONObject();
        String address = null;
        String zydm = null;
        String jtdh = null;
        JSONArray array = new JSONArray();
        String sql = "SELECT brid as \"brid\",hkdz as \"hkdz\",zydm as \"zydm\",jtdh as \"jtdh\" from portal_his.V_ZKSG_BRCX@xec_link where jzkh = '"+cardNo+"'";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        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");
            if (array!=null&&array.size()!=0){
                JSONObject object = array.getJSONObject(0);
                address=object.getString("hkdz");
                zydm = object.getString("zydm");
                jtdh = object.getString("jtdh");
                jsonObject.put("address",address);
                jsonObject.put("zydm",zydm);
                jsonObject.put("jtdh",jtdh);
            }
        }
        return  jsonObject;
    }
    /**
     * 通过卡号更新患者信息
     */
    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);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
            String brid = json.getString("brid");
            Float id = Float.parseFloat(brid);
            Map<String,Object> params = new HashedMap();
            params.put("brid",id);
            params.put("sfzh",basePatientDO.getIdcard());
            params.put("lxdh",phone);
            params.put("lxdz",address);
            params.put("zy",zy);
            HttpResponse response = HttpUtils.doGet(updateJdxx,params);
            logger.info("更新患者信息"+response);
        }
    }
    public String saveJdxx(String brxm,String csny,Float brxb,String czgh,String sfzh,Float sjhm,String ybkh,String lxdz,Float zy){
        return  hibenateUtils.saveJdxx(brxm,DateUtil.strToDateShort(csny),brxb,czgh,sfzh,sjhm,ybkh,lxdz,zy);
    }
    public String updateJdxx(Float brid,String sfzh,String lxdz,Float zy,String lxdh){
        return  hibenateUtils.updateJdxx(brid,sfzh,lxdz,zy,lxdh);
    }
    public String findInfoBysql(String sql) throws Exception {
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
@ -2771,4 +3106,84 @@ public class YkyyEntranceService {
        String content = response.getContent();
        return content;
    }
    //判断居民是否建过档,没有就建档
    public JSONObject patientJDKH(String patientId, String idcard, String name,String phoneNum, String medicare) throws Exception {
        JSONObject res = new JSONObject();
        //查询是否建档
        String brid = "";
        String bridSql = "SELECT brid \"brid\" from portal_his.V_ZKSG_BRCX@xec_link where jzkh = '" + medicare + "' ";
        Map<String, Object> params = new HashedMap();
        params.put("sql", bridSql);
        logger.info("bridSql:" + bridSql);
        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) {
            JSONArray array = rs.getJSONArray("detailModelList");
            int size = array.size();
            if (size == 1) {
                brid = ((JSONObject) array.get(0)).getString("BRID");
            } else if (size > 1) {
                res.put("status", -1);
                res.put("message", "该居民存在多条建档信息!");
                return res;
            }
        }
        //先通过身份证查询是否有这个病人id 如果有直接返回 如果没有则新建
        if (StringUtil.isBlank(brid)) {
            Map<String, Object> params1 = new HashedMap();
            params1.put("brxm", name);
            params1.put("csny", IdCardUtil.getBirthdayForIdcardStr(idcard));
            params1.put("brxb", IdCardUtil.getSexForIdcard_new(idcard));
            params1.put("czgh", "1996");
            params1.put("sfzh", idcard);
            params1.put("sjhm", phoneNum);
            params1.put("ybkh", medicare);
            params1.put("lxdz", 0);
            params1.put("zy", 0);
            HttpResponse response1 = HttpUtils.doGet(saveJdxxUrl, params1);
            String content1 = response1.getContent();
            logger.info("params1:" + params1);
            logger.info("response1:" + content1);
            JSONObject rs1 = JSON.parseObject(content1);
            if (rs1.getInteger("status") != 200) {
                res.put("status", -1);
                res.put("message", "操作失败,失败原因:" + rs1.getString("message"));
                return res;
            } else {
                if (rs1.get("message")!=null){
                    if (rs1.getString("message").contains("已经建过档案")){
                        res.put("status", 200);
                        res.put("message",rs1.getString("message"));
                        return res;
                    }
                }
                //获取病人id
                response = HttpUtils.doGet(url, params);
                content = response.getContent();
                rs = JSON.parseObject(content);
                status = rs.getInteger("status");
                if (status == 200) {
                    res.put("status", 200);
                    /*JSONArray array = rs.getJSONArray("detailModelList");
                    int size = array.size();
                    if(size == 1){
                        logger.info("array:" + array.toString());
                        brid = ((JSONObject)array.get(0)).getString("brid");
                        res.put("status", 200);
                        res.put("message", brid);
                        logger.info("brid:" + brid);
                    }else if (size > 1){
                        res.put("status", -1);
                        res.put("message", "该居民存在多条建档信息!");
                        return res;
                    }*/
                }
            }
        }
        return res;
    }
}

+ 21 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -451,6 +451,13 @@ 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("订单已支付");
        }
        String body = businessOrderDO.getDescription();
        String totalFee = businessOrderDO.getPayPrice().intValue()+"";
        String patient = businessOrderDO.getPatient();
@ -916,6 +923,20 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    }
                }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("6")){
                    String price = Integer.parseInt(totalFee)/100+"";
                    BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.parseInt(businessOrderDO.getRelationCode()));
                    baseNatAppointmentDO.setPayStatus("1");
                    baseNatAppointmentDao.save(baseNatAppointmentDO);
                    String updatesql = "update V_MS_YJ01 t set t.HLWJF=1 where t.yjxh='"+baseNatAppointmentDO.getRealOrder()+"'";
                    try {
                        ykyyEntranceService.updateHisStatus(updatesql);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    //发送核酸支付成功提醒
                    prescriptionService.sendYktemplateMessage(baseNatAppointmentDO.getId(),true);
                }
            }
            if (businessOrderDO!=null&&!businessOrderDO.getOrderCategory().equalsIgnoreCase("5")&&businessOrderDO.getStatus()!=1){

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

@ -8,10 +8,13 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.ParameterMode;
import javax.persistence.PersistenceContext;
import javax.persistence.StoredProcedureQuery;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -183,4 +186,53 @@ public class HibenateUtils {
    public String saveJdxx(String brxm,Date csny,Float brxb,String czgh,String sfzh,Float sjhm,String ybkh,String lxdz,Float zy) {
        StoredProcedureQuery query = entityManager
                .createStoredProcedureQuery(" ZKSG.sp_zksg_jdkh_2021@xec_link") // 被调用存储过程名称
                .registerStoredProcedureParameter("P_BRXM", String.class, ParameterMode.IN) // 注册参数
                .registerStoredProcedureParameter("P_CSNY", Date.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_BRXB", Float.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_CZGH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_SFZH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_SJHM", Float.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_YBKH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_LXDZ", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_ZY", Float.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_ERRMSG", String.class, ParameterMode.INOUT)
                .setParameter("P_BRXM", brxm)
                .setParameter("P_CSNY", csny)
                .setParameter("P_CZGH", czgh)
                .setParameter("P_BRXB", brxb)
                .setParameter("P_SFZH",sfzh)
                .setParameter("P_SJHM",sjhm)
                .setParameter("P_YBKH",ybkh)
                .setParameter("P_LXDZ",lxdz)
                .setParameter("P_ZY",zy);
        query.execute();
        String priceStr = (String) query.getOutputParameterValue("P_ERRMSG"); // 获取存储过程中的返回值
        return priceStr;
    }
    public String updateJdxx(Float brid,String sfzh,String lxdz,Float zy,String lxdh) {
        StoredProcedureQuery query = entityManager
                .createStoredProcedureQuery("ZKSG.SP_ZKSG_MZBRXXXG@xec_link") // 被调用存储过程名称
                .registerStoredProcedureParameter("P_BRID", Float.class, ParameterMode.IN) // 注册参数
                .registerStoredProcedureParameter("P_SFZH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_LXDZ", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_LXDH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_ZY", Float.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_ERRMSG", String.class, ParameterMode.INOUT)
                .setParameter("P_BRID", brid)
                .setParameter("P_SFZH", sfzh)
                .setParameter("P_LXDZ", lxdz)
                .setParameter("P_LXDH", lxdh)
                .setParameter("P_ZY",zy);
        query.execute();
        String priceStr = (String) query.getOutputParameterValue("P_ERRMSG"); // 获取存储过程中的返回值
        return priceStr;
    }
}

+ 3 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/dao/BaseSmsTemplateDao.java

@ -2,6 +2,7 @@ package com.yihu.jw.sms.dao;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -14,4 +15,6 @@ public interface BaseSmsTemplateDao extends PagingAndSortingRepository<SmsTempla
    List<SmsTemplateDO> findByClientIdAndType(String clientId, SmsTemplateDO.Type type);
    SmsTemplateDO findByClientId(String clientId);
}

+ 3 - 4
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -1,6 +1,5 @@
package com.yihu.jw.entity;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
@ -19,13 +18,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
 /*   @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
/*   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 27 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java

@ -9,7 +9,7 @@ import java.util.Date;
@Entity
@Table(name = "base_nat_appointment")
@SequenceGenerator(name="id_generated", sequenceName="base_nat_appointment")
@SequenceGenerator(name="id_generated", sequenceName="BASE_NAT_APPOINTMENT_SEQ")
public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    private String cardType;
    private String cardNo;
@ -56,7 +56,17 @@ public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    private String registerNo;
    private String ampm;
    private String cardNoType;
    private String hospitalFlag;
    private String consumer;
    private String consumerName;
    public String getConsumer() {
        return consumer;
    }
    public void setConsumer(String consumer) {
        this.consumer = consumer;
    }
    public String getMedicare() {
        return medicare;
@ -418,4 +428,20 @@ public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    public void setCardNoType(String cardNoType) {
        this.cardNoType = cardNoType;
    }
    public String getHospitalFlag() {
        return hospitalFlag;
    }
    public void setHospitalFlag(String hospitalFlag) {
        this.hospitalFlag = hospitalFlag;
    }
    public String getConsumerName() {
        return consumerName;
    }
    public void setConsumerName(String consumerName) {
        this.consumerName = consumerName;
    }
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkEmrJcsqDO.java

@ -289,4 +289,5 @@ public class YkEmrJcsqDO {
    public void setJzxh(Integer jzxh) {
        this.jzxh = jzxh;
    }
}

+ 4 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java

@ -37,6 +37,10 @@ public class AesEncryptUtils {
        return "CAST(AES_DECRYPT(from_base64("+name+"), '"+KEY+"') AS char)";
    }
    public static String decryptMysqlNo(String name,String alias){
        return decryptMysqlNo(name)+" as "+alias+" ";
    }
    /**
     * 针对 GROUP_CONCAT 函数,逗号分隔符进行解密
     * @param str

+ 0 - 8
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java

@ -643,14 +643,6 @@ public class DoorOrderController extends BaseController {
                        continue;
                    }
                    List<BaseDoctorRoleDO> baseDoctorRoleDOS = baseDoctorRoleDao.findByDoctorCode(doctor.get("id").toString());
                    if (baseDoctorRoleDOS.size()<1){
                        continue;
                    }
                    if (baseDoctorRoleDOS.get(0).getRoleCode().equals("nurse")){
                        continue;
                    }
                    String status = wlyyDoorServiceOrderService.findDispatchStatusByDoctor(doctor.get("id").toString());
                    JSONObject json = new JSONObject();
                    json.put("status", status);

+ 5 - 3
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -2126,13 +2126,13 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;
        String sql = "select ds.doctor,d.name, d.job_title_name as jobName, 1 as sortFlag " +
        String sql = "select DISTINCT ds.doctor,d.name, d.job_title_name as jobName, 1 as sortFlag " +
                " from wlyy_door_doctor_status ds " +
                "        JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code='" + hospital + "')  d on ds.doctor = d.id " +
                " LEFT JOIN base_doctor_role dr ON dr.doctor_code = d.id where ds.status in (1,2,3,4) AND dr.role_code != 'nurse' " +
                " limit " + start + "," + end ;
        String countSql = "select count(ds.id) " +
        String countSql = "select DISTINCT count(ds.id) " +
                "from wlyy_door_doctor_status ds " +
                "         JOIN (select b.* from base_doctor b,base_doctor_hospital dh where b.id=dh.doctor_code and dh.del = 1 and dh.org_code= '" + hospital + "') d on ds.doctor = d.id " +
                " LEFT JOIN base_doctor_role dr ON dr.doctor_code = d.id where ds.status in (1,2,3,4) AND dr.role_code != 'nurse' ";
@ -2335,7 +2335,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        doorServiceOrderDO.setNursingStaff(nursingStaff);
        doorServiceOrderDO.setNursingStaffName(nursingStaffName);
        doorServiceOrderDO.setNursingStaffType(nursingStaffType);
        System.out.println(dispathcherName+"医生派单给"+doctorName+"医生");
        String sql = "DELETE FROM wlyy_door_doctor WHERE order_id ='"+orderId+"' AND doctor = '"+dispatcher+"'";
        jdbcTemplate.execute(sql);
        this.save(doorServiceOrderDO);
        // 给医生发派单消息

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

@ -305,6 +305,8 @@ public class YkyyController extends EnvelopRestEndpoint {
                ykMsYj01DO.setJcbw(0);
                ykMsYj01DO.setZjflag(1);
                ykMsYj01DO.setLjlx(0);
                ykMsYj01DO.setHlwjf(0);
                ykMsYj01DO.setSjly(1);
                System.out.println(ykMsYj01DO);
                ykyyEntranceService.save(ykMsYj01DO);
                String sqlCxzt = "Select t.zlxmid as \"zlxmid\",t.fyxh as \"fyxh\",t.fysl as \"fysl\" from VEMR_ORDER_ITEM_MX t where t.zlxmid ='"+ykEmrJcsqDO.getXmid()+"'";
@ -325,7 +327,8 @@ public class YkyyController extends EnvelopRestEndpoint {
                        YkMsYj02DO ykMsYj02DO = new YkMsYj02DO();
                        ykMsYj02DO.setSbxh(sbxh.intValue());
                        ykMsYj02DO.setYjxh(ykMsYj01DO.getYjxh());
                        ykMsYj02DO.setYlxh(ykEmrJcsqDO.getXmid());
                        /*ykMsYj02DO.setYlxh(ykEmrJcsqDO.getXmid());*/
                        ykMsYj02DO.setYlxh(map.get("fyxh")!=null?Integer.parseInt(map.get("fyxh").toString()):0);
                        Integer sqsl = ykEmrJcsqDO.getSqsl();
                        ykMsYj02DO.setYlsl(Integer.valueOf(map.get("fysl").toString())*sqsl);
                        ykMsYj02DO.setYjzx(i==0?1:0);
@ -355,5 +358,46 @@ public class YkyyController extends EnvelopRestEndpoint {
        }
        return mixEnvelop;
    }
    
    @GetMapping(value = "/saveJdxx")
    @ApiOperation(value = "患者建档")
    public Envelop saveJdxx(@ApiParam(name = "brxm", value = "病人姓名", required = true)
                                      @RequestParam(value = "brxm",required = true)String brxm,
                                      @ApiParam(name = "csny", value = "出生日期", required = false)
                                      @RequestParam(value = "csny",required = false)String csny,
                                      @ApiParam(name = "brxb", value = "病人性别", required = false)
                                      @RequestParam(value = "brxb",required = false)Float brxb,
                                      @ApiParam(name = "czgh", value = "操作工号", required = false)
                                      @RequestParam(value = "czgh",required = false)String czgh,
                                @ApiParam(name = "sfzh", value = "身份证号", required = false)
                                    @RequestParam(value = "sfzh",required = false)String sfzh,
                                @ApiParam(name = "sjhm", value = "手机号码", required = false)
                                    @RequestParam(value = "sjhm",required = false)Float sjhm,
                                @ApiParam(name = "ybkh", value = "医保卡号", required = false)
                                    @RequestParam(value = "ybkh",required = false)String ybkh,
                                @ApiParam(name = "lxdz", value = "联系地址", required = false)
                                    @RequestParam(value = "lxdz",required = false)String lxdz,
                                @ApiParam(name = "zy", value = "职业", required = false)
                                    @RequestParam(value = "zy",required = false)Float zy){
        return success(ykyyEntranceService.saveJdxx(brxm,csny,brxb, czgh,sfzh,sjhm,ybkh,lxdz,zy));
    }
    @GetMapping(value = "/updateJdxx")
    @ApiOperation(value = "更新患者档案")
    public Envelop updateJdxx(@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,
                            @ApiParam(name = "lxdh", value = "联系电话", required = false)
                            @RequestParam(value = "lxdh",required = false)String lxdh,
                            @ApiParam(name = "lxdz", value = "联系地址", required = false)
                            @RequestParam(value = "lxdz",required = false)String lxdz,
                            @ApiParam(name = "zy", value = "职业", required = false)
                            @RequestParam(value = "zy",required = false)Float zy){
        return success(ykyyEntranceService.updateJdxx(brid,sfzh,lxdz,zy,lxdh));
    }
}

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

@ -153,6 +153,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>

+ 20 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java

@ -20,6 +20,7 @@ import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
@ -27,8 +28,8 @@ import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.DateUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -92,6 +93,8 @@ public class TimeoutOverDueService {
    private EntranceService entranceService;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    /**
     *  取消未结束门诊
     */
@ -238,7 +241,22 @@ public class TimeoutOverDueService {
                    if (patientMappingDO != null) {
                        userNo = patientMappingDO.getMappingCode();
                    }
                    entranceService.BS10145(baseNatAppointmentDO.getDept(),baseNatAppointmentDO.getDoctorId(), DateUtil.dateToStr(baseNatAppointmentDO.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),userNo,baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),false);
                    if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                        entranceService.BS10145("3150000","0001", DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),baseNatAppointmentDO.getAmpm(),false);
                    }
                    if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                        baseNatAppointmentDO.setIsSuccess("-1");
                        baseNatAppointmentDO.setCancelReson("系统超时取消");
                        baseNatAppointmentDO.setCancelTime(new Date());
                        baseNatAppointmentDO.setCancelBy("system");
                        baseNatAppointmentDao.save(baseNatAppointmentDO);
                        if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                            String updateJcsq = "update V_EMR_JCSQ set ZFBZ = 1 where yjxh = "+baseNatAppointmentDO.getRealOrder();
                            ykyyEntranceService.updateHisStatus(updateJcsq);
                            String update01sq = "update V_MS_YJ01 set ZFPB = 1 where yjxh = "+baseNatAppointmentDO.getRealOrder();
                            ykyyEntranceService.updateHisStatus(update01sq);
                        }
                    }
                    //取消挂号
                } catch (Exception e) {
                    e.printStackTrace();

+ 30 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.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.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
@ -33,6 +34,8 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
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;
@ -116,6 +119,10 @@ public class UnSettledHISPrescriptionService {
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    
    
    /**
@ -182,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 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,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";
                    List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                    if(pre!=null && pre.size()>0){
                        String prescriptionId = pre.get(0).get("ID").toString();
@ -200,6 +207,19 @@ public class UnSettledHISPrescriptionService {
                        System.out.println("发送诊断消息开始+"+wlyyOutpatientDO.getId());
                        String immsg = imService.pushPrescriptionBackMsg(msgObj,doctor,doctorName,outpatientId,wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType(),wlyyOutpatientDO.getType());
                        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);
                        }
                    }
                }
            }
@ -220,6 +240,7 @@ public class UnSettledHISPrescriptionService {
                        List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                        if(pre!=null && pre.size()>0){
                            String outpatientId = pre.get(0).get("OUTPATIENT_ID").toString();
                            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
                            String prescriptionId = pre.get(0).get("ID").toString();
                            String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                            //判断是否发送过
@ -284,6 +305,14 @@ 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);
                                }
                            }
                        }
                    }

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/CancelNotPay.java

@ -22,7 +22,7 @@ import java.util.Date;
public class CancelNotPay implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(CancelNotPay.class);
    private static String cron = "0 */1 * * * ?";//"0 0 0 * * ?";0 */5 * * * ?
    private static String cron = "0 0 0 * * ?";//"0 0 0 * * ?";0 */5 * * * ?
    @Autowired
    private TimeoutOverDueService timeoutOverDueService;
    public String change(String corIn) {

+ 47 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/DownLoadYxJob.java

@ -0,0 +1,47 @@
package com.yihu.jw.util;
import com.yihu.jw.hospital.prescription.service.YkyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import java.util.Date;
public class DownLoadYxJob implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(DownLoadYxJob.class);
    private static String cron = "0 0 0 * * ?";//"0 0 0 * * ?";0 */5 * * * ?
    @Autowired
    private YkyyPrescriptionService ykyyPrescriptionService;
    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        taskRegistrar.addTriggerTask(new Runnable() {
            @Override
            public void run() {
                logger.info("START========OverdueJob========");
                try {
                    ykyyPrescriptionService.findYxVideoList();
                    logger.info("END========OverdueJob========");
                } catch (Exception e) {
                    e.printStackTrace();
                    logger.error("END===ERROE===OverdueJob,message:"+e.getMessage());
                }
            }
        }, new Trigger() {
            @Override
            public Date nextExecutionTime(TriggerContext triggerContext) {
                // 任务触发,可修改任务的执行周期
                CronTrigger trigger = new CronTrigger(cron);
                System.out.println("OverdueJob任务触发,可修改任务的执行周期"+cron);
                Date nextExec = trigger.nextExecutionTime(triggerContext);
                return nextExec;
            }
        });
    }
}

+ 9 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
@ -721,4 +722,12 @@ public class JobController extends BaseController {
        return success(ykyyPrescriptionService.saveVideoFile(vip));
    }
    @RequestMapping(value = "saveVideoFileList", method = RequestMethod.GET)
    @ApiOperation("下载云信录制")
    public String saveVideoFile(@RequestParam(value = "startTime", required = false)String startTime,
                                @RequestParam(value = "endTime", required = false)String endTime, Integer status, Integer page , Integer pageSize){
        return success(ykyyPrescriptionService.saveVideoFileList(startTime,endTime,status,page,pageSize));
    }
}

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

@ -102,7 +102,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
        }*/
        net.sf.json.JSONArray jsonArray = new JSONArray();
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            jsonArray = ykyyEntranceService.findHisPatientBymMedicare(medicare,clinicId,false);
            /*jsonArray = ykyyEntranceService.findHisPatientBymMedicare(medicare,clinicId,false);
            if(jsonArray!=null&&jsonArray.size()>0){
                net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
                if (null!=jsonObject.get("brid")){
@ -122,7 +122,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您所添加的家属无就诊记录无法添加");
                return mixEnvelop;
            }
            }*/
        }else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            jsonArray = entranceService.BS10008(idCard, "", "", "", "", "", false);
            if(jsonArray!=null&&jsonArray.size()>0){
@ -195,20 +195,14 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
            if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                System.out.println("发送眼科验证码开始");
                ResultMsg result= null;
                if (null!=jsonArray&&jsonArray.size() > 0) {
                    result = ykyySMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                    if (result.isSuccess()){
                        this.store(client_id, phoneNum, captcha, 120);
                        mixEnvelop.setMessage("验证码发送成功");
                    } else {
                        mixEnvelop.setMessage("验证码发送失败");
                        mixEnvelop.setStatus(500);
                    }
                }else {
                    mixEnvelop.setStatus(408);
                    mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
                result = ykyySMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                if (result.isSuccess()){
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");
                } else {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }else if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                System.out.println("发送中山验证码开始");
                int result = 1;
@ -357,7 +351,17 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
                if (null != jsonObject.get("id")) {
                    id = jsonObject.get("id").toString();
                }
                mixEnvelop = wlyyFamilyMemberService.addFamily(id, patientId, familyName, dictId, cardType, idCard, username, false,medicareType,medicare,clinicId);
                //获取建档信息
                JSONObject jdObject = ykyyEntranceService.patientJDKH(patientId, idCard,familyName,username,medicare);
                if (jdObject!=null){
                    if(jdObject.getInteger("status") == 200) {
                        mixEnvelop = wlyyFamilyMemberService.addFamily(id, patientId, familyName, dictId, cardType, idCard, username, false, medicareType, medicare, clinicId);
                    }else {
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage(jdObject.getString("message"));
                        return mixEnvelop;
                    }
                }
            } else {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("验证码不正确");
@ -391,7 +395,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    @ApiOperation("获取单个亲属信息")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findSingleMember)
    public Envelop findSingleMember(@ApiParam(name = "id", value = "id", required = false)
                                    @RequestParam(value = "id", required = false) String id) throws ParseException {
                                    @RequestParam(value = "id", required = false) String id) throws Exception {
        return success(wlyyFamilyMemberService.findMemberById(id));
    }
    public boolean verifyCaptcha(String key,String text){

+ 33 - 5
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.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
@ -48,6 +49,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.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
@ -182,7 +184,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private BaseBannerDoctorService baseBannerDoctorService;
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
@ -403,7 +408,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
     */
    @RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public Envelop getOpenidByCode(String code) throws Exception {
    public Envelop getOpenidByCode(String code,@RequestParam(value = "patientId", required = false)String patientId) throws Exception {
        //通过redis获取openid, 获取不到,则调用微信接口去取
        String key = wxId+":code";
        String openid = redisTemplate.opsForValue().get(key);
@ -411,6 +416,23 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            return success(PatientRequestMapping.Wechat.api_success,openid);
        }
        openid = wechatInfoService.getOpenidByCode(code, wxId);
        if (!StringUtils.isEmpty(patientId)){
            List<BasePatientWechatDo> list = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patientId);
            if (list!=null&&list.size()>0){
                for (BasePatientWechatDo basePatientWechatDo:list){
                    basePatientWechatDo.setOpenid(openid);
                    basePatientWechatDao.save(basePatientWechatDo);
                }
            }else {
                BasePatientWechatDo basePatientWechatDo = new BasePatientWechatDo();
                basePatientWechatDo.setPatientId(patientId);
                basePatientWechatDo.setWechatId(wxId);
                basePatientWechatDo.setCreateTime(new Date());
                basePatientWechatDo.setOpenid(openid);
                basePatientWechatDao.save(basePatientWechatDo);
            }
        }
        redisTemplate.opsForValue().set(key,openid);
        redisTemplate.expire(key,10, TimeUnit.SECONDS);
        return success(PatientRequestMapping.Wechat.api_success,openid);
@ -1497,9 +1519,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                    @ApiParam(name = "page", value = "页数")
                                    @RequestParam(value = "page", required = false)Integer page,
                                    @ApiParam(name = "pageSize", value = "每页大小")
                                        @RequestParam(value = "pageSize", required = false)Integer pageSize) {
                                        @RequestParam(value = "pageSize", required = false)Integer pageSize) throws Exception {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            prescriptionService.savePayStatusByHis(patientId);
        }
        logger.info("同步数据成功");
        return  prescriptionService.getNatRecords(patientId,id,payStatus,appointmentTime,isSuccess,page,pageSize);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findBaseAddress)
@ -1512,4 +1536,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        return  success(prescriptionService.findBaseAddress(addressFlag,parentName));
    }
    @GetMapping("/testsms")
    public void testsms(String mobile ,String contet){
        ykyySMSService.ykyySendSMS(mobile,contet);
    }
}

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

@ -2592,7 +2592,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "cardNoType", value = "cardNoType")
                                          @RequestParam(value = "cardNoType",required = false)String cardNoType){
        try {
            return success(prescriptionService.saveNatAppointment(mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,cityName,townName,streetName,pm,pushChannel,pushFlag,cardNoType));
            return success(prescriptionService.saveNatAppointment(mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,cityName,townName,streetName,pm,pushChannel,pushFlag,cardNoType,getUID()));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }

+ 5 - 0
svr/svr-internet-hospital/src/main/resources/wechat/weixin_menu.txt

@ -9,6 +9,11 @@
   {
	  "name":"就医问诊",
	  "sub_button":[
	    {
               		"type":"view",
               		"name":"核酸预约申请",
               		"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"
               },
		 {
         		"type":"view",
         		"name":"预约挂号",

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java

@ -270,7 +270,7 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
        for (int i=0;i<list.size();i++){
            list.get(i).setPurchaserName(AesEncryptUtils.decrypt(list.get(i).getPurchaserName()));
            list.get(i).setPurchaserPhone(AesEncryptUtils.decrypt(list.get(i).getPurchaserPhone()));
            list.get(i).setSupplierName(AesEncryptUtils.decrypt(list.get(i).getSupplierName()));
            list.get(i).setSupplierLeader(AesEncryptUtils.decrypt(list.get(i).getSupplierLeader()));
            list.get(i).setSupplierLeaderPhone(AesEncryptUtils.decrypt(list.get(i).getSupplierLeaderPhone()));
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));

+ 4 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java

@ -162,11 +162,11 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
        ArrayList<IotDeviceSimDO> list = new ArrayList<>();
        mapList.forEach(one->{
            IotDeviceSimDO iotDeviceSimDO = JSONObject.parseObject(JSONObject.toJSONString(one), IotDeviceSimDO.class);
            if (one.get("patient_name")!=null){
                iotDeviceSimDO.setContactsName(AesEncryptUtils.decrypt(one.get("patient_name").toString()));
            if (one.get("contacts_name")!=null){
                iotDeviceSimDO.setContactsName(AesEncryptUtils.decrypt(one.get("contacts_name").toString()));
            }
            if (one.get("mobile")!=null){
                iotDeviceSimDO.setContactsMobile(AesEncryptUtils.decrypt(one.get("mobile").toString()));
            if (one.get("contacts_mobile")!=null){
                iotDeviceSimDO.setContactsMobile(AesEncryptUtils.decrypt(one.get("contacts_mobile").toString()));
            }
            if (one.get("sn")!=null){
                iotDeviceSimDO.setDeviceSn(one.get("sn").toString());