Parcourir la source

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

luofenqiang il y a 3 ans
Parent
commit
8a4af91799

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

@ -12613,7 +12613,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                baseNatAppointmentDO.setPatientId(patientId);
                baseNatAppointmentDO.setIsSuccess("0");
                baseNatAppointmentDO.setCardNoType(cardNoType);
                baseNatAppointmentDO.setPayStatus("0");
                if(itemPrice.equalsIgnoreCase("0")){
                    baseNatAppointmentDO.setPayStatus("1");
                }else {
                    baseNatAppointmentDO.setPayStatus("0");
                }
                baseNatAppointmentDO.setCreateTime(new Date());
                baseNatAppointmentDO.setMobile(mobile);
                baseNatAppointmentDO.setInspectionCode(chargeCode);
@ -12631,61 +12635,84 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                logger.info("BaseNatAppointmentDO保存结束"+baseNatAppointmentDO.getId());
                //添加订单
                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(natFee);
                businessDO.setRematk("核酸检测订单");
                businessDO.setDescription("核酸检测订单");
                businessDO.setPayType(1);
                businessDO.setUpdateTime(new Date());
                businessDO=businessOrderDao.save(businessDO);
                String openId="";
                List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,consumer);
                if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
                    openId=basePatientWechatDo.get(0).getOpenid();
                }
                //亿同支付创建订单
                com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
                orderObj.put("payType",1);
                orderObj.put("tradeNo",businessDO.getOrderNo());
                orderObj.put("openId",openId);
                orderObj.put("name",name);
                orderObj.put("idNo",cardNo.trim());
                Map mapHis=tasyNatService.getPatientHisId(cardNo.trim(),mediaCard.trim());
                orderObj.put("patientId",mapHis.get("Patientid").toString());
                orderObj.put("mobile",mapHis.get("MobilePhone").toString());
                //orderObj.put("socialCard","");
                orderObj.put("icCard",mediaCard);
                BigDecimal b = new BigDecimal(itemPrice);
                b=b.setScale(2, BigDecimal.ROUND_DOWN);
                System.out.println("amount"+b);
                orderObj.put("amount",b);
                String orderRes=tasyNatService.placeOrder(orderObj);
                if (StringUtils.isNoneBlank(orderRes)){
                    com.alibaba.fastjson.JSONObject jsonObject= JSON.parseObject(orderRes);
                    if (jsonObject!=null){
                        if("0".equalsIgnoreCase(jsonObject.getString("code"))){
                            com.alibaba.fastjson.JSONObject dataObj= com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
                            businessDO.setTraceNo(dataObj.getString("orderNo"));
                            businessDO.setRematk(dataObj.toJSONString());
                            businessDO=businessOrderDao.save(businessDO);
                if(!itemPrice.equalsIgnoreCase("0")){
                    //添加订单
                    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(natFee);
                    businessDO.setRematk("核酸检测订单");
                    businessDO.setDescription("核酸检测订单");
                    businessDO.setPayType(1);
                    businessDO.setUpdateTime(new Date());
                    businessDO=businessOrderDao.save(businessDO);
                    String openId="";
                    List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,consumer);
                    if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
                        openId=basePatientWechatDo.get(0).getOpenid();
                    }
                    //亿同支付创建订单
                    com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
                    orderObj.put("payType",1);
                    orderObj.put("tradeNo",businessDO.getOrderNo());
                    orderObj.put("openId",openId);
                    orderObj.put("name",name);
                    orderObj.put("idNo",cardNo.trim());
                    Map mapHis=tasyNatService.getPatientHisId(cardNo.trim(),mediaCard.trim());
                    orderObj.put("patientId",mapHis.get("Patientid").toString());
                    orderObj.put("mobile",mapHis.get("MobilePhone").toString());
                    //orderObj.put("socialCard","");
                    orderObj.put("icCard",mediaCard);
                    BigDecimal b = new BigDecimal(itemPrice);
                    b=b.setScale(2, BigDecimal.ROUND_DOWN);
                    System.out.println("amount"+b);
                    orderObj.put("amount",b);
                    String orderRes=tasyNatService.placeOrder(orderObj);
                    if (StringUtils.isNoneBlank(orderRes)){
                        com.alibaba.fastjson.JSONObject jsonObject= JSON.parseObject(orderRes);
                        if (jsonObject!=null){
                            if("0".equalsIgnoreCase(jsonObject.getString("code"))){
                                com.alibaba.fastjson.JSONObject dataObj= com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
                                businessDO.setTraceNo(dataObj.getString("orderNo"));
                                businessDO.setRematk(dataObj.toJSONString());
                                businessDO=businessOrderDao.save(businessDO);
                            }
                        }
                    }
                }
                try {
                    tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hszftx",baseNatAppointmentDO.getId().toString());
                    tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hsyycg",baseNatAppointmentDO.getId().toString());
                }catch (Exception e){
                    e.printStackTrace();
                    try {
                        tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hszftx",baseNatAppointmentDO.getId().toString());
                        tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hsyycg",baseNatAppointmentDO.getId().toString());
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                }else {
                    com.alibaba.fastjson.JSONObject chargeObj=new com.alibaba.fastjson.JSONObject();
                    chargeObj.put("hisTradeNo",baseNatAppointmentDO.getRealOrder());
                    chargeObj.put("icCardNo",baseNatAppointmentDO.getMedicare().trim());
                    chargeObj.put("patientName",baseNatAppointmentDO.getName());
                    //调用扣费接口
                    String feeRes=tasyNatService.ChargenucleicBill(chargeObj);
                    com.alibaba.fastjson.JSONObject feeObj = com.alibaba.fastjson.JSONObject.parseObject(feeRes);
                    if (feeObj!=null){
                        if ("1".equalsIgnoreCase(feeObj.getString("ReturnCode"))){
                            com.alibaba.fastjson.JSONObject ApplyInfoObj = JSON.parseObject(feeObj.getString("ApplyInfo"));
                            if (ApplyInfoObj!=null){
                                String voucherNo = ApplyInfoObj.getString("ApplyNo");
                                if(org.apache.commons.lang3.StringUtils.isNoneBlank(voucherNo)){
                                    System.out.println("ApplyNo:"+voucherNo);
                                    baseNatAppointmentDO.setVoucherNo(voucherNo);
                                }
                            }
                        }
                    }
                    tasyNatService.sendWxtemplateMessaeg(baseNatAppointmentDO.getConsumer(),baseNatAppointmentDO.getName(),"hszfcgtx",baseNatAppointmentDO.getId().toString());
                }
                logger.info("开单结束");
                returnMap.put("msg","预约成功");
@ -14496,10 +14523,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if (StringUtils.isNoneBlank(hospitalSysDictDO2.getDictValue())){
                    com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(hospitalSysDictDO2.getDictValue());
                    String startPm2 = jsonObject.getString("startPm");
                    String endPm2 = jsonObject.getString("endPm");
                    Date startPmDate2 = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startPm2);
                    Date endPmDate2 = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endPm2);
                    String startAm2 = jsonObject.getString("startAm");
                    String endAm2 = jsonObject.getString("endAm");
                    Date startPmDate2 = DateUtil.strToDateLong(DateUtil.getStringDatePre("yyyy-MM-dd","1")+" "+startPm2);
                    Date startAmDate2 = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startAm2);
                    Date endAmDate2 = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endAm2);
                    if (now.getTime()>=startPmDate2.getTime()&&now.getTime()<=endAmDate2.getTime()){
                    if (now.getTime()>=startPmDate2.getTime()&&now.getTime()<=endPmDate2.getTime()){
                        object.put("isAllow","0");//混采1展示0不展示
                    }else if (now.getTime()>=startAmDate2.getTime()&&now.getTime()<=endAmDate2.getTime()){
                        object.put("isAllow","0");//混采1展示0不展示
                    }else {
                        object.put("isAllow","1");//混采1展示0不展示
@ -14523,6 +14556,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String isOpen = null;
        String sql = "SELECT COUNT(1) as count FROM `base_nat_appointment` where is_success = 1 and pay_status=1 ";
        if (hospitalSysDictDO!=null){
            String dictValue = hospitalSysDictDO.getDictValue();
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(dictValue);
            String startAm = jsonObject.getString("startAm");
@ -14539,6 +14573,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            Date startPmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startPm);
            Date endPmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endPm);
            WlyyHospitalSysDictDO hospitalSysDictDO2 = hospitalSysDictDao.findById("natTimeConfig2");
            if (hospitalSysDictDO2!=null){
                if (StringUtils.isNoneBlank(hospitalSysDictDO2.getDictValue())){
                    com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(hospitalSysDictDO2.getDictValue());
                    String startPm2 = object.getString("startPm");
                    String endPm2 = object.getString("endPm");
                    Date startPmDate2 = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startPm2);
                    Date endPmDate2 = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endPm2);
                    String startAm2 = object.getString("startAm");
                    String endAm2 = object.getString("endAm");
                    Date startAmDate2 = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startAm2);
                    Date endAmDate2 = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endAm2);
                    if (now.getTime()>=startPmDate2.getTime()&&now.getTime()<=endPmDate2.getTime()){
                        jsonObject.put("isAllow","0");//混采1展示0不展示
                    }else if (now.getTime()>=startAmDate2.getTime()&&now.getTime()<=endAmDate2.getTime()){
                        jsonObject.put("isAllow","0");//混采1展示0不展示
                    }else {
                        jsonObject.put("isAllow","1");//混采1展示0不展示
                    }
                }else {
                    jsonObject.put("isAllow","1");//混采1展示0不展示
                }
            }else {
                jsonObject.put("isAllow","1");//混采1展示0不展示
            }
            if (i==0){
                if (now.getTime()>=startAmDate.getTime()&&now.getTime()<=endAmDate.getTime()){
                    sql += " and create_time >= '"+DateUtil.dateToStrLong(startAmDate)+"' and create_time <='"+DateUtil.dateToStrLong(endAmDate)+"' ";
@ -14585,26 +14646,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    return envelop;
                }
            }
            WlyyHospitalSysDictDO hospitalSysDictDO2 = hospitalSysDictDao.findById("natTimeConfig2");
            if (hospitalSysDictDO2!=null){
                if (StringUtils.isNoneBlank(hospitalSysDictDO2.getDictValue())){
                    com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(hospitalSysDictDO2.getDictValue());
                    String startPm2 = object.getString("startPm");
                    String endAm2 = object.getString("endAm");
                    Date startPmDate2 = DateUtil.strToDateLong(DateUtil.getStringDatePre("yyyy-MM-dd","1")+" "+startPm2);
                    Date endAmDate2 = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endAm2);
                    if (now.getTime()>=startPmDate2.getTime()&&now.getTime()<=endAmDate2.getTime()){
                        jsonObject.put("isAllow","0");//混采1展示0不展示
                    }else {
                        jsonObject.put("isAllow","1");//混采1展示0不展示
                    }
                }else {
                    jsonObject.put("isAllow","1");//混采1展示0不展示
                }
            }else {
                jsonObject.put("isAllow","1");//混采1展示0不展示
            }
            envelop.setStatus(200);
            envelop.setMessage("获取号源成功");
            envelop.setObj(jsonObject);

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java

@ -210,7 +210,7 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "findUserByType")
    @ApiOperation(value = "人员实时动态搜索")
    public Envelop findUserByType(@ApiParam(name = "type", value = "类型:1幼儿,2老人,3助老员,4医生。不传返回四个类型的数据")
    public Envelop findUserByType(@ApiParam(name = "type", value = "类型:1幼儿,2老人,3助老员,4医生,5老人家属。不传返回四个类型的数据")
                                  @RequestParam(value = "type", required = false) String type,
                                  @ApiParam(name = "name", value = "姓名")
                                  @RequestParam(value = "name", required = false) String name,

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -241,9 +241,9 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            return result;
        }
        assistanceDO = emergencyAssistanceDao.save(assistanceDO);
        //创建im会话  紧急救助咨询的sessionid  为居民code+(wlyy_consult_team表consult)+20
        //创建im会话  紧急救助咨询的sessionid  为居民code+20
        JSONObject IMObj = consultTeamService.addServiceConsult(assistanceDO.getId(),patient,agent,null);
        String sessionId=patient+"_"+ IMObj.getJSONObject("resultMsg").getString("consult") + "_20";
        String sessionId=patient + "_20";
        assistanceDO.setSessionId(sessionId);
        //向会话中发送一条消息
        ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(assistanceDO.getId());

+ 5 - 108
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java

@ -195,7 +195,7 @@ public class ConsultTeamService {
        consultTeam.setConsult(consult.getId()); // 设置咨询标识
        //(im创建咨询) 紧急救助咨询的sessionid为居民code+咨询类型
        String sessionId = patient + "_" + consult.getId() + "_" + consultTeam.getType();
        String sessionId = patient + "_" + consultTeam.getType();
        //4、 紧急救助咨询-参与者
        JSONObject participants = new JSONObject();
@ -313,8 +313,8 @@ public class ConsultTeamService {
        consult.setRelationCode(doorServiceOrderDO.getId());//关联业务code
        consultTeam.setConsult(consult.getId()); // 设置咨询标识
        //(im创建咨询) 上门服务咨询的sessionid为居民code+咨询code+工单编号+咨询类型
        String sessionId = patient + "_" + consult.getId() + "_" + doorServiceOrderDO.getNumber() +  "_" + consultTeam.getType();
        //(im创建咨询) 上门服务咨询的sessionid为居民code+咨询类型
        String sessionId = patient + "_" + consultTeam.getType();
        //4、 上门服务咨询-参与者
        JSONObject participants = new JSONObject();
@ -411,8 +411,8 @@ public class ConsultTeamService {
        consult.setRelationCode(orderId);//关联业务code
        consultTeam.setConsult(consult.getId()); // 设置咨询标识
        //(im创建咨询) 安防警报咨询的sessionid为居民code+咨询id+咨询类型
        String sessionId = patient + "_" + consult.getId() + "_" + consultTeam.getType();
        //(im创建咨询) 安防警报咨询的sessionid为居民code+咨询类型
        String sessionId = patient + "_" + consultTeam.getType();
        //4、安防警报咨询-参与者  提供服务的助老员 老人本人 家属
        JSONObject participants = new JSONObject();
@ -567,109 +567,6 @@ public class ConsultTeamService {
            throw new RuntimeException(String.valueOf(obj.get("message")));
        }
        //结束咨询才发送推送给IM文字消息
//        if (endType == 1) {
//            BasePatientDO p = patientDao.findOne(endOperator);
//            endName = p.getName();
//            if (consultTeam.getType() == 2 || consultTeam.getType() == 8) {
//                String openId = p.getOpenid();
//
//                WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey", "zxpj");
//                String first = templateConfig.getFirst();
//                first = first.replace("key1", (endName == null ? "" : endName));
//                String keyword1 = templateConfig.getKeyword1();
//
//                org.json.JSONObject json = new org.json.JSONObject();
//                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//                json.put("keyword1", keyword1);
//                json.put("keyword2", sdf.format(new Date()));
//                json.put("toUser", p.getCode());
//                json.put("represented", p.getCode());//被代理人
//                json.put("remark", "");
//                json.put("consult", consult);
//                if (consultTeam.getType() == 8) {
//                    first = first.replace("key2", "续方");
//                } else {
//                    first = first.replace("key2", "");
//                }
//                json.put("first", first);
//                if (StringUtils.isNotBlank(p.getOpenid())) {
//                    pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, openId, p.getName(), json);
//                } else {
//                    //发送代理人
//                    org.json.JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
//                    if (jsonArray != null && jsonArray.length() > 0) {
//                        for (int i = 0; i < jsonArray.length(); i++) {
//                            org.json.JSONObject j = jsonArray.getJSONObject(i);
//                            Patient member = (Patient) j.get("member");
//                            org.json.JSONObject data = json;
//                            data.remove("toUser");
//                            data.put("toUser", member.getCode());
//                            data.remove("first");
//                            data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()) + first);
//                            pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, member.getOpenid(), p.getName(), data);
//                        }
//                    }
//                }
//            }
//        } else {
//            if (consultTeam.getType() == 2 || consultTeam.getType() == 8) {
//                Patient p = patientDao.findByCode(consultTeam.getPatient());
//                String name = p.getName();
//                String openId = p.getOpenid();
//
//                WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey", "zxpj");
//
//                if (endOperator.equals("admin")) {
//                    templateConfig = templateConfigDao.findByScene("template_doctor_survey", "zxcspj");
//                }
//                String first = templateConfig.getFirst();
//                first = first.replace("key1", (name == null ? "" : name));
//                String keyword1 = templateConfig.getKeyword1();
//
//                org.json.JSONObject json = new org.json.JSONObject();
//                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//                json.put("keyword1", keyword1);
//                json.put("keyword2", sdf.format(new Date()));
//                json.put("toUser", p.getCode());
//                json.put("represented", p.getCode());//被代理人
//                json.put("remark", "");
//                json.put("consult", consult);
//
//                if (consultTeam.getType() == 8) {
//                    first += "续方";
//                    first = first.replace("key2", "续方");
//                } else {
//                    first = first.replace("key2", "");
//                }
//                /*if (endOperator.equals("admin")) {
//                    first += "咨询超时未回复,系统自动关闭,请及时对咨询医生进行评价。";
//                }else {
//                    first += "咨询已结束,请及时对咨询医生进行评价。";
//                }*/
//                json.put("first", first);
//                if (StringUtils.isNotBlank(p.getOpenid())) {
//                    pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, openId, p.getName(), json);
//                } else {
//                    //发送代理人
//                    org.json.JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
//                    if (jsonArray != null && jsonArray.length() > 0) {
//                        for (int i = 0; i < jsonArray.length(); i++) {
//                            org.json.JSONObject j = jsonArray.getJSONObject(i);
//                            Patient member = (Patient) j.get("member");
//                            org.json.JSONObject data = json;
//                            data.remove("toUser");
//                            data.put("toUser", member.getCode());
//                            data.remove("first");
//                            data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()) + first);
//                            pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, member.getOpenid(), p.getName(), data);
//                        }
//                    }
//                }
//
//            }
//        }
        consultTeam.setEndMsgId(obj.getString("id"));
        cons.setEndTime(new Date());
        consultTeam.setEndTime(new Date());

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java

@ -866,7 +866,7 @@ public class DoctorDoorCoachOrderService {
                "  o.serve_lat as lat, " +
                "  o.`status` as status, " +
                "  o.`dispatcher_name` as dispatcherName, " +
                "  concat( o.patient,'_' ,c.id, '_',o.`number`,'_21' ) as sessionId " +
                "  concat( o.patient,'_21' ) as sessionId " +
                patientTypeTemp +
                " FROM " +
                " ( base_door_coach_order o " +

+ 33 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -558,6 +558,11 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
            re.put("helperTotal",findHelperTotal(name,filter));
        }
        if("5".equals(type)||StringUtils.isBlank(type)){//老人家属
            List<Map<String,Object>> list = findOlderFamily(name,limit,filter);
            re.put("oldFamily",list);
            re.put("oldFamilyCount",findOlderFamilyTotal(name,filter));
        }
        return re;
    }
@ -729,7 +734,35 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        return jdbcTemplate.queryForObject(sql,Integer.class);
    }
    public List<Map<String,Object>> findOlderFamily(String name,String limit,String fileter){
        String sql = "select t2.id,t2.name,t2.sex,t2.mobile,t2.idcard,if(t2.openid is null,0,1) online,t2.photo,t1.family_relation,t1.patient older,t3.name olderName " +
                "from base_patient t2 left JOIN base_patient_family_member t1 on t1.family_member = t2.id " +
                "left join base_patient t3 on t3.id = t1.patient  " +
                "where t2.archive_type=3 and t2.del=1 ";
        if (StringUtils.isNotBlank(name)){
            sql += " and t3.name like '%"+name+"%'";
        }
        sql += fileter + "GROUP BY t2.id,t1.patient ";
        sql += limit;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object>tmp:list){
            tmp.put("relaholder", familyMemberService.relations.get(tmp.get("family_relation")));
        }
        return list;
    }
    public Integer findOlderFamilyTotal(String name,String fileter){
        String sql = "select t2.id,t1.patient " +
                "from base_patient t2 left JOIN base_patient_family_member t1 on t1.family_member = t2.id " +
                "left join base_patient t3 on t3.id = t1.patient  " +
                "where t2.archive_type=3 and t2.del=1 ";
        if (StringUtils.isNotBlank(name)){
            sql += " and t3.name like '%"+name+"%'";
        }
        sql += fileter +" group by t2.id,t1.patient ";
        String sqlCount = "SELECT count(*) from ( "+sql+")A";
        return jdbcTemplate.queryForObject(sqlCount,Integer.class);
    }
    public void intiPatient(){
        String sql = "SELECT * from base_patient WHERE residential_area is not null and `password` is null";

+ 11 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -243,9 +243,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        orderDO.setType(1);//发起类型
        orderDO.setServiceStatus("2");
        this.save(orderDO);
        //创建im会话  安防警报咨询的sessionid  为居民code+(wlyy_consult_team表consult)+20
        //创建im会话  安防警报咨询的sessionid  为居民code+22
        JSONObject IMObj = consultTeamService.addSecurityMoConsult(orderDO.getId(), orderDO.getPatient(), null, null, orderDO.getServeDesc());
        String sessionId = orderDO.getPatient() + "_" + IMObj.getJSONObject("resultMsg").getString("consult") + "_22";
        String sessionId = orderDO.getPatient() + "_22";
        orderDO.setSessionId(sessionId);
        if (StringUtils.isNotBlank(orderDO.getServeDesc())) {
            ConsultTeamDo consultTeam = consultTeamDao.queryByRelationCode(orderDO.getId());
@ -1736,6 +1736,15 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                            result.put("fences", fencesEnables);
                        }
                    }
                    //手表剩余电量
                    if (response.containsKey("remaining_power") && response.get("remaining_power") != null) {
                        result.put("remaining_power", response.get("remaining_power"));
                    }
                    //手表佩戴状态
                    if (response.containsKey("wear_flag") && response.get("wear_flag") != null) {
                        result.put("wear_flag", response.get("wear_flag"));
                        result.put("wear_flagName", 1==response.getInteger("wear_flag")?"未佩戴":"已佩戴");
                    }
                }
            }
            if (devicePatientDeviceDos2.size() > 0 && (16 == categoryCode || 0 == categoryCode)) {//拐杖

+ 30 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.care.util.CommonUtil;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.vo.NumVo;
@ -91,6 +92,8 @@ public class StatisticsService {
    private String esIndex;
    @Value("${es.type.Statistics}")
    private String esType;
    @Autowired
    private CarePatientService carePatientService;
    private static final String defalutArea = "330100";
@ -652,6 +655,10 @@ public class StatisticsService {
        Integer olderOn = 0;
        Integer olderWxOn = 0;
        Integer olderPadOn = 0;
        Integer olderFamilyTotal = 0;//老人家属
        Integer olderFamilyOn = 0;
        Integer olderFamilyOff = 0;
        Integer olderFamilyBinding = 0;//家属绑定老人数量
        //儿童注册人数
        String childFilter = "";
        String sqlChildtmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older'  ";
@ -729,6 +736,23 @@ public class StatisticsService {
        helperTotal = helperOff + helperOn;
        teacherTotal = teacherOff + teacherOn;
        //老人家属
        sql2 = " select count(id) count,if(openid is null,0,1) online from base_patient where  archive_type=3 and del=1 GROUP BY online; ";
        List<Map<String, Object>> oldFamilyList2 = jdbcTemplate.queryForList(sql2);
        for(Map<String,Object>tmp:oldFamilyList2){
            Integer num = Integer.valueOf(tmp.get("count").toString());
            Integer online = Integer.valueOf(tmp.get("online").toString());
            if (0==online){
                olderFamilyOff+=num;
            }
            if (1==online){
                olderFamilyOn+=num;
            }
        }
        olderFamilyTotal = olderFamilyOff+olderFamilyOn;
        //家属绑定老人数量
        olderFamilyBinding = carePatientService.findOlderFamilyTotal(null,"");
        //helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
        result.put("olderTotal", olderTotal);
        result.put("childTotal", childTotal);
@ -743,6 +767,12 @@ public class StatisticsService {
        result.put("helperOff", helperOff);
        result.put("teacherOff", teacherOff);
        result.put("olderOff", olderOff);
        //老人家属
        result.put("olderFamilyTotal", olderFamilyTotal);
        result.put("olderFamilyOn", olderFamilyOn);
        result.put("olderFamilyOff", olderFamilyOff);
        result.put("olderFamilyBinding", olderFamilyBinding);
        return result;
    }

+ 1 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/order/EmeWarnOrderDayJob.java

@ -95,7 +95,7 @@ public class EmeWarnOrderDayJob implements Job {
                    }else {
                        message = new JSONObject();
                        String sessionId = map.get("patient")+"_"+ map.get("consult") + "_22";
                        String sessionId = map.get("patient") + "_22";
                        message.put("session_id",sessionId);
                        message.put("sender_name",map.get("patientName"));
                        message.put("content_notice",map.get("patientName")+" "+map.get("serverDesc")+"!");

+ 1 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/order/EmeWarnOrderJob.java

@ -97,7 +97,7 @@ public class EmeWarnOrderJob implements Job {
                    }else {
                        message = new JSONObject();
                        String sessionId = map.get("patient")+"_"+ map.get("consult") + "_22";
                        String sessionId = map.get("patient") + "_22";
                        message.put("session_id",sessionId);
                        message.put("sender_name",map.get("patientName"));
                        message.put("content_notice",map.get("patientName")+" "+map.get("serverDesc")+"!");