Bladeren bron

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

zhanghaoyu 7 jaren geleden
bovenliggende
commit
9dd093382f

+ 3 - 2
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DeviceTypeConvert.java

@ -43,14 +43,15 @@ public class DeviceTypeConvert implements Convert {
        if("1".equals(dataModel.getServerType())){
             for (Map<String,Object> one : dict){
                String result = one.get("name")+"";
                if(result.equals("血糖")){
                //if(result.equals("血糖")){
                 if (result.equals("1")){
                    return one.get("code")+"";
                }
            }
        }else if("2".equals(dataModel.getServerType())){
            for (Map<String,Object> one : dict){
                String result = one.get("name")+"";
                if(result.equals("血压")){
                if(result.equals("2")){
                    return one.get("code")+"";
                }
            }

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

@ -5634,7 +5634,7 @@ public class StatisticsESService {
                        obj.put("code", one.get("doctorCode"));
                        obj.put("name", one.get("doctorName"));
                        obj.put("amount", one.get("amount"));
                        obj = deviceRateList(obj,hos,String.valueOf(obj.get("doctorCode")));
                        obj = deviceRateList(obj,hos);
                        if("other".equals(one.get("doctorCode")+"")){
                            amount += Integer.valueOf(obj.get("amount")+"");
                            allNum += Integer.valueOf(obj.get("allNum")+"");
@ -5766,14 +5766,14 @@ public class StatisticsESService {
    }
    //按绑定的医生列表展示绑定的设备列表
    public Map<String, Object> deviceRateList(Map<String, Object> reMap,Hospital hos,String doctor){
    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 p.doctor is null ":" 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 grant_doctor ='"+doctor+"' AND dd.category_code IN('1','2')";
       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);
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        Map<String,Object> map = result.get(0);

+ 16 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemDataRedis.java

@ -1,7 +1,7 @@
package com.yihu.wlyy.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.security.Token;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Set;
/**
@ -22,6 +23,8 @@ public class SystemDataRedis {
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * tokenTypeName
@ -37,7 +40,7 @@ public class SystemDataRedis {
     * 设置医生缓存
     * @param token
     */
    public String setDoctorToken(Token token){
    public String setDoctorToken(Token token) throws Exception{
        return setToken(doctorTokens,token);
    }
@ -45,7 +48,7 @@ public class SystemDataRedis {
     * 设置pc端缓存
     * @param token
     */
    public String setDoctorPCToken(Token token){
    public String setDoctorPCToken(Token token) throws Exception{
       return setToken(doctorPCTokens,token);
    }
@ -53,7 +56,7 @@ public class SystemDataRedis {
     * 设置居民缓存
     * @param token
     */
    public String setPatientToken(Token token){
    public String setPatientToken(Token token) throws Exception{
        return setToken(patientTokens,token);
    }
@ -61,7 +64,7 @@ public class SystemDataRedis {
     *  设置医生微信缓存
     * @param token
     */
    public String setDoctorWXToken(Token token){
    public String setDoctorWXToken(Token token) throws Exception{
        return setToken(doctorWXTokens,token);
    }
//====设置token==end===
@ -88,12 +91,12 @@ public class SystemDataRedis {
     * @param tokenTypeName
     * @param token
     */
    public String setToken(String tokenTypeName,Token token){
    public String setToken(String tokenTypeName,Token token) throws Exception{
        JSONObject json = JSONObject.fromObject(token);
        String tokenStr = objectMapper.writeValueAsString(token);
        String key = "token:"+tokenTypeName+":"+token.getUser();
        redisTemplate.opsForValue().set(key,json.toString());
        return json.toString();
        redisTemplate.opsForValue().set(key,tokenStr);
        return tokenStr;
    }
    /**
@ -105,9 +108,10 @@ public class SystemDataRedis {
    public Token getToken(String tokenTypeName,String uid) {
        try{
            //获取token
            String tokenJosn = redisTemplate.opsForValue().get("token:" + tokenTypeName + ":" + uid);
            if(StringUtils.isNotBlank(tokenJosn)){
                Token token = (Token)JSONObject.toBean(JSONObject.fromObject(tokenJosn),Token.class);
            String tokenJson = redisTemplate.opsForValue().get("token:" + tokenTypeName + ":" + uid);
            if(StringUtils.isNotBlank(tokenJson)){
                objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
                Token token = objectMapper.readValue(tokenJson, Token.class);
                return token;
            }
            return null;

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java

@ -565,7 +565,7 @@ public class LoginController extends BaseController {
    @RequestMapping(value = "setTokenTest", method = RequestMethod.POST)
    @ResponseBody
    public String setToken(String uid){
    public String setToken(String uid) throws Exception{
        Token token = new Token();
        token.setToken("123456");
        token.setDel("1");

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java

@ -688,12 +688,12 @@ public class DataHandingService {
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        //wlyy_patient_device取出对应的device_sn和doctor
        String patientDeviceSql ="SELECT device_sn,doctor,doctor_name FROM `wlyy_patient_device`  WHERE doctor IS NOT NULL and  doctor = '' and category_code IN('1','2') GROUP BY device_sn";
        String patientDeviceSql ="SELECT device_sn,doctor,doctor_name FROM `wlyy_patient_device`  WHERE doctor IS NOT NULL and  doctor <> '' and category_code IN('1','2') GROUP BY device_sn";
        List<Map<String,Object>> patientDeviceList = jdbcTemplate.queryForList(patientDeviceSql);
        String patientDeviceLogSql ="SELECT s.* FROM" +
                "(SELECT device_sn, operator doctor, operator_name doctor_name FROM" +
                " wlyy_patient_device_log WHERE device_sn NOT IN (SELECT device_sn FROM wlyy_patient_device WHERE" +
                " category_code IN ('1', '2') AND doctor IS NOT NULL GROUP BY device_sn )" +
                " category_code IN ('1', '2') AND doctor IS NOT NULL and doctor <> '' GROUP BY device_sn )" +
                " AND category_code IN ('1', '2')" +
                " AND operate_code = 1" +
                " AND is_del = 1" +