|
@ -126,38 +126,23 @@ public class OnlineContactService extends BaseJpaService<BasePatientDO, BasePati
|
|
|
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","100","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,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);
|
|
|
//医生默认取签约第一个
|
|
|
List<Map<String,Object>> signDoctors = servicePackageService.getServerDoctorAll(patient,null,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);
|
|
|
}
|
|
|
|
|
|
JSONArray families = familyMemberService.membersWithOnLineFlag(patient);
|
|
|
if (families.size()>0){
|
|
|
List<String> familyIds = families.stream().map(item->((JSONObject)item).getString("id")).collect(Collectors.toList());
|