| 
					
				 | 
			
			
				@ -1,6 +1,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.fasterxml.jackson.core.type.TypeReference; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.fasterxml.jackson.databind.ObjectMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.archives.PatientArchives; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.archives.PatientArchivesInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.iot.device.IotDeviceQualityInspectionPlanDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9,6 +13,7 @@ import com.yihu.jw.restmodel.archives.PatientArchivesVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.archives.Test; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.common.Envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.common.EnvelopRestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.iot.device.IotDeviceImportVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.archives.PatientArchivesMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.iot.IotRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.service.PatientArchivesSevice; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -16,10 +21,8 @@ import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.GetMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.RequestParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.cloud.sleuth.Tracer; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -33,7 +36,8 @@ import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class PatientArchivesController extends EnvelopRestController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientArchivesSevice patientArchivesSevice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private Tracer tracer; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = "test") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "测试") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Test test(){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -57,6 +61,7 @@ public class PatientArchivesController extends EnvelopRestController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return patientArchivesSevice.queryPatientArchivesPage(page,size,status, cancelReseanType ,name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tracer.getCurrentSpan().logEvent(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Envelop.getError(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -69,39 +74,44 @@ public class PatientArchivesController extends EnvelopRestController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return patientArchivesSevice.queryPatientArchivesInfoPage(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tracer.getCurrentSpan().logEvent(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Envelop.getError(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = PatientArchivesMapping.Archives.createPatientArchives) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = PatientArchivesMapping.Archives.createPatientArchives) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "创建健康信息详情列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop<Boolean> createPatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                  @RequestParam(value = "patientArchives", required = true)String patientArchives, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                  @ApiParam(name = "list", value = "建档详情") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                  @RequestParam(value = "list", required = true)List<PatientArchivesInfoVO> list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                  @ApiParam(name = "list", value = "建档详情Json") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                  @RequestParam(value = "list", required = true)String list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            PatientArchives ps = toEntity(patientArchives, PatientArchives.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<PatientArchivesInfo> infos = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            convertToModels(list,infos,PatientArchivesInfo.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<PatientArchivesInfo> infos = new ObjectMapper().readValue(list, new TypeReference<List<PatientArchivesInfo>>(){}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return patientArchivesSevice.createPatientArchives(ps,infos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tracer.getCurrentSpan().logEvent(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Envelop.getError(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = PatientArchivesMapping.Archives.updatePatientArchives) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PutMapping(value = PatientArchivesMapping.Archives.updatePatientArchives) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "更新健康信息详情列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop<Boolean> updatePatientArchives(@ApiParam(name = "patientArchives", value = "建档基本信息Json") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                  @RequestParam(value = "patientArchives", required = true)String patientArchives, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                  @ApiParam(name = "list", value = "建档详情") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                  @RequestParam(value = "list", required = true)List<PatientArchivesInfoVO> list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                  @RequestParam(value = "list", required = true)String list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            PatientArchives ps = toEntity(patientArchives, PatientArchives.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<PatientArchivesInfo> infos = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            convertToModels(list,infos,PatientArchivesInfo.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<PatientArchivesInfo> infos = new ObjectMapper().readValue(list, new TypeReference<List<PatientArchivesInfo>>(){}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return patientArchivesSevice.updatePatientArchives(ps,infos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tracer.getCurrentSpan().logEvent(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Envelop.getError(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 |