/**
 云胶片北京维卓接口 grpc 内部服务
 对应实现文件：src/controllers/cloudfilmControllers.js
 项目地址：https://gogs.ywtinfo.com/ywt/rest-api.git

 云胶片虎丘加密码算法 grpc 内部服务
 对应实现文件：src/provider/cloudfilm.js
 项目地址：https://gogs.ywtinfo.com/ywt/base-service.git

*/
syntax = "proto3";
package com.ywt.gapi.third.cloudfilm;

option java_multiple_files = true;
option java_package = "com.ywt.gapi.third.cloudfilm";
option java_outer_classname = "CloudfilmProto";

//获取3D重构待处理订单列表信息请求
message GetOrderListRequest{
    int32 hospitalId = 1;  //医院Id（太和医院为12）
}


//获取3D重构待处理订单列表信息响应
message GetOrderListResponse{
    message orderInfo {
        string accessionNumber = 1; //检查单号
        string patientId = 2;//病人ID
        string patientName = 3;//病人姓名
        string note = 4;//需求说明
    }

    int32 code = 1;
    string info = 2;
    repeated orderInfo list = 3;
}


//接收已完成结果信息请求
message SetCompleteResultRequest{
    int32 hospitalId = 1;  //医院Id（太和医院为12）
    string accessionNumber = 2;  //检查单号
    string pacsViewUrl = 3;  //3D结果公网可访问
}

//接收已完成结果信息响应
message SetCompleteResultResponse{
    int32 code = 1;
    string info = 2;
}


message Get2DCloudfilmUrlRequest {
    string phone = 1;    //手机号
    string idNo = 2;    //身份证号
    string cardNo = 3;  //卡号
    string hospitalNo = 4;   //门诊号或者住院院号
    int32 hospitalId = 5;  //本地医院ID，需求转换成虎丘的医生ID
    string accessionNumber = 6;  //检查单号
    string patientId = 7;   //病人ID
    string patientName = 8;
}


message Get2DCloudfilmUrlResponse {
    int32 code = 1;
    string msg = 2;
    string pacsViewUrl =3;
}

message CreateOrderRequest {
    string checkResultId = 1;
    int32 medicalCardId = 2;
    string reportNum = 3;
    string reportType = 4;
    int32 terminal = 5;
}

message CreateOrderResponse {
    int32 code = 1;
    string msg = 2;
    int32 orderId = 3;
    string orderNo = 4;
    bool isPaid = 5;
}

//订单支付成功通知消息
message PayCallbackRequest{
    string orderNo = 1;
    int32 orderId = 2;
    int32 payType = 3; //1: 微信; 2: 管理员线下收费
    string custom = 4; //回发创建单时设置的自定义数据
    int32 bizId = 5;
    string paymentNo = 6; //订单中心支付流水号
    int32 userId = 7;//用户id
    string prepayId = 8; //本次支付微信 prepay_id
    int32 terminal = 9;  //发起支付终端
    string openid = 10; //完成微信支付的微信用户 openid
    int32 paymentChannel = 11;
    string oneTimeCustom = 12;//本次操作自定义数据
    string wxTransactionId = 13; //本次微信支付交易流水号
    int64 payFinishDate = 14; //支付完成时间，单位：秒
}

//订单支付成功通知响应消息
message PayCallbackResponse{
    int32 code = 1;
    string info = 2;
}

message GetConfigRequest {
    int32 hospitalId = 1;
}

message GetConfigResponse {
    int32 code = 1;
    string info = 2;
    int32 checkResultFee = 3;
    int32 estWaitTime = 4;
}

message GetReportInfoRequest {
    string reportId = 1;
    int32 medicalCardId = 2;
    string reportNum = 3;
    string reportDate = 4;//格式yyyy-MM-dd
    string reportType = 5;// 检查类型
}

message GetReportInfoResponse {
    int32 code = 1;
    string info = 2;
    int32 orderId = 3;
    string url2D = 4;
    string url3D = 5;
    bool visible2D = 6;
    bool visible3D = 7;
}

//获取账单请求消息
message GetOrderBillRequest {
    string billDate = 1;    //下载对账单的日期，格式：20180603
    int32 hospitalId = 2;
}

//获取账单响应消息
message GetOrderBillResponse {
    int32 code = 1;
    string info = 2;
    string data = 3;        //账单数据 csv数据格式
}

// 影像报告订单退款回调
message RefundCheckResultOrderCallbackRequest{
    int32 amount = 1;       //已退金额
    int32 bizId = 2;
    int32 orderId = 3;
    string orderNo = 4;
    string refundNo = 5;    //退款单号
    int32 refundStatus = 6; //退款状态 1: 退款成功，2: 退款异常，3: 退款关闭
    string custom = 7;      //回发 custom 数据
}

message RefundCheckResultOrderCallbackResponse{
    int32 code = 1;
    string msg = 2;
}

// 对应 rpc 项目的 CloudfilmServiceImpl入口 文件(3d业务，rest-api项目)
service CloudfilmService{
    //获取3D重构待处理订单列表
    rpc getOrderList(GetOrderListRequest) returns (GetOrderListResponse);

    //接收3D已完成结果
    rpc setCompleteResult(SetCompleteResultRequest) returns (SetCompleteResultResponse);
    // 下单
    rpc createOrder(CreateOrderRequest) returns (CreateOrderResponse);
    // 支付成功回调
    rpc payCallback(PayCallbackRequest) returns (PayCallbackResponse);
    // 获取配置
    rpc getConfig(GetConfigRequest) returns (GetConfigResponse);
    // 获取报告信息
    rpc getReportInfo(GetReportInfoRequest) returns (GetReportInfoResponse);

    //获取账单
    rpc getOrderBill(GetOrderBillRequest) returns (GetOrderBillResponse);

    //影像报告订单退款回调
    rpc refundCheckResultOrderCallback(RefundCheckResultOrderCallbackRequest) returns (RefundCheckResultOrderCallbackResponse);
}

//对应 rpc 项目的 Cloudfilm2DServiceImpl入口 文件(2d业务，base_service项目)
service Cloudfilm2DService{
    //获取2d加密URL结果
    rpc get2DCloudfilmUrl(Get2DCloudfilmUrlRequest) returns (Get2DCloudfilmUrlResponse);


}


