Sfoglia il codice sorgente

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 anni fa
parent
commit
a4cf4c0403

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

@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/***
 * @ClassName: OnlineContactService
@ -133,7 +134,7 @@ public class OnlineContactService extends BaseJpaService<BasePatientDO, BasePati
        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");
        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){//取签约医生其中一个
@ -164,42 +165,48 @@ public class OnlineContactService extends BaseJpaService<BasePatientDO, BasePati
            }
            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","其他");
        JSONArray families = familyMemberService.membersWithOnLineFlag(patient);
        if (families.size()>0){
            List<String> familyIds = families.stream().map(item->((JSONObject)item).getString("id")).collect(Collectors.toList());
            if(patientArr.size()>0){
                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)&&familyIds.contains(id)){
                        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;
                    }
                    patientResult.add(tmp);
                    break;
                }
            }
            if (patientResult.size()==0){
                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);
                }
            }
        }
        result.put("doctors",doctorResult);
        result.put("patients",patientResult);
        return result;

+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -275,8 +275,8 @@ public class PatientDeviceService {
            if (devices.size() > 0) {
                lostSN.addAll(devices);
            }
            //智能拐杖、手表
            sql = " SELECT pd.device_sn FROM base.wlyy_patient_device pd  where pd.del=0 and pd.category_code in (4,16) and not EXISTS ( " +
            //智能拐杖、手表 睡眠带
            sql = " SELECT pd.device_sn FROM base.wlyy_patient_device pd  where pd.del=0 and pd.category_code in (4,13,16) and not EXISTS ( " +
                    "select dp.device_sn from device_data_push_log dp where dp.device_sn = pd.device_sn and dp.create_time " +
                    " BETWEEN '"+startTimeDevice2+"' AND '"+endTime+"') ";
            devices = jdbcTemplate.queryForList(sql,String.class) ;