syntax = "proto3";
package com.ywt.gapi.consult;

option java_generic_services = true;
option java_multiple_files = true;
option java_package = "com.ywt.gapi.consult";
option go_package = "/gapi";

//创建咨询订单请求
message CreateConsultingOrderRequest{
	int32 userId = 1;
	string mobile = 2;
	string patientName = 3;
	int32 age = 4;
	int32 sex = 5;
	string desc = 6;
	string images = 7;
	int32 doctorId = 8;
	int32 recordId = 9;
	string idNo = 10;				//身份证号
	int32 userPatientId = 11;		//对应user_patient表的id
	int32 terminal = 12;			//当前终端
	int32 shared = 13; 				//咨询内容是否可被分享查看，1-是 0-否
	int32 consultType = 14;			//咨询类型：1-咨询 2-复诊
}

//创建咨询订单响应
message CreateConsultingOrderResponse{
	int32 code = 1;
	repeated string imageUrl = 2;
	string sessionId = 3;
	int32 orderId = 4;
	int32 orderType = 5;
	string msg = 6;
}

//订单支付成功通知消息
message PayConsultingCallbackRequest{
    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;//本次操作自定义数据
}
//订单支付成功通知响应消息
message PayConsultingCallbackResponse{
    int32 code = 1;
    string info = 2;
}

//咨询订单接诊/退诊请求
message ArrangeConsultingRequest{
	int32 doctorId = 1;		//医生Id
    int32 orderId = 2;		//订单Id
    int32 isArranged = 3;	//1-接诊 0-退诊
}

//咨询订单接诊/退诊响应
message ArrangeConsultingResponse{
	int32 code = 1;
	string msg = 2;
	int32 patientId = 3;
}

message CancelConsultingRequest{
	int32 orderId = 1;
	int32 userId = 2;
}

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

//咨询订单退款回调
message RefundConsultingCallbackRequest{
    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 RefundConsultingCallbackResponse{
	int32 code = 1;
	string msg = 2;
}

//线上咨询排班
message ConsultingSchedule{
	int32 scheduleId = 1;
	int32 doctorId = 2;
	int64 createTime = 3;
	int32 datePeriod = 4;
	int32 repeated = 5;
	int32 week = 6;
	int64 scheduleDate = 7;
}

//线上咨询排班列表
message GetConsultingScheduleListRequest{
	int32 doctorId = 1;
}

message GetConsultingScheduleListResponse{
	int32 code = 1;
	string msg = 2;
	repeated ConsultingSchedule schedule = 3;
}

//设置线上咨询排班
message SetConsultingScheduleRequest{
	int32 doctorId = 1;
	int32 repeated = 2;
	string serviceDate = 3;
	int32 datePeriod = 4;
}

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

//取消线上排班
message CancelConsultingScheduleRequest{
	int32 doctorId = 1;
	int32 scheduleId = 2;
}

message CancelConsultingScheduleResponse{
	int32 code = 1;
	string msg = 2;
}
// 咨询订单定义类
message ConsultOrder{
	int32 orderId = 1;
	int32 consultId = 2;
	string orderTitle = 3;
	int32 orderType = 4;
	string orderNo = 5;
	string patientName = 6;
	int32 patientSex = 7;
	string strPatientSex = 8;
	string hospitalName = 9;
	string doctorName = 10;
	string deptName = 11;
	int64 createTime = 12;
	int32 orderAmount = 13;
	string strOrderAmount = 14;
	string statusName = 15;
	int32 doctorId = 16;
	int32 paymentStatus = 17;
	int32 userId = 18;
	string patientMobile = 19;
	int32 patientAge = 20;
	string description = 21;
	int32 hospitalId = 22;
	int32 deptId = 23;
	string sessionId = 24;
	int32 status = 25;
	int32 patientId = 26;
	string idNo = 27;
	int32 extStatus = 28;
}

// 得到咨询订单列表
message GetConsultOrderListRequest{
	int32 userId = 1;
	int32 pageIndex = 2;
	int32 pageSize = 3;
}
message GetConsultOrderListResponse{
	int32 code = 1;
	string msg = 2;
	repeated ConsultOrder consult = 3;
	int32 count = 4;
    int32 totalPages = 5;
}

//获取咨询订单详情请求
message GetConsultOrderRequest{
	int32 orderId = 1;
}
//获取咨询订单详情响应
message GetConsultOrderResponse{
	int32 code = 1;
	string msg = 2;
	ConsultOrder consult = 3;	//咨询订单详情
	repeated string imageUrl = 4;	//订单图片链接
}

//咨询业务逻辑类		// 对应 rpc 项目的 ConsultingServiceImpl 类
service ConsultingService{
	//创建咨询订单
	rpc createConsultingOrder(CreateConsultingOrderRequest) returns (CreateConsultingOrderResponse);

	//订单支付成功通知
	rpc payConsultingCallback(PayConsultingCallbackRequest) returns (PayConsultingCallbackResponse);

	//咨询订单接诊/退诊
	rpc arrangeConsulting(ArrangeConsultingRequest) returns (ArrangeConsultingResponse);

	//取消咨询订单
	rpc cancelConsulting(CancelConsultingRequest) returns (CancelConsultingResponse);

	//咨询订单退款回调
	rpc refundConsultingCallback(RefundConsultingCallbackRequest) returns (RefundConsultingCallbackResponse);

	//线上咨询排班列表
	rpc getConsultingScheduleList(GetConsultingScheduleListRequest) returns (GetConsultingScheduleListResponse);

	//设置线上咨询排班
	rpc setConsultingSchedule(SetConsultingScheduleRequest) returns (SetConsultingScheduleResponse);

	//取消线上排班
	rpc cancelConsultingSchedule(CancelConsultingScheduleRequest) returns (CancelConsultingScheduleResponse);

	// 得到咨询订单列表
	rpc getConsultOrderList(GetConsultOrderListRequest) returns (GetConsultOrderListResponse);

	//获取咨询订单详情
	rpc getConsultOrder(GetConsultOrderRequest) returns (GetConsultOrderResponse);
}