feat: add dynamic nursing news/information management
- Backend: create RlzNursingArticle CRUD (entity, mapper, service, controller) - Backend: replace hardcoded data in getAppIndexInfo with DB query - Admin UI: add nursing article management page under 系统管理 - Android: fetch nursing info from API instead of hardcoded data - SQL: create rlz_nursing_article table with menu and permissions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,8 @@ package com.ruilaizi.service.main.find.entity;
|
||||
|
||||
public class homeListBean {
|
||||
private String pic;
|
||||
private String content;
|
||||
private String url;
|
||||
|
||||
public String getPic() {
|
||||
return pic;
|
||||
@@ -19,5 +21,11 @@ public class homeListBean {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
private String content;
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruilaizi.service.main.kehu.Bean;
|
||||
|
||||
|
||||
import com.ruilaizi.service.base.BaseModel;
|
||||
import com.ruilaizi.service.main.find.entity.homeListBean;
|
||||
import com.ruilaizi.service.main.my.entity.receiveOrderListBean;
|
||||
|
||||
import java.util.List;
|
||||
@@ -34,6 +35,14 @@ public class robCustomerInfoBean extends BaseModel {
|
||||
|
||||
String attestation; //认证状态 0 未认证 1认证通过 2审核中 3审核失败
|
||||
|
||||
List<homeListBean> nursingInfoList;
|
||||
|
||||
public List<homeListBean> getNursingInfoList() {
|
||||
return nursingInfoList;
|
||||
}
|
||||
|
||||
public void setNursingInfoList(List<homeListBean> nursingInfoList) {
|
||||
this.nursingInfoList = nursingInfoList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ import com.lzy.okgo.model.Response;
|
||||
import com.lzy.okrx2.adapter.ObservableResponse;
|
||||
import com.ruilaizi.service.R;
|
||||
import com.ruilaizi.service.base.BaseFragment;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruilaizi.service.main.find.entity.homeListBean;
|
||||
import com.ruilaizi.service.main.kehu.Bean.robCustomerInfoBean;
|
||||
import com.ruilaizi.service.main.kehu.adapter.MenuAdapter;
|
||||
import com.ruilaizi.service.main.my.entity.appUserInfoBean;
|
||||
@@ -31,6 +35,7 @@ import com.ruilaizi.service.okgonet.HttpConstants;
|
||||
import com.ruilaizi.service.utils.JsonUtils;
|
||||
import com.ruilaizi.service.utils.checkVersionsUtils.ProfileSpUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@@ -68,6 +73,7 @@ public class HomeFragment extends BaseFragment {
|
||||
if(ProfileSpUtils.getInstance().isLogin()) {
|
||||
getAppUserInfo();
|
||||
}
|
||||
initNursingInfo();
|
||||
return mContentView;
|
||||
}
|
||||
|
||||
@@ -133,6 +139,56 @@ public class HomeFragment extends BaseFragment {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取护理资讯
|
||||
*/
|
||||
private void initNursingInfo() {
|
||||
OkGo.<String>get(HttpConstants.URi_system_getAppIndexInfo)
|
||||
.converter(new StringConvert())
|
||||
.cacheMode(CacheMode.NO_CACHE)
|
||||
.adapt(new ObservableResponse<String>())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new io.reactivex.Observer<Response<String>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull Response<String> response) {
|
||||
String body = (String) response.body();
|
||||
Log.e("护理资讯", body);
|
||||
JSONObject json = JSON.parseObject(body);
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
if (data != null) {
|
||||
JSONArray realTimeInfoList = data.getJSONArray("realTimeInfoList");
|
||||
if (realTimeInfoList != null) {
|
||||
List<homeListBean> list = new ArrayList<>();
|
||||
for (int i = 0; i < realTimeInfoList.size(); i++) {
|
||||
JSONObject item = realTimeInfoList.getJSONObject(i);
|
||||
homeListBean bean = new homeListBean();
|
||||
bean.setContent(item.getString("title"));
|
||||
bean.setPic(item.getString("realTimeInfoImage"));
|
||||
bean.setUrl(item.getString("realTimeInfoUrl"));
|
||||
list.add(bean);
|
||||
}
|
||||
robCustomerInfoBean.setNursingInfoList(list);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*获取个人信息(查看认证状态)
|
||||
*/
|
||||
|
||||
@@ -45,23 +45,11 @@ public class ViewHolderFive extends AbstractViewTypeHolder {
|
||||
//护理资讯
|
||||
LinearLayoutManager manager = new LinearLayoutManager(mContext);
|
||||
style_recyleview.setLayoutManager(manager);
|
||||
List<homeListBean> data = new ArrayList<>();
|
||||
homeListBean homeListBean = new homeListBean();
|
||||
homeListBean.setContent("病室适宜的温度、湿度应保持在多少?");
|
||||
homeListBean.setPic("111");
|
||||
data.add(homeListBean);
|
||||
homeListBean homeListBeann = new homeListBean();
|
||||
homeListBeann.setContent("人人关注肾健康——吾爱吾肾、知识强肾");
|
||||
homeListBeann.setPic("222");
|
||||
data.add(homeListBeann);
|
||||
homeListBean homeListBeannn = new homeListBean();
|
||||
homeListBeannn.setContent("人人关注肾健康——吾爱吾肾、知识强肾");
|
||||
homeListBeannn.setPic("222");
|
||||
data.add(homeListBeannn);
|
||||
homeListBean homeListBeannnn = new homeListBean();
|
||||
homeListBeannnn.setContent("人人关注肾健康——吾爱吾肾、知识强肾");
|
||||
homeListBeannnn.setPic("222");
|
||||
data.add(homeListBeannnn);
|
||||
List<homeListBean> data = dataBean.getNursingInfoList();
|
||||
if (data == null) {
|
||||
data = new ArrayList<>();
|
||||
}
|
||||
final List<homeListBean> finalData = data;
|
||||
style_recyleview.setAdapter(new BaseQuickAdapter<homeListBean, BaseViewHolder>(R.layout.home_list_item, data) {
|
||||
@Override
|
||||
protected void convert(final BaseViewHolder helper, final homeListBean item) {
|
||||
@@ -76,7 +64,12 @@ public class ViewHolderFive extends AbstractViewTypeHolder {
|
||||
mContext.startActivity(intent);
|
||||
return;
|
||||
}
|
||||
XfiveWebActivity.runActivity(mContext, "了解陪护", "file:///android_asset/privacy.html");
|
||||
String url = item.getUrl();
|
||||
if (url != null && !url.isEmpty()) {
|
||||
XfiveWebActivity.runActivity(mContext, "了解陪护", url);
|
||||
} else {
|
||||
XfiveWebActivity.runActivity(mContext, "了解陪护", "file:///android_asset/privacy.html");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,6 +31,11 @@ public class HttpConstants {
|
||||
*/
|
||||
public static String URi_system_getAppUserInfo = URiBase + "/system/user/getAppUserInfo";
|
||||
|
||||
/**
|
||||
* 首页护理资讯
|
||||
*/
|
||||
public static String URi_system_getAppIndexInfo = URiBase + "/system/user/getAppIndexInfo";
|
||||
|
||||
/**
|
||||
* 上传图片
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user