LAPTOP-KB9HII50\70708 2 vuotta sitten
vanhempi
commit
06d6d9b49d

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/article/dao/BaseMenuDictDao.java

@ -19,4 +19,7 @@ public interface BaseMenuDictDao extends JpaRepository<BaseMenuDictDO, String>,
    void updateStatus(String id,Integer status);
    @Query("from BaseMenuDictDO p where p.parentId=?1 and p.isDel='1'")
    List<BaseMenuDictDO> findByParentId(String parentId);
    @Query("select a from BaseMenuDictDO a where a.isDel='1' and a.id=?1")
    BaseMenuDictDO findByIdAndDel(String id);
}

+ 16 - 0
business/base-service/src/main/java/com/yihu/jw/article/dao/BaseMenuDictUserDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.article.dao;
import com.yihu.jw.entity.base.menu.BaseMenuDictUserDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
/**
 * Created by yeshijie on 2023/5/4.
 */
public interface BaseMenuDictUserDao  extends JpaRepository<BaseMenuDictUserDO, String>, JpaSpecificationExecutor<BaseMenuDictUserDO> {
    @Query("select a from BaseMenuDictUserDO a where a.del=1 and a.relationCode=?1 and a.user=?2")
    BaseMenuDictUserDO findByRelationCodeAndUserAndDel(String relationCode, String user);
}

+ 94 - 6
business/base-service/src/main/java/com/yihu/jw/article/service/BaseMenuManageService.java

@ -2,16 +2,18 @@ package com.yihu.jw.article.service;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.article.dao.BaseLinkDictDao;
import com.yihu.jw.article.dao.BaseMenuDictDao;
import com.yihu.jw.article.dao.BaseMenuShowDao;
import com.yihu.jw.article.dao.KnowledgeArticleDictDao;
import com.yihu.jw.article.dao.*;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.menu.BaseLinkDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuDictUserDO;
import com.yihu.jw.entity.base.menu.BaseMenuShowDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.lang3.StringUtils;
@ -19,6 +21,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -40,6 +44,64 @@ public class BaseMenuManageService {
    private KnowledgeArticleDictDao knowledgeArticleDictDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseMenuDictUserDao baseMenuDictUserDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    /**
     *
     * @param id
     * @param flag 1收藏2阅读3点赞4分享
     * @param status
     * @return
     */
    public BaseMenuDictDO setCollectionById(String id, Integer flag, Integer status, String user, String userType){
        BaseMenuDictDO dictDO = baseMenuDictDao.findByIdAndDel(id);
        if(dictDO==null){
            return null;
        }
        BaseMenuDictUserDO dictUserDO =baseMenuDictUserDao.findByRelationCodeAndUserAndDel(id,user);
        if (dictUserDO==null){
            dictUserDO = new BaseMenuDictUserDO();
            dictUserDO.setRelationCode(id);
            dictUserDO.setRelationName(dictDO.getMenuTitle());
            dictUserDO.setRelationType(1);
            dictUserDO.setDel(1);
            dictUserDO.setUser(user);
            if (StringUtils.isNoneBlank(userType)&&userType.equalsIgnoreCase("1")){
                BasePatientDO patientDO = patientDao.findById(user).orElse(null);
                if (patientDO!=null){
                    dictUserDO.setUserName(patientDO.getName());
                }
            }else if (StringUtils.isNoneBlank(userType)&&userType.equalsIgnoreCase("2")){
                BaseDoctorDO doctorDO = doctorDao.findById(user).orElse(null);
                if (doctorDO!=null){
                    dictUserDO.setUserName(doctorDO.getName());
                }
            }
            dictUserDO.setCreateTime(new Date());
        }
        if (flag!=null&&flag==1){
            dictUserDO.setCollection(status);
        }else if (flag!=null&&flag==2){
            dictUserDO.setIsRead(status);
        }else if (flag!=null&&flag==3){
            dictUserDO.setFabulous(status);
        }else if (flag!=null&&flag==4){
            dictUserDO.setShare(status);
        }
        baseMenuDictUserDao.save(dictUserDO);
        return dictDO;
    }
    //删除菜单字典
    public void deletMenuDict(String id) throws  Exception{
        BaseMenuDictDO baseMenuDictDO= baseMenuDictDao.findById(id).orElse(null);
@ -120,6 +182,7 @@ public class BaseMenuManageService {
        List<WlyyHospitalSysDictDO> menuLocation = wlyyHospitalSysDictDao.findByDictName("menuLocation");
        List<WlyyHospitalSysDictDO> menuFunction = wlyyHospitalSysDictDao.findByDictName("menuFunction");
        List<WlyyHospitalSysDictDO> effect = wlyyHospitalSysDictDao.findByDictName("isEffect");
        List<WlyyHospitalSysDictDO> releaseType = wlyyHospitalSysDictDao.findByDictName("releaseType");
        for (Map<String,Object> map:listParent){
            List<Map<String,Object>> childList = new ArrayList<>();
            Integer articleParentNum= knowledgeArticleDictDao.getCountByCategoryFirst(map.get("id").toString());
@ -135,6 +198,16 @@ public class BaseMenuManageService {
                    map.put("menuLocationName",wlyyHospitalSysDictDO.getDictValue());
                }
            }
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:menuLocation){
                if (map.get("menuLocation").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    map.put("menuLocationName",wlyyHospitalSysDictDO.getDictValue());
                }
            }
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:releaseType){
                if (map.get("releaseType").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    map.put("releaseTypeName",wlyyHospitalSysDictDO.getDictValue());
                }
            }
            for (Map<String,Object> mapchild:list){
                if (mapchild.get("parentId").toString().equalsIgnoreCase(map.get("id").toString())){
                    List<String> list1 = new ArrayList<>();
@ -161,7 +234,7 @@ public class BaseMenuManageService {
        return listParent;
    }
    //查询单挑菜单字典
    public BaseMenuDictDO findOneMenuDict(String id){
    public BaseMenuDictDO findOneMenuDict(String id,String patient){
        BaseMenuDictDO baseMenuDictDO= baseMenuDictDao.findById(id).orElse(null);
        if (baseMenuDictDO!=null){
            WlyyHospitalSysDictDO effect = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("isEffect",baseMenuDictDO.getStatus().toString());
@ -186,6 +259,18 @@ public class BaseMenuManageService {
                    baseMenuDictDO.setLocaTionName(menuLocation.getDictValue());
                }
            }
            if(StringUtils.isNotBlank(baseMenuDictDO.getDoctors())){
                String doctors = "'"+baseMenuDictDO.getDoctors().replace(",","','")+"'";
                String sql = "select * from base_doctor where id in ("+doctors+")";
                List<BaseDoctorDO> doctorDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(BaseDoctorDO.class));
                baseMenuDictDO.setDoctorList(doctorDOList);
            }
            if(StringUtils.isNotBlank(patient)){
                //点赞收藏相关
            }
        }
        return baseMenuDictDO;
    }
@ -280,6 +365,10 @@ public class BaseMenuManageService {
                menuOld.setDescribtion(menuDO.getDescribtion());
                menuOld.setMenuTitle(menuDO.getMenuTitle());
                menuOld.setBgImg(menuDO.getBgImg());
                menuOld.setReleaseType(menuDO.getReleaseType());
                menuOld.setDoctors(menuDO.getDoctors());
                menuOld.setAuthor(menuDO.getAuthor());
                menuOld.setMusicUrl(menuDO.getMusicUrl());
                menuOld.setUpdateTime(new Date());
                menuOld.setIsDel("1");
                menuDO = baseMenuDictDao.save(menuOld);
@ -748,7 +837,6 @@ public class BaseMenuManageService {
                    map.put("menuLocationName",wlyyHospitalSysDictDO.getDictValue());
                }
            }
        }
        return listParent;

+ 28 - 0
common/common-entity/src/db/2023.sql

@ -1,3 +1,31 @@
-- 2023-05-04
ALTER table base_menu_dict add COLUMN `author` varchar(255) DEFAULT NULL COMMENT '来源、作者';
ALTER table base_menu_dict add COLUMN `doctors` varchar(255) DEFAULT NULL COMMENT '推荐医生 多个逗号间隔';
ALTER table base_menu_dict add COLUMN `music_url` varchar(255) DEFAULT NULL COMMENT '音频';
ALTER table base_menu_dict add COLUMN `release_type` varchar(255) DEFAULT NULL COMMENT '发布类型 1图文 2视频 3音频';
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('releaseType1', NULL, 'releaseType', '1', '图文', NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('releaseType2', NULL, 'releaseType', '2', '视频', NULL, '2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict` (`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('releaseType3', NULL, 'releaseType', '3', '音频', NULL, '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CREATE TABLE `base_menu_dict_user` (
     `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
     `user_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
     `user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
     `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
     `fabulous` int DEFAULT NULL COMMENT '1已赞0未赞',
     `is_read` int DEFAULT NULL COMMENT '1已读0未读',
     `is_share` int DEFAULT NULL COMMENT '1已分享0未分享',
     `collection` int DEFAULT NULL COMMENT '是否收藏1是0否',
     `used` int DEFAULT NULL COMMENT '1常用0不常用',
     `del` int DEFAULT '1' COMMENT '是否删除,1正常,0删除',
     `relation_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
     `relation_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
     `relation_type` int DEFAULT NULL COMMENT '1、文章2、问卷',
     PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- 2023-04-24

+ 124 - 21
common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuDictDO.java

@ -1,38 +1,51 @@
package com.yihu.jw.entity.base.menu;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;
@Entity
@Table(name = "base_menu_dict")
public class BaseMenuDictDO extends UuidIdentityEntityWithOperator {
    private String parentId;
    private String name;
    private Integer menuSort;
    private String icon;
    private String url;
    private String isShow;
    private Integer status;
    private String remark;
    private Integer menuLevel;
    private String functionType;
    private String menuLocation;
    private String menuImg;
    private String functionName;
    private String locaTionName;
    private String showName;
    private String statusName;
    private String parentName;
    private String isDel;
    private String bgImg;
    private String menuTitle;
    private String describtion;
    private String parentId;//父id
    private String name;//名称
    private Integer menuSort;//排序
    private String icon;//菜单图标
    private String url;//url
    private String isShow;//是否展示(1是,2否)
    private Integer status;//状态 -1 已删除 0不可用 1可用
    private String remark;//别再
    private Integer menuLevel;//菜单层级
    private String functionType;//功能类型01单页,02列表页,03幻灯轮播
    private String menuLocation;//01导航栏,02首页分区,03友情链接
    private String menuImg;//可放多个图片逗号隔开
    private String functionName;//
    private String locaTionName;//
    private String showName;//
    private String statusName;//
    private String parentName;//
    private String isDel;//删除标识 1正常 0删除
    private String bgImg;//背景图片
    private String menuTitle;//标题
    private String describtion;//描述
    private String releaseType;//发布类型 1图文 2视频 3音频
    private String releaseTypeName;//发布类型 1图文 2视频 3音频
    private String musicUrl;//音频
    private String doctors;//推荐医生 多个逗号间隔
    private String author;//来源、作者
    private Integer type;//类型 1 官网菜单 2app文章菜单
    private List<BaseDoctorDO> doctorList;//推荐医生
    private Integer collection;//收藏数量
    private Integer fabulous;//点赞数量
    private String isCollection;//是否收藏 1是0否
    private String isFabulous;//是否点赞  1是0否
    @Column(name = "bg_img")
    public String getBgImg() {
        return bgImg;
@ -217,4 +230,94 @@ public class BaseMenuDictDO extends UuidIdentityEntityWithOperator {
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "release_type")
    public String getReleaseType() {
        return releaseType;
    }
    public void setReleaseType(String releaseType) {
        this.releaseType = releaseType;
    }
    @Column(name = "music_url")
    public String getMusicUrl() {
        return musicUrl;
    }
    public void setMusicUrl(String musicUrl) {
        this.musicUrl = musicUrl;
    }
    @Column(name = "doctors")
    public String getDoctors() {
        return doctors;
    }
    public void setDoctors(String doctors) {
        this.doctors = doctors;
    }
    @Column(name = "author")
    public String getAuthor() {
        return author;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    @Transient
    public List<BaseDoctorDO> getDoctorList() {
        return doctorList;
    }
    public void setDoctorList(List<BaseDoctorDO> doctorList) {
        this.doctorList = doctorList;
    }
    @Transient
    public String getReleaseTypeName() {
        return releaseTypeName;
    }
    public void setReleaseTypeName(String releaseTypeName) {
        this.releaseTypeName = releaseTypeName;
    }
    @Transient
    public Integer getCollection() {
        return collection;
    }
    public void setCollection(Integer collection) {
        this.collection = collection;
    }
    @Transient
    public Integer getFabulous() {
        return fabulous;
    }
    public void setFabulous(Integer fabulous) {
        this.fabulous = fabulous;
    }
    @Transient
    public String getIsCollection() {
        return isCollection;
    }
    public void setIsCollection(String isCollection) {
        this.isCollection = isCollection;
    }
    @Transient
    public String getIsFabulous() {
        return isFabulous;
    }
    public void setIsFabulous(String isFabulous) {
        this.isFabulous = isFabulous;
    }
}

+ 132 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuDictUserDO.java

@ -0,0 +1,132 @@
package com.yihu.jw.entity.base.menu;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 菜单文章中间表
 * @author
 * @date
 */
@Entity
@Table(name = "base_menu_dict_user")
public class BaseMenuDictUserDO extends UuidIdentityEntityWithCreateTime {
	private String user;//用户code
	private String userName;//用户名称
	private String relationCode;//文章code或者问卷code
	private Integer relationType;//1文章2问卷
	private String relationName;//文章名称
	private Integer fabulous;//1已赞0未赞
	private Integer isRead;//1已读0未读
	private Integer share;//1已分享0未分享
	private Integer collection;//是否收藏1是0否
	private Integer used;//1常用0不常用
	private Integer del;//是否删除,1正常,0删除
	private BaseMenuDictDO baseMenuDictDO;
	@Column(name = "user_code")
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getRelationCode() {
		return relationCode;
	}
	public void setRelationCode(String relationCode) {
		this.relationCode = relationCode;
	}
	public Integer getRelationType() {
		return relationType;
	}
	public void setRelationType(Integer relationType) {
		this.relationType = relationType;
	}
	public String getRelationName() {
		return relationName;
	}
	public void setRelationName(String relationName) {
		this.relationName = relationName;
	}
	public Integer getFabulous() {
		return fabulous;
	}
	public void setFabulous(Integer fabulous) {
		this.fabulous = fabulous;
	}
	public Integer getIsRead() {
		return isRead;
	}
	public void setIsRead(Integer isRead) {
		this.isRead = isRead;
	}
	@Column(name = "is_share")
	public Integer getShare() {
		return share;
	}
	public void setShare(Integer share) {
		this.share = share;
	}
	public Integer getCollection() {
		return collection;
	}
	public void setCollection(Integer collection) {
		this.collection = collection;
	}
	public Integer getUsed() {
		return used;
	}
	public void setUsed(Integer used) {
		this.used = used;
	}
	public Integer getDel() {
		return del;
	}
	public void setDel(Integer del) {
		this.del = del;
	}
	@Transient
	public BaseMenuDictDO getBaseMenuDictDO() {
		return baseMenuDictDO;
	}
	public void setBaseMenuDictDO(BaseMenuDictDO baseMenuDictDO) {
		this.baseMenuDictDO = baseMenuDictDO;
	}
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuManageEndpoint.java

@ -55,7 +55,7 @@ public class BaseMenuManageEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            return success(menuService.findOneMenuDict(id));
            return success(menuService.findOneMenuDict(id,null));
        }catch (Exception e){
            return failedException(e);
        }

+ 27 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/BaseMenuManageEndpoint.java

@ -3,6 +3,7 @@ package com.yihu.jw.hospital.endpoint.article;
import com.yihu.jw.article.service.BaseMenuManageService;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
@ -22,6 +23,28 @@ public class BaseMenuManageEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseMenuManageService menuService;
    @PostMapping(value = "setCollection")
    @ApiOperation(value = "设置文章状态")
    public ObjEnvelop setCollection(@ApiParam(name = "id", value = "文章id")
                                           @RequestParam(value = "id",required = true)String id,
                                           @ApiParam(name = "flag", value = "1收藏2阅读3点赞4分享")
                                           @RequestParam(value = "flag",required = true)Integer flag,
                                           @ApiParam(name = "status", value = "收藏(1收藏0未收藏)/阅读(1已读0未读)/点赞(1已赞0未赞)分享(1已分享0未分享)")
                                           @RequestParam(value = "status",required = true)Integer status,
                                           @ApiParam(name = "user", value = "用户code")
                                           @RequestParam(value = "user",required = true)String user,
                                           @ApiParam(name = "userType", value = "用户类型(1患者2医生)")
                                           @RequestParam(value = "userType",required = true)String userType)throws Exception {
        try {
            return success(menuService.setCollectionById(id,flag,status,user,userType));
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuDict.deleteMenuDict)
    @ApiOperation(value = "删除菜单")
    public Envelop deleteMenuDict(
@ -51,9 +74,11 @@ public class BaseMenuManageEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "根据id查询链接单条")
    public Envelop findOneMenuDict(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
            @RequestParam(value = "id") String id,
            @ApiParam(name = "patient", value = "居民id", required = false)
            @RequestParam(value = "patient", required = false) String patient) {
        try {
            return success(menuService.findOneMenuDict(id));
            return success(menuService.findOneMenuDict(id,patient));
        }catch (Exception e){
            return failedException(e);
        }