审核通过 医保上传单据并且调用查询关联关系入库
							parent
							
								
									d62caf7947
								
							
						
					
					
						commit
						3eddd3676a
					
				| @ -0,0 +1,141 @@ | ||||
| package com.glxp.api.res.alihealth; | ||||
| 
 | ||||
| import cn.hutool.json.JSONArray; | ||||
| import cn.hutool.json.JSONObject; | ||||
| import cn.hutool.json.JSONUtil; | ||||
| import com.glxp.api.entity.collect.RelCodeBatch; | ||||
| import com.glxp.api.entity.collect.RelCodeDetail; | ||||
| import com.glxp.api.util.udi.FilterUdiUtils; | ||||
| import lombok.Data; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| 
 | ||||
| import java.util.*; | ||||
| 
 | ||||
| @Data | ||||
| public class AlihealthYljgSinglerelationResponse extends AlihealthKytCommonParametersResponse{ | ||||
|     private JSONObject base_infos_dto; | ||||
|     private String code; | ||||
|     private JSONObject code_active_info_dto; | ||||
|     private JSONObject code_relation_list; | ||||
|     private String is_smallest; | ||||
|     private JSONObject pkg_info_dto; | ||||
|     private JSONObject produce_info_list; | ||||
| 
 | ||||
|     private String refEntId; | ||||
| 
 | ||||
|     public AlihealthYljgSinglerelationResponse(String json) { | ||||
|         // 初始化请求的值
 | ||||
|         JSONObject jsonObject = JSONUtil.parseObj(json); | ||||
|         JSONObject jsonObjectResult = null; | ||||
|         for (String s : jsonObject.keySet()) { | ||||
|             jsonObjectResult = jsonObject.getJSONObject(s).getJSONObject("result"); | ||||
| 
 | ||||
|         } | ||||
|         AlihealthKytCommonParametersResponse alihealthKytCommonParametersResponse = JSONUtil.toBean(jsonObjectResult.toString(), | ||||
|                 AlihealthKytCommonParametersResponse.class); | ||||
|         BeanUtils.copyProperties(alihealthKytCommonParametersResponse,this); | ||||
|         if(StringUtils.isNotEmpty(this.getMsg_info()) | ||||
|                 && this.getMsg_info().equals("调用成功") | ||||
|         ){ | ||||
|             this.disposeResult(jsonObjectResult); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
|     public void disposeResult(JSONObject jsonObjectResult){ | ||||
|         JSONArray jsonArray = jsonObjectResult.getJSONObject("model_list").getJSONArray("code_relation_dto"); | ||||
|         JSONObject codeRelationDto = (JSONObject) jsonArray.get(0); | ||||
|         if (!Objects.isNull(codeRelationDto)) { | ||||
|             this.setBase_infos_dto(codeRelationDto.getJSONObject("base_infos_dto")); | ||||
|             this.setCode(codeRelationDto.getStr("code")); | ||||
|             this.setCode_active_info_dto(codeRelationDto.getJSONObject("code_active_info_dto")); | ||||
|             this.setCode_relation_list(codeRelationDto.getJSONObject("code_relation_list")); | ||||
|             this.setIs_smallest(codeRelationDto.getStr("is_smallest")); | ||||
|             this.setPkg_info_dto(codeRelationDto.getJSONObject("pkg_info_dto")); | ||||
|             this.setProduce_info_list(codeRelationDto.getJSONObject("produce_info_list")); | ||||
|         } | ||||
|     } | ||||
|     public RelCodeBatch disposeRelCodeBatch(String customerId){ | ||||
|         JSONArray jsonArrayBaseInfoDto  = this.getBase_infos_dto().getJSONObject("base_info_list").getJSONArray("base_info_dto"); | ||||
|         JSONObject jsonObject = (JSONObject) jsonArrayBaseInfoDto.get(0); | ||||
|         RelCodeBatch relCodeBatch = new RelCodeBatch(); | ||||
|         List<Map<String, String>> jsonArray = (List) this.getCode_relation_list().get("code_info"); | ||||
|         Integer oneLevelCount = 0; | ||||
|         Integer twoLevelCount = 0; | ||||
|         Integer threeLevelCount = 0; | ||||
|         String parentCode  = null; | ||||
|         if (jsonArray != null && jsonArray.size() > 0) { | ||||
|             parentCode = jsonArray.get(0).get("parent_code"); | ||||
|             relCodeBatch.setCurCode(parentCode); | ||||
| 
 | ||||
|             for (Map<String, String> map : jsonArray) { | ||||
|                 switch (map.get("code_level")) { | ||||
|                     case "1": | ||||
|                         oneLevelCount++; | ||||
|                         break; | ||||
|                     case "2": | ||||
|                         twoLevelCount++; | ||||
|                         break; | ||||
|                     case "3": | ||||
|                         threeLevelCount++; | ||||
|                         break; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| //        relCodeBatch.setId();
 | ||||
|         relCodeBatch.setProductCode(FilterUdiUtils.getUdi(parentCode).getUdi()); | ||||
|         relCodeBatch.setSubTypeNo(this.getCode_active_info_dto().getStr("relation_type")); | ||||
|         relCodeBatch.setCascadeRatio(jsonObject.getStr("pkg_ratio")); | ||||
|         relCodeBatch.setPackageSpec(jsonObject.getStr("pkg_spec")); | ||||
| //        relCodeBatch.setComment();
 | ||||
|         relCodeBatch.setBatchNo(jsonObject.getStr("produce_batch_no")); | ||||
|         relCodeBatch.setMadeDate(jsonObject.getStr("produce_date")); | ||||
|         relCodeBatch.setValidateDate(jsonObject.getStr("exprie_date")); | ||||
|         relCodeBatch.setWorkShop(jsonObject.getStr("exprie_date")); | ||||
| //        relCodeBatch.setLineName();
 | ||||
|         relCodeBatch.setLineManager(jsonObject.getStr("oper_ic_name")); | ||||
| //        relCodeBatch.setCreateTime();
 | ||||
| //        relCodeBatch.setCreateUser();
 | ||||
|         relCodeBatch.setUpdateTime(new Date()); | ||||
|         relCodeBatch.setUpdateUser(customerId); | ||||
|         relCodeBatch.setUploadFlagUp(0); | ||||
|         relCodeBatch.setUploadFlagDown(0); | ||||
|         relCodeBatch.setParentCode(null); | ||||
|         relCodeBatch.setErpId(customerId); | ||||
| 
 | ||||
|         relCodeBatch.setOneLevelCount(oneLevelCount); | ||||
|         relCodeBatch.setTwoLevelCount(twoLevelCount); | ||||
|         relCodeBatch.setThreeLevelCount(threeLevelCount); | ||||
| 
 | ||||
|         return relCodeBatch; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     public List<RelCodeDetail> disposeRelRodeDetailList(Integer batchIdFk) { | ||||
|         List<RelCodeDetail> list = new ArrayList<>(); | ||||
|         List<Map<String, String>> jsonArray = (List) this.getCode_relation_list().get("code_info"); | ||||
|         if (jsonArray != null && jsonArray.size() > 0) { | ||||
|             for (Map<String, String> map : jsonArray) { | ||||
|                 if (!Objects.isNull(map)) { | ||||
|                     RelCodeDetail relCodeDetail = new RelCodeDetail(); | ||||
|                     relCodeDetail.setCurCode(map.get("code")); | ||||
|                     relCodeDetail.setPackLayer(Integer.valueOf(map.get("code_level"))); | ||||
|                     relCodeDetail.setParentCode(map.get("parent_code")); | ||||
|                     Integer flag = null; | ||||
|                     switch (map.get("status")) { | ||||
|                         case "I": | ||||
|                             flag = 1; | ||||
|                             break; | ||||
|                         case "O": | ||||
|                             flag = 0; | ||||
|                             break; | ||||
|                     } | ||||
|                     relCodeDetail.setFlag(flag); | ||||
|                     relCodeDetail.setBatchIdFk(batchIdFk); | ||||
|                     list.add(relCodeDetail); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return list; | ||||
|     } | ||||
| } | ||||
					Loading…
					
					
				
		Reference in New Issue