|
|
@@ -10,6 +10,7 @@ import org.jeecg.modules.medical.entity.EventAttr;
|
|
|
import org.jeecg.modules.medical.entity.FactorAttrRela;
|
|
|
import org.jeecg.modules.medical.entity.FactorEnchance;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
|
import org.springframework.jdbc.support.rowset.SqlRowSet;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -27,7 +28,8 @@ public class SqlUtil {
|
|
|
|
|
|
public void setSqlResultByFactorEnchance(Map<String, Object> localMap, Map<Integer, List<FactorAttrRela>> ioTypeMap, FactorEnchance factorEnchance, Integer medicalInsRuleInfoId) {
|
|
|
String dataSourceKey = factorEnchance.getExtAttr1();
|
|
|
- JdbcTemplate jdbcTemplate = DynamicDBUtil.getJdbcTemplate(dataSourceKey);
|
|
|
+ NamedParameterJdbcTemplate namedParameterJdbcTemplate = DynamicDBUtil.getNamedParameterJdbcTemplate(dataSourceKey);
|
|
|
+// JdbcTemplate jdbcTemplate = DynamicDBUtil.getJdbcTemplate(dataSourceKey);
|
|
|
List<FactorAttrRela> factorAttrRelaList = ioTypeMap.get(Constant.INPUT);
|
|
|
List<Integer> paramNameList = new ArrayList<>();
|
|
|
List<Integer> paramTypeList = new ArrayList<>();
|
|
|
@@ -41,23 +43,25 @@ public class SqlUtil {
|
|
|
paramTypeList.add(eventAttr.getDispType());
|
|
|
}
|
|
|
}
|
|
|
- String sql = getSqlText(localMap, factorEnchance.getEnhanceValue(), paramNameList, paramTypeList, factorEnchance, medicalInsRuleInfoId);
|
|
|
-
|
|
|
+// String sql = getSqlText(localMap, factorEnchance.getEnhanceValue(), paramNameList, paramTypeList, factorEnchance, medicalInsRuleInfoId);
|
|
|
+ String sql = factorEnchance.getEnhanceValue();
|
|
|
List<FactorAttrRela> factorAttrRelaOutList = ioTypeMap.get(Constant.OUTPUT);
|
|
|
if (CollectionUtil.isNotEmpty(factorAttrRelaOutList)) {
|
|
|
- if (factorAttrRelaOutList.size() == 1 && checkEventAttrArrMap(factorAttrRelaOutList.get(0).getEventAttrId())) {
|
|
|
- List<Map<String,Object>> dataList = jdbcTemplate.queryForList(sql);
|
|
|
+ if (checkEventAttrArrMap(factorAttrRelaOutList.get(0).getEventAttrId())) {
|
|
|
+// List<Map<String,Object>> dataList = jdbcTemplate.queryForList(sql);
|
|
|
// jdbcTemplate.queryForList()
|
|
|
+ List<Map<String,Object>> dataList = namedParameterJdbcTemplate.queryForList(sql, localMap);
|
|
|
localMap.put(FactorEnchangeFactory.getParamName(factorAttrRelaOutList.get(0).getEventAttrId()), dataList);
|
|
|
- }else if (factorAttrRelaOutList.size() == 1 && checkEventAttrArr(factorAttrRelaOutList.get(0).getEventAttrId())) {
|
|
|
- List<Object> dataList = jdbcTemplate.queryForList(sql,Object.class);
|
|
|
+ }else if (checkEventAttrArr(factorAttrRelaOutList.get(0).getEventAttrId())) {
|
|
|
+// List<Object> dataList = jdbcTemplate.queryForList(sql,Object.class);
|
|
|
+ List<Object> dataList = namedParameterJdbcTemplate.queryForList(sql, localMap, Object.class);
|
|
|
// jdbcTemplate.queryForList()
|
|
|
localMap.put(FactorEnchangeFactory.getParamName(factorAttrRelaOutList.get(0).getEventAttrId()), dataList);
|
|
|
- } else if (factorAttrRelaOutList.size() == 1 && checkEventAttrMap(factorAttrRelaOutList.get(0).getEventAttrId())) {
|
|
|
- Map<String, Object> dataMap = jdbcTemplate.queryForMap(sql);
|
|
|
+ } else if (checkEventAttrMap(factorAttrRelaOutList.get(0).getEventAttrId())) {
|
|
|
+ Map<String, Object> dataMap = namedParameterJdbcTemplate.queryForMap(sql, localMap);
|
|
|
localMap.put(FactorEnchangeFactory.getParamName(factorAttrRelaOutList.get(0).getEventAttrId()), dataMap);
|
|
|
} else {
|
|
|
- SqlRowSet rs = jdbcTemplate.queryForRowSet(sql);
|
|
|
+ SqlRowSet rs = namedParameterJdbcTemplate.queryForRowSet(sql, localMap);
|
|
|
if (rs.first()) {
|
|
|
for (int paramIndex = 1; paramIndex <= factorAttrRelaOutList.size(); paramIndex++) {
|
|
|
Object paramObj = rs.getObject(paramIndex);
|