diff --git a/src/main/java/com/peanut/modules/common/controller/MedicalRecordsController.java b/src/main/java/com/peanut/modules/common/controller/MedicalRecordsController.java index b744772a..b378773d 100644 --- a/src/main/java/com/peanut/modules/common/controller/MedicalRecordsController.java +++ b/src/main/java/com/peanut/modules/common/controller/MedicalRecordsController.java @@ -5,14 +5,8 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.peanut.common.utils.R; import com.peanut.common.utils.ShiroUtils; -import com.peanut.modules.common.entity.MedicalRecords; -import com.peanut.modules.common.entity.MedicalRecordsLabel; -import com.peanut.modules.common.entity.MedicalRecordsToLabel; -import com.peanut.modules.common.entity.TaihuTalent; -import com.peanut.modules.common.service.MedicalRecordsLabelService; -import com.peanut.modules.common.service.MedicalRecordsService; -import com.peanut.modules.common.service.MedicalRecordsToLabelService; -import com.peanut.modules.common.service.TaihuTalentService; +import com.peanut.modules.common.entity.*; +import com.peanut.modules.common.service.*; import com.vladsch.flexmark.html.HtmlRenderer; import com.vladsch.flexmark.parser.Parser; import com.vladsch.flexmark.util.data.MutableDataSet; @@ -43,6 +37,8 @@ public class MedicalRecordsController { private MedicalRecordsToLabelService medicalRecordsToLabelService; @Autowired private TaihuTalentService taihuTalentService; + @Autowired + private TaihuTalentArticleService taihuTalentArticleService; //当前用户是否拥有医案模块 @RequestMapping("/getMedicalRecordsRoleByUser") @@ -76,6 +72,9 @@ public class MedicalRecordsController { @RequestMapping(value = "/medicalRecordsSplit") public R medicalRecordsSplit(@RequestBody Map parmas) { MedicalRecords mr = new MedicalRecords(); + if (parmas.containsKey("img")&& StringUtils.isNotEmpty(parmas.get("img").toString())) { + mr.setImg(parmas.get("img").toString()); + } if (parmas.containsKey("userId")&& StringUtils.isNotEmpty(parmas.get("userId").toString())) { mr.setUserId(Integer.parseInt(parmas.get("userId").toString())); }else { @@ -233,4 +232,29 @@ public class MedicalRecordsController { return R.ok().put("medicalRecordsList",medicalRecordsList); } + //通过审核医案是否公开 + @RequestMapping(value = "/setMedicalRecordsShow") + public R setMedicalRecordsShow(@RequestBody Map parmas) { + MedicalRecords medicalRecords = medicalRecordsService.getById(parmas.get("id").toString()); + medicalRecords.setShowFlag(1); + medicalRecordsService.updateById(medicalRecords); + return R.ok(); + } + + //通过审核医案同步发布文章 + @RequestMapping(value = "/addTaihuTalentArticle") + @Transactional + public R addTaihuTalentArticle(@RequestBody Map parmas) { + MedicalRecords medicalRecords = medicalRecordsService.getById(parmas.get("id").toString()); + TaihuTalentArticle article = new TaihuTalentArticle(); + article.setUserId(medicalRecords.getUserId()); + article.setTitle(medicalRecords.getTitle()); + article.setContent(medicalRecords.getData()); + article.setImg(medicalRecords.getImg()); + taihuTalentArticleService.save(article); + medicalRecords.setArticleFlag(1); + medicalRecordsService.updateById(medicalRecords); + return R.ok(); + } + } diff --git a/src/main/java/com/peanut/modules/common/entity/MedicalRecords.java b/src/main/java/com/peanut/modules/common/entity/MedicalRecords.java index d453db4d..722365ff 100644 --- a/src/main/java/com/peanut/modules/common/entity/MedicalRecords.java +++ b/src/main/java/com/peanut/modules/common/entity/MedicalRecords.java @@ -17,6 +17,10 @@ public class MedicalRecords { private Integer id; //用户id private Integer userId; + //是否公开 + private Integer showFlag; + //是否同步文章 + private Integer articleFlag; //标题 private String title; //0暂存1提交审核2审核拒绝3审核成功 diff --git a/src/main/java/com/peanut/modules/taihumed/controller/TaihuTalentController.java b/src/main/java/com/peanut/modules/taihumed/controller/TaihuTalentController.java index dd1e2287..5ec3f80a 100644 --- a/src/main/java/com/peanut/modules/taihumed/controller/TaihuTalentController.java +++ b/src/main/java/com/peanut/modules/taihumed/controller/TaihuTalentController.java @@ -115,6 +115,7 @@ public class TaihuTalentController { //精彩医案 List medicalRecords = medicalRecordsService.list(new LambdaQueryWrapper() .eq(MedicalRecords::getState,3) + .eq(MedicalRecords::getShowFlag,1) .eq(MedicalRecords::getUserId,taihuTalent.getUserId()) .orderByDesc(MedicalRecords::getTrain)); return R.ok()