Przeglądaj źródła

Merge remote-tracking branch 'origin/matser' into matser

WuYi 2 dni temu
rodzic
commit
b3412b17c0

+ 32 - 6
ibps-base-root/modules/base-db/src/main/java/com/lc/ibps/base/db/ddd/dao/MyBatisQueryDaoImpl.java

@@ -1,12 +1,11 @@
 package com.lc.ibps.base.db.ddd.dao;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.Map.Entry;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.session.RowBounds;
 import org.mybatis.spring.SqlSessionTemplate;
 import org.slf4j.Logger;
@@ -574,9 +573,36 @@ public abstract class MyBatisQueryDaoImpl<PK extends java.io.Serializable, P ext
 			dynamicWhereSql = StringUtil.isNotEmpty(dynamicWhereSql) ? dynamicWhereSql + " and " + defaultWhere
 					: defaultWhere;
 		}
-		
+		/** 1.是否华创启德医院环境 */
+		String setting = currentContext().getSetting();
+		boolean flag1 = false;
+		if (StringUtils.isNotEmpty(setting)) {
+			try {
+				ObjectMapper objectMapper = new ObjectMapper();
+				HashMap<String, Object> map = (HashMap) objectMapper.readValue(setting, Map.class);
+				String dgyy = Optional.ofNullable(map)
+						.map(m -> m.get("HCQD"))
+						.map(Object::toString)
+						.orElse("");
+				flag1 = Boolean.parseBoolean(dgyy);
+			} catch (Exception e) {
+				logger.warn("解析setting JSON失败, setting={}", setting, e);
+			}
+		}
+
 		if (StringUtil.isNotEmpty(dynamicWhereSql)) {
-			params.put("whereSql", dynamicWhereSql);
+			if (StringUtil.isNotEmpty(dynamicWhereSql)) {
+				// 将 subject_ like 替换为对两个 # 之间内容的匹配
+				String modifiedWhereSql = dynamicWhereSql.replaceAll(
+						"subject_\\s+like\\s+",
+						"SUBSTRING_INDEX(SUBSTRING_INDEX(subject_, '#', 2), '#', -1) like "
+				);
+				if(flag1){//如果修改流程数据客户不好根据标题区分,所以在这里进行代码转换,保证页面查询无误
+					params.put("whereSql", modifiedWhereSql);//华创
+				}else{
+					params.put("whereSql", dynamicWhereSql);//原逻辑
+				}
+			}
 		}
 		// 构建排序SQL
 		if (BeanUtils.isNotEmpty(queryFilter.getFieldSortList())) {

+ 9 - 4
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/business/service/impl/TrainingStatisticsServiceImpl.java

@@ -65,15 +65,20 @@ public class TrainingStatisticsServiceImpl implements TrainingStatisticsService
             String employee = map.get("id_").toString();
             String sumSql = "";
             String signSql = "";
+            //当userList中某些用户有多个部门的时候,本来查的A部门,但是会实际上把其他部门的数据也统计进来,所以做这个修改
+            String deptCondition = "";
+            if (BeanUtils.isNotEmpty(deptId)){
+                deptCondition = " and bian_zhi_bu_men_='" + deptId + "'";
+            }
             if(BeanUtils.isNotEmpty(version) && "1".equals(version)){
                 //新版培训
-                sumSql = "select count(*)as planedjoin from t_lhrypxjlb where pei_xun_zhuang_ta='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'";
+                sumSql = "select count(*)as planedjoin from t_lhrypxjlb where pei_xun_zhuang_ta='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'" + deptCondition;
                 signSql = "select count(distinct guan_lian_id_) as truejoin from t_qdxxb where ren_yuan_id_ ='"+employee+"' and guan_lian_id_ " +
-                        " in(select id_ from t_lhrypxjlb where pei_xun_zhuang_ta='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'";
+                        " in(select id_ from t_lhrypxjlb where pei_xun_zhuang_ta='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'" + deptCondition;
             }else{
-                sumSql = "select count(*)as planedjoin from t_rypxcjb where shi_fou_guo_shen_='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'";
+                sumSql = "select count(*)as planedjoin from t_rypxcjb where shi_fou_guo_shen_='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'" + deptCondition;
                 signSql = "select count(distinct guan_lian_id_) as truejoin from t_qdxxb where ren_yuan_id_ ='"+employee+"' and guan_lian_id_ " +
-                        " in(select id_ from t_rypxcjb where shi_fou_guo_shen_='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'";
+                        " in(select id_ from t_rypxcjb where shi_fou_guo_shen_='已结束' and pei_xun_ren_yuan_ like '%"+employee+"%'" + deptCondition;
             }
             if (BeanUtils.isNotEmpty(startTime)){
                 sumSql = sumSql + " and date_format(pei_xun_shi_jian_,'%Y-%m-%d')>='"+startTime+"' ";