首页签出接口定义
parent
427f9aa7e2
commit
50ddc2108f
@ -0,0 +1,48 @@
|
|||||||
|
package com.docus.server.collection.controller;
|
||||||
|
|
||||||
|
import com.docus.core.util.Func;
|
||||||
|
import com.docus.infrastructure.web.api.CommonResult;
|
||||||
|
import com.docus.infrastructure.web.api.ResultCode;
|
||||||
|
import com.docus.server.collection.converter.FirstPageCheckoutConverter;
|
||||||
|
import com.docus.server.collection.dto.FirstPageCheckoutInDTO;
|
||||||
|
import com.docus.server.collection.dto.FirstPageCheckoutRequest;
|
||||||
|
import com.docus.server.collection.service.MzZyHisService;
|
||||||
|
import com.docus.server.collection.validator.RequestValidator;
|
||||||
|
import com.docus.server.collection.validator.ValidateResult;
|
||||||
|
import com.docus.server.collection.validator.impl.FirstPageCheckoutRequestValidator;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Api("梅州中西HIS相关接口")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/his")
|
||||||
|
public class MzZyHisController {
|
||||||
|
@Resource
|
||||||
|
private MzZyHisService mzZyHisService;
|
||||||
|
|
||||||
|
@ApiOperation("首页签出")
|
||||||
|
@PostMapping("/firstPageCheckout")
|
||||||
|
public CommonResult<String> firstPageCheckout(@RequestBody FirstPageCheckoutRequest firstPageCheckoutRequest) {
|
||||||
|
log.info("首页签出接口参数:{}", Func.toJson(firstPageCheckoutRequest));
|
||||||
|
// 验证数据
|
||||||
|
RequestValidator validator = new FirstPageCheckoutRequestValidator(firstPageCheckoutRequest);
|
||||||
|
ValidateResult validateResult = validator.validate();
|
||||||
|
if (validateResult.getResultCode() == ResultCode.FAILED) {
|
||||||
|
return CommonResult.failed(validateResult.getMsg());
|
||||||
|
}
|
||||||
|
// 转换数据,业务处理
|
||||||
|
FirstPageCheckoutConverter converter = new FirstPageCheckoutConverter(firstPageCheckoutRequest);
|
||||||
|
FirstPageCheckoutInDTO checkoutInDTO = converter.req2dto();
|
||||||
|
mzZyHisService.firstPageCheckout(checkoutInDTO);
|
||||||
|
return CommonResult.success("操作成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.docus.server.collection.converter;
|
||||||
|
|
||||||
|
import com.docus.server.collection.dto.FirstPageCheckoutInDTO;
|
||||||
|
import com.docus.server.collection.dto.FirstPageCheckoutRequest;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页签出转换
|
||||||
|
*
|
||||||
|
* @author WYBDEV
|
||||||
|
*/
|
||||||
|
public class FirstPageCheckoutConverter {
|
||||||
|
private FirstPageCheckoutRequest firstPageCheckoutRequest;
|
||||||
|
|
||||||
|
public FirstPageCheckoutConverter(FirstPageCheckoutRequest firstPageCheckoutRequest) {
|
||||||
|
this.firstPageCheckoutRequest = firstPageCheckoutRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FirstPageCheckoutConverter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求参数转service处理参数
|
||||||
|
*
|
||||||
|
* @return service处理参数
|
||||||
|
*/
|
||||||
|
public FirstPageCheckoutInDTO req2dto() {
|
||||||
|
FirstPageCheckoutRequest firstPageCheckoutRequest = this.firstPageCheckoutRequest;
|
||||||
|
if (Objects.isNull(firstPageCheckoutRequest)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
FirstPageCheckoutInDTO dto = new FirstPageCheckoutInDTO();
|
||||||
|
dto.setSyncType(firstPageCheckoutRequest.getSyncType());
|
||||||
|
dto.setPatientInfo(firstPageCheckoutRequest.getPatientInfo());
|
||||||
|
dto.setSysId(firstPageCheckoutRequest.getSysId());
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.docus.server.collection.service;
|
||||||
|
|
||||||
|
import com.docus.server.collection.dto.FirstPageCheckoutInDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wyb
|
||||||
|
*/
|
||||||
|
public interface MzZyHisService {
|
||||||
|
/**
|
||||||
|
* 首页签出
|
||||||
|
*
|
||||||
|
* @param checkoutInDTO 首页签出参数
|
||||||
|
*/
|
||||||
|
void firstPageCheckout(FirstPageCheckoutInDTO checkoutInDTO);
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.docus.server.collection.service.impl;
|
||||||
|
|
||||||
|
import com.docus.server.collection.dto.FirstPageCheckoutInDTO;
|
||||||
|
import com.docus.server.collection.service.MzZyHisService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wyb
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class MzZyHisServiceImpl implements MzZyHisService {
|
||||||
|
@Override
|
||||||
|
public void firstPageCheckout(FirstPageCheckoutInDTO dto) {
|
||||||
|
System.out.println(dto);
|
||||||
|
// todo 首页签出处理逻辑
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.docus.server.collection.validator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求参数验证
|
||||||
|
* @author WYBDEV
|
||||||
|
*/
|
||||||
|
public interface RequestValidator {
|
||||||
|
/**
|
||||||
|
* 验证
|
||||||
|
* @return 返回验证结果
|
||||||
|
*/
|
||||||
|
ValidateResult validate();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.docus.server.collection.validator;
|
||||||
|
|
||||||
|
import com.docus.infrastructure.web.api.ResultCode;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author WYBDEV
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ValidateResult {
|
||||||
|
/**
|
||||||
|
* 验证结果代码
|
||||||
|
*/
|
||||||
|
private ResultCode resultCode;
|
||||||
|
/**
|
||||||
|
* 验证结果信息
|
||||||
|
*/
|
||||||
|
private String msg;
|
||||||
|
public ValidateResult(ResultCode resultCode,String msg){
|
||||||
|
this.resultCode=resultCode;
|
||||||
|
this.msg=msg;
|
||||||
|
}
|
||||||
|
public static ValidateResult success(String msg){
|
||||||
|
return new ValidateResult(ResultCode.SUCCESS,msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ValidateResult failed(String msg){
|
||||||
|
return new ValidateResult(ResultCode.FAILED,msg);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue