|
|
@ -32,11 +32,17 @@ import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.http.HttpRequest; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.BufferedReader; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
@ -66,7 +72,7 @@ public class ExternalController { |
|
|
|
@GetMapping("/http/getUserInfo") |
|
|
|
@DataSource(DataSourceType.MASTER) |
|
|
|
public Object test(@RequestParam("from") String from, @RequestParam("memberid") String memberid) { |
|
|
|
log.info("获取人员信息:{},{}",from, memberid); |
|
|
|
log.info("获取人员信息:{},{}", from, memberid); |
|
|
|
checkoutData(from); |
|
|
|
ExternalVo.Result query = externalService.query(from, memberid); |
|
|
|
if (query == null) { |
|
|
@ -85,7 +91,7 @@ public class ExternalController { |
|
|
|
} |
|
|
|
//切换数据源查询
|
|
|
|
DynamicDataSourceContextHolder.setDataSourceType(dataSourceList.get(0).getDataSourceKey()); |
|
|
|
}catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
throw new BaseException("UUID错误:{}", from); |
|
|
|
} |
|
|
|
|
|
|
@ -111,14 +117,14 @@ public class ExternalController { |
|
|
|
@Anonymous |
|
|
|
@ApiOperation("上传数据") |
|
|
|
@PostMapping("/http/uploadMemberInfo") |
|
|
|
public Object add(@RequestBody String str){ |
|
|
|
public Object add(@RequestBody String str) { |
|
|
|
log.info("str:{}", str); |
|
|
|
JSONArray objects = new JSONArray(str); |
|
|
|
List<ExternalDto.RtcfInfoDto> list = new ArrayList<>(); |
|
|
|
for (Object object : objects) { |
|
|
|
list.add(BeanUtil.copyProperties(object, ExternalDto.RtcfInfoDto.class)); |
|
|
|
} |
|
|
|
log.info("上传数据dto123:{}",list); |
|
|
|
log.info("上传数据dto123:{}", list); |
|
|
|
// List<ExternalDto.RtcfInfoDto> list = dto.getList();
|
|
|
|
int add = 0; |
|
|
|
for (ExternalDto.RtcfInfoDto rtcfInfoDto : list) { |
|
|
@ -134,7 +140,7 @@ public class ExternalController { |
|
|
|
@Anonymous |
|
|
|
@ApiOperation("上传数据") |
|
|
|
@PostMapping("/http/addReportImage") |
|
|
|
public Object addReportImage(MultipartFile image){ |
|
|
|
public Object addReportImage(MultipartFile image) { |
|
|
|
try { |
|
|
|
//切换数据源
|
|
|
|
String str = removeExtension(image.getOriginalFilename()); |
|
|
@ -160,9 +166,7 @@ public class ExternalController { |
|
|
|
reportImageDto.setMemberId(str); |
|
|
|
externalService.addReportImage(reportImageDto); |
|
|
|
return ajax; |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
} catch (Exception e) { |
|
|
|
return AjaxResult.error(e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
@ -177,26 +181,53 @@ public class ExternalController { |
|
|
|
|
|
|
|
@ApiOperation("上传数据查询") |
|
|
|
@PostMapping("/http/list") |
|
|
|
public List<UplRtcfInfo> list(){ |
|
|
|
public List<UplRtcfInfo> list() { |
|
|
|
return externalService.list(); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据诊疗档案ID查询人体成分信息") |
|
|
|
@PostMapping("/api/http/selectByMemberId") |
|
|
|
public JsonResponse<UplRtcfInfoVo.Result> selectByMemberId(@RequestBody @Validated ExternalDto.MemberDto dto){ |
|
|
|
return JsonResponse.ok(externalService.selectByMemberId(dto.getId(), dto.getMemberId())); |
|
|
|
public JsonResponse<UplRtcfInfoVo.Result> selectByMemberId(@RequestBody @Validated ExternalDto.MemberDto dto) { |
|
|
|
return JsonResponse.ok(externalService.selectByMemberId(dto.getId(), dto.getMemberId())); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据住院号/门诊号查询人体成分报告") |
|
|
|
@PostMapping("/api/http/selectReportByMemberId") |
|
|
|
public JsonResponse<UplReportImage> selectReportByMemberId(@RequestBody @Validated ExternalDto.MemberDto dto){ |
|
|
|
public JsonResponse<UplReportImage> selectReportByMemberId(@RequestBody @Validated ExternalDto.MemberDto dto) { |
|
|
|
return JsonResponse.ok(externalService.selectReportByMemberId(dto.getId())); |
|
|
|
} |
|
|
|
|
|
|
|
// @Anonymous
|
|
|
|
// @ApiOperation("身高体重仪和针灸系统的对接")
|
|
|
|
// @RequestMapping(value = "/api/http/dmh", method = {RequestMethod.GET, RequestMethod.POST})
|
|
|
|
// public JsonResponse<Integer> dmh(String str){
|
|
|
|
// //W:066.5 H:173.5\r\n
|
|
|
|
// log.info("身高体重仪和针灸系统的对接:{}", str);
|
|
|
|
// externalService.dmh(str);
|
|
|
|
// return JsonResponse.ok();
|
|
|
|
// }
|
|
|
|
|
|
|
|
@Anonymous |
|
|
|
@ApiOperation("身高体重仪和针灸系统的对接") |
|
|
|
@RequestMapping(value = "/api/http/dmh", method = {RequestMethod.GET, RequestMethod.POST}) |
|
|
|
public JsonResponse<Integer> dmh(@RequestBody String str){ |
|
|
|
public JsonResponse<Integer> dmh(HttpServletRequest request) { |
|
|
|
|
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
InputStream is = null; |
|
|
|
String error = "error"; |
|
|
|
try { |
|
|
|
is = request.getInputStream(); |
|
|
|
InputStreamReader isr = new InputStreamReader(is, "GBK"); |
|
|
|
BufferedReader br = new BufferedReader(isr); |
|
|
|
String s = ""; |
|
|
|
while ((s = br.readLine()) != null) { |
|
|
|
sb.append(s); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
String str =sb.toString(); |
|
|
|
log.info(str); |
|
|
|
//W:066.5 H:173.5\r\n
|
|
|
|
log.info("身高体重仪和针灸系统的对接:{}", str); |
|
|
|
externalService.dmh(str); |
|
|
@ -206,7 +237,7 @@ public class ExternalController { |
|
|
|
@DataSource(DataSourceType.MASTER) |
|
|
|
@ApiOperation("查询身高体重") |
|
|
|
@PostMapping("/api/http/getWeightHeight") |
|
|
|
public JsonResponse<HmsWeightHeight> getWeightHeight(){ |
|
|
|
public JsonResponse<HmsWeightHeight> getWeightHeight() { |
|
|
|
return JsonResponse.ok(externalService.getWeightHeight()); |
|
|
|
} |
|
|
|
|
|
|
|