소스 검색

<护理信息同步>

weizhengliang 5 년 전
부모
커밋
ac82f52e03

+ 1 - 1
.idea/misc.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build/classes" />
   </component>
   <component name="ProjectType">

+ 7 - 1
app/build.gradle

@@ -5,12 +5,18 @@ android {
     buildToolsVersion "29.0.2"
     defaultConfig {
         applicationId "com.wdkl.infoboardclassic"
-        minSdkVersion 23
+        minSdkVersion 24
         targetSdkVersion 29
         versionCode 1
         versionName "1.0"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
+
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+
     buildTypes {
         release {
             minifyEnabled false

+ 13 - 3
app/src/main/java/com/wdkl/infoboardclassic/InitActivity.java

@@ -12,8 +12,12 @@ import android.widget.TextView;
 import androidx.annotation.Nullable;
 import androidx.appcompat.app.AppCompatActivity;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.wdkl.infoboardclassic.constant.Constants;
+import com.wdkl.infoboardclassic.data.HospitalFrameBean;
+import com.wdkl.infoboardclassic.data.NurseConfigBean;
 import com.wdkl.infoboardclassic.data.PatientInfoBean;
 import com.wdkl.infoboardclassic.manager.PatientInfoManager;
 import com.wdkl.infoboardclassic.utils.SharedPreferencesUtil;
@@ -57,7 +61,6 @@ public class InitActivity extends AppCompatActivity {
             @Override
             public void onClick(View v) {
                 String ipAddr = et_ipAddr.getText().toString().trim();
-                Log.d("wzl", "ip: " + ipAddr);
                 if (ipAddr.length() < 7 || ipAddr.length() > 15) {
                     ToastUtil.showShortToast(R.string.tips_invalid_ip);
                 } else {
@@ -89,7 +92,6 @@ public class InitActivity extends AppCompatActivity {
                 .readTimeout(60, TimeUnit.SECONDS);
 
         String hostUrl = Constants.HOST_ADDR_PRE + Constants.HOST_IP + Constants.PORT + "/" + Constants.PATH;
-        Log.d("wzl", "host ip: " + Constants.HOST_IP + ", hostUrl: " + hostUrl);
         OkHttpClient httpClient = builder.build();
         Request request = new Request.Builder()
                 .url(hostUrl)
@@ -106,8 +108,16 @@ public class InitActivity extends AppCompatActivity {
             public void onResponse(Call call, Response response) throws IOException {
                 if (response.isSuccessful()) {
                     String responseStr = response.body().string();
-                    List<PatientInfoBean> patientList = JSONObject.parseArray(responseStr, PatientInfoBean.class);
+                    //Log.d("wzl", "get response:" + responseStr);
+                    JSONObject json = JSON.parseObject(responseStr);
+                    List<PatientInfoBean> patientList = JSONArray.parseArray(json.getString("patient"), PatientInfoBean.class);
+                    List<NurseConfigBean> nurseConfigList = JSONArray.parseArray(json.getString("nurse_config"), NurseConfigBean.class);
+                    List<HospitalFrameBean> bedFrameList = JSONArray.parseArray(json.getString("bed_frame"), HospitalFrameBean.class);
+
+                    PatientInfoManager.getInstance().setBedFrameBeanList(bedFrameList);
+                    PatientInfoManager.getInstance().setNurseConfigBeanList(nurseConfigList);
                     PatientInfoManager.getInstance().setPatientInfoBeanList(patientList);
+
                     showMainActivity();
                 } else {
                     ToastUtil.showShortToast(R.string.tips_get_data_err);

+ 3 - 3
app/src/main/java/com/wdkl/infoboardclassic/MainActivity.java

@@ -83,13 +83,13 @@ public class MainActivity extends AppCompatActivity {
                     case MSG_GET_DATE:
                         activity.updateDate();
                         PatientInfoManager.getInstance().getPatientInfo();
-                        activity.mHandler.sendEmptyMessageDelayed(MSG_UPDATE_ROOM_INFO, 10*1000);
+                        activity.mHandler.sendEmptyMessageDelayed(MSG_UPDATE_ROOM_INFO, 20*1000);
                         break;
                     case MSG_UPDATE_ROOM_INFO:
                         if (activity.roomInfoFragment != null) {
-                            activity.roomInfoFragment.updateData();
+                            activity.roomInfoFragment.refresh();
                         }
-                        activity.mHandler.sendEmptyMessageDelayed(MSG_GET_DATE, 30*1000);
+                        activity.mHandler.sendEmptyMessageDelayed(MSG_GET_DATE, 40*1000);
                         break;
                 }
             }

+ 14 - 6
app/src/main/java/com/wdkl/infoboardclassic/adapter/NurseConfigAdapter.java

@@ -12,6 +12,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.wdkl.infoboardclassic.R;
+import com.wdkl.infoboardclassic.data.NurseConfigItem;
+import com.wdkl.infoboardclassic.manager.MyLinearLayoutManager;
 import com.wdkl.infoboardclassic.manager.PatientInfoManager;
 
 import java.util.List;
@@ -19,12 +21,12 @@ import java.util.List;
 public class NurseConfigAdapter extends RecyclerView.Adapter<NurseConfigAdapter.NurseConfigViewHolder> {
     private Context mContext;
     private int layoutId;
-    private List<String> nurseConfigTitles;
+
+    private List<NurseConfigItem> nurseConfigItemList;
 
     public NurseConfigAdapter(Context context, int resId) {
         mContext = context;
         layoutId = resId;
-        nurseConfigTitles = PatientInfoManager.getInstance().getNurseConfigTitle();
     }
 
     @NonNull
@@ -38,16 +40,17 @@ public class NurseConfigAdapter extends RecyclerView.Adapter<NurseConfigAdapter.
     @Override
     public void onBindViewHolder(@NonNull NurseConfigViewHolder holder, int position) {
         try {
-            holder.tvNurseConfigTitle.setText(nurseConfigTitles.get(position));
+            holder.tvNurseConfigTitle.setText(nurseConfigItemList.get(position).getNurseConfigTitle());
 
-            NurseConfigDetailAdapter adapter = new NurseConfigDetailAdapter(mContext, R.layout.nurse_config_detail_item);
-            LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
+            NurseConfigDetailAdapter adapter = new NurseConfigDetailAdapter(mContext, R.layout.nurse_config_detail_item, nurseConfigItemList.get(position).getNurseConfigLevelList());
+            LinearLayoutManager layoutManager = new MyLinearLayoutManager(mContext);
             layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
             holder.rvNurseConfigLevel.setLayoutManager(layoutManager);
             holder.rvNurseConfigLevel.setAdapter(adapter);
             DividerItemDecoration itemDecoration = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL);
             itemDecoration.setDrawable(mContext.getResources().getDrawable(R.drawable.white_line, null));
             holder.rvNurseConfigLevel.addItemDecoration(itemDecoration);
+            adapter.notifyDataSetChanged();
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -55,7 +58,12 @@ public class NurseConfigAdapter extends RecyclerView.Adapter<NurseConfigAdapter.
 
     @Override
     public int getItemCount() {
-        return nurseConfigTitles.size();
+        return nurseConfigItemList.size();
+    }
+
+    public void refreshData() {
+        nurseConfigItemList = PatientInfoManager.getInstance().getNurseConfigItems();
+        notifyDataSetChanged();
     }
 
     class NurseConfigViewHolder extends RecyclerView.ViewHolder {

+ 7 - 8
app/src/main/java/com/wdkl/infoboardclassic/adapter/NurseConfigDetailAdapter.java

@@ -10,20 +10,19 @@ import androidx.annotation.NonNull;
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.wdkl.infoboardclassic.R;
-import com.wdkl.infoboardclassic.data.NurseConfigItem;
-import com.wdkl.infoboardclassic.manager.PatientInfoManager;
+import com.wdkl.infoboardclassic.data.NurseConfigLevel;
 
 import java.util.List;
 
 public class NurseConfigDetailAdapter extends RecyclerView.Adapter<NurseConfigDetailAdapter.NurseConfigDetailViewHolder> {
     private Context mContext;
     private int layoutId;
-    private List<NurseConfigItem> nurseConfigItemList;
+    private List<NurseConfigLevel> nurseConfigLevelList;
 
-    public NurseConfigDetailAdapter(Context context, int resId) {
+    public NurseConfigDetailAdapter(Context context, int resId, List<NurseConfigLevel> data) {
         mContext = context;
         layoutId = resId;
-        nurseConfigItemList = PatientInfoManager.getInstance().getNurseConfigItems();
+        nurseConfigLevelList = data;
     }
 
     @NonNull
@@ -37,8 +36,8 @@ public class NurseConfigDetailAdapter extends RecyclerView.Adapter<NurseConfigDe
     @Override
     public void onBindViewHolder(@NonNull NurseConfigDetailViewHolder holder, int position) {
         try {
-            holder.tvNurseConfigLevel.setText(nurseConfigItemList.get(position).getNurseConfigLevel());
-            holder.tvNurseConfigContent.setText(nurseConfigItemList.get(position).getNurseConfigContent());
+            holder.tvNurseConfigLevel.setText(nurseConfigLevelList.get(position).getNurseConfigLevel());
+            holder.tvNurseConfigContent.setText(nurseConfigLevelList.get(position).getNurseConfigContent());
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -46,7 +45,7 @@ public class NurseConfigDetailAdapter extends RecyclerView.Adapter<NurseConfigDe
 
     @Override
     public int getItemCount() {
-        return nurseConfigItemList.size();
+        return nurseConfigLevelList.size();
     }
 
 

+ 1 - 1
app/src/main/java/com/wdkl/infoboardclassic/constant/Constants.java

@@ -11,5 +11,5 @@ public class Constants {
 
     public static String PORT = ":8080";
 
-    public static String PATH = "home/patient_info";
+    public static String PATH = "home/room_info";
 }

+ 97 - 0
app/src/main/java/com/wdkl/infoboardclassic/data/HospitalFrameBean.java

@@ -0,0 +1,97 @@
+package com.wdkl.infoboardclassic.data;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+
+/**
+ * 医院结构。楼、病房、床位
+ *
+ * @author Ingawu
+ */
+public class HospitalFrameBean {
+
+    @JSONField(name = "type")
+    //(name = "type", value = "类型:0楼、1病房、2床位", required = true)
+    private Integer type;
+
+    @JSONField(name = "name")
+    //(name = "name", value = "名称", required = true)
+    private String name;
+
+    @JSONField(name = "alias")
+    //(name = "alias", value = "别名", required = true)
+    private String alias;
+
+    @JSONField(name = "parent_id")
+    //(name = "parent_id", value = "父级id", required = true)
+    private Integer parentId;
+
+    private Long id;
+
+    @JSONField(name = "create_time")
+    //(name = "create_time", value = "创建时间", required = false)
+    private Long createTime;
+
+    public HospitalFrameBean(Integer type, String name, String alias,
+                             Integer parentId, Long id, Long createTime) {
+        this.type = type;
+        this.name = name;
+        this.alias = alias;
+        this.parentId = parentId;
+        this.id = id;
+        this.createTime = createTime;
+    }
+
+    public HospitalFrameBean() {
+    }
+
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
+
+
+    public Integer getType() {
+        return this.type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAlias() {
+        return this.alias;
+    }
+
+    public void setAlias(String alias) {
+        this.alias = alias;
+    }
+
+    public Integer getParentId() {
+        return this.parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+}

+ 198 - 0
app/src/main/java/com/wdkl/infoboardclassic/data/NurseConfigBean.java

@@ -0,0 +1,198 @@
+package com.wdkl.infoboardclassic.data;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+/**
+ * 护理配置表
+ *
+ * @author Ingawu
+ */
+
+public class NurseConfigBean {
+
+    @JSONField(name = "nurse_level")
+    //(name = "nurse_level", value = "护理级别索引号(0-4)", required = false)
+    private Integer nurseLevel;
+
+    @JSONField(name = "value")
+    //(name = "value", value = "该护理配置值", required = false)
+    private String value;
+
+    @JSONField(name = "his_value")
+    //(name = "his_value", value = "该护理配置HIS值", required = false)
+    private String hisValue;
+
+    @JSONField(name = "name")
+    //(name = "name", value = "护理名称", required = false)
+    private String name;
+
+    @JSONField(name = "color")
+    //(name = "color", value = "护理颜色", required = false)
+    private String color;
+
+    @JSONField(name = "content")
+    //(name = "content", value = "护理备注", required = false)
+    private String content;
+
+    private Long id;
+
+    @JSONField(name = "create_time")
+    //(name = "create_time", value = "创建时间", required = false)
+    private Long createTime;
+
+    @JSONField(name = "archived")
+    private Boolean archived;
+
+    @JSONField(name = "update_time")
+    //(name = "update_time", value = "修改时间", required = false)
+    private Long updateTime;
+
+    @JSONField(name = "sync_time")
+    //(name = "sync_time", value = "数据同步时间", required = false)
+    private Long syncTime;
+
+    @JSONField(name = "server_id")
+    private Integer serverId;
+
+    @JSONField(name = "client_id")
+    private Long clientId;
+
+    @JSONField(name = "part_id")
+    //(name = "part_id", value = "科室id", required = false)
+    private Integer partId;
+
+
+    public NurseConfigBean(Integer nurseLevel, String value, String hisValue, String name,
+                           String color, String content, Long id, Long createTime, Boolean archived,
+                           Long updateTime, Long syncTime, Integer serverId, Long clientId, Integer partId) {
+        this.nurseLevel = nurseLevel;
+        this.value = value;
+        this.hisValue = hisValue;
+        this.name = name;
+        this.color = color;
+        this.content = content;
+        this.id = id;
+        this.createTime = createTime;
+        this.archived = archived;
+        this.updateTime = updateTime;
+        this.syncTime = syncTime;
+        this.serverId = serverId;
+        this.clientId = clientId;
+        this.partId = partId;
+    }
+
+    public NurseConfigBean() {
+    }
+
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
+
+    public Boolean getArchived() {
+        return archived;
+    }
+
+    public void setArchived(Boolean archived) {
+        this.archived = archived;
+    }
+
+    public Long getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Long updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Long getSyncTime() {
+        return syncTime;
+    }
+
+    public void setSyncTime(Long syncTime) {
+        this.syncTime = syncTime;
+    }
+
+    public Integer getServerId() {
+        return serverId;
+    }
+
+    public void setServerId(Integer serverId) {
+        this.serverId = serverId;
+    }
+
+    public Long getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(Long clientId) {
+        this.clientId = clientId;
+    }
+
+    public Integer getPartId() {
+        return partId;
+    }
+
+    public void setPartId(Integer partId) {
+        this.partId = partId;
+    }
+    public Integer getNurseLevel() {
+        return nurseLevel;
+    }
+
+    public void setNurseLevel(Integer nurseLevel) {
+        this.nurseLevel = nurseLevel;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getHisValue() {
+        return hisValue;
+    }
+
+    public void setHisValue(String hisValue) {
+        this.hisValue = hisValue;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getColor() {
+        return color;
+    }
+
+    public void setColor(String color) {
+        this.color = color;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+}

+ 15 - 13
app/src/main/java/com/wdkl/infoboardclassic/data/NurseConfigItem.java

@@ -1,31 +1,33 @@
 package com.wdkl.infoboardclassic.data;
 
+import java.util.List;
+
 public class NurseConfigItem {
-    private String nurseConfigLevel;
+    private String nurseConfigTitle;
 
-    private String nurseConfigContent;
+    private List<NurseConfigLevel> nurseConfigLevelList;
 
     public NurseConfigItem() {
     }
 
-    public NurseConfigItem(String level, String content) {
-        nurseConfigLevel = level;
-        nurseConfigContent = content;
+    public NurseConfigItem(String title, List<NurseConfigLevel> list) {
+        nurseConfigTitle = title;
+        nurseConfigLevelList = list;
     }
 
-    public String getNurseConfigLevel() {
-        return nurseConfigLevel;
+    public String getNurseConfigTitle() {
+        return nurseConfigTitle;
     }
 
-    public void setNurseConfigLevel(String nurseConfigLevel) {
-        this.nurseConfigLevel = nurseConfigLevel;
+    public void setNurseConfigTitle(String nurseConfigTitle) {
+        this.nurseConfigTitle = nurseConfigTitle;
     }
 
-    public String getNurseConfigContent() {
-        return nurseConfigContent;
+    public List<NurseConfigLevel> getNurseConfigLevelList() {
+        return nurseConfigLevelList;
     }
 
-    public void setNurseConfigContent(String nurseConfigContent) {
-        this.nurseConfigContent = nurseConfigContent;
+    public void setNurseConfigLevelList(List<NurseConfigLevel> nurseConfigLevelList) {
+        this.nurseConfigLevelList = nurseConfigLevelList;
     }
 }

+ 31 - 0
app/src/main/java/com/wdkl/infoboardclassic/data/NurseConfigLevel.java

@@ -0,0 +1,31 @@
+package com.wdkl.infoboardclassic.data;
+
+public class NurseConfigLevel {
+    private String nurseConfigLevel;
+
+    private String nurseConfigContent;
+
+    public NurseConfigLevel() {
+    }
+
+    public NurseConfigLevel(String level, String content) {
+        nurseConfigLevel = level;
+        nurseConfigContent = content;
+    }
+
+    public String getNurseConfigLevel() {
+        return nurseConfigLevel;
+    }
+
+    public void setNurseConfigLevel(String nurseConfigLevel) {
+        this.nurseConfigLevel = nurseConfigLevel;
+    }
+
+    public String getNurseConfigContent() {
+        return nurseConfigContent;
+    }
+
+    public void setNurseConfigContent(String nurseConfigContent) {
+        this.nurseConfigContent = nurseConfigContent;
+    }
+}

+ 3 - 1
app/src/main/java/com/wdkl/infoboardclassic/fragment/RoomInfoFragment.java

@@ -65,9 +65,11 @@ public class RoomInfoFragment extends BaseFragment {
         rvNurseConfig.setLayoutManager(layoutManager2);
         rvNurseConfig.setAdapter(nurseConfigAdapter);
         rvNurseConfig.addItemDecoration(itemDecoration);
+        nurseConfigAdapter.refreshData();
     }
 
-    public void updateData() {
+    public void refresh() {
         patientAdapter.refreshData();
+        nurseConfigAdapter.refreshData();
     }
 }

+ 127 - 11
app/src/main/java/com/wdkl/infoboardclassic/manager/PatientInfoManager.java

@@ -10,7 +10,10 @@ import com.wdkl.infoboardclassic.MainActivity;
 import com.wdkl.infoboardclassic.R;
 import com.wdkl.infoboardclassic.constant.Constants;
 import com.wdkl.infoboardclassic.data.AllPatientInfoItem;
+import com.wdkl.infoboardclassic.data.HospitalFrameBean;
+import com.wdkl.infoboardclassic.data.NurseConfigBean;
 import com.wdkl.infoboardclassic.data.NurseConfigItem;
+import com.wdkl.infoboardclassic.data.NurseConfigLevel;
 import com.wdkl.infoboardclassic.data.PatientInfoBean;
 import com.wdkl.infoboardclassic.utils.ToastUtil;
 
@@ -20,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 import okhttp3.Call;
 import okhttp3.Callback;
@@ -36,8 +40,11 @@ public class PatientInfoManager {
     private List<NurseConfigItem> nurseConfigItemList = new ArrayList<>();
 
     private List<PatientInfoBean> patientInfoBeanList;
+    private List<NurseConfigBean> nurseConfigBeanList;
+    private List<HospitalFrameBean> bedFrameBeanList;
 
     private int[] titleId = new int[] {R.string.patient_count_title, R.string.discharged_today_title, R.string.discharged_tomorrow_title, R.string.admission_today};
+    private int[] nurseConfigTitleIds = new int[] {R.string.gradeLevel, R.string.dosageLevel, R.string.dietLevel, R.string.insulateLevel, R.string.allerayLevel};
 
     private PatientInfoManager(){
     }
@@ -78,7 +85,15 @@ public class PatientInfoManager {
                 if (response.isSuccessful()) {
                     String responseStr = response.body().string();
                     //Log.d(TAG, "get response:" + responseStr);
-                    patientInfoBeanList = JSONObject.parseArray(responseStr, PatientInfoBean.class);
+
+                    JSONObject json = JSON.parseObject(responseStr);
+                    List<PatientInfoBean> patientList = JSONArray.parseArray(json.getString("patient"), PatientInfoBean.class);
+                    List<NurseConfigBean> nurseConfigList = JSONArray.parseArray(json.getString("nurse_config"), NurseConfigBean.class);
+                    List<HospitalFrameBean> bedFrameList = JSONArray.parseArray(json.getString("bed_frame"), HospitalFrameBean.class);
+
+                    PatientInfoManager.getInstance().setBedFrameBeanList(bedFrameList);
+                    PatientInfoManager.getInstance().setNurseConfigBeanList(nurseConfigList);
+                    PatientInfoManager.getInstance().setPatientInfoBeanList(patientList);
                 } else {
                     Log.e(TAG, response.body().string());
                     ToastUtil.showShortToast("获取数据错误");
@@ -141,21 +156,122 @@ public class PatientInfoManager {
         return allPatientInfoItemList;
     }
 
-    public List<String> getNurseConfigTitle() {
-        nurseConfigTitleList.clear();
-        for (int i = 0; i < 5; i++) {
-            nurseConfigTitleList.add("护理等级");
+    //默认值
+    public List<NurseConfigItem> defaultNurseConfigItems() {
+        for (int i = 0; i < nurseConfigTitleIds.length; i++) {
+            NurseConfigItem item = new NurseConfigItem();
+            List<NurseConfigLevel> configLevelList = new ArrayList<>();
+            for (int j = 0; j < 4; j++) {
+                NurseConfigLevel configLevel = new NurseConfigLevel();
+                configLevel.setNurseConfigLevel("");
+                configLevel.setNurseConfigContent("");
+                configLevelList.add(configLevel);
+            }
+
+            item.setNurseConfigTitle(BaseApp.getContext().getString(nurseConfigTitleIds[i]));
+            item.setNurseConfigLevelList(configLevelList);
+            nurseConfigItemList.add(item);
         }
-        return nurseConfigTitleList;
+        return nurseConfigItemList;
+    }
+
+    public void setBedFrameBeanList(List<HospitalFrameBean> hospitalFrameBeans) {
+        bedFrameBeanList = hospitalFrameBeans;
+    }
+
+    public void setNurseConfigBeanList(List<NurseConfigBean> nurseConfigBeans) {
+        nurseConfigBeanList = nurseConfigBeans;
     }
 
     public List<NurseConfigItem> getNurseConfigItems() {
-        nurseConfigItemList.clear();
-        for (int i = 0; i < 4; i++) {
-            NurseConfigItem item = new NurseConfigItem("一级", "1,5,9,22");
-            nurseConfigItemList.add(item);
+        if (nurseConfigBeanList != null) {
+            List<NurseConfigBean> gradeLvl = nurseConfigBeanList.stream().filter(p -> p.getNurseLevel() == 0).collect(Collectors.toList());
+            List<NurseConfigBean> insulateLvl = nurseConfigBeanList.stream().filter(p -> p.getNurseLevel() == 1).collect(Collectors.toList());
+            List<NurseConfigBean> dietLvl = nurseConfigBeanList.stream().filter(p -> p.getNurseLevel() == 2).collect(Collectors.toList());
+            List<NurseConfigBean> dosageLvl = nurseConfigBeanList.stream().filter(p -> p.getNurseLevel() == 3).collect(Collectors.toList());
+            List<NurseConfigBean> allerayLvl = nurseConfigBeanList.stream().filter(p -> p.getNurseLevel() == 4).collect(Collectors.toList());
+
+            for (int i = 0; i < nurseConfigTitleIds.length; i++) {
+                NurseConfigItem item = new NurseConfigItem();
+                //护理名称
+                item.setNurseConfigTitle(BaseApp.getContext().getString(nurseConfigTitleIds[i]));
+                //护理级别名称和对应床号
+                List<NurseConfigLevel> configLevelList = new ArrayList<>();
+                for (int j = 0; j < 4; j++) {
+                    NurseConfigLevel configLevel = new NurseConfigLevel();
+                    switch (i) {
+                        case 0:
+                            if (gradeLvl != null && j < gradeLvl.size()) {
+                                configLevel.setNurseConfigLevel(gradeLvl.get(j).getValue());
+                                long id = gradeLvl.get(j).getId();
+                                configLevel.setNurseConfigContent(getNurseConfigNumber(id));
+                            } else {
+                                configLevel.setNurseConfigLevel("");
+                            }
+                            break;
+                        case 1:
+                            if (insulateLvl != null && j < insulateLvl.size()) {
+                                configLevel.setNurseConfigLevel(insulateLvl.get(j).getValue());
+                                long id = gradeLvl.get(j).getId();
+                                configLevel.setNurseConfigContent(getNurseConfigNumber(id));
+                            } else {
+                                configLevel.setNurseConfigLevel("");
+                            }
+                            break;
+                        case 2:
+                            if (dietLvl != null && j < dietLvl.size()) {
+                                configLevel.setNurseConfigLevel(dietLvl.get(j).getValue());
+                                long id = gradeLvl.get(j).getId();
+                                configLevel.setNurseConfigContent(getNurseConfigNumber(id));
+                            } else {
+                                configLevel.setNurseConfigLevel("");
+                            }
+                            break;
+                        case 3:
+                            if (dosageLvl != null && j < dosageLvl.size()) {
+                                configLevel.setNurseConfigLevel(dosageLvl.get(j).getValue());
+                                long id = gradeLvl.get(j).getId();
+                                configLevel.setNurseConfigContent(getNurseConfigNumber(id));
+                            } else {
+                                configLevel.setNurseConfigLevel("");
+                            }
+                            break;
+                        case 4:
+                            if (allerayLvl != null && j < allerayLvl.size()) {
+                                configLevel.setNurseConfigLevel(allerayLvl.get(j).getValue());
+                                long id = gradeLvl.get(j).getId();
+                                configLevel.setNurseConfigContent(getNurseConfigNumber(id));
+                            } else {
+                                configLevel.setNurseConfigLevel("");
+                            }
+                            break;
+                    }
+                    configLevelList.add(configLevel);
+                }
+                item.setNurseConfigLevelList(configLevelList);
+                nurseConfigItemList.add(item);
+            }
+            return nurseConfigItemList;
+        } else {
+            return defaultNurseConfigItems();
         }
-        return nurseConfigItemList;
+    }
+
+    private String getNurseConfigNumber(long configLevelId) {
+        String bedNo = "";
+        if (patientInfoBeanList != null && bedFrameBeanList != null) {
+            //通过护理项ID查找对应所有病人
+            List<PatientInfoBean> patients = patientInfoBeanList.stream().filter(p -> p.getGradeLevel() == configLevelId).collect(Collectors.toList());
+            //通过病人信息查找对应床位号
+            for (PatientInfoBean bean : patients) {
+                for (HospitalFrameBean frameBean : bedFrameBeanList) {
+                    if (bean.getFrameId().longValue() == frameBean.getId().longValue()) {
+                        bedNo = bedNo + frameBean.getName() + ",";
+                    }
+                }
+            }
+        }
+        return bedNo;
     }
 
     private String getString(int resId) {

+ 6 - 0
app/src/main/res/values/strings.xml

@@ -13,4 +13,10 @@
     <string name="discharged_tomorrow_title">明日出院</string>
     <string name="admission_today">今日入院</string>
     <string name="date_format">yyyy-MM-dd</string>
+
+    <string name="gradeLevel">护理等级</string>
+    <string name="dosageLevel">剂量级别</string>
+    <string name="dietLevel">饮食级别</string>
+    <string name="insulateLevel">隔离级别</string>
+    <string name="allerayLevel">过敏级别</string>
 </resources>