Commit b1a3258958ded9266b1c5414b64bcb47c54a652c
1 parent
5f42a8f9a6
Exists in
dev
#fix:优化高危颜色查询逻辑
Showing 1 changed file with 152 additions and 3 deletions
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
b1a3258
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | import com.lyms.platform.common.dao.operator.MongoCondition; |
| 6 | 6 | import com.lyms.platform.common.dao.operator.MongoOper; |
| 7 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; |
| 8 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 8 | 9 | import com.lyms.platform.common.utils.StringUtils; |
| 9 | 10 | import org.apache.commons.collections.CollectionUtils; |
| 10 | 11 | import org.springframework.data.mongodb.core.query.Criteria; |
| ... | ... | @@ -950,9 +951,7 @@ |
| 950 | 951 | if (null != created) { |
| 951 | 952 | condition = condition.and("created", created, MongoOper.LTE); |
| 952 | 953 | } |
| 953 | - if (StringUtils.isNotEmpty(rLevel)) { | |
| 954 | - condition = condition.and("riskLevelId", rLevel, MongoOper.LIKE); | |
| 955 | - } | |
| 954 | + | |
| 956 | 955 | //居住地 |
| 957 | 956 | if (StringUtils.isNotEmpty(areaId)) { |
| 958 | 957 | condition = condition.and("areaId", areaId, MongoOper.IS); |
| ... | ... | @@ -1114,6 +1113,156 @@ |
| 1114 | 1113 | } |
| 1115 | 1114 | |
| 1116 | 1115 | Criteria c1 = null; |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + if (StringUtils.isNotEmpty(rLevel)) { | |
| 1120 | + //大同特殊处理 按颜色等于查询 | |
| 1121 | + if("2100002419".equals(hospitalId)){ | |
| 1122 | + List<String> levelList= StringUtils.covertToList(rLevel, String.class); | |
| 1123 | + if (CollectionUtils.isNotEmpty(levelList)){ | |
| 1124 | + if (levelList.size()>1){ | |
| 1125 | + MongoCondition c = MongoCondition.newInstance(); | |
| 1126 | + List<String> riskLevelIds=new ArrayList<>(); | |
| 1127 | + MongoCondition condition1 = MongoCondition.newInstance("riskLevelId", JsonUtil.array2JsonString(levelList), MongoOper.IS); | |
| 1128 | + if (levelList.size()==2){ | |
| 1129 | + riskLevelIds.add(levelList.get(1)); | |
| 1130 | + riskLevelIds.add(levelList.get(0)); | |
| 1131 | + MongoCondition condition2 = MongoCondition.newInstance("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1132 | + if (c1 != null) { | |
| 1133 | + c1 = c1.andOperator(c.orCondition(new MongoCondition[]{condition1, condition2}).getCriteria()); | |
| 1134 | + } else { | |
| 1135 | + c1 = c.orCondition(new MongoCondition[]{condition1, condition2}).getCriteria(); | |
| 1136 | + } | |
| 1137 | + }else if (levelList.size()==3){ | |
| 1138 | + riskLevelIds.add(levelList.get(0)); | |
| 1139 | + riskLevelIds.add(levelList.get(2)); | |
| 1140 | + riskLevelIds.add(levelList.get(1)); | |
| 1141 | + MongoCondition condition2 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1142 | + riskLevelIds.clear(); | |
| 1143 | + riskLevelIds.add(levelList.get(1)); | |
| 1144 | + riskLevelIds.add(levelList.get(0)); | |
| 1145 | + riskLevelIds.add(levelList.get(2)); | |
| 1146 | + MongoCondition condition3 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1147 | + | |
| 1148 | + riskLevelIds.clear(); | |
| 1149 | + riskLevelIds.add(levelList.get(1)); | |
| 1150 | + riskLevelIds.add(levelList.get(2)); | |
| 1151 | + riskLevelIds.add(levelList.get(0)); | |
| 1152 | + MongoCondition condition4 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1153 | + | |
| 1154 | + riskLevelIds.clear(); | |
| 1155 | + | |
| 1156 | + riskLevelIds.add(levelList.get(2)); | |
| 1157 | + riskLevelIds.add(levelList.get(0)); | |
| 1158 | + riskLevelIds.add(levelList.get(1)); | |
| 1159 | + MongoCondition condition5 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1160 | + | |
| 1161 | + riskLevelIds.clear(); | |
| 1162 | + riskLevelIds.add(levelList.get(2)); | |
| 1163 | + riskLevelIds.add(levelList.get(1)); | |
| 1164 | + riskLevelIds.add(levelList.get(0)); | |
| 1165 | + MongoCondition condition6 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1166 | + | |
| 1167 | + riskLevelIds.clear(); | |
| 1168 | + //condition=condition.orCondition(new MongoCondition[]{condition1, condition2,condition3,condition4,condition5,condition6}); | |
| 1169 | + if (c1 != null) { | |
| 1170 | + c1 = c1.andOperator(c.orCondition(new MongoCondition[]{condition1, condition2,condition3,condition4,condition5,condition6}).getCriteria()); | |
| 1171 | + } else { | |
| 1172 | + c1 = c.orCondition(new MongoCondition[]{condition1, condition2,condition3,condition4,condition5,condition6}).getCriteria(); | |
| 1173 | + } | |
| 1174 | + }else if (levelList.size()==4){ | |
| 1175 | + riskLevelIds.add(levelList.get(0)); | |
| 1176 | + riskLevelIds.add(levelList.get(2)); | |
| 1177 | + riskLevelIds.add(levelList.get(1)); | |
| 1178 | + riskLevelIds.add(levelList.get(3)); | |
| 1179 | + MongoCondition condition2 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1180 | + riskLevelIds.clear(); | |
| 1181 | + riskLevelIds.add(levelList.get(0)); | |
| 1182 | + riskLevelIds.add(levelList.get(2)); | |
| 1183 | + riskLevelIds.add(levelList.get(3)); | |
| 1184 | + riskLevelIds.add(levelList.get(1)); | |
| 1185 | + MongoCondition condition3 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1186 | + | |
| 1187 | + riskLevelIds.clear(); | |
| 1188 | + riskLevelIds.add(levelList.get(1)); | |
| 1189 | + riskLevelIds.add(levelList.get(0)); | |
| 1190 | + riskLevelIds.add(levelList.get(2)); | |
| 1191 | + riskLevelIds.add(levelList.get(3)); | |
| 1192 | + MongoCondition condition4 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1193 | + | |
| 1194 | + riskLevelIds.clear(); | |
| 1195 | + | |
| 1196 | + riskLevelIds.add(levelList.get(1)); | |
| 1197 | + riskLevelIds.add(levelList.get(0)); | |
| 1198 | + riskLevelIds.add(levelList.get(3)); | |
| 1199 | + riskLevelIds.add(levelList.get(2)); | |
| 1200 | + MongoCondition condition5 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1201 | + | |
| 1202 | + riskLevelIds.clear(); | |
| 1203 | + riskLevelIds.add(levelList.get(1)); | |
| 1204 | + riskLevelIds.add(levelList.get(2)); | |
| 1205 | + riskLevelIds.add(levelList.get(0)); | |
| 1206 | + riskLevelIds.add(levelList.get(3)); | |
| 1207 | + MongoCondition condition6 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1208 | + | |
| 1209 | + riskLevelIds.clear(); | |
| 1210 | + | |
| 1211 | + riskLevelIds.add(levelList.get(1)); | |
| 1212 | + riskLevelIds.add(levelList.get(2)); | |
| 1213 | + riskLevelIds.add(levelList.get(3)); | |
| 1214 | + riskLevelIds.add(levelList.get(0)); | |
| 1215 | + MongoCondition condition7 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1216 | + riskLevelIds.clear(); | |
| 1217 | + | |
| 1218 | + riskLevelIds.add(levelList.get(2)); | |
| 1219 | + riskLevelIds.add(levelList.get(1)); | |
| 1220 | + riskLevelIds.add(levelList.get(0)); | |
| 1221 | + riskLevelIds.add(levelList.get(3)); | |
| 1222 | + MongoCondition condition8 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1223 | + riskLevelIds.clear(); | |
| 1224 | + | |
| 1225 | + riskLevelIds.add(levelList.get(2)); | |
| 1226 | + riskLevelIds.add(levelList.get(1)); | |
| 1227 | + riskLevelIds.add(levelList.get(3)); | |
| 1228 | + riskLevelIds.add(levelList.get(0)); | |
| 1229 | + MongoCondition condition9 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1230 | + riskLevelIds.clear(); | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + riskLevelIds.add(levelList.get(2)); | |
| 1234 | + riskLevelIds.add(levelList.get(3)); | |
| 1235 | + riskLevelIds.add(levelList.get(0)); | |
| 1236 | + riskLevelIds.add(levelList.get(1)); | |
| 1237 | + MongoCondition condition10 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1238 | + riskLevelIds.clear(); | |
| 1239 | + | |
| 1240 | + riskLevelIds.add(levelList.get(2)); | |
| 1241 | + riskLevelIds.add(levelList.get(3)); | |
| 1242 | + riskLevelIds.add(levelList.get(1)); | |
| 1243 | + riskLevelIds.add(levelList.get(0)); | |
| 1244 | + MongoCondition condition11 = new MongoCondition("riskLevelId",JsonUtil.array2JsonString(riskLevelIds), MongoOper.IS); | |
| 1245 | + riskLevelIds.clear(); | |
| 1246 | + | |
| 1247 | + //condition=condition.orCondition(new MongoCondition[]{condition1, condition2,condition3,condition4,condition5,condition6,condition7,condition8,condition9,condition10,condition11}); | |
| 1248 | + if (c1 != null) { | |
| 1249 | + c1 = c1.andOperator(c.orCondition(new MongoCondition[]{condition1, condition2,condition3,condition4,condition5,condition6,condition7,condition8,condition9,condition10,condition11}).getCriteria()); | |
| 1250 | + } else { | |
| 1251 | + c1 = c.orCondition(new MongoCondition[]{condition1, condition2,condition3,condition4,condition5,condition6,condition7,condition8,condition9,condition10,condition11}).getCriteria(); | |
| 1252 | + } | |
| 1253 | + } | |
| 1254 | + | |
| 1255 | + }else { | |
| 1256 | + condition = condition.and("riskLevelId", JsonUtil.array2JsonString(levelList), MongoOper.IS); | |
| 1257 | + } | |
| 1258 | + | |
| 1259 | + } | |
| 1260 | + | |
| 1261 | + }else { | |
| 1262 | + condition = condition.and("riskLevelId", rLevel, MongoOper.LIKE); | |
| 1263 | + } | |
| 1264 | + | |
| 1265 | + } | |
| 1117 | 1266 | |
| 1118 | 1267 | |
| 1119 | 1268 | if (StringUtils.isNotEmpty(queryNo)) { |