syntax = "proto3";

package com.ywt.gapi.taihe.biz;

option java_multiple_files = true;
option java_package = "com.ywt.gapi.taihe.biz";
option java_outer_classname = "TaiheBizProto";

message MriBookingRequest {
    int32 userId = 1;
    string name = 2;
    int32 sex = 3;
    string mobile = 4;
    string date = 5;
}

message MriBaseResponse {
    int32 code = 1;
    string info = 2;
}

message GetScreeningTableRequest {
    int32 userId = 1;
}

message PatientInfo {
    string patientName = 1;
    int32 sex = 2;
    string birthday = 3;
    string patientMobile = 4;
    string address = 5;
}

message QuestionOption {
    int32 id = 1;
    string name = 2;
    bool value1 = 3;// checked or not
    string value2 = 4;
    string value3 = 5;
    repeated QuestionOption children = 6;
}

message Question {
    int32 questionId = 1;
    string category = 2;
    repeated QuestionOption options = 3;
}

message ScreeningTable {
    PatientInfo patientInfo = 1;
    repeated Question questions = 2;
    int32 tableId = 3;// 题目 id，大于 0 表示是修改答案
}

message GetScreeningTableResponse {
    int32 code = 1;
    string msg = 2;
    ScreeningTable screeningTable = 3;
}

message SubmitScreeningTableRequest {
    int32 userId = 1;
    ScreeningTable table = 2;
    string submitContent = 3;// 提交的内容，JSON 格式
    bool completed = 4;// 是否完成所有题目
}

message SubmitScreeningTableResponse {
    int32 code = 1;
    string msg = 2;
    int32 tableId = 3;
}

message GetAvailableBookNumRequest {
    string date = 1;
}

message GetAvailableBookNumResponse {
    int32 code = 1;
    string msg = 2;
    int32 count = 3;
}

// 太和定制业务
service TaiheBizService {
    // 预约
    rpc mriBooking (MriBookingRequest) returns (MriBaseResponse);
    // 获取筛查表，如果有之前提交的选项也一并返回
    rpc getScreeningTable (GetScreeningTableRequest) returns (GetScreeningTableResponse);
    // 提交筛查表选项
    rpc submitScreeningTable (SubmitScreeningTableRequest) returns (SubmitScreeningTableResponse);
    // 查询剩余号数
    rpc getAvailableBookNum (GetAvailableBookNumRequest) returns (GetAvailableBookNumResponse);
}