|
@@ -21,15 +21,13 @@ import java.time.DayOfWeek;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.Month;
|
|
import java.time.Month;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
-import java.util.Optional;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
public class QualityIndicatorJob extends AbstractJob {
|
|
public class QualityIndicatorJob extends AbstractJob {
|
|
|
|
|
|
|
|
public static final String START_FLOW = "start_flow";
|
|
public static final String START_FLOW = "start_flow";
|
|
|
|
|
|
|
|
|
|
+
|
|
|
private static final Logger logger = LoggerFactory.getLogger(QualityIndicatorJob.class);
|
|
private static final Logger logger = LoggerFactory.getLogger(QualityIndicatorJob.class);
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -42,32 +40,17 @@ public class QualityIndicatorJob extends AbstractJob {
|
|
|
logger.warn("jobDataMap=is {}.", JacksonUtil.toJsonString(dataMap.getWrappedMap()));
|
|
logger.warn("jobDataMap=is {}.", JacksonUtil.toJsonString(dataMap.getWrappedMap()));
|
|
|
// String sql = "SELECT id_,di_dian_,cha_xun_yu_ju_ FROM t_zlzbpzb WHERE shi_fou_ji_huo_ = 'Y'";
|
|
// String sql = "SELECT id_,di_dian_,cha_xun_yu_ju_ FROM t_zlzbpzb WHERE shi_fou_ji_huo_ = 'Y'";
|
|
|
List<Map<String, Object>> list = fetchRecords("zlzb1");
|
|
List<Map<String, Object>> list = fetchRecords("zlzb1");
|
|
|
- /** 1.是否 东莞医院环境 */
|
|
|
|
|
- String setting = ContextUtil.getSetting();
|
|
|
|
|
- boolean flag1 = false;
|
|
|
|
|
- if (StringUtils.isNotEmpty(setting)) {
|
|
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
- HashMap<String, Object> map =(HashMap) objectMapper.readValue(setting, Map.class);
|
|
|
|
|
- String dgyy = Optional.ofNullable(map)
|
|
|
|
|
- .map(m -> m.get("DGYY"))
|
|
|
|
|
- .map(Object::toString)
|
|
|
|
|
- .orElse("");
|
|
|
|
|
- flag1 = Boolean.parseBoolean(dgyy);
|
|
|
|
|
- }
|
|
|
|
|
if (BeanUtils.isNotEmpty(list)) {
|
|
if (BeanUtils.isNotEmpty(list)) {
|
|
|
for (Map<String, Object> map : list) {
|
|
for (Map<String, Object> map : list) {
|
|
|
String canshu = (String)map.get("cha_xun_yu_ju_");
|
|
String canshu = (String)map.get("cha_xun_yu_ju_");
|
|
|
String id = (String)map.get("id_");
|
|
String id = (String)map.get("id_");
|
|
|
- //String diDian = (String)map.get("di_dian_");
|
|
|
|
|
- //东莞中医特殊改造,按照部门细分
|
|
|
|
|
- String diDian = flag1?(String)map.get("bian_zhi_bu_men_"):(String)map.get("di_dian_");
|
|
|
|
|
- String shiYongFangWei = flag1?(String)map.get("shi_yong_fan_wei_"):"";
|
|
|
|
|
- logger.warn("东莞中医院flag1的值{}应该为true,如果不对请在ipcc中添加配置", flag1);
|
|
|
|
|
|
|
+ String diDian = (String)map.get("di_dian_");
|
|
|
|
|
+ String dataType = (String)map.get("shi_yong_fan_wei_");
|
|
|
QualityIndicatorJobParameter parameter = JSON.parseObject(canshu, QualityIndicatorJobParameter.class);
|
|
QualityIndicatorJobParameter parameter = JSON.parseObject(canshu, QualityIndicatorJobParameter.class);
|
|
|
- createRecords(diDian,id,"每月",parameter.checkMonth(),flag1,shiYongFangWei);
|
|
|
|
|
- createRecords(diDian,id,"每季度",parameter.checkQuarter(),flag1,shiYongFangWei);
|
|
|
|
|
- createRecords(diDian,id,"每半年",parameter.checkHalfYear(),flag1,shiYongFangWei);
|
|
|
|
|
- createRecords(diDian,id,"每年",parameter.checkYear(),flag1,shiYongFangWei);
|
|
|
|
|
|
|
+ createRecords(diDian,id,"每月",parameter.checkMonth(),dataType);
|
|
|
|
|
+ createRecords(diDian,id,"每季度",parameter.checkQuarter(),dataType);
|
|
|
|
|
+ createRecords(diDian,id,"每半年",parameter.checkHalfYear(),dataType);
|
|
|
|
|
+ createRecords(diDian,id,"每年",parameter.checkYear(),dataType);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
String flow = dataMap.getString(START_FLOW);
|
|
String flow = dataMap.getString(START_FLOW);
|
|
@@ -77,43 +60,29 @@ public class QualityIndicatorJob extends AbstractJob {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void createRecords(String diDian,String id,String rate, String periodNum,Boolean flag,String shiYongFangWei) {
|
|
|
|
|
-
|
|
|
|
|
- /* if(StringUtils.isBlank(periodNum) ||
|
|
|
|
|
- fetchRecords("zlzb2", new String[]{diDian, rate, periodNum,shiYongFangWei}) != null){//统计数据列表防重
|
|
|
|
|
|
|
+ private void createRecords(String diDian, String id, String rate, String periodNum, String dataType) {
|
|
|
|
|
+ if(StringUtils.isBlank(periodNum) ||fetchRecords("zlzb2", new String[]{diDian, rate, periodNum, dataType}) != null){
|
|
|
return;
|
|
return;
|
|
|
- }*/
|
|
|
|
|
- if (checkDuplicate(diDian, rate, periodNum, shiYongFangWei,flag)) {
|
|
|
|
|
- return; // 命中防重规则,直接返回
|
|
|
|
|
- }
|
|
|
|
|
- List<Map<String, Object>> list = fetchRecords("zlzb3", new String[]{periodNum,rate,id});
|
|
|
|
|
- if(list == null) return ;
|
|
|
|
|
- try {
|
|
|
|
|
- List<String> ids = generateRecords(list, "t_zlzbpjb");
|
|
|
|
|
- String parentId = ids.get(0);
|
|
|
|
|
- List<Map<String, Object>> list1 = fetchRecords("zlzb4", new String[]{parentId,id,rate,periodNum});
|
|
|
|
|
- generateRecords(list1, "t_zlzbpjzb");
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- //ignore it.
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- private boolean checkDuplicate(String diDian, String rate, String periodNum,
|
|
|
|
|
- String shiYongFangWei, boolean falg) {
|
|
|
|
|
- // 如果periodNum为空,直接返回 true(表示存在重复/无需继续处理)
|
|
|
|
|
- if (StringUtils.isBlank(periodNum)) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- // 根据条件A动态构建参数数组
|
|
|
|
|
- String[] params;
|
|
|
|
|
- if (falg) {
|
|
|
|
|
- params = new String[]{diDian, rate, periodNum, shiYongFangWei};//东莞专用
|
|
|
|
|
- } else {
|
|
|
|
|
- params = new String[]{diDian, rate, periodNum};//原来的逻辑
|
|
|
|
|
|
|
+ List<Map<String, Object>> list = fetchRecords("zlzb3", new String[]{periodNum,rate,id, dataType});
|
|
|
|
|
+ if(list == null) return ;
|
|
|
|
|
+ for (Map<String, Object> curMap : list) {
|
|
|
|
|
+ // 将单个 Map 包装成只含一个元素的不可变 List
|
|
|
|
|
+ List<Map<String, Object>> singleList = Collections.singletonList(curMap);
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<String> ids = generateRecords(singleList, "t_zlzbpjb");
|
|
|
|
|
+ for (String parentId : ids) {
|
|
|
|
|
+ // 处理每个 curItem
|
|
|
|
|
+ List<Map<String, Object>> list1 = fetchRecords("zlzb4", new String[]{parentId,id,rate,periodNum, dataType});
|
|
|
|
|
+ generateRecords(list1, "t_zlzbpjzb");
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ //ignore it.
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- // 存在数据则表示已经处理过返回true跳过
|
|
|
|
|
- return fetchRecords("zlzb2", params) != null;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
protected void startWorkflow(String tableName, String formKey, String defKey) {
|
|
protected void startWorkflow(String tableName, String formKey, String defKey) {
|
|
|
String fetchSql = "SELECT id_ FROM %s WHERE shi_fou_guo_shen_='待处理' ";
|
|
String fetchSql = "SELECT id_ FROM %s WHERE shi_fou_guo_shen_='待处理' ";
|
|
|
fetchSql = String.format(fetchSql,tableName);
|
|
fetchSql = String.format(fetchSql,tableName);
|