|
@ -10,7 +10,6 @@ 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.BasePatientBusinessDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeArticleBrowseDO;
|
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
|
|
@ -69,46 +68,45 @@ public class BaseMenuManageService {
|
|
|
private String wxId;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param id
|
|
|
* @param flag 1收藏2阅读3点赞4分享
|
|
|
* @param flag 1收藏2阅读3点赞4分享
|
|
|
* @param status
|
|
|
* @return
|
|
|
*/
|
|
|
public BaseMenuDictDO setCollectionById(String id, Integer flag, Integer status, String user, String userType){
|
|
|
public BaseMenuDictDO setCollectionById(String id, Integer flag, Integer status, String user, String userType) {
|
|
|
BaseMenuDictDO dictDO = baseMenuDictDao.findByIdAndDel(id);
|
|
|
if(dictDO==null){
|
|
|
if (dictDO == null) {
|
|
|
return null;
|
|
|
}
|
|
|
BaseMenuDictUserDO dictUserDO =baseMenuDictUserDao.findByRelationCodeAndUserAndDel(id,user);
|
|
|
if (dictUserDO==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")){
|
|
|
if (StringUtils.isNoneBlank(userType) && userType.equalsIgnoreCase("1")) {
|
|
|
BasePatientDO patientDO = patientDao.findById(user).orElse(null);
|
|
|
if (patientDO!=null){
|
|
|
if (patientDO != null) {
|
|
|
dictUserDO.setUserName(patientDO.getName());
|
|
|
}
|
|
|
}else if (StringUtils.isNoneBlank(userType)&&userType.equalsIgnoreCase("2")){
|
|
|
} else if (StringUtils.isNoneBlank(userType) && userType.equalsIgnoreCase("2")) {
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(user).orElse(null);
|
|
|
if (doctorDO!=null){
|
|
|
if (doctorDO != null) {
|
|
|
dictUserDO.setUserName(doctorDO.getName());
|
|
|
}
|
|
|
}
|
|
|
dictUserDO.setCreateTime(new Date());
|
|
|
}
|
|
|
|
|
|
if (flag!=null&&flag==1){
|
|
|
if (flag != null && flag == 1) {
|
|
|
dictUserDO.setCollection(status);
|
|
|
}else if (flag!=null&&flag==2){
|
|
|
} else if (flag != null && flag == 2) {
|
|
|
dictUserDO.setIsRead(status);
|
|
|
}else if (flag!=null&&flag==3){
|
|
|
} else if (flag != null && flag == 3) {
|
|
|
dictUserDO.setFabulous(status);
|
|
|
}else if (flag!=null&&flag==4){
|
|
|
} else if (flag != null && flag == 4) {
|
|
|
dictUserDO.setShare(status);
|
|
|
}
|
|
|
baseMenuDictUserDao.save(dictUserDO);
|
|
@ -117,28 +115,29 @@ public class BaseMenuManageService {
|
|
|
}
|
|
|
|
|
|
//删除菜单字典
|
|
|
public void deletMenuDict(String id) throws Exception{
|
|
|
BaseMenuDictDO baseMenuDictDO= baseMenuDictDao.findById(id).orElse(null);
|
|
|
if (baseMenuDictDO!=null){
|
|
|
if ("0".equalsIgnoreCase(baseMenuDictDO.getParentId())){
|
|
|
List<BaseMenuDictDO> childList = baseMenuDictDao.findByParentId(baseMenuDictDO.getId());
|
|
|
if (childList!=null&&childList.size()>0){
|
|
|
throw new Exception("存在子菜单不允许删除");
|
|
|
}else {
|
|
|
baseMenuDictDO.setIsDel("0");
|
|
|
}
|
|
|
}else {
|
|
|
if (1==baseMenuDictDO.getStatus()){
|
|
|
throw new Exception("生效的子菜单不允许删除");
|
|
|
}else{
|
|
|
public void deletMenuDict(String id) throws Exception {
|
|
|
BaseMenuDictDO baseMenuDictDO = baseMenuDictDao.findById(id).orElse(null);
|
|
|
if (baseMenuDictDO != null) {
|
|
|
if ("0".equalsIgnoreCase(baseMenuDictDO.getParentId())) {
|
|
|
List<BaseMenuDictDO> childList = baseMenuDictDao.findByParentId(baseMenuDictDO.getId());
|
|
|
if (childList != null && childList.size() > 0) {
|
|
|
throw new Exception("存在子菜单不允许删除");
|
|
|
} else {
|
|
|
baseMenuDictDO.setIsDel("0");
|
|
|
}
|
|
|
} else {
|
|
|
if (1 == baseMenuDictDO.getStatus()) {
|
|
|
throw new Exception("生效的子菜单不允许删除");
|
|
|
} else {
|
|
|
baseMenuDictDO.setIsDel("0");
|
|
|
}
|
|
|
}
|
|
|
baseMenuDictDao.save(baseMenuDictDO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//菜单词典查询
|
|
|
public List<Map<String,Object>> findMenuDictByKey(String parentId, String name,Integer status,Integer type){
|
|
|
public List<Map<String, Object>> findMenuDictByKey(String parentId, String name, Integer status, Integer type) {
|
|
|
String sql = "select t.id as \"id\", " +
|
|
|
" t.parent_id as \"parentId\", " +
|
|
|
" t.name as \"name\", " +
|
|
@ -156,8 +155,8 @@ public class BaseMenuManageService {
|
|
|
" t.menu_title as \"menuTitle\", " +
|
|
|
" t.describtion as \"describtion\", " +
|
|
|
" t.menu_img as \"menuImg\" " +
|
|
|
"from base_menu_dict t where 1=1 and t.is_del ='1' and t.type="+type;
|
|
|
String sqlParent ="select t.id as \"id\", " +
|
|
|
"from base_menu_dict t where 1=1 and t.is_del ='1' and t.type=" + type;
|
|
|
String sqlParent = "select t.id as \"id\", " +
|
|
|
" t.parent_id as \"parentId\", " +
|
|
|
" t.name as \"name\", " +
|
|
|
" t.menu_sort as \"menuSort\", " +
|
|
@ -174,122 +173,127 @@ public class BaseMenuManageService {
|
|
|
" t.describtion as \"describtion\", " +
|
|
|
" t.menu_location as \"menuLocation\", " +
|
|
|
" t.menu_img as \"menuImg\" " +
|
|
|
"from base_menu_dict t where 1=1 and t.is_del ='1' and t.type="+type;
|
|
|
if (StringUtils.isNoneBlank(parentId)){
|
|
|
sql+=" and t.parent_id = '"+parentId+"'";
|
|
|
sqlParent+=" and t.id = '"+parentId+"'";
|
|
|
}else {
|
|
|
sqlParent+=" and t.parent_id = '0'";
|
|
|
"from base_menu_dict t where 1=1 and t.is_del ='1' and t.type=" + type;
|
|
|
if (StringUtils.isNoneBlank(parentId)) {
|
|
|
sql += " and t.parent_id = '" + parentId + "'";
|
|
|
sqlParent += " and t.id = '" + parentId + "'";
|
|
|
} else {
|
|
|
sqlParent += " and t.parent_id = '0'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.name like '%"+name+"%'";
|
|
|
sqlParent+=" and t.name like '%"+name+"%'";
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
sql += " and t.name like '%" + name + "%'";
|
|
|
sqlParent += " and t.name like '%" + name + "%'";
|
|
|
}
|
|
|
if (status!=null){
|
|
|
sql += " and t.status = '"+status+"' ";
|
|
|
sqlParent+=" and t.status = '"+status+"' " ;
|
|
|
if (status != null) {
|
|
|
sql += " and t.status = '" + status + "' ";
|
|
|
sqlParent += " and t.status = '" + status + "' ";
|
|
|
}
|
|
|
|
|
|
sql+=" order by t.parent_id asc ,t.menu_sort asc ";
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
List<Map<String,Object>> listParent = hibenateUtils.createSQLQuery(sqlParent);
|
|
|
sql += " order by t.parent_id asc ,t.menu_sort asc ";
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
List<Map<String, Object>> listParent = hibenateUtils.createSQLQuery(sqlParent);
|
|
|
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());
|
|
|
map.put("articleNum",articleParentNum);
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
|
|
|
if (map.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
map.put("statusName",wlyyHospitalSysDictDO.getDictValue());
|
|
|
map.put("isShow",map.get("status").toString().equalsIgnoreCase("1")?"是":"否");
|
|
|
for (Map<String, Object> map : listParent) {
|
|
|
List<Map<String, Object>> childList = new ArrayList<>();
|
|
|
Integer articleParentNum = knowledgeArticleDictDao.getCountByCategoryFirst(map.get("id").toString());
|
|
|
map.put("articleNum", articleParentNum);
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO : effect) {
|
|
|
if (map.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())) {
|
|
|
map.put("statusName", wlyyHospitalSysDictDO.getDictValue());
|
|
|
map.put("isShow", map.get("status").toString().equalsIgnoreCase("1") ? "是" : "否");
|
|
|
}
|
|
|
}
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:menuLocation){
|
|
|
if (map.get("menuLocation").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
map.put("menuLocationName",wlyyHospitalSysDictDO.getDictValue());
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO : menuLocation) {
|
|
|
if (map.get("menuLocation").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())) {
|
|
|
map.put("menuLocationName", wlyyHospitalSysDictDO.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
for (Map<String,Object> mapchild:list){
|
|
|
if (mapchild.get("parentId").toString().equalsIgnoreCase(map.get("id").toString())){
|
|
|
for (Map<String, Object> mapchild : list) {
|
|
|
if (mapchild.get("parentId").toString().equalsIgnoreCase(map.get("id").toString())) {
|
|
|
List<String> list1 = new ArrayList<>();
|
|
|
list1.add(mapchild.get("id").toString());
|
|
|
Integer articleChildNum= knowledgeArticleDictDao.getCountByCategorySecond(list1);
|
|
|
mapchild.put("articleNum",articleChildNum);
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
|
|
|
if (mapchild.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
mapchild.put("statusName",wlyyHospitalSysDictDO.getDictValue());
|
|
|
mapchild.put("isShow",mapchild.get("status").toString().equalsIgnoreCase("1")?"是":"否");
|
|
|
Integer articleChildNum = knowledgeArticleDictDao.getCountByCategorySecond(list1);
|
|
|
mapchild.put("articleNum", articleChildNum);
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO : effect) {
|
|
|
if (mapchild.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())) {
|
|
|
mapchild.put("statusName", wlyyHospitalSysDictDO.getDictValue());
|
|
|
mapchild.put("isShow", mapchild.get("status").toString().equalsIgnoreCase("1") ? "是" : "否");
|
|
|
}
|
|
|
}
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:menuFunction){
|
|
|
if (mapchild.get("functionType").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
mapchild.put("functionTypeName",wlyyHospitalSysDictDO.getDictValue());
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO : menuFunction) {
|
|
|
if (mapchild.get("functionType").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())) {
|
|
|
mapchild.put("functionTypeName", wlyyHospitalSysDictDO.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
childList.add(mapchild);
|
|
|
}
|
|
|
}
|
|
|
map.put("childList",childList);
|
|
|
map.put("childList", childList);
|
|
|
}
|
|
|
|
|
|
return listParent;
|
|
|
}
|
|
|
|
|
|
//查询单挑菜单字典
|
|
|
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());
|
|
|
baseMenuDictDO.setShowName(baseMenuDictDO.getStatus().equals("1")?"是":"否");
|
|
|
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());
|
|
|
baseMenuDictDO.setShowName(baseMenuDictDO.getStatus().equals("1") ? "是" : "否");
|
|
|
baseMenuDictDO.setStatusName(effect.getDictValue());
|
|
|
if (!"0".equalsIgnoreCase(baseMenuDictDO.getParentId())){
|
|
|
BaseMenuDictDO parentDo= baseMenuDictDao.findById(baseMenuDictDO.getParentId()).orElse(null);;
|
|
|
if (parentDo!=null){
|
|
|
if (!"0".equalsIgnoreCase(baseMenuDictDO.getParentId())) {
|
|
|
BaseMenuDictDO parentDo = baseMenuDictDao.findById(baseMenuDictDO.getParentId()).orElse(null);
|
|
|
;
|
|
|
if (parentDo != null) {
|
|
|
baseMenuDictDO.setParentName(parentDo.getName());
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(baseMenuDictDO.getFunctionType())){
|
|
|
WlyyHospitalSysDictDO menuFunction = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("menuFunction",baseMenuDictDO.getFunctionType());
|
|
|
if(menuFunction!=null){
|
|
|
if (StringUtils.isNotBlank(baseMenuDictDO.getFunctionType())) {
|
|
|
WlyyHospitalSysDictDO menuFunction = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("menuFunction", baseMenuDictDO.getFunctionType());
|
|
|
if (menuFunction != null) {
|
|
|
baseMenuDictDO.setFunctionName(menuFunction.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
WlyyHospitalSysDictDO menuLocation = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("menuLocation",baseMenuDictDO.getMenuLocation());
|
|
|
if (menuLocation==null||menuLocation.getDictValue() == null){
|
|
|
} else {
|
|
|
WlyyHospitalSysDictDO menuLocation = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("menuLocation", baseMenuDictDO.getMenuLocation());
|
|
|
if (menuLocation == null || menuLocation.getDictValue() == null) {
|
|
|
baseMenuDictDO.setLocaTionName("无");
|
|
|
}else {
|
|
|
} else {
|
|
|
baseMenuDictDO.setLocaTionName(menuLocation.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return baseMenuDictDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 二级菜单下移
|
|
|
*
|
|
|
* @param
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public BaseMenuDictDO downMenu(String id) throws Exception{
|
|
|
BaseMenuDictDO baseMenuDictDO= baseMenuDictDao.findById(id).orElse(null);
|
|
|
public BaseMenuDictDO downMenu(String id) throws Exception {
|
|
|
BaseMenuDictDO baseMenuDictDO = baseMenuDictDao.findById(id).orElse(null);
|
|
|
int maxSort = baseMenuDictDao.getMaxSort(baseMenuDictDO.getParentId());
|
|
|
int sort = 0;
|
|
|
if(null!=baseMenuDictDO){
|
|
|
if (null != baseMenuDictDO) {
|
|
|
sort = baseMenuDictDO.getMenuSort();
|
|
|
}
|
|
|
if (maxSort==sort){
|
|
|
if (maxSort == sort) {
|
|
|
throw new Exception("不能下移");
|
|
|
}
|
|
|
String sql = "select t.id AS \"id\" from base_menu_dict t where t.is_del='1' and t.menu_sort > "+sort+" and " +
|
|
|
" t.parent_id='"+baseMenuDictDO.getParentId()+"' order by t.menu_sort asc ";
|
|
|
String sql = "select t.id AS \"id\" from base_menu_dict t where t.is_del='1' and t.menu_sort > " + sort + " and " +
|
|
|
" t.parent_id='" + baseMenuDictDO.getParentId() + "' order by t.menu_sort asc ";
|
|
|
System.out.println(sql);
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, 1, 1);
|
|
|
BaseMenuDictDO upPrevious = new BaseMenuDictDO();
|
|
|
if (list.size()>0){
|
|
|
if (list.size() > 0) {
|
|
|
String prviousBannerId = list.get(0).get("id").toString();
|
|
|
upPrevious =baseMenuDictDao.findById(prviousBannerId).orElse(null);;
|
|
|
upPrevious = baseMenuDictDao.findById(prviousBannerId).orElse(null);
|
|
|
;
|
|
|
}
|
|
|
|
|
|
//交换sort值
|
|
@ -299,30 +303,33 @@ public class BaseMenuManageService {
|
|
|
baseMenuDictDao.save(upPrevious);
|
|
|
return baseMenuDictDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 二级菜单上移
|
|
|
* * @param
|
|
|
*
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public BaseMenuDictDO upMenu(String id) throws Exception{
|
|
|
public BaseMenuDictDO upMenu(String id) throws Exception {
|
|
|
//当前
|
|
|
BaseMenuDictDO baseMenuDictDO = baseMenuDictDao.findById(id).orElse(null);
|
|
|
int minSort = baseMenuDictDao.getMinSort(baseMenuDictDO.getParentId());
|
|
|
int sort = 0;
|
|
|
if(null!=baseMenuDictDO){
|
|
|
if (null != baseMenuDictDO) {
|
|
|
sort = baseMenuDictDO.getMenuSort();
|
|
|
}
|
|
|
if (minSort==sort){
|
|
|
if (minSort == sort) {
|
|
|
throw new Exception("不能上移");
|
|
|
}
|
|
|
String sql = " select id AS \"id\" from base_menu_dict where is_del='1' and menu_sort < "+sort+" and" +
|
|
|
" parent_id='"+baseMenuDictDO.getParentId()+"'order by menu_sort desc ";
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
|
|
|
String sql = " select id AS \"id\" from base_menu_dict where is_del='1' and menu_sort < " + sort + " and" +
|
|
|
" parent_id='" + baseMenuDictDO.getParentId() + "'order by menu_sort desc ";
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, 1, 1);
|
|
|
BaseMenuDictDO downPrevious = new BaseMenuDictDO();
|
|
|
if (list.size()>0){
|
|
|
if (list.size() > 0) {
|
|
|
String prviousBannerId = list.get(0).get("id").toString();
|
|
|
downPrevious =baseMenuDictDao.findById(prviousBannerId).orElse(null);;
|
|
|
downPrevious = baseMenuDictDao.findById(prviousBannerId).orElse(null);
|
|
|
;
|
|
|
}
|
|
|
//获取的下一条b
|
|
|
//交换sort值
|
|
@ -332,28 +339,32 @@ public class BaseMenuManageService {
|
|
|
baseMenuDictDao.save(downPrevious);
|
|
|
return baseMenuDictDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置生效和失效
|
|
|
*
|
|
|
* @param id
|
|
|
* @param status
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateStatus(String id,Integer status){
|
|
|
public void updateStatus(String id, Integer status) {
|
|
|
BaseMenuDictDO menuDictDO = baseMenuDictDao.findByIdAndDel(id);
|
|
|
if (menuDictDO.getParentId().equalsIgnoreCase("0")){
|
|
|
if (menuDictDO.getParentId().equalsIgnoreCase("0")) {
|
|
|
List<BaseMenuDictDO> baseMenuDictDOS = baseMenuDictDao.findByParentId(id);
|
|
|
for (BaseMenuDictDO menuDictDO1:baseMenuDictDOS){
|
|
|
baseMenuDictDao.updateStatus(menuDictDO1.getId(),status);
|
|
|
for (BaseMenuDictDO menuDictDO1 : baseMenuDictDOS) {
|
|
|
baseMenuDictDao.updateStatus(menuDictDO1.getId(), status);
|
|
|
}
|
|
|
}
|
|
|
baseMenuDictDao.updateStatus(id,status);
|
|
|
baseMenuDictDao.updateStatus(id, status);
|
|
|
}
|
|
|
|
|
|
//新增修改菜单
|
|
|
public BaseMenuDictDO createOrUpdateMenu(String json,Integer type) throws Exception{
|
|
|
BaseMenuDictDO menuDO = objectMapper.readValue(json,BaseMenuDictDO.class);
|
|
|
if (StringUtils.isNoneBlank(menuDO.getId())){
|
|
|
BaseMenuDictDO menuOld = baseMenuDictDao.findById(menuDO.getId()).orElse(null);;
|
|
|
if (menuOld!=null){
|
|
|
public BaseMenuDictDO createOrUpdateMenu(String json, Integer type) throws Exception {
|
|
|
BaseMenuDictDO menuDO = objectMapper.readValue(json, BaseMenuDictDO.class);
|
|
|
if (StringUtils.isNoneBlank(menuDO.getId())) {
|
|
|
BaseMenuDictDO menuOld = baseMenuDictDao.findById(menuDO.getId()).orElse(null);
|
|
|
;
|
|
|
if (menuOld != null) {
|
|
|
menuOld.setParentId(menuDO.getParentId());
|
|
|
menuOld.setName(menuDO.getName());
|
|
|
menuOld.setMenuLocation(menuDO.getMenuLocation());
|
|
@ -369,15 +380,15 @@ public class BaseMenuManageService {
|
|
|
menuOld.setIsDel("1");
|
|
|
menuDO = baseMenuDictDao.save(menuOld);
|
|
|
}
|
|
|
}else {
|
|
|
if (!"0".equalsIgnoreCase(menuDO.getParentId())){
|
|
|
Integer maxSort=baseMenuDictDao.getMaxSort(menuDO.getParentId());
|
|
|
menuDO.setMenuSort((maxSort==null?0:maxSort)+1);
|
|
|
} else {
|
|
|
if (!"0".equalsIgnoreCase(menuDO.getParentId())) {
|
|
|
Integer maxSort = baseMenuDictDao.getMaxSort(menuDO.getParentId());
|
|
|
menuDO.setMenuSort((maxSort == null ? 0 : maxSort) + 1);
|
|
|
menuDO.setIsDel("1");
|
|
|
menuDO.setIsShow(menuDO.getStatus()==1?"1":"0");
|
|
|
}else{
|
|
|
menuDO.setIsShow(menuDO.getStatus() == 1 ? "1" : "0");
|
|
|
} else {
|
|
|
menuDO.setIsDel("1");
|
|
|
menuDO.setIsShow(menuDO.getStatus()==1?"1":"0");
|
|
|
menuDO.setIsShow(menuDO.getStatus() == 1 ? "1" : "0");
|
|
|
menuDO.setMenuSort(1);
|
|
|
}
|
|
|
menuDO.setType(type);
|
|
@ -385,32 +396,35 @@ public class BaseMenuManageService {
|
|
|
}
|
|
|
return menuDO;
|
|
|
}
|
|
|
|
|
|
//新增修改友情链接
|
|
|
public BaseLinkDictDO createOrUpdateLink(String json) throws Exception{
|
|
|
BaseLinkDictDO linkDictDO = objectMapper.readValue(json,BaseLinkDictDO.class);
|
|
|
Integer maxSort=baseLinkDictDao.getMaxSort();
|
|
|
if (StringUtils.isNoneBlank(linkDictDO.getId())){
|
|
|
BaseLinkDictDO baseLinkDictDO=baseLinkDictDao.findById(linkDictDO.getId()).orElse(null);;
|
|
|
if (baseLinkDictDO!=null){
|
|
|
public BaseLinkDictDO createOrUpdateLink(String json) throws Exception {
|
|
|
BaseLinkDictDO linkDictDO = objectMapper.readValue(json, BaseLinkDictDO.class);
|
|
|
Integer maxSort = baseLinkDictDao.getMaxSort();
|
|
|
if (StringUtils.isNoneBlank(linkDictDO.getId())) {
|
|
|
BaseLinkDictDO baseLinkDictDO = baseLinkDictDao.findById(linkDictDO.getId()).orElse(null);
|
|
|
;
|
|
|
if (baseLinkDictDO != null) {
|
|
|
baseLinkDictDO.setName(linkDictDO.getName());
|
|
|
baseLinkDictDO.setLinkUrl(linkDictDO.getLinkUrl());
|
|
|
//baseLinkDictDO.setLinkSort((maxSort==null?0:maxSort)+1);
|
|
|
baseLinkDictDO.setIsShow(linkDictDO.getIsShow());
|
|
|
baseLinkDictDO.setStatus(linkDictDO.getStatus());
|
|
|
baseLinkDictDO.setIsDel("1");
|
|
|
linkDictDO = baseLinkDictDao.save(baseLinkDictDO);
|
|
|
}else {
|
|
|
throw new NoSuchElementException();
|
|
|
linkDictDO = baseLinkDictDao.save(baseLinkDictDO);
|
|
|
} else {
|
|
|
throw new NoSuchElementException();
|
|
|
}
|
|
|
}else {
|
|
|
linkDictDO.setLinkSort((maxSort==null?0:maxSort)+1);
|
|
|
} else {
|
|
|
linkDictDO.setLinkSort((maxSort == null ? 0 : maxSort) + 1);
|
|
|
linkDictDO.setIsDel("1");
|
|
|
linkDictDO = baseLinkDictDao.save(linkDictDO);
|
|
|
linkDictDO = baseLinkDictDao.save(linkDictDO);
|
|
|
}
|
|
|
return linkDictDO;
|
|
|
}
|
|
|
public List<Map<String,Object>> findLinkDict(String name,String status){
|
|
|
String sql="select t.id as \"id\"," +
|
|
|
|
|
|
public List<Map<String, Object>> findLinkDict(String name, String status) {
|
|
|
String sql = "select t.id as \"id\"," +
|
|
|
" t.name as \"name\"," +
|
|
|
" t.link_url as \"linkUrl\"," +
|
|
|
" t.is_show as \"isShow\"," +
|
|
@ -419,20 +433,20 @@ public class BaseMenuManageService {
|
|
|
" t.create_time as \"createTime\"," +
|
|
|
" t.is_del as \"isDel\" " +
|
|
|
" from base_link_dict t where 1=1 and t.is_del='1'";
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sql+=" and t.name like '%"+name+"%'";
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
sql += " and t.name like '%" + name + "%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(status)){
|
|
|
sql+=" and t.status = '"+status+"'";
|
|
|
if (StringUtils.isNoneBlank(status)) {
|
|
|
sql += " and t.status = '" + status + "'";
|
|
|
}
|
|
|
sql+=" order by t.link_sort asc";
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
sql += " order by t.link_sort asc";
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
List<WlyyHospitalSysDictDO> effect = wlyyHospitalSysDictDao.findByDictName("isEffect");
|
|
|
for (Map<String,Object> map:list){
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
|
|
|
if (map.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
map.put("statusName",wlyyHospitalSysDictDO.getDictValue());
|
|
|
map.put("isShow",map.get("status").toString().equalsIgnoreCase("1")?"是":"否");
|
|
|
for (Map<String, Object> map : list) {
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO : effect) {
|
|
|
if (map.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())) {
|
|
|
map.put("statusName", wlyyHospitalSysDictDO.getDictValue());
|
|
|
map.put("isShow", map.get("status").toString().equalsIgnoreCase("1") ? "是" : "否");
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -440,11 +454,12 @@ public class BaseMenuManageService {
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
public BaseLinkDictDO findOneLinkDict(String id){
|
|
|
BaseLinkDictDO baseLinkDictDO= baseLinkDictDao.findById(id).orElse(null);
|
|
|
if (baseLinkDictDO!=null){
|
|
|
WlyyHospitalSysDictDO effect = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("isEffect",baseLinkDictDO.getStatus());
|
|
|
baseLinkDictDO.setShowName(baseLinkDictDO.getStatus().equalsIgnoreCase("1")?"是":"否");
|
|
|
|
|
|
public BaseLinkDictDO findOneLinkDict(String id) {
|
|
|
BaseLinkDictDO baseLinkDictDO = baseLinkDictDao.findById(id).orElse(null);
|
|
|
if (baseLinkDictDO != null) {
|
|
|
WlyyHospitalSysDictDO effect = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("isEffect", baseLinkDictDO.getStatus());
|
|
|
baseLinkDictDO.setShowName(baseLinkDictDO.getStatus().equalsIgnoreCase("1") ? "是" : "否");
|
|
|
baseLinkDictDO.setStatusName(effect.getDictValue());
|
|
|
}
|
|
|
return baseLinkDictDO;
|
|
@ -452,27 +467,29 @@ public class BaseMenuManageService {
|
|
|
|
|
|
/**
|
|
|
* 友情链接下移
|
|
|
*
|
|
|
* @param
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public BaseLinkDictDO downlink(String id) throws Exception{
|
|
|
BaseLinkDictDO baseLinkDictDO= baseLinkDictDao.findById(id).orElse(null);
|
|
|
public BaseLinkDictDO downlink(String id) throws Exception {
|
|
|
BaseLinkDictDO baseLinkDictDO = baseLinkDictDao.findById(id).orElse(null);
|
|
|
int maxSort = baseLinkDictDao.getMaxSort();
|
|
|
int sort = 0;
|
|
|
if(null!=baseLinkDictDO){
|
|
|
if (null != baseLinkDictDO) {
|
|
|
sort = baseLinkDictDO.getLinkSort();
|
|
|
}
|
|
|
if (maxSort==sort){
|
|
|
if (maxSort == sort) {
|
|
|
throw new Exception("不能下移");
|
|
|
}
|
|
|
String sql = "select t.id AS \"id\" from base_link_dict t where t.is_del='1' and t.link_sort > "+sort+" order by t.link_sort asc ";
|
|
|
String sql = "select t.id AS \"id\" from base_link_dict t where t.is_del='1' and t.link_sort > " + sort + " order by t.link_sort asc ";
|
|
|
System.out.println(sql);
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, 1, 1);
|
|
|
BaseLinkDictDO upPrevious = new BaseLinkDictDO();
|
|
|
if (list.size()>0){
|
|
|
if (list.size() > 0) {
|
|
|
String prviousBannerId = list.get(0).get("id").toString();
|
|
|
upPrevious =baseLinkDictDao.findById(prviousBannerId).orElse(null);;
|
|
|
upPrevious = baseLinkDictDao.findById(prviousBannerId).orElse(null);
|
|
|
;
|
|
|
}
|
|
|
|
|
|
//交换sort值
|
|
@ -482,29 +499,32 @@ public class BaseMenuManageService {
|
|
|
baseLinkDictDao.save(upPrevious);
|
|
|
return baseLinkDictDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 友情链接上移
|
|
|
* * @param
|
|
|
*
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public BaseLinkDictDO upLink(String id) throws Exception{
|
|
|
public BaseLinkDictDO upLink(String id) throws Exception {
|
|
|
//当前
|
|
|
BaseLinkDictDO baseLinkDictDO = baseLinkDictDao.findById(id).orElse(null);
|
|
|
int minSort = baseLinkDictDao.getMinSort();
|
|
|
int sort = 0;
|
|
|
if(null!=baseLinkDictDO){
|
|
|
if (null != baseLinkDictDO) {
|
|
|
sort = baseLinkDictDO.getLinkSort();
|
|
|
}
|
|
|
if (minSort==sort){
|
|
|
if (minSort == sort) {
|
|
|
throw new Exception("不能上移");
|
|
|
}
|
|
|
String sql = " select id AS \"id\" from base_link_dict where is_del='1' and link_sort < "+sort+" order by link_sort desc ";
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
|
|
|
String sql = " select id AS \"id\" from base_link_dict where is_del='1' and link_sort < " + sort + " order by link_sort desc ";
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, 1, 1);
|
|
|
BaseLinkDictDO downPrevious = new BaseLinkDictDO();
|
|
|
if (list.size()>0){
|
|
|
if (list.size() > 0) {
|
|
|
String prviousBannerId = list.get(0).get("id").toString();
|
|
|
downPrevious =baseLinkDictDao.findById(prviousBannerId).orElse(null);;
|
|
|
downPrevious = baseLinkDictDao.findById(prviousBannerId).orElse(null);
|
|
|
;
|
|
|
}
|
|
|
//获取的下一条b
|
|
|
//交换sort值
|
|
@ -517,51 +537,57 @@ public class BaseMenuManageService {
|
|
|
|
|
|
/**
|
|
|
* 设置生效和失效
|
|
|
*
|
|
|
* @param id
|
|
|
* @param status
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateLinkStatus(String id,String status){
|
|
|
baseLinkDictDao.updateStatus(id,status);
|
|
|
public void updateLinkStatus(String id, String status) {
|
|
|
baseLinkDictDao.updateStatus(id, status);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置生效和失效
|
|
|
*
|
|
|
* @param id
|
|
|
* @param status
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateLinkShow(String id,String status){
|
|
|
baseLinkDictDao.updateShow(id,status);
|
|
|
public void updateLinkShow(String id, String status) {
|
|
|
baseLinkDictDao.updateShow(id, status);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 友情链接删除
|
|
|
* @param id
|
|
|
*
|
|
|
* @param id
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateLinkDel(String id){
|
|
|
baseLinkDictDao.updateDel(id,"0");
|
|
|
public void updateLinkDel(String id) {
|
|
|
baseLinkDictDao.updateDel(id, "0");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 移除首页菜单
|
|
|
* @param menuId
|
|
|
*
|
|
|
* @param menuId
|
|
|
*/
|
|
|
public BaseMenuShowDO removeMenu(String menuId){
|
|
|
BaseMenuShowDO baseMenuShowDO = baseMenuShowDao.findById(menuId).orElse(null);;
|
|
|
public BaseMenuShowDO removeMenu(String menuId) {
|
|
|
BaseMenuShowDO baseMenuShowDO = baseMenuShowDao.findById(menuId).orElse(null);
|
|
|
;
|
|
|
baseMenuShowDO.setIsDel("0");
|
|
|
baseMenuShowDao.save(baseMenuShowDO);
|
|
|
return baseMenuShowDO;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<Map<String,Object>> findMenuShow(){
|
|
|
public List<Map<String, Object>> findMenuShow() {
|
|
|
String modelSql = "select t.id as \"id\"," +
|
|
|
" t.model_id as \"modelId\", " +
|
|
|
" t.model_name as \"modelName\" from base_menu_show t where t.is_del ='1'" +
|
|
|
" group by t.model_id, t.model_name" ;
|
|
|
List<Map<String,Object>> listModel=hibenateUtils.createSQLQuery(modelSql);
|
|
|
String sql =" select t.id as \"id\", " +
|
|
|
" group by t.model_id, t.model_name";
|
|
|
List<Map<String, Object>> listModel = hibenateUtils.createSQLQuery(modelSql);
|
|
|
String sql = " select t.id as \"id\", " +
|
|
|
" t.model_id as \"modelId\", " +
|
|
|
" t.model_name as \"modelName\", " +
|
|
|
" t.menu_id as \"menuId\", " +
|
|
@ -579,18 +605,18 @@ public class BaseMenuManageService {
|
|
|
" from base_menu_show t left join " +
|
|
|
" base_menu_dict m on t.menu_id= m.id" +
|
|
|
" where t.is_del ='1' order by t.model_id asc ,t.menu_sort asc ";
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql);
|
|
|
for (Map<String,Object> map:list){
|
|
|
if (map.get("parentId")!=null){
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
if (map.get("parentId") != null) {
|
|
|
String parentId = map.get("parentId").toString();
|
|
|
BaseMenuDictDO parentDo= baseMenuDictDao.findById(parentId).orElse(null);
|
|
|
if (parentDo!=null){
|
|
|
map.put("parentName",parentDo.getName());
|
|
|
BaseMenuDictDO parentDo = baseMenuDictDao.findById(parentId).orElse(null);
|
|
|
if (parentDo != null) {
|
|
|
map.put("parentName", parentDo.getName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String sqlLink =" select t.id as \"id\", " +
|
|
|
String sqlLink = " select t.id as \"id\", " +
|
|
|
" t.model_id as \"modelId\", " +
|
|
|
" t.model_name as \"modelName\", " +
|
|
|
" t.menu_id as \"menuId\", " +
|
|
@ -605,19 +631,19 @@ public class BaseMenuManageService {
|
|
|
" from base_menu_show t left join " +
|
|
|
" base_link_dict m on t.menu_id= m.id" +
|
|
|
" where t.is_del ='1' and t.model_id='03' order by t.menu_sort asc ";
|
|
|
List<Map<String,Object>> listLink=hibenateUtils.createSQLQuery(sqlLink);
|
|
|
for (Map<String,Object> map:listModel){
|
|
|
List<Map<String,Object>> child = new ArrayList<>();
|
|
|
if("03".equalsIgnoreCase(map.get("modelId").toString())){
|
|
|
map.put("childList",listLink);
|
|
|
map.put("childListNum",listLink==null?0:listLink.size());
|
|
|
}else {
|
|
|
for (Map<String,Object> childMap:list){
|
|
|
if (childMap.get("modelId").toString().equalsIgnoreCase(map.get("modelId").toString())){
|
|
|
List<Map<String, Object>> listLink = hibenateUtils.createSQLQuery(sqlLink);
|
|
|
for (Map<String, Object> map : listModel) {
|
|
|
List<Map<String, Object>> child = new ArrayList<>();
|
|
|
if ("03".equalsIgnoreCase(map.get("modelId").toString())) {
|
|
|
map.put("childList", listLink);
|
|
|
map.put("childListNum", listLink == null ? 0 : listLink.size());
|
|
|
} else {
|
|
|
for (Map<String, Object> childMap : list) {
|
|
|
if (childMap.get("modelId").toString().equalsIgnoreCase(map.get("modelId").toString())) {
|
|
|
child.add(childMap);
|
|
|
}
|
|
|
}
|
|
|
map.put("childList",child);
|
|
|
map.put("childList", child);
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -627,28 +653,30 @@ public class BaseMenuManageService {
|
|
|
|
|
|
/**
|
|
|
* 首页菜单展示下移
|
|
|
*
|
|
|
* @param
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public BaseMenuShowDO downMenuShow(String id) throws Exception{
|
|
|
BaseMenuShowDO baseMenuShowDO= baseMenuShowDao.findById(id).orElse(null);
|
|
|
public BaseMenuShowDO downMenuShow(String id) throws Exception {
|
|
|
BaseMenuShowDO baseMenuShowDO = baseMenuShowDao.findById(id).orElse(null);
|
|
|
int maxSort = baseMenuShowDao.getMaxSort(baseMenuShowDO.getModelId());
|
|
|
int sort = 0;
|
|
|
if(null!=baseMenuShowDO){
|
|
|
if (null != baseMenuShowDO) {
|
|
|
sort = baseMenuShowDO.getMenuSort();
|
|
|
}
|
|
|
if (maxSort==sort){
|
|
|
if (maxSort == sort) {
|
|
|
throw new Exception("不能下移");
|
|
|
}
|
|
|
String sql = "select t.id AS \"id\" from base_menu_show t where t.is_del='1' and t.menu_sort > "+sort+" " +
|
|
|
" and t.model_id='"+baseMenuShowDO.getModelId()+"'order by t.menu_sort asc ";
|
|
|
String sql = "select t.id AS \"id\" from base_menu_show t where t.is_del='1' and t.menu_sort > " + sort + " " +
|
|
|
" and t.model_id='" + baseMenuShowDO.getModelId() + "'order by t.menu_sort asc ";
|
|
|
System.out.println(sql);
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, 1, 1);
|
|
|
BaseMenuShowDO upPrevious = new BaseMenuShowDO();
|
|
|
if (list.size()>0){
|
|
|
if (list.size() > 0) {
|
|
|
String prviousBannerId = list.get(0).get("id").toString();
|
|
|
upPrevious =baseMenuShowDao.findById(prviousBannerId).orElse(null);;
|
|
|
upPrevious = baseMenuShowDao.findById(prviousBannerId).orElse(null);
|
|
|
;
|
|
|
}
|
|
|
|
|
|
//交换sort值
|
|
@ -658,30 +686,33 @@ public class BaseMenuManageService {
|
|
|
baseMenuShowDao.save(upPrevious);
|
|
|
return baseMenuShowDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 首页菜单展示上移
|
|
|
* * @param
|
|
|
*
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public BaseMenuShowDO upMenuShow(String id) throws Exception{
|
|
|
public BaseMenuShowDO upMenuShow(String id) throws Exception {
|
|
|
//当前
|
|
|
BaseMenuShowDO baseMenuShowDO = baseMenuShowDao.findById(id).orElse(null);
|
|
|
int minSort = baseMenuShowDao.getMinSort(baseMenuShowDO.getModelId());
|
|
|
int sort = 0;
|
|
|
if(null!=baseMenuShowDO){
|
|
|
if (null != baseMenuShowDO) {
|
|
|
sort = baseMenuShowDO.getMenuSort();
|
|
|
}
|
|
|
if (minSort==sort){
|
|
|
if (minSort == sort) {
|
|
|
throw new Exception("不能上移");
|
|
|
}
|
|
|
String sql = " select id AS \"id\" from base_menu_show where is_del='1' and menu_sort < "+sort+" " +
|
|
|
" and model_id ='"+baseMenuShowDO.getModelId()+"'order by menu_sort desc ";
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
|
|
|
String sql = " select id AS \"id\" from base_menu_show where is_del='1' and menu_sort < " + sort + " " +
|
|
|
" and model_id ='" + baseMenuShowDO.getModelId() + "'order by menu_sort desc ";
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, 1, 1);
|
|
|
BaseMenuShowDO downPrevious = new BaseMenuShowDO();
|
|
|
if (list.size()>0){
|
|
|
if (list.size() > 0) {
|
|
|
String prviousBannerId = list.get(0).get("id").toString();
|
|
|
downPrevious =baseMenuShowDao.findById(prviousBannerId).orElse(null);;
|
|
|
downPrevious = baseMenuShowDao.findById(prviousBannerId).orElse(null);
|
|
|
;
|
|
|
}
|
|
|
//获取的下一条b
|
|
|
//交换sort值
|
|
@ -691,26 +722,27 @@ public class BaseMenuManageService {
|
|
|
baseMenuShowDao.save(downPrevious);
|
|
|
return baseMenuShowDO;
|
|
|
}
|
|
|
public void saveMenuShow(String json) throws Exception{
|
|
|
List<BaseMenuShowDO> menuShowDO = JSON.parseArray(json,BaseMenuShowDO.class);
|
|
|
|
|
|
public void saveMenuShow(String json) throws Exception {
|
|
|
List<BaseMenuShowDO> menuShowDO = JSON.parseArray(json, BaseMenuShowDO.class);
|
|
|
List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("menuStyle");
|
|
|
int i =1;
|
|
|
for (BaseMenuShowDO baseMenuShowDO:menuShowDO){
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:list){
|
|
|
if (StringUtils.isNoneBlank(baseMenuShowDO.getStyleCode())){
|
|
|
if (baseMenuShowDO.getStyleCode().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
int i = 1;
|
|
|
for (BaseMenuShowDO baseMenuShowDO : menuShowDO) {
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO : list) {
|
|
|
if (StringUtils.isNoneBlank(baseMenuShowDO.getStyleCode())) {
|
|
|
if (baseMenuShowDO.getStyleCode().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())) {
|
|
|
baseMenuShowDO.setStyleName(wlyyHospitalSysDictDO.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
String modelSql = "select t.id as \"id\"," +
|
|
|
" t.model_id as \"modelId\", max(t.menu_sort) as \"maxSort\"" +
|
|
|
" from base_menu_show t where t.is_del ='1'" +"and t.model_id='"+baseMenuShowDO.getModelId()+"'"+
|
|
|
" group by t.model_id " ;
|
|
|
List<Map<String,Object>> listModel=hibenateUtils.createSQLQuery(modelSql);
|
|
|
if (listModel!=null&&listModel.size()>0){
|
|
|
baseMenuShowDO.setMenuSort((listModel.get(0).get("maxSort")==null?0:Integer.valueOf(listModel.get(0).get("maxSort").toString()))+i);
|
|
|
}else {
|
|
|
" from base_menu_show t where t.is_del ='1'" + "and t.model_id='" + baseMenuShowDO.getModelId() + "'" +
|
|
|
" group by t.model_id ";
|
|
|
List<Map<String, Object>> listModel = hibenateUtils.createSQLQuery(modelSql);
|
|
|
if (listModel != null && listModel.size() > 0) {
|
|
|
baseMenuShowDO.setMenuSort((listModel.get(0).get("maxSort") == null ? 0 : Integer.valueOf(listModel.get(0).get("maxSort").toString())) + i);
|
|
|
} else {
|
|
|
baseMenuShowDO.setMenuSort(1);
|
|
|
}
|
|
|
baseMenuShowDO.setIsDel("1");
|
|
@ -719,7 +751,8 @@ public class BaseMenuManageService {
|
|
|
}
|
|
|
baseMenuShowDao.saveAll(menuShowDO);
|
|
|
}
|
|
|
public List<Map<String,Object>> findByParentId(String parentId,Integer status){
|
|
|
|
|
|
public List<Map<String, Object>> findByParentId(String parentId, Integer status) {
|
|
|
String sql = "select t.id as \"id\", " +
|
|
|
" t.parent_id as \"parentId\", " +
|
|
|
" t.name as \"name\", " +
|
|
@ -738,52 +771,52 @@ public class BaseMenuManageService {
|
|
|
" t.describtion as \"describtion\", " +
|
|
|
" t.menu_img as \"menuImg\" " +
|
|
|
"from base_menu_dict t where 1=1 and t.is_del ='1' ";
|
|
|
if (StringUtils.isNoneBlank(parentId)){
|
|
|
sql+=" and t.parent_id='"+parentId+"' ";
|
|
|
if (StringUtils.isNoneBlank(parentId)) {
|
|
|
sql += " and t.parent_id='" + parentId + "' ";
|
|
|
}
|
|
|
if (status!=null){
|
|
|
sql+=" and t.status="+status+"";
|
|
|
if (status != null) {
|
|
|
sql += " and t.status=" + status + "";
|
|
|
}
|
|
|
sql+=" order by t.menu_sort asc";
|
|
|
System.out.print("sql"+sql);
|
|
|
List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql);
|
|
|
sql += " order by t.menu_sort asc";
|
|
|
System.out.print("sql" + sql);
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public MixEnvelop findArticleByMenuId(String menuId,String title,Integer page,Integer pageSize,String isContent,String articleType){
|
|
|
public MixEnvelop findArticleByMenuId(String menuId, String title, Integer page, Integer pageSize, String isContent, String articleType) {
|
|
|
List<String> menuIds = new ArrayList<>();
|
|
|
if (StringUtils.isNoneBlank(menuId)){
|
|
|
String str[]= menuId.split(",");
|
|
|
for (int i=0;i<str.length;i++){
|
|
|
if (StringUtils.isNoneBlank(menuId)) {
|
|
|
String str[] = menuId.split(",");
|
|
|
for (int i = 0; i < str.length; i++) {
|
|
|
menuIds.add(str[i]);
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(articleType)){
|
|
|
if(StringUtils.isBlank(menuId)){
|
|
|
if (StringUtils.isNotBlank(articleType)) {
|
|
|
if (StringUtils.isBlank(menuId)) {
|
|
|
menuId = "";
|
|
|
}
|
|
|
String sqlType = "select * from base_menu_dict where article_type='"+articleType+"' and is_del='1' and status=1";
|
|
|
List<BaseMenuDictDO> menuDictDOS = jdbcTemplate.query(sqlType,new BeanPropertyRowMapper<>(BaseMenuDictDO.class));
|
|
|
if(menuDictDOS.size()>0){
|
|
|
for (BaseMenuDictDO menuDictDO:menuDictDOS){
|
|
|
String sqlType = "select * from base_menu_dict where article_type='" + articleType + "' and is_del='1' and status=1";
|
|
|
List<BaseMenuDictDO> menuDictDOS = jdbcTemplate.query(sqlType, new BeanPropertyRowMapper<>(BaseMenuDictDO.class));
|
|
|
if (menuDictDOS.size() > 0) {
|
|
|
for (BaseMenuDictDO menuDictDO : menuDictDOS) {
|
|
|
menuIds.add(menuDictDO.getId());
|
|
|
menuId = menuId+","+menuDictDO.getId()+",";
|
|
|
menuId = menuId + "," + menuDictDO.getId() + ",";
|
|
|
}
|
|
|
menuId = menuId.substring(1,menuId.length()-1);
|
|
|
menuId = menuId.substring(1, menuId.length() - 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
System.out.print("menuId"+menuId);
|
|
|
System.out.print("menuId" + menuId);
|
|
|
Integer count;
|
|
|
List<KnowledgeArticleDictDO> list;
|
|
|
if(StringUtils.isNotBlank(title)){
|
|
|
count = knowledgeArticleDictDao.getCountByCategorySecond(menuIds,title);
|
|
|
}else {
|
|
|
if (StringUtils.isNotBlank(title)) {
|
|
|
count = knowledgeArticleDictDao.getCountByCategorySecond(menuIds, title);
|
|
|
} else {
|
|
|
count = knowledgeArticleDictDao.getCountByCategorySecond(menuIds);
|
|
|
}
|
|
|
String sqlTmp = " content,";
|
|
|
if(!"1".equals(isContent)){
|
|
|
sqlTmp = " null content ," ;
|
|
|
if (!"1".equals(isContent)) {
|
|
|
sqlTmp = " null content ,";
|
|
|
}
|
|
|
String sql = "select a.id ,\n" +
|
|
|
" a.title ,\n" +
|
|
@ -824,13 +857,13 @@ public class BaseMenuManageService {
|
|
|
" d.photo doctorImage,\n" +
|
|
|
" a.recommend_doctor_name from wlyy_knowledge_article_dict a " +
|
|
|
" left join base_doctor d on a.create_user=d.id where a.del=1 and " +
|
|
|
" a.category_second IN ( '"+menuId.replaceAll(",","','")+"' ) and a.release_status=1 ";
|
|
|
if(StringUtils.isNotBlank(title)){
|
|
|
sql += " and a.title like '%"+title+"%'";
|
|
|
" a.category_second IN ( '" + menuId.replaceAll(",", "','") + "' ) and a.release_status=1 ";
|
|
|
if (StringUtils.isNotBlank(title)) {
|
|
|
sql += " and a.title like '%" + title + "%'";
|
|
|
}
|
|
|
sql += " and a.release_time<='"+ DateUtil.getStringDate() +"'";
|
|
|
sql += " order by a.release_time desc,a.create_time desc limit "+(page-1)*pageSize+","+pageSize;
|
|
|
list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(KnowledgeArticleDictDO.class));
|
|
|
sql += " and a.release_time<='" + DateUtil.getStringDate() + "'";
|
|
|
sql += " order by a.release_time desc,a.create_time desc limit " + (page - 1) * pageSize + "," + pageSize;
|
|
|
list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(KnowledgeArticleDictDO.class));
|
|
|
|
|
|
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
@ -844,8 +877,8 @@ public class BaseMenuManageService {
|
|
|
|
|
|
|
|
|
//菜单词典查询
|
|
|
public List<Map<String,Object>> findMenuDictParent(String parentId, String name){
|
|
|
String sqlParent ="select t.id as \"id\", " +
|
|
|
public List<Map<String, Object>> findMenuDictParent(String parentId, String name) {
|
|
|
String sqlParent = "select t.id as \"id\", " +
|
|
|
" t.parent_id as \"parentId\", " +
|
|
|
" t.name as \"name\", " +
|
|
|
" t.menu_sort as \"menuSort\", " +
|
|
@ -863,29 +896,29 @@ public class BaseMenuManageService {
|
|
|
" t.describtion as \"describtion\", " +
|
|
|
" t.menu_img as \"menuImg\" " +
|
|
|
"from base_menu_dict t where 1=1 and t.is_del ='1' and t.status =1";
|
|
|
if (StringUtils.isNoneBlank(parentId)){
|
|
|
sqlParent+=" and t.id = '"+parentId+"'";
|
|
|
}else {
|
|
|
sqlParent+=" and t.parent_id = '0'";
|
|
|
if (StringUtils.isNoneBlank(parentId)) {
|
|
|
sqlParent += " and t.id = '" + parentId + "'";
|
|
|
} else {
|
|
|
sqlParent += " and t.parent_id = '0'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(name)){
|
|
|
sqlParent+=" and t.name like '%"+name+"%'";
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
sqlParent += " and t.name like '%" + name + "%'";
|
|
|
}
|
|
|
List<Map<String,Object>> listParent = hibenateUtils.createSQLQuery(sqlParent);
|
|
|
List<Map<String, Object>> listParent = hibenateUtils.createSQLQuery(sqlParent);
|
|
|
List<WlyyHospitalSysDictDO> menuLocation = wlyyHospitalSysDictDao.findByDictName("menuLocation");
|
|
|
List<WlyyHospitalSysDictDO> effect = wlyyHospitalSysDictDao.findByDictName("isEffect");
|
|
|
for (Map<String,Object> map:listParent){
|
|
|
Integer articleParentNum= knowledgeArticleDictDao.getCountByCategoryFirst(map.get("id").toString());
|
|
|
map.put("articleNum",articleParentNum);
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
|
|
|
if (map.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
map.put("statusName",wlyyHospitalSysDictDO.getDictValue());
|
|
|
map.put("isShow",map.get("status").toString().equalsIgnoreCase("1")?"是":"否");
|
|
|
for (Map<String, Object> map : listParent) {
|
|
|
Integer articleParentNum = knowledgeArticleDictDao.getCountByCategoryFirst(map.get("id").toString());
|
|
|
map.put("articleNum", articleParentNum);
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO : effect) {
|
|
|
if (map.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())) {
|
|
|
map.put("statusName", wlyyHospitalSysDictDO.getDictValue());
|
|
|
map.put("isShow", map.get("status").toString().equalsIgnoreCase("1") ? "是" : "否");
|
|
|
}
|
|
|
}
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:menuLocation){
|
|
|
if (map.get("menuLocation").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
map.put("menuLocationName",wlyyHospitalSysDictDO.getDictValue());
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO : menuLocation) {
|
|
|
if (map.get("menuLocation").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())) {
|
|
|
map.put("menuLocationName", wlyyHospitalSysDictDO.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -897,55 +930,55 @@ public class BaseMenuManageService {
|
|
|
/**
|
|
|
* 患者对文章操作
|
|
|
*
|
|
|
* @param flag 1点赞2收藏3常用4分享5阅读
|
|
|
* @param flag 1点赞2收藏3常用4分享5阅读
|
|
|
* @param articleId 文章id
|
|
|
* @param userCode 用户编码
|
|
|
* @param userCode 用户编码
|
|
|
* @return
|
|
|
*/
|
|
|
public KnowledgeArticleUserDO updateArticleUser(Integer flag, String articleId, String userCode, Integer status){
|
|
|
KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleId,userCode);
|
|
|
BasePatientDO patientDO = patientDao.findByIdAndDel(userCode,"1");
|
|
|
public KnowledgeArticleUserDO updateArticleUser(Integer flag, String articleId, String userCode, Integer status) {
|
|
|
KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleId, userCode);
|
|
|
BasePatientDO patientDO = patientDao.findByIdAndDel(userCode, "1");
|
|
|
KnowledgeArticleDictDO knowledgeArticleDictDO = knowledgeArticleDictService.findByIdAndDel(articleId);
|
|
|
if (knowledgeArticleUserDO!=null){
|
|
|
if (flag==1){
|
|
|
if (knowledgeArticleUserDO != null) {
|
|
|
if (flag == 1) {
|
|
|
knowledgeArticleUserDO.setFabulous(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setFabulous(knowledgeArticleDictDO.getFabulous()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setFabulous(knowledgeArticleDictDO.getFabulous()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setFabulous(knowledgeArticleDictDO.getFabulous() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setFabulous(knowledgeArticleDictDO.getFabulous() - 1);
|
|
|
}
|
|
|
}else if (flag==2){
|
|
|
} else if (flag == 2) {
|
|
|
knowledgeArticleUserDO.setCollection(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setCollection(knowledgeArticleDictDO.getCollection()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setCollection(knowledgeArticleDictDO.getCollection()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setCollection(knowledgeArticleDictDO.getCollection() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setCollection(knowledgeArticleDictDO.getCollection() - 1);
|
|
|
}
|
|
|
}else if (flag==3){
|
|
|
} else if (flag == 3) {
|
|
|
knowledgeArticleUserDO.setUsed(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setUsed(knowledgeArticleDictDO.getUsed()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setUsed(knowledgeArticleDictDO.getUsed()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setUsed(knowledgeArticleDictDO.getUsed() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setUsed(knowledgeArticleDictDO.getUsed() - 1);
|
|
|
}
|
|
|
}else if (flag==4){
|
|
|
} else if (flag == 4) {
|
|
|
knowledgeArticleUserDO.setShare(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setShare(knowledgeArticleDictDO.getShare()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setShare(knowledgeArticleDictDO.getShare()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setShare(knowledgeArticleDictDO.getShare() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setShare(knowledgeArticleDictDO.getShare() - 1);
|
|
|
}
|
|
|
}else if (flag==5){
|
|
|
} else if (flag == 5) {
|
|
|
knowledgeArticleUserDO.setIsRead(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setReadCount(knowledgeArticleDictDO.getReadCount()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setReadCount(knowledgeArticleDictDO.getReadCount()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setReadCount(knowledgeArticleDictDO.getReadCount() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setReadCount(knowledgeArticleDictDO.getReadCount() - 1);
|
|
|
}
|
|
|
}
|
|
|
knowledgeArticleUserDO = knowledgeArticleUserDao.save(knowledgeArticleUserDO);
|
|
|
knowledgeArticleDictDao.save(knowledgeArticleDictDO);
|
|
|
}else {
|
|
|
} else {
|
|
|
knowledgeArticleUserDO = new KnowledgeArticleUserDO();
|
|
|
knowledgeArticleUserDO.setUser(userCode);
|
|
|
knowledgeArticleUserDO.setUserName(patientDO.getName());
|
|
@ -960,40 +993,40 @@ public class BaseMenuManageService {
|
|
|
knowledgeArticleUserDO.setUsed(0);
|
|
|
knowledgeArticleUserDO.setShare(0);
|
|
|
knowledgeArticleUserDO.setCollection(0);
|
|
|
if (flag==1){
|
|
|
if (flag == 1) {
|
|
|
knowledgeArticleUserDO.setFabulous(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setFabulous(knowledgeArticleDictDO.getFabulous()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setFabulous(knowledgeArticleDictDO.getFabulous()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setFabulous(knowledgeArticleDictDO.getFabulous() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setFabulous(knowledgeArticleDictDO.getFabulous() - 1);
|
|
|
}
|
|
|
}else if (flag==2){
|
|
|
} else if (flag == 2) {
|
|
|
knowledgeArticleUserDO.setCollection(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setCollection(knowledgeArticleDictDO.getFabulous()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setCollection(knowledgeArticleDictDO.getFabulous()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setCollection(knowledgeArticleDictDO.getFabulous() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setCollection(knowledgeArticleDictDO.getFabulous() - 1);
|
|
|
}
|
|
|
}else if (flag==3){
|
|
|
} else if (flag == 3) {
|
|
|
knowledgeArticleUserDO.setUsed(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setUsed(knowledgeArticleDictDO.getUsed()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setUsed(knowledgeArticleDictDO.getUsed()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setUsed(knowledgeArticleDictDO.getUsed() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setUsed(knowledgeArticleDictDO.getUsed() - 1);
|
|
|
}
|
|
|
}else if (flag==4){
|
|
|
} else if (flag == 4) {
|
|
|
knowledgeArticleUserDO.setShare(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setShare(knowledgeArticleDictDO.getShare()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setShare(knowledgeArticleDictDO.getShare()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setShare(knowledgeArticleDictDO.getShare() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setShare(knowledgeArticleDictDO.getShare() - 1);
|
|
|
}
|
|
|
}else if (flag==5){
|
|
|
} else if (flag == 5) {
|
|
|
knowledgeArticleUserDO.setIsRead(status);
|
|
|
if (status==1){
|
|
|
knowledgeArticleDictDO.setReadCount(knowledgeArticleDictDO.getReadCount()+1);
|
|
|
}else if (status==0){
|
|
|
knowledgeArticleDictDO.setReadCount(knowledgeArticleDictDO.getReadCount()-1);
|
|
|
if (status == 1) {
|
|
|
knowledgeArticleDictDO.setReadCount(knowledgeArticleDictDO.getReadCount() + 1);
|
|
|
} else if (status == 0) {
|
|
|
knowledgeArticleDictDO.setReadCount(knowledgeArticleDictDO.getReadCount() - 1);
|
|
|
}
|
|
|
}
|
|
|
knowledgeArticleUserDO = knowledgeArticleUserDao.save(knowledgeArticleUserDO);
|
|
@ -1006,11 +1039,11 @@ public class BaseMenuManageService {
|
|
|
* 查询患者关注文章列表分类
|
|
|
*
|
|
|
* @param userCode 用户id
|
|
|
* @param flag 1点赞2收藏3常用4分享5阅读
|
|
|
* @param status 1或者0
|
|
|
* @param flag 1点赞2收藏3常用4分享5阅读
|
|
|
* @param status 1或者0
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> selectMenuList(String userCode,Integer flag,Integer status){
|
|
|
public List<Map<String, Object>> selectMenuList(String userCode, Integer flag, Integer status) {
|
|
|
String sql = "SELECT\n" +
|
|
|
"\tkad.category_first as \"categoryFirst\",\n" +
|
|
|
"\tkad.category_first_name as \"categoryFirstName\",\n" +
|
|
@ -1020,26 +1053,26 @@ public class BaseMenuManageService {
|
|
|
"\twlyy_knowledge_article_user kau\n" +
|
|
|
"LEFT JOIN wlyy_knowledge_article_dict kad ON kad.id = kau.relation_code\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tkau.user_code = '"+userCode+"' AND kad.category_second IN(SELECT md.id from base_menu_dict md where md.status=1 and md.is_del= 1) " +
|
|
|
"\tkau.user_code = '" + userCode + "' AND kad.category_second IN(SELECT md.id from base_menu_dict md where md.status=1 and md.is_del= 1) " +
|
|
|
" AND kad.category_first IN(SELECT md.parent_id from base_menu_dict md where md.status=1 and md.is_del= 1) ";
|
|
|
String condition = "";
|
|
|
if (flag==1){
|
|
|
condition+=" and kau.fabulous = "+status;
|
|
|
if (flag == 1) {
|
|
|
condition += " and kau.fabulous = " + status;
|
|
|
}
|
|
|
if (flag==2){
|
|
|
condition+=" and kau.collection = "+status;
|
|
|
if (flag == 2) {
|
|
|
condition += " and kau.collection = " + status;
|
|
|
}
|
|
|
if (flag==3){
|
|
|
condition+=" and kau.used = "+status;
|
|
|
if (flag == 3) {
|
|
|
condition += " and kau.used = " + status;
|
|
|
}
|
|
|
if (flag==4){
|
|
|
condition+=" and kau.is_share = "+status;
|
|
|
if (flag == 4) {
|
|
|
condition += " and kau.is_share = " + status;
|
|
|
}
|
|
|
if (flag==5){
|
|
|
condition+=" and kau.is_read = "+status;
|
|
|
if (flag == 5) {
|
|
|
condition += " and kau.is_read = " + status;
|
|
|
}
|
|
|
condition += " GROUP BY kad.category_first,kad.category_first_name,kad.category_second,kad.category_second_name ";
|
|
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql+condition);
|
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql + condition);
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
@ -1048,11 +1081,11 @@ public class BaseMenuManageService {
|
|
|
* 查询患者关注文章列表分类
|
|
|
*
|
|
|
* @param userCode 用户id
|
|
|
* @param flag 1点赞2收藏3常用4分享5阅读
|
|
|
* @param status 1或者0
|
|
|
* @param flag 1点赞2收藏3常用4分享5阅读
|
|
|
* @param status 1或者0
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject selectArticleListByCategory(String categoryFirst,String categorySecond,String userCode,Integer flag,Integer status,Integer page,Integer size){
|
|
|
public JSONObject selectArticleListByCategory(String categoryFirst, String categorySecond, String userCode, Integer flag, Integer status, Integer page, Integer size) {
|
|
|
String sql = "SELECT kad.category_first as \"categoryFirst\",\n" +
|
|
|
"\tkad.category_first_name as \"categoryFirstName\",\n" +
|
|
|
"\tkad.category_second as \"categorySecond\",\n" +
|
|
@ -1067,72 +1100,73 @@ public class BaseMenuManageService {
|
|
|
"\tkad.puplish_type_name as \"puplishTypeName\",\n" +
|
|
|
"\tkad.vedio_url as \"vedioUrl\",\n" +
|
|
|
"\tkad.create_user as \"createUser\",\n" +
|
|
|
"\tkad.create_user_name as \"createUserName\",\n" ;
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
sql+=" to_char(kad.release_time,'yyyy-MM-dd HH24:mi:ss') as \"releaseTime\",";
|
|
|
}else{
|
|
|
sql+="date_format(kad.release_time, '%Y-%m-%d %H:%i:%s') as \"releaseTime\",";
|
|
|
}
|
|
|
sql +=
|
|
|
"\tkad.create_user_name as \"createUserName\",\n";
|
|
|
if ("xm_ykyy_wx".equals(wxId)) {
|
|
|
sql += " to_char(kad.release_time,'yyyy-MM-dd HH24:mi:ss') as \"releaseTime\",";
|
|
|
} else {
|
|
|
sql += "date_format(kad.release_time, '%Y-%m-%d %H:%i:%s') as \"releaseTime\",";
|
|
|
}
|
|
|
sql +=
|
|
|
"\tkad.source as \"source\" \n" +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_knowledge_article_user kau\n" +
|
|
|
"LEFT JOIN wlyy_knowledge_article_dict kad ON kad.id = kau.relation_code \n" +
|
|
|
"WHERE\n" +
|
|
|
"\tkau.user_code = '"+userCode+"' AND kad.category_second IN(SELECT md.id from base_menu_dict md where md.status=1 and md.is_del= 1) AND kad.category_first IN(SELECT md.parent_id from base_menu_dict md where md.status=1 and md.is_del= 1) ";
|
|
|
"FROM\n" +
|
|
|
"\twlyy_knowledge_article_user kau\n" +
|
|
|
"LEFT JOIN wlyy_knowledge_article_dict kad ON kad.id = kau.relation_code \n" +
|
|
|
"WHERE\n" +
|
|
|
"\tkau.user_code = '" + userCode + "' AND kad.category_second IN(SELECT md.id from base_menu_dict md where md.status=1 and md.is_del= 1) AND kad.category_first IN(SELECT md.parent_id from base_menu_dict md where md.status=1 and md.is_del= 1) ";
|
|
|
String condition = "";
|
|
|
if (StringUtils.isNoneBlank(categoryFirst)){
|
|
|
condition =" and kad.category_first = '"+categoryFirst+"' ";
|
|
|
if (StringUtils.isNoneBlank(categoryFirst)) {
|
|
|
condition = " and kad.category_first = '" + categoryFirst + "' ";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(categorySecond)){
|
|
|
condition =" and kad.category_second ='"+categorySecond+"' ";
|
|
|
if (StringUtils.isNoneBlank(categorySecond)) {
|
|
|
condition = " and kad.category_second ='" + categorySecond + "' ";
|
|
|
}
|
|
|
if (flag==1){
|
|
|
condition+=" and kau.fabulous = "+status;
|
|
|
if (flag == 1) {
|
|
|
condition += " and kau.fabulous = " + status;
|
|
|
}
|
|
|
if (flag==2){
|
|
|
condition+=" and kau.collection = "+status;
|
|
|
if (flag == 2) {
|
|
|
condition += " and kau.collection = " + status;
|
|
|
}
|
|
|
if (flag==3){
|
|
|
condition+=" and kau.used = "+status;
|
|
|
if (flag == 3) {
|
|
|
condition += " and kau.used = " + status;
|
|
|
}
|
|
|
if (flag==4){
|
|
|
condition+=" and kau.is_share = "+status;
|
|
|
if (flag == 4) {
|
|
|
condition += " and kau.is_share = " + status;
|
|
|
}
|
|
|
if (flag==5){
|
|
|
condition+=" and kau.is_read = "+status;
|
|
|
if (flag == 5) {
|
|
|
condition += " and kau.is_read = " + status;
|
|
|
}
|
|
|
condition += " order by kau.create_time desc ";
|
|
|
List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql+condition,page,size);
|
|
|
List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql + condition, page, size);
|
|
|
|
|
|
String sqlTotal = "SELECT count(1) as total "+
|
|
|
String sqlTotal = "SELECT count(1) as total " +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_knowledge_article_user kau\n" +
|
|
|
"LEFT JOIN wlyy_knowledge_article_dict kad ON kad.id = kau.relation_code \n" +
|
|
|
"WHERE\n" +
|
|
|
"\tkau.user_code = '"+userCode+"' AND kad.category_second IN(SELECT md.id from base_menu_dict md where md.status=1 and md.is_del= 1) AND kad.category_first IN(SELECT md.parent_id from base_menu_dict md where md.status=1 and md.is_del= 1) ";
|
|
|
List<Map<String,Object>> mapTotalList = hibenateUtils.createSQLQuery(sqlTotal+condition);
|
|
|
"\tkau.user_code = '" + userCode + "' AND kad.category_second IN(SELECT md.id from base_menu_dict md where md.status=1 and md.is_del= 1) AND kad.category_first IN(SELECT md.parent_id from base_menu_dict md where md.status=1 and md.is_del= 1) ";
|
|
|
List<Map<String, Object>> mapTotalList = hibenateUtils.createSQLQuery(sqlTotal + condition);
|
|
|
Long count = 0L;
|
|
|
if(mapTotalList!=null){
|
|
|
if (mapTotalList != null) {
|
|
|
count = Long.parseLong(mapTotalList.get(0).get("total").toString());
|
|
|
}
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("data",mapList);
|
|
|
object.put("page",page);
|
|
|
object.put("size",size);
|
|
|
object.put("total",count);
|
|
|
object.put("data", mapList);
|
|
|
object.put("page", page);
|
|
|
object.put("size", size);
|
|
|
object.put("total", count);
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询患者关联的文章
|
|
|
*
|
|
|
* @param userCode
|
|
|
* @param articleId
|
|
|
* @return
|
|
|
*/
|
|
|
public KnowledgeArticleUserDO findArticleUserById(String userCode,String articleId){
|
|
|
return knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleId,userCode);
|
|
|
public KnowledgeArticleUserDO findArticleUserById(String userCode, String articleId) {
|
|
|
return knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleId, userCode);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -1141,8 +1175,8 @@ public class BaseMenuManageService {
|
|
|
* @param articleDoctorDO
|
|
|
* @return
|
|
|
*/
|
|
|
public KnowledgeArticleDoctorDO insert(KnowledgeArticleDoctorDO articleDoctorDO){
|
|
|
if(StringUtils.isBlank(articleDoctorDO.getBaseArticleDoctorId())){
|
|
|
public KnowledgeArticleDoctorDO insert(KnowledgeArticleDoctorDO articleDoctorDO) {
|
|
|
if (StringUtils.isBlank(articleDoctorDO.getBaseArticleDoctorId())) {
|
|
|
articleDoctorDO.setBaseArticleDoctorId(null);
|
|
|
}
|
|
|
articleDoctorDO.setCreateTime(new Date());
|
|
@ -1153,24 +1187,25 @@ public class BaseMenuManageService {
|
|
|
/**
|
|
|
* 取消点赞和收藏
|
|
|
*/
|
|
|
public void deleteArticleDoctorById(String baseArticleDoctorId,String relationCode,Integer type,String user){
|
|
|
if (StringUtils.isNoneBlank(baseArticleDoctorId)){
|
|
|
knowledgeArticleDoctorDao.deletByBaseArticleDoctorIdAndType(baseArticleDoctorId,user,type);
|
|
|
}else {
|
|
|
knowledgeArticleDoctorDao.deletByRelationCodeAndType(relationCode,user,type);
|
|
|
public void deleteArticleDoctorById(String baseArticleDoctorId, String relationCode, Integer type, String user) {
|
|
|
if (StringUtils.isNoneBlank(baseArticleDoctorId)) {
|
|
|
knowledgeArticleDoctorDao.deletByBaseArticleDoctorIdAndType(baseArticleDoctorId, user, type);
|
|
|
} else {
|
|
|
knowledgeArticleDoctorDao.deletByRelationCodeAndType(relationCode, user, type);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询医生关联文章回复数据
|
|
|
*
|
|
|
* @param id
|
|
|
* @param type 1
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
public MixEnvelop selectArticleDoctorById(String user,String id,Integer type,Integer page,Integer size){
|
|
|
public MixEnvelop selectArticleDoctorById(String user, String id, Integer type, Integer page, Integer size) {
|
|
|
String orderBy = " order by create_time desc ";
|
|
|
String condition = " ";
|
|
|
String sql = "SELECT\n" +
|
|
@ -1190,29 +1225,29 @@ public class BaseMenuManageService {
|
|
|
"\tbase_knowledge_article_doctor\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tbase_article_doctor_id IS NULL ";
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(id)){
|
|
|
condition +=" and relation_code = '"+id+"' ";
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(id)) {
|
|
|
condition += " and relation_code = '" + id + "' ";
|
|
|
}
|
|
|
if (type!=null){
|
|
|
condition +=" and type ="+type+" ";
|
|
|
if (type != null) {
|
|
|
condition += " and type =" + type + " ";
|
|
|
}
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql+condition+orderBy, page, size);
|
|
|
for (Map<String,Object> map:list){
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql + condition + orderBy, page, size);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(map.get("user").toString()).get();
|
|
|
map.put("doctor",doctorDO);
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOS = knowledgeArticleDoctorDao.findByBaseArticleDoctorIdAndType(map.get("id").toString(),1);//获取评论列表
|
|
|
map.put("replyList",knowledgeArticleDoctorDOS);//获取评论列表
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOList = knowledgeArticleDoctorDao.findByBaseArticleDoctorIdAndType(map.get("id").toString(),2);//获取评论的点赞
|
|
|
map.put("replyApoint",knowledgeArticleDoctorDOList.size());//获取评论的点赞
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOList1 = knowledgeArticleDoctorDao.findByBaseArticleDoctorIdAndRelationCodeAndTypeAndUser(map.get("relationCode").toString(),2,user,map.get("id").toString());
|
|
|
if (knowledgeArticleDoctorDOList1!=null&&knowledgeArticleDoctorDOList1.size()>0) {
|
|
|
map.put("doctor", doctorDO);
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOS = knowledgeArticleDoctorDao.findByBaseArticleDoctorIdAndType(map.get("id").toString(), 1);//获取评论列表
|
|
|
map.put("replyList", knowledgeArticleDoctorDOS);//获取评论列表
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOList = knowledgeArticleDoctorDao.findByBaseArticleDoctorIdAndType(map.get("id").toString(), 2);//获取评论的点赞
|
|
|
map.put("replyApoint", knowledgeArticleDoctorDOList.size());//获取评论的点赞
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOList1 = knowledgeArticleDoctorDao.findByBaseArticleDoctorIdAndRelationCodeAndTypeAndUser(map.get("relationCode").toString(), 2, user, map.get("id").toString());
|
|
|
if (knowledgeArticleDoctorDOList1 != null && knowledgeArticleDoctorDOList1.size() > 0) {
|
|
|
map.put("appointFlag", 1);//1已点赞
|
|
|
}else {
|
|
|
} else {
|
|
|
map.put("appointFlag", 0);//0未点赞
|
|
|
}
|
|
|
}
|
|
|
String sqlCount ="select COUNT(1) as total from base_knowledge_article_doctor where base_article_doctor_id IS NULL ";
|
|
|
List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(sqlCount+condition+orderBy);
|
|
|
String sqlCount = "select COUNT(1) as total from base_knowledge_article_doctor where base_article_doctor_id IS NULL ";
|
|
|
List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(sqlCount + condition + orderBy);
|
|
|
Long count = 0L;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
count = Long.parseLong(rstotal.get(0).get("total").toString());
|
|
@ -1223,26 +1258,27 @@ public class BaseMenuManageService {
|
|
|
|
|
|
/**
|
|
|
* 获取某篇问章的统计数据
|
|
|
*
|
|
|
* @param articleId
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject findArticleStaticsByArticleId(String articleId){
|
|
|
Integer knowledgeArticleDoctorDOS = findByRelationCodeAndType(articleId,2);//获取点赞
|
|
|
Integer knowledgeArticleDoctorDOList = findByRelationCodeAndType(articleId,3);//获取收藏
|
|
|
Integer knowledgeArticleDoctorDOList1 = findByRelationCodeAndType(articleId,1);//获取评论
|
|
|
Integer knowledgeArticleDoctorDOList2 = findByRelationCodeAndType(articleId,4);//获取评论
|
|
|
public JSONObject findArticleStaticsByArticleId(String articleId) {
|
|
|
Integer knowledgeArticleDoctorDOS = findByRelationCodeAndType(articleId, 2);//获取点赞
|
|
|
Integer knowledgeArticleDoctorDOList = findByRelationCodeAndType(articleId, 3);//获取收藏
|
|
|
Integer knowledgeArticleDoctorDOList1 = findByRelationCodeAndType(articleId, 1);//获取评论
|
|
|
Integer knowledgeArticleDoctorDOList2 = findByRelationCodeAndType(articleId, 4);//获取评论
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("eulogyTotal",knowledgeArticleDoctorDOS);//点赞数量
|
|
|
object.put("collectTotal",knowledgeArticleDoctorDOList);//收藏数量
|
|
|
object.put("commentTotal",knowledgeArticleDoctorDOList1);//评论数量
|
|
|
object.put("browseTotal",knowledgeArticleDoctorDOList2);//浏览量
|
|
|
object.put("eulogyTotal", knowledgeArticleDoctorDOS);//点赞数量
|
|
|
object.put("collectTotal", knowledgeArticleDoctorDOList);//收藏数量
|
|
|
object.put("commentTotal", knowledgeArticleDoctorDOList1);//评论数量
|
|
|
object.put("browseTotal", knowledgeArticleDoctorDOList2);//浏览量
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
|
|
|
public Integer findByRelationCodeAndType(String relationCode,Integer type){
|
|
|
String sql = "select count(*) from base_knowledge_article_doctor where relation_code='"+relationCode+"' and type="+type;
|
|
|
return jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
public Integer findByRelationCodeAndType(String relationCode, Integer type) {
|
|
|
String sql = "select count(*) from base_knowledge_article_doctor where relation_code='" + relationCode + "' and type=" + type;
|
|
|
return jdbcTemplate.queryForObject(sql, Integer.class);
|
|
|
}
|
|
|
|
|
|
|
|
@ -1252,30 +1288,31 @@ public class BaseMenuManageService {
|
|
|
* @param articleId
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject selectArticleDoctorByArticleIdAndUser(String articleId,String user){
|
|
|
boolean eulogy= false;
|
|
|
public JSONObject selectArticleDoctorByArticleIdAndUser(String articleId, String user) {
|
|
|
boolean eulogy = false;
|
|
|
boolean collect = false;
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOS = knowledgeArticleDoctorDao.findByRelationCodeAndTypeAndUser(articleId,2,user);//获取点赞
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOList = knowledgeArticleDoctorDao.findByRelationCodeAndTypeAndUser(articleId,3,user);//获取收藏
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOS = knowledgeArticleDoctorDao.findByRelationCodeAndTypeAndUser(articleId, 2, user);//获取点赞
|
|
|
List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOList = knowledgeArticleDoctorDao.findByRelationCodeAndTypeAndUser(articleId, 3, user);//获取收藏
|
|
|
JSONObject object = new JSONObject();
|
|
|
if (knowledgeArticleDoctorDOS!=null&&knowledgeArticleDoctorDOS.size()>0){
|
|
|
if (knowledgeArticleDoctorDOS != null && knowledgeArticleDoctorDOS.size() > 0) {
|
|
|
eulogy = true;
|
|
|
}
|
|
|
if (knowledgeArticleDoctorDOList !=null && knowledgeArticleDoctorDOList.size()>0){
|
|
|
if (knowledgeArticleDoctorDOList != null && knowledgeArticleDoctorDOList.size() > 0) {
|
|
|
collect = true;
|
|
|
}
|
|
|
object.put("eulogy",eulogy);
|
|
|
object.put("collect",collect);
|
|
|
object.put("eulogy", eulogy);
|
|
|
object.put("collect", collect);
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 新增用户浏览数据
|
|
|
*
|
|
|
* @param browseDO
|
|
|
* @return
|
|
|
*/
|
|
|
public KnowledgeArticleBrowseDO insertBrowseDO(KnowledgeArticleBrowseDO browseDO){
|
|
|
public KnowledgeArticleBrowseDO insertBrowseDO(KnowledgeArticleBrowseDO browseDO) {
|
|
|
browseDO.setCreateTime(new Date());
|
|
|
browseDO.setUpdateTime(new Date());
|
|
|
return knowledgeArticleBrowseDao.save(browseDO);
|
|
@ -1284,28 +1321,45 @@ public class BaseMenuManageService {
|
|
|
|
|
|
/**
|
|
|
* 查询文章浏览量
|
|
|
*
|
|
|
* @param relationCode
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
public int selectArticleBrowseByRelationCode(String relationCode,Integer type){
|
|
|
List<KnowledgeArticleBrowseDO> browseDOS = knowledgeArticleBrowseDao.findByRelationCodeAndType(relationCode,type);
|
|
|
public int selectArticleBrowseByRelationCode(String relationCode, Integer type) {
|
|
|
List<KnowledgeArticleBrowseDO> browseDOS = knowledgeArticleBrowseDao.findByRelationCodeAndType(relationCode, type);
|
|
|
return browseDOS.size();
|
|
|
}
|
|
|
|
|
|
public List<KnowledgeArticleDictDO> findDoctorCollectionArticle(String doctor, String relationType,Integer page, Integer size) {
|
|
|
String sql="SELECT\n" +
|
|
|
public List<KnowledgeArticleDictDO> findDoctorCollectionArticle(String doctor, String relationType, Integer page, Integer size) {
|
|
|
String sql = "SELECT\n" +
|
|
|
" b.* \n" +
|
|
|
"FROM\n" +
|
|
|
" base_knowledge_article_doctor a\n" +
|
|
|
" INNER JOIN wlyy_knowledge_article_dict b ON a.relation_code=b.id\n" +
|
|
|
" WHERE 1=1 \n" +
|
|
|
" AND a.relation_type='"+relationType+"' \n" +
|
|
|
" AND a.`user`='"+doctor+"'\n" ;
|
|
|
String limit = " limit "+(page-1)+","+size;
|
|
|
sql+=limit;
|
|
|
System.out.println("sql==>"+sql);
|
|
|
" AND a.relation_type='" + relationType + "' \n" +
|
|
|
" AND a.`user`='" + doctor + "'\n";
|
|
|
String limit = " limit " + (page - 1) + "," + size;
|
|
|
sql += limit;
|
|
|
System.out.println("sql==>" + sql);
|
|
|
List<KnowledgeArticleDictDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(KnowledgeArticleDictDO.class));
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public List findArticleUserStatusList(String doctorCode, String relationCode, String patientName) {
|
|
|
String sql = " SELECT DISTINCT \n" +
|
|
|
" TIMESTAMPDIFF(YEAR, d.birthday, CURDATE()) AS age, d.sex,d.photo, c.* \n" +
|
|
|
" FROM wlyy_knowledge_article_dict a " +
|
|
|
" INNER JOIN base_patient_business b ON a.id=b.relation_code" +
|
|
|
" INNER JOIN wlyy_knowledge_article_user c ON a.id=c.relation_code \n" +
|
|
|
" INNER JOIN base_patient d ON d.id=c.user_code \n" +
|
|
|
" WHERE 1=1 " +
|
|
|
" and b.doctor='" + doctorCode + "' and c.relation_code='" + relationCode + "' ";
|
|
|
if (StringUtils.isNotBlank(patientName)) {
|
|
|
sql += " and c.user_name like '%" + patientName + "%' ";
|
|
|
}
|
|
|
List<KnowledgeArticleUserDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(KnowledgeArticleUserDO.class));
|
|
|
return list;
|
|
|
}
|
|
|
}
|