Commit 2b175b8bf3f87885d160dbb59cf3f04b17a9c909
1 parent
4b5aeb988c
Exists in
master
修改高危因素查询
Showing 1 changed file with 26 additions and 37 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/DischargeAbstractFacade.java
View file @
2b175b8
| ... | ... | @@ -3,14 +3,12 @@ |
| 3 | 3 | import com.lyms.platform.biz.service.*; |
| 4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 5 | import com.lyms.platform.common.enums.RenShenJieJuEnums; |
| 6 | -import com.lyms.platform.common.enums.RiskDefaultTypeEnum; | |
| 7 | 6 | import com.lyms.platform.common.enums.YnEnums; |
| 8 | 7 | import com.lyms.platform.common.utils.BeanUtils; |
| 9 | 8 | import com.lyms.platform.common.utils.DateUtil; |
| 10 | 9 | import com.lyms.platform.operate.web.request.DischargeAbstractQueryRequest; |
| 11 | 10 | import com.lyms.platform.operate.web.request.DischargeAbstractSaveRequest; |
| 12 | 11 | import com.lyms.platform.operate.web.result.*; |
| 13 | -import com.lyms.platform.pojo.BasicConfig; | |
| 14 | 12 | import com.lyms.platform.pojo.DischargeAbstractBabyModel; |
| 15 | 13 | import com.lyms.platform.pojo.DischargeAbstractMotherModel; |
| 16 | 14 | import com.lyms.platform.pojo.Patients; |
| ... | ... | @@ -18,6 +16,7 @@ |
| 18 | 16 | import com.lyms.platform.query.DischargeAbstractBabyQuery; |
| 19 | 17 | import com.lyms.platform.query.DischargeAbstractMotherQuery; |
| 20 | 18 | import com.lyms.platform.query.PatientsQuery; |
| 19 | +import org.apache.commons.collections.CollectionUtils; | |
| 21 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | 21 | import org.springframework.stereotype.Component; |
| 23 | 22 | import org.springframework.util.StringUtils; |
| ... | ... | @@ -26,6 +25,7 @@ |
| 26 | 25 | import java.util.ArrayList; |
| 27 | 26 | import java.util.Date; |
| 28 | 27 | import java.util.List; |
| 28 | +import java.util.Map; | |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @auther HuJiaqi |
| ... | ... | @@ -50,6 +50,9 @@ |
| 50 | 50 | @Autowired |
| 51 | 51 | private BabyService babyService; |
| 52 | 52 | |
| 53 | + @Autowired | |
| 54 | + private AntenatalExaminationFacade antenatalExaminationFacade; | |
| 55 | + | |
| 53 | 56 | public DischargeAbstractSaveResult save(DischargeAbstractSaveRequest dischargeAbstractSaveRequest) { |
| 54 | 57 | |
| 55 | 58 | DischargeAbstractSaveResult dischargeAbstractSaveResult = new DischargeAbstractSaveResult(); |
| ... | ... | @@ -127,8 +130,27 @@ |
| 127 | 130 | dischargeAbstractQueryResult.setUserName(patients.getUsername()); |
| 128 | 131 | dischargeAbstractQueryResult.setAge(DateUtil.getAge(patients.getBirth(), new Date())); |
| 129 | 132 | dischargeAbstractQueryResult.setFmDate(DateUtil.getyyyy_MM_dd(patients.getFmDate())); |
| 130 | - List<RiskFactoryResultModel> riskFactoryResultModelList = getRiskFactory(patients.getRiskFactorId()); | |
| 131 | - dischargeAbstractQueryResult.setRiskFactoryResultModelList(riskFactoryResultModelList); | |
| 133 | + | |
| 134 | + // 这里之所以转换时以为前端已经写好了,并且这个循环也不是很慢 | |
| 135 | + try { | |
| 136 | + HighScoreResult highScoreResult = antenatalExaminationFacade.findLastRisk(patients.getPid(), false); | |
| 137 | + List<RiskFactoryResultModel> riskFactoryResultModelList = new ArrayList<>(); | |
| 138 | + if (highScoreResult != null && CollectionUtils.isNotEmpty(highScoreResult.getHighRisk())) { | |
| 139 | + // 这个必然是这个泛型,否则直接抛出异常 | |
| 140 | + @SuppressWarnings("unchecked") | |
| 141 | + List<Map<String, String>> temp = highScoreResult.getHighRisk(); | |
| 142 | + for (Map<String, String> map : temp) { | |
| 143 | + RiskFactoryResultModel riskFactoryResultModel = new RiskFactoryResultModel(); | |
| 144 | + riskFactoryResultModel.setName(map.get("name")); | |
| 145 | + riskFactoryResultModel.setColor(map.get("color")); | |
| 146 | + riskFactoryResultModelList.add(riskFactoryResultModel); | |
| 147 | + } | |
| 148 | + } | |
| 149 | + dischargeAbstractQueryResult.setRiskFactoryResultModelList(riskFactoryResultModelList); | |
| 150 | + } catch (Exception e) { | |
| 151 | + // 什么都不干 | |
| 152 | + } | |
| 153 | + | |
| 132 | 154 | dischargeAbstractQueryResult.setGestationalWeeks(PredictedStatisticsFacade.getGestationalWeeks(patients.getLastMenses(), patients.getType(), patients.getDueStatus())); |
| 133 | 155 | dischargeAbstractQueryResult.setDueDate(new SimpleDateFormat("yyyy年MM月dd日").format(patients.getDueDate())); |
| 134 | 156 | |
| ... | ... | @@ -180,39 +202,6 @@ |
| 180 | 202 | dischargeAbstractQueryResult.setErrormsg("已分娩并且已经做过出院小结"); |
| 181 | 203 | |
| 182 | 204 | return dischargeAbstractQueryResult; |
| 183 | - } | |
| 184 | - | |
| 185 | - private List<RiskFactoryResultModel> getRiskFactory(List<String> riskFactorIdList) { | |
| 186 | - | |
| 187 | - List<RiskFactoryResultModel> riskFactoryResultModelList = new ArrayList<>(); | |
| 188 | - | |
| 189 | - if (riskFactorIdList != null && riskFactorIdList.size() > 0) { | |
| 190 | - for (String riskFactoryId : riskFactorIdList) { | |
| 191 | - RiskFactoryResultModel riskFactoryResultModel = new RiskFactoryResultModel(); | |
| 192 | - try { | |
| 193 | - BasicConfig basicConfig1 = basicConfigService.getOneBasicConfigById(riskFactoryId); | |
| 194 | - String name = basicConfig1.getName(); | |
| 195 | - boolean flag = true; | |
| 196 | - if (riskFactoryResultModelList.size() > 0) { | |
| 197 | - for (RiskFactoryResultModel factoryResultModel : riskFactoryResultModelList) { | |
| 198 | - if (factoryResultModel.getName().equals(name)) { | |
| 199 | - flag = false; | |
| 200 | - } | |
| 201 | - } | |
| 202 | - } | |
| 203 | - if (flag) { | |
| 204 | - riskFactoryResultModel.setName(name); | |
| 205 | - BasicConfig basicConfig2 = basicConfigService.getOneBasicConfigById(basicConfig1.getParentId()); | |
| 206 | - name = basicConfig2.getName(); | |
| 207 | - riskFactoryResultModel.setColor("risk_" + RiskDefaultTypeEnum.getColor(name)); | |
| 208 | - riskFactoryResultModelList.add(riskFactoryResultModel); | |
| 209 | - } | |
| 210 | - } catch (Exception e) { | |
| 211 | - // 什么都不干 | |
| 212 | - } | |
| 213 | - } | |
| 214 | - } | |
| 215 | - return riskFactoryResultModelList; | |
| 216 | 205 | } |
| 217 | 206 | |
| 218 | 207 | } |