From d4357b9949cab171fc19645592d9c7f4f42e5fef Mon Sep 17 00:00:00 2001 From: skjia <106962133@qq.com> Date: Mon, 9 Jun 2025 15:57:19 +0800 Subject: [PATCH] jsk --- .../health/domain/HealthPopularArticle.java | 8 ++- .../mapper/HealthPopularArticleMapper.java | 23 ++++--- .../impl/HealthPopularArticleServiceImpl.java | 28 ++++++++ .../HealthPersonMedicalReportMapper.xml | 2 +- .../health/HealthPopularArticleMapper.xml | 66 +++++++++++++++---- 5 files changed, 104 insertions(+), 23 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/domain/HealthPopularArticle.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/domain/HealthPopularArticle.java index 963232f..cce079f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/domain/HealthPopularArticle.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/domain/HealthPopularArticle.java @@ -10,7 +10,7 @@ import com.bonus.common.core.web.domain.BaseEntity; /** * 营养科普对象 health_popular_article - * + * * @author xsheng * @date 2025-05-25 */ @@ -74,6 +74,8 @@ public class HealthPopularArticle extends BaseEntity { @Excel(name = "文章摘要") @ApiModelProperty(value = "文章摘要") private String summary; - - + private String chronicIds; + private String chronicId; + private String chronicName; + private String chronicNames; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/mapper/HealthPopularArticleMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/mapper/HealthPopularArticleMapper.java index 0b7d312..1573ac3 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/mapper/HealthPopularArticleMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/mapper/HealthPopularArticleMapper.java @@ -1,18 +1,21 @@ package com.bonus.canteen.core.health.mapper; import java.util.List; + +import com.bonus.canteen.core.health.domain.HealthPersonInfo; import com.bonus.canteen.core.health.domain.HealthPopularArticle; +import org.apache.ibatis.annotations.Param; /** * 营养科普Mapper接口 - * + * * @author xsheng * @date 2025-05-25 */ public interface HealthPopularArticleMapper { /** * 查询营养科普 - * + * * @param articleId 营养科普主键 * @return 营养科普 */ @@ -20,15 +23,15 @@ public interface HealthPopularArticleMapper { /** * 查询营养科普列表 - * + * * @param healthPopularArticle 营养科普 * @return 营养科普集合 */ public List selectHealthPopularArticleList(HealthPopularArticle healthPopularArticle); - + /** * 新增营养科普 - * + * * @param healthPopularArticle 营养科普 * @return 结果 */ @@ -36,7 +39,7 @@ public interface HealthPopularArticleMapper { /** * 修改营养科普 - * + * * @param healthPopularArticle 营养科普 * @return 结果 */ @@ -44,7 +47,7 @@ public interface HealthPopularArticleMapper { /** * 删除营养科普 - * + * * @param articleId 营养科普主键 * @return 结果 */ @@ -52,9 +55,13 @@ public interface HealthPopularArticleMapper { /** * 批量删除营养科普 - * + * * @param articleIds 需要删除的数据主键集合 * @return 结果 */ public int deleteHealthPopularArticleByArticleIds(Long[] articleIds); + + int insertHealthArticleChronic(@Param("entities") List entities); + + public int deleteHealthArticleChronic(HealthPopularArticle healthPopularArticle); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/service/impl/HealthPopularArticleServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/service/impl/HealthPopularArticleServiceImpl.java index a32384e..a97687a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/service/impl/HealthPopularArticleServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/health/service/impl/HealthPopularArticleServiceImpl.java @@ -1,6 +1,10 @@ package com.bonus.canteen.core.health.service.impl; +import java.util.ArrayList; import java.util.List; + +import com.bonus.canteen.core.health.domain.HealthPersonInfo; +import com.bonus.canteen.core.health.mapper.HealthPersonInfoMapper; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -20,6 +24,9 @@ public class HealthPopularArticleServiceImpl implements IHealthPopularArticleSer @Autowired private HealthPopularArticleMapper healthPopularArticleMapper; + @Autowired + private HealthPersonInfoMapper healthPersonInfoMapper; + /** * 查询营养科普 * @@ -68,6 +75,27 @@ public class HealthPopularArticleServiceImpl implements IHealthPopularArticleSer public int updateHealthPopularArticle(HealthPopularArticle healthPopularArticle) { healthPopularArticle.setUpdateTime(DateUtils.getNowDate()); try { + HealthPersonInfo chronicVo=new HealthPersonInfo(); + chronicVo.setChronicIds(healthPopularArticle.getChronicIds()); + List chronicVos=healthPersonInfoMapper.selectHealthChronicList(chronicVo); + if(chronicVos!=null&&chronicVos.size()>0){ + /** + * 清空疾病信息 + */ + healthPopularArticleMapper.deleteHealthArticleChronic(healthPopularArticle); + List articleVos=new ArrayList<>(); + for(HealthPersonInfo vo:chronicVos){ + HealthPopularArticle hpa=new HealthPopularArticle(); + hpa.setArticleId(healthPopularArticle.getArticleId()); + hpa.setChronicId(vo.getChronicIds()); + hpa.setChronicName(vo.getChronicNames()); + articleVos.add(hpa); + } + /** + * 重新录入疾病信息 + */ + healthPopularArticleMapper.insertHealthArticleChronic(articleVos); + } return healthPopularArticleMapper.updateHealthPopularArticle(healthPopularArticle); } catch (Exception e) { throw new ServiceException(e.getMessage()); diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/health/HealthPersonMedicalReportMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/health/HealthPersonMedicalReportMapper.xml index 7df3c8b..c20266c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/health/HealthPersonMedicalReportMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/health/HealthPersonMedicalReportMapper.xml @@ -159,7 +159,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select medical_project_id as medicalprojectid,medical_project_name as medicalprojectname,medical_id as medicalid from health_person_medical_report_project a where medical_id = #{medicalId} - ORDER BY create_time ASC + ORDER BY id ASC - + select + aa.article_id, + aa.article_title, + aa.cover_photo, + aa.article_type, + aa.article_content, + aa.article_url, + aa.if_visible, + aa.hits, + aa.if_pushed, + aa.push_time, + aa.summary, + aa.create_by, + aa.create_time, + aa.update_by, + aa.update_time , + GROUP_CONCAT(bb.chronic_name ORDER BY bb.chronic_id desc) AS chronic_names, + GROUP_CONCAT(bb.chronic_id ORDER BY bb.chronic_id desc) AS chronic_ids + from health_popular_article aa + left join health_popular_article_chronic bb on aa.article_id=bb.article_id - and article_title = #{articleTitle} - and cover_photo = #{coverPhoto} - and article_type = #{articleType} - and article_content = #{articleContent} - and article_url = #{articleUrl} - and if_visible = #{ifVisible} - and hits = #{hits} - and if_pushed = #{ifPushed} - and push_time = #{pushTime} - and summary = #{summary} + and aa.article_title = #{articleTitle} + and aa.cover_photo = #{coverPhoto} + and aa.article_type = #{articleType} + and aa.article_content = #{articleContent} + and aa.article_url = #{articleUrl} + and aa.if_visible = #{ifVisible} + and aa.hits = #{hits} + and aa.if_pushed = #{ifPushed} + and aa.push_time = #{pushTime} + and aa.summary = #{summary} + group by aa.article_id, + aa.article_title, + aa.cover_photo, + aa.article_type, + aa.article_content, + aa.article_url, + aa.if_visible, + aa.hits, + aa.if_pushed, + aa.push_time, + aa.summary, + aa.create_by, + aa.create_time, + aa.update_by, + aa.update_time