소스 검색

代码修改

liubing 3 년 전
부모
커밋
f780c17550

+ 17 - 0
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -892,4 +892,21 @@ public class ImUtil {
		String ret = HttpClientUtil.get(url, "UTF-8");
		return ret;
	}
	/**
	 *按会话类型、会话状态获取会话列表
	 * @param user_id
	 * @param page
	 * @param size
	 * @param type
	 * @param status 不传为获取所有状态
	 * @param name
	 * @param search_type 仅当type为2时有效 1与医生p2p会话 2与患者p2p
	 * @return
	 */
	public String getSessionListByType(String user_id, String page, String size, String type, String status, String name,String search_type){
		String url = im_host + "api/v2/sessions/sessionListByType?user_id="+user_id+"&page="+page+"&size="+size+"&type="+type+"&status="+(status==null?"":status)+"&name="+(name==null?"":name)+"&search_type="+(search_type==null?"":search_type);
		String ret = HttpClientUtil.get(url, "utf-8");
		return ret;
	}
}

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/OnlineContactEndpoint.java

@ -36,4 +36,15 @@ public class OnlineContactEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "getContactFirst")
    @ApiOperation(value = "pad首页获取在线联系()")
    public Envelop getContactFirst(
            @ApiParam(name = "patient", value = "居民id") @RequestParam(value = "patient", required = true) String patient) {
        try{
            return success("获取成功",service.getContactFirst(patient));
        }catch (Exception e){
            return failedException2(e);
        }
    }
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DeviceDetailService.java

@ -214,7 +214,7 @@ public class DeviceDetailService extends BaseJpaService<DeviceDetail, DeviceDeta
			String url = "http://www.cityihealth.com:43210/deviceManage/register";
			List<NameValuePair> params = new ArrayList<>();
			params.add(new BasicNameValuePair("deviceSN", device.getDeviceSn()));
			params.add(new BasicNameValuePair("pushAddress", cloudDeviceUrl+"/"+deviceDO.getNeedRegister()));
			params.add(new BasicNameValuePair("pushAddress", cloudDeviceUrl+deviceDO.getNeedRegister()));
			String response = httpClientUtil.post(url, params,"UTF-8");
			//注册日志
		}

+ 85 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/OnlineContactService.java

@ -1,12 +1,15 @@
package com.yihu.jw.care.service.patient;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.family.PatientFamilyMemberService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -28,6 +31,10 @@ public class OnlineContactService extends BaseJpaService<BasePatientDO, BasePati
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ImUtil imUtil;
    @Autowired
    private PatientFamilyMemberService familyMemberService;
    @Autowired
    private ServicePackageService servicePackageService;
    public JSONObject getOnLineObj(String patient){
        JSONObject obj = new JSONObject();
@ -121,4 +128,81 @@ public class OnlineContactService extends BaseJpaService<BasePatientDO, BasePati
        return obj;
    }
    public JSONObject getContactFirst(String patient){
        JSONObject result = new JSONObject();
        JSONArray doctorResult = new JSONArray();
        JSONArray patientResult = new JSONArray();
        String doctors = imUtil.getSessionListByType(patient,"0","1","2",null,null,"1");
        String patients = imUtil.getSessionListByType(patient,"0","1","2",null,null,"2");
        JSONArray doctorArr = JSON.parseArray(doctors);
        JSONArray patientArr = JSON.parseArray(patients);
        if (doctorArr.size()==0){//取签约医生其中一个
          List<Map<String,Object>> signDoctors =  servicePackageService.getServerDoctorAll(patient,null);
          if (signDoctors.size()>0){
              Map<String,Object> tmp = signDoctors.get(0);
              JSONObject tmpObj = new JSONObject();
              tmpObj.put("name",tmp.get("doctorName"));
              tmpObj.put("unread_count","0");
              tmpObj.put("avatar",tmp.get("photo"));
              tmpObj.put("userType","1");
              tmpObj.put("doctorId",tmp.get("doctor"));
              tmpObj.put("relationName","助老员");
              doctorResult.add(tmpObj);
          }
        }else {
            JSONObject tmp = doctorArr.getJSONObject(0);
            JSONArray participantsTimeArray = tmp.getJSONArray("participantsTimeArray");
            for (int i=0;i<participantsTimeArray.size();i++){
                JSONObject tmpObj = participantsTimeArray.getJSONObject(i);
                String id =  tmpObj.getString("id");
                if (!id.equals(patient)){
                    tmp.put("avatar",tmp.getString("photo"));
                    tmp.put("doctorId",id);
                    tmp.put("relationName","助老员");
                    break;
                }
            }
            doctorResult.add(tmp);
        }
        if (patientArr.size()==0){//取家属
            JSONArray families = familyMemberService.membersWithOnLineFlag(patient);
            if (families.size()>0){
                JSONObject tmp = families.getJSONObject(0);
                JSONObject tmpObj = new JSONObject();
                tmpObj.put("name",tmp.getString("name"));
                tmpObj.put("unread_count","0");
                tmpObj.put("avatar",tmp.getString("photo"));
                tmpObj.put("userType","2");
                tmpObj.put("patientId",tmp.get("id"));
                tmpObj.put("relationName",tmp.get("familyRelationName"));
                patientResult.add(tmpObj);
            }
        }else {
            JSONObject tmp = patientArr.getJSONObject(0);
            JSONArray participantsTimeArray = tmp.getJSONArray("participantsTimeArray");
            for (int i=0;i<participantsTimeArray.size();i++){
                JSONObject tmpObj = participantsTimeArray.getJSONObject(i);
                String id =  tmpObj.getString("id");
                if (!id.equals(patient)){
                    tmp.put("avatar",tmp.getString("photo"));
                    tmp.put("patientId",id);
                    String sql = " select family_relation from base_patient_family_member where " +
                            " patient = '"+patient+"' and family_member='"+id+"' " +
                            " and (del=1 or del is null) ";
                    List<Integer> relations = jdbcTemplate.queryForList(sql,Integer.class);
                    if(relations.size()>0){
                        tmp.put("relationName",familyMemberService.relations.get(relations.get(0)));
                    }else {
                        tmp.put("relationName","其他");
                    }
                    patientResult.add(tmp);
                    break;
                }
            }
        }
        result.put("doctors",doctorResult);
        result.put("patients",patientResult);
        return result;
    }
}

+ 7 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java

@ -243,7 +243,13 @@ public class DeviceUploadService {
                    }
                }
            }else {
                device = patientDeviceDao.findByDeviceSnAndCategoryCodeAndUserType(deviceSn, type, userType);
//                device = patientDeviceDao.findByDeviceSnAndCategoryCodeAndUserType(deviceSn, type, userType);
                List<DevicePatientDevice> devices = patientDeviceDao.findByDeviceSnAndCategoryCode(deviceSn, type);
                if (devices.size()>0){
                    device = devices.get(0);
                }else {
                    device=null;
                }
            }
        }
        if (device != null) {