| | |
| | | import cn.lihu.jh.module.ecg.service.queue.QueueServiceTxFunctions; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.dataformat.xml.XmlMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class DevRentServiceImpl implements DevRentService { |
| | | |
| | | @Resource |
| | | QueueServiceTxFunctions queueServiceTxFunctions; |
| | | |
| | | @Resource |
| | | private RemoteDataService remoteDataService; |
| | | private FeeConfirmFeignService feeConfirmFeignService; |
| | | |
| | | @Resource |
| | | private DevRentMapper devRentMapper; |
| | |
| | | String userNickname = SecurityFrameworkUtils.getLoginUserNickname(); |
| | | Long rent_id = createReqVO.getId(); |
| | | |
| | | // 对于已有领用,但是装机时使用的不是已领用设备,需释放 源领用 设备 |
| | | DevRentDO devRentDO = getDevRent(rent_id); |
| | | |
| | | // 对于已有领用,但是装机时使用的不是已领用设备,报错 |
| | | if ( null != devRentDO.getDevId() && !createReqVO.getDevId().equals(devRentDO.getDevId()) ) { |
| | | markDevFree( devRentDO.getDevId(), rent_id); |
| | | throw exception(DEVICE_NOT_PAT_RECEIVED); |
| | | } |
| | | |
| | | // 设置设备 使用中 |
| | |
| | | item.setExeDateTime( getCurTimeString() ); // |
| | | ExmRequest exmRequest = new ExmRequest(); |
| | | exmRequest.setAuthorOrganization("47162057-2"); |
| | | exmRequest.setRequestId( patDetails.getApplyNo() ); // |
| | | exmRequest.setRequestId( devRentDO.getApplyNo() ); // |
| | | exmRequest.setPatientType( getPatientType(patDetails.getSource()) ); // |
| | | exmRequest.setItem(item); |
| | | hisFeeConfirmReqBody.setExmRequest(exmRequest); |
| | | HisFeeConfirmRespResult result = remoteDataService.httpFeeApi("UpdateExmRequestStatus", "ECG", "ECG", hisFeeConfirmReqBody); |
| | | HisFeeConfirmRespResult result = feeConfirmFeignService.httpFeeApi("UpdateExmRequestStatus", "ECG", "ECG", hisFeeConfirmReqBody); |
| | | log.info( result.getMsgHeader().getStatus() ); |
| | | Integer returnValue = result.getMsgHeader().getStatus().equals("true") ? 0 : 1; |
| | | if (0 == returnValue) { |
| | | devRentMapper.setPaid(rentId, isFeeConfirmOrCancel ? 1 : 0); |
| | | } |
| | | return returnValue; |
| | | return returnValue; // 0 成功 1 失败 |
| | | } |
| | | |
| | | // 标记 设备已被领取 |