Преглед на файлове

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

zd_123 преди 7 години
родител
ревизия
5bb8a1bc8d

+ 16 - 2
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/FamilyLianQianService.java

@ -49,7 +49,7 @@ public class FamilyLianQianService {
        JSONObject object = new JSONObject();
        List<FamilyLianQian> familyLianQians = new ArrayList<>();
        String signSql = "select * from wlyy_sign_family_lianqian WHERE status = "+status+" " +
                "and sign_year= '"+year+"' and hospital_name = '" +hospitalName+"'";
                "and sign_year= '"+year+"' and hospital_name = '" +hospitalName+"' limit 0,100";
        List<SignFamily> signFamilyList = jdbcTemplate.query(signSql,new BeanPropertyRowMapper(SignFamily.class));
        if (signFamilyList != null && signFamilyList.size() != 0){
@ -79,6 +79,7 @@ public class FamilyLianQianService {
                        }else{
                            j=1;
                        }
                        logger.info("residence:"+residenceInfo1.getPersonid());
                        String signSql1 = "select * from wlyy_sign_family_lianqian WHERE status = " + status + " " +
                                "and sign_year= '" + year + "' and idcard = '" + demographicInfo1.getCardid() + "' and hospital_name = '" + hospitalName + "'";
                        List<SignFamily> signFamilyList1 = jdbcTemplate.query(signSql1, new BeanPropertyRowMapper(SignFamily.class));
@ -115,8 +116,21 @@ public class FamilyLianQianService {
                            familyLianQian.setName(demographicInfo1.getName());
                            familyLianQian.setStatus(signFamily1.getStatus().toString());
                            familyDao.save(familyLianQian);
                            ++i;
                        }else{
                            familyLianQian.setName(demographicInfo1.getName());
                            familyLianQian.setStatus("-5");
                            familyLianQian.setSex(Integer.parseInt(demographicInfo1.getSex()));
                            familyLianQian.setIdcard(demographicInfo1.getCardid());
                            FoundationMedicalSystemParam param = tblsysParamDao.findByParamnameAndCode("Relaholder", residenceInfo1.getRelaholder());
                            familyLianQian.setRelaholder(param.getParamchina());
                            familyLianQian.setSignType("0");
                            familyLianQian.setHighBloodPressure(0);
                            familyLianQian.setDiabetes(0);
                            familyLianQian.setBind(0);
                            familyDao.save(familyLianQian);
                        }
                        ++i;
                    }
                    if (i == residenceInfoList.size()&& j==0) {
                        FamilyLianQian familyLianQian = new FamilyLianQian();

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java

@ -23,7 +23,7 @@ import java.lang.reflect.Method;
import java.util.Date;
/**
 * 患者权限校验
 * 患者权限校验.
 *
 * @author George
 */
@ -81,7 +81,9 @@ public class PatientInterceptor extends BaseInterceptor {
                token = tokenDao.findByPatient(user, platform);
                // 加入缓存
                if (platform == 3) {
                    systemDataRedis.setPatientToken(token);
                    if(token!=null){
                        systemDataRedis.setPatientToken(token);
                    }
                    //SystemData.patientTokens.put(user, token);
                }
            }

+ 0 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -804,8 +804,6 @@ public class FamilyMemberService extends BaseService {
        switch (relation) {
            case 1:
                relationTrans = 1;
                break;
            case 2:
                if (patient.getSex() == 1) {
                    relationTrans = 5;

+ 13 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -5623,18 +5623,15 @@ public class StatisticsESService {
                    if (hos.getCode().length() > 10) {
                        continue;
                    }
//                    String sql = " select count(DISTINCT p.doctor,p.device_sn) AS amount,p.doctor as doctorCode,r.name as doctorName from wlyy.wlyy_patient_device p JOIN wlyy.wlyy_doctor r on p.doctor is not null and  p.doctor =r.code  LEFT JOIN device.wlyy_devices d on p.device_sn=d.device_code where p.del=0 and p.doctor is not null and d.grant_org_code ='" + hos.getCode() + "'  group by p.doctor,r.name";
                    String sql = " select count(*) as amount,if(a.doctor is null,'other',a.doctor) as doctorCode,if(a.NAME is null,'其他',a.NAME) as doctorName " +
                            " from (select  DISTINCT p.doctor,r.name,p.device_sn FROM wlyy.wlyy_patient_device p RIGHT join device.wlyy_devices d on p.device_sn=d.device_code left JOIN wlyy.wlyy_doctor r ON  p.doctor = r. CODE " +
                            "where p.del=0 and d.is_binding in (1,2) and p.category_code in('1','2') and d.grant_org_code ='" + hos.getCode() + "') a " +
                            " GROUP BY a.doctor,a.name";
                    //计算发放量,按发放人分组
                    String sql =" select count(*) as amount, if(d.grant_doctor is null,'other',d.grant_doctor) as doctorCode,if(d.grant_doctor_name is null,'其他',d.grant_doctor_name) as doctorName from device.wlyy_devices d where d.grant_org_code = '"+ hos.getCode()+"' GROUP BY d.grant_doctor,d.grant_doctor_name";
                    List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                    for (Map<String, Object> one : list) {
                        Map<String, Object> obj = new HashMap<>();
                        obj.put("code", one.get("doctorCode"));
                        obj.put("name", one.get("doctorName"));
                        obj.put("amount", one.get("amount"));
                        obj = deviceRateList(obj,hos);
                        obj = deviceRateList(obj,hos);//统计每个人发放的设备中绑定的数量
                        if("other".equals(one.get("doctorCode")+"")){
                            amount += Integer.valueOf(obj.get("amount")+"");
                            allNum += Integer.valueOf(obj.get("allNum")+"");
@ -5767,21 +5764,18 @@ public class StatisticsESService {
    //按绑定的医生列表展示绑定的设备列表
    public Map<String, Object> deviceRateList(Map<String, Object> reMap,Hospital hos){
//        String sql = " select count(1) as amount from wlyy.wlyy_patient_device p JOIN wlyy.wlyy_doctor r on p.doctor is not null and  p.doctor =r.code  LEFT JOIN device.wlyy_devices d on p.device_sn=d.device_code where  p.doctor is not null and d.grant_org_code ='" + hos.getCode() + "' and p.doctor='"+reMap.get("code")+"'";
        String temp = "other".equals(reMap.get("code"))? " and wd.grant_org_code ='"+hos.getCode()+"' and (wd.grant_doctor is null or wd.grant_doctor='')":" and wd.grant_doctor='"+String.valueOf(reMap.get("code"))+"' ";
       /* String sql = " select count(1) as amount " +
                " from (select  DISTINCT p.doctor,r.name,p.device_sn FROM wlyy.wlyy_patient_device p left join device.wlyy_devices d on p.device_sn=d.device_code left JOIN wlyy.wlyy_doctor r ON  p.doctor = r. CODE " +
                " where d.is_binding in (1,2) and p.category_code in('1','2') and d.grant_org_code ='" + hos.getCode() + "' "+temp+") a " +
                " GROUP BY a.doctor,a.name";*/
       String sql ="SELECT count(1) as amount from device.wlyy_devices wd LEFT JOIN dm_device dd ON wd.device_model=dd.model where 1=1 "+temp+" AND dd.category_code IN('1','2') and wd.is_grant=1";
//        Map<String, Object> map = jdbcTemplate.queryForMap(sql);
        String temp = "other".equals(reMap.get("code"))? " and (d.grant_doctor is null or d.grant_doctor='')":" and d.grant_doctor='"+String.valueOf(reMap.get("code"))+"' ";
        String sql =" select count(DISTINCT d.id) amount from wlyy.wlyy_patient_device p " +
                " LEFT JOIN device.wlyy_devices d on p.device_sn=d.device_code  " +
                " where p.del = 0 "+temp+" and p.id is not null and d.grant_org_code='"+hos.getCode()+"'";
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        Map<String,Object> map = result.get(0);
        Integer amount = Integer.valueOf(map.get("amount").toString());
        reMap.put("allNum", amount);
        reMap.put("bindingNum", reMap.get("amount"));
        reMap.put("rate", getRange(Integer.valueOf(reMap.get("amount").toString()), amount, 2));//续签率是 续签量/去年的签约数
        reMap.put("rateNum", getRangeNum(Integer.valueOf(reMap.get("amount").toString()), amount, 2));//续签率是 续签量/去年的签约数
        Integer bingdingAmount = Integer.valueOf(map.get("amount").toString());//绑定量
        Integer paymentAmount = Integer.valueOf(reMap.get("amount").toString());//发放量
        reMap.put("allNum", paymentAmount);
        reMap.put("bindingNum", bingdingAmount);
        reMap.put("rate", getRange(bingdingAmount, paymentAmount, 2));//续签率是 续签量/去年的签约数
        reMap.put("rateNum", getRangeNum(bingdingAmount, paymentAmount, 2));//续签率是 续签量/去年的签约数
        return reMap;
    }

+ 3 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/WeiXinCoreService.java

@ -1,9 +1,6 @@
package com.yihu.wlyy.service.weixin;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.process.WeiXinEventProcess;
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
import org.dom4j.Document;
@ -11,8 +8,6 @@ import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -20,8 +15,6 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -42,13 +35,13 @@ public class WeiXinCoreService extends BaseService {
     * @param accessToken
     */
    public String messageProcess(HttpServletRequest request, String accessToken) {
        try {
        try (InputStream inputStream = request.getInputStream()){
            String returnStr = "";
            // 将解析结果存储在HashMap中
            Map<String, String> message = new HashMap();
            // 从request中取得输入流
            InputStream inputStream = request.getInputStream();
            // 读取输入流
            SAXReader reader = new SAXReader();
            Document document = reader.read(inputStream);
@ -62,9 +55,7 @@ public class WeiXinCoreService extends BaseService {
                Element ele = (Element) e;
                message.put(ele.getName(), ele.getText());
            }
            logger.info("weixin  event:" + message.toString());
            // 释放资源
            inputStream.close();
//            logger.info("weixin  event:" + message.toString());
            // 添加access_token参数
            message.put("token", accessToken);
            // 消息处理