syntax = "proto3";

import "base.proto";

package com.ywt.gapi.user;

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

//用户信息
message User {
    int32 userid = 1;
    string username = 2;
    string realname = 3;
    string mobile = 4;
    int32 idtype = 5;
    string idno = 6;
    int32 sex = 7;
    int32 age = 8;
    string avatar = 9;
    string birthday = 10;
    int64 createtime = 11;
    string registerip = 12;
    int32 usertype = 13;
}

//银行卡信息
message BankCard{
    int32 bankCardId = 1;
    string bankName = 2;
    string logo = 3;
    string cardNo = 4;
    int32 type = 5;
}

//明细信息
message AccountDetail{
    int32 detailId = 1;
    double balance = 2;
    double amount = 3;
    string title = 4;
    int64 createTime = 5;
}



//获取微信小程序登录 token
message GetWxAppTokenRequest{
    string nickName = 1;
    int32 gender = 2;
    string language = 3;
    string city = 4;
    string province = 5;
    string country = 6;
    string avatarUrl = 7;
    string openid = 8;
    string sessionKey = 9;
    string unionid = 10;
    int32 expiresIn = 11;

}



//获取微信小程序登录 token
message GetWxAppTokenResponse{
    Result result = 1;
    int32 isUnion = 2;
    int32 userId = 3;
    string sessionId = 4;
}

//微信号关联手机号码
message BindWxAppMobileRequest{
    string mobile = 1;
    string openId = 2;
    string ip = 3;
}

message UserRequest {
    int32 userid = 1;
    string phone = 2;
}

message UserResponse {
    Result result = 1;
    User user = 2;
}

message AddBankCardRequest{
    int32 userId = 1;
    string name = 2;
    string cardNo = 3;
    string bankName = 4;
    int32 cardType = 5;
    string mobile = 6;
}

message AddBankCardResponse{
    Result result = 1;
    int32 cardId = 2;
    string cardNo = 3;
}

message BankCardListRequest{
    int32 doctorId = 1;
    int32 pageIndex = 2;
    int32 pageSize = 3;
}

message BankCardListResponse{
    Result result = 1;
    repeated BankCard bankCardList = 2;
    int32 count = 3;
    int32 totalPages = 4;
}

message AccountBalanceRequest{
    int32 userId = 1;
}

message AccountBalanceResponse {
    Result result = 1;
    double totalBalance = 2;// 账户总余额
    double withdrawableBalance = 3;// 可提现余额
}

message AccountDetailListRequest{
    int32 doctorId = 1;
    int32 pageIndex = 2;
    int32 pageSize = 3;
}

//账户明细列表
message AccountDetailListResponse{
    Result result = 1;
    repeated AccountDetail detailList = 2;
    int32 count = 3;
    int32 totalPages = 4;
}

message WithdrawRequest{
    int32 doctorId = 1;
    double amount = 2;
    int32 cardId = 3;
}

message FeedbackRequest{
    string content = 1;
    int32 origin = 2;
    int32 userId = 3;
}

message WithdrawRecord{
    int32 recordId = 1;
    double amount = 2;
    int64 createTime = 3;
    int32 cardId = 4;
    string cardNo = 5;
    int32 status = 6;
    int64 updateTime = 7;
    int32 auditStatus = 8;   //状态（1-待审核，2-审核通过，3-审核不通过）
    int32 userId = 9;
    string remark = 10;
}

message WithdrawRecordListRequest{
    int32 doctorId = 1;
    int32 pageIndex = 2;
    int32 pageSize = 3;
    int32 status = 4;
}

message WithdrawRecordListResponse{
    Result result = 1;
    repeated WithdrawRecord recordList = 2;
    int32 count = 3;
    int32 totalPages = 4;
}

//删除银行卡请求
message DelBankCardRequest{
    int32 doctorId = 1;
    int32 cardId = 2;
}

// 第三方账户信息
message SnsUser{
    int32 id = 1;
    string openId = 2;
    string unionId = 3;
    int32 userId = 4;
    string nickname = 5;
    int32 sex = 6;
    string province = 7;
    string city = 8;
    string country = 9;
    string avatar = 10;
    string language = 11;
    int32 snsType = 12;
    int32 status = 13;
    int64 createTime = 14;
}

message GetSnsUserRequest{
    string openId = 1;
    string unionId = 2;
    int32 userId = 3;
}

message GetSnsUserByOpenIdRequest{
    string openId = 1;
}

message GetSnsUserByUserIdRequest{
    int32 userId = 1;
}

message GetSnsUserResponse{
    Result result = 1;
    SnsUser snsUser = 2;
}

//诊疗卡
message MedicalCard{
    string patientId = 1;
    string patientName = 2;
    int32 sex = 3;
    string birthday = 4;
    string telephoneNo = 5;
    string mobile = 6;
    string documentId = 7;
    string address = 8;
    string idTypeCode = 9;
    string idTypeDesc = 10;
    string idNo = 11;
    string insureCardNo = 12;
    string accInfo = 13;
    string cardNo = 14;
    string cardType = 15;
    string patientType = 16;
    int32 balance = 17;
    int32 userId = 18;           //用户Id
    int32 hospitalId = 19;       //医院Id
    int32 cardId = 20;           //卡Id
    string hospitalName = 21;    //医院名称
    string hisPatientId = 22;    //his的病人ID
    string guardian = 23;        //监护人（家长姓名）
    int32 flag = 24;             //加号标识 1-是 0-否
}

//绑定诊疗卡请求
message AddMedicalCardRequest{
    int32 userId = 1;           //用户Id
    int32 hospitalId = 2;       //医院Id
    string cardNo = 3;          //卡号
    string realName = 4;        //姓名
    string mobile = 5;          //手机号
}

//获取诊疗卡列表请求
message GetMedicalCardListRequest{
    int32 userId = 1;           //用户Id
    int32 hospitalId = 2;       //医院Id
    int32 flag = 3;             //加号标识，1-是，0-否
}

//获取诊疗卡列表响应
message GetMedicalCardListResponse{
    Result result = 1;
    repeated MedicalCard medicalCards = 2;
}

//用户登录信息
message UserLoginInfo{
    int32 userId = 1;
    string userName = 2;
    string realName = 3;
    string mobile = 4;
    int32 idType = 5;
    string idNo = 6;
    int32 sex = 7;
    int32 age = 8;
    string avatar = 9;
    string birthday = 10;
    int64 createTime = 11;
    string registerIp = 12;
    int32 userType = 13;
    string title = 14;
    string specialty = 15;
    string briefIntro = 16;
    string hospitalName = 17;
    string deptName = 18;
    string city = 19;
    int32 status = 20;
    string province = 21;
    string area = 22;
    string hospitalIds = 23;
    string deptIds = 24;
    string qrCodeUrl = 25;
}

//通过手机号码登录请求
message LoginByMobileRequest{
    string mobile = 1;      //手机号
    int32 userType = 2;     //登录用户类型
    string ip = 3;          //IP地址
}

//通过用户名+密码登录请求
message LoginByUserNameRequest{
    string username = 1;    //用户名
    string pwd = 2;         //用户密码
}

//登录响应
message LoginResponse{
    Result result = 1;
    UserLoginInfo userLoginInfo = 2;
}

message MedicalRecordsImage{
    int32 id = 1;
    int32 doctorId = 2;
    int32 patientId = 3;
    string imageUrl = 4;
    int64 createTime = 5;
    int32 orderId = 6;
}

//删除诊疗卡请求
message DeleteMedicalCardRequest{
    int32 userId = 1;           //用户Id
    int32 cardId = 2;       //诊疗卡Id
}

message AddSnsUserRequest{
    string nickName = 1;
    int32 gender = 2;
    string language = 3;
    string city = 4;
    string province = 5;
    string country = 6;
    string avatarUrl = 7;
    string openid = 8;
    string sessionKey = 9;
    string unionid = 10;
    int32 expiresIn = 11;
    int32 snsType = 12;
    string privilege = 13;
    string accessToken = 14;
    string refreshToken = 15;
}

message BindWxRequest {
    string mobile = 1;
    string unionId = 2;
    string ip = 3;
    int32 terminal = 4; //终端类型
    string openId = 5;
    string name = 6; // 姓名
    string idNo = 7; // 身份证号
}

//获取公众号用户信息请求
message GetOffcialUserInfoRequest{
    int32 hospitalId = 1;
    string unionId = 2;
}

//获取公众号用户信息响应
message GetOffcialUserInfoResponse{
    Result result = 1;
    int32 userId = 2;
    int32 hasMedicalCard = 3;
}

message MedicalRecords{
    int32 id = 1;
    int32 userId = 2;
    string clinicCode = 3;
    string admTime = 4;
    string hospitalName = 5;
    string doctorName = 6;
    string doctorTitle = 7;
}

message GetMedicalRecordsListRequest{
    int32 medicalCardId = 1;
    int32 pageIndex = 2;
    int32 pageSize = 3;
    int32 userId = 4;
}

message GetMedicalRecordsListResponse{
    Result result = 1;
    repeated MedicalRecords records = 2;
    int32 count = 3;
    int32 totalPages = 4;
}

//更换手机号码请求
message ChangeMobileRequest{
    int32 userId = 1;
    string mobile = 2;
}

//病历详情
message MedicalRecordsDetail{
    int32 recordId = 1;
    string typeName = 2;
    string desc = 3;
    repeated string imageUrl = 4;                           //图片
    int32 doctorId = 5;
    int32 patientId = 6;
    int64 createTime = 7;
    string mobile = 8;
    int32 age = 9;
    int32 sex = 10;
    string patientName = 11;                                //患者姓名
    int32 userId = 12;
    string admTime = 13;                                    //患者入院日期
    string hospitalName = 14;                               //医院名称
    string doctorName = 15;                                 //医生名字
    string selfReport = 16;                                 //主诉
    string phyExam = 17;                                    //体格检查
    string diagnose = 18;                                   //诊断结果
    string suggestion = 19;                                 //意见
    string advice = 20;                                     //门急诊医嘱
    repeated LaboratoryReport laboratoryReport = 21;        //化验报告
    repeated InspectionReport inspectionReport = 22;        //检查报告
    string idNo = 23;                                       //身份证号

}

//获取病历详情请求
message GetMedicalRecordsDetailRequest{
    int32 recordId = 1;
}

//获取病历详情响应
message GetMedicalRecordsDetailResponse{
    Result result = 1;
    MedicalRecordsDetail detail = 2;
}

//获取病历列表请求
message GetMedicalRecordListByUserIdRequest{
    int32 userId = 1;
    int32 pageIndex = 2;
    int32 pageSize = 3;
}

//获取病历列表响应
message GetMedicalRecordListByUserIdResponse{
    Result result = 1;
    repeated MedicalRecordsDetail detail = 2;
    int32 count = 3;
    int32 totalPages = 4;
}

//获取公众号用户信息请求
message GetOfficialUserInfoRequest{
    int32 hospitalId = 1;
    string unionId = 2;
    int32 terminal = 3;         //终端
    string openId = 4;
}

//获取公众号用户信息响应
message GetOfficialUserInfoResponse{
    Result result = 1;
    int32 userId = 2;
    int32 hasMedicalCard = 3;
    string avatar = 4;
    string nickname = 5;
    string openId = 6;
    string mobile = 7;
    string unionId = 8;
    int32 sex = 9;
}

//检查结果
message InspectionReport{
    string reportId = 1;            //检查报告单id
    string reportTitle = 2;         //检查报告单标题名称
    int64 reportDate = 3;           //检查报告单审核日期（YYYY-MM-DD HH:MM:SS）
    int32 status = 4;               //报告状态 0 未审核 1已审核
    string patientName = 5;         //患者姓名
    string patientAge = 6;          //患者年龄
    int32 sex = 7;                  //性别
    string clinicalDiagnosis = 8;   //临床诊断
    string clinicSeq = 9;           //门诊就诊流水号
    string inpatientId = 10;        //住院流水号
    int32 id = 11;                  //主键Id
}

//检查结果详情
message InspectionReportDetail{
    string deptName = 1;            //申请科室名称
    string reportDoctorName = 2;    //报告医生姓名
    string checkParts = 3;          //检查部位
    string examination = 4;         //检查所见
    string diagnosis = 5;           //诊断结果
    string checkDoctorName = 6;     //检查医生（技师）姓名
    int64 examinationDate = 7;      //检查日期（YYYY-MM-DD HH:MM:SS）
    int64 verifyDate = 8;           //审核日期
    string verifyDocName = 9;       //审核医生
    string appDocName = 10;         //开单医生
    int32 id = 11;                  //主键Id
    string reportId = 12;           //检查报告单id
}

//获取检查结果列表请求
message GetInspectionReportListRequest{
    int32 medicalCardId = 1;        //诊疗卡Id
    int32 userId = 2;               //用户Id
}

//获取检查结果列表响应
message GetInspectionReportListResponse{
    Result result = 1;
    repeated InspectionReport report = 2;
}

//获取检查结果详情请求
message GetInspectionReportDetailRequest{
    string reportId = 1;            //检查报告单id
}

//获取检查结果详情响应
message GetInspectionReportDetailResponse{
    Result result = 1;
    InspectionReportDetail report = 2;
}

//化验报告
message LaboratoryReport {
    string inspectionId = 1;        //检验报告单id
    string inspectionName = 2;      //检验报告单标题名称
    int64 inspectionDate = 3;       //检验报告单审核日期（YYYY-MM-DD HH:MM:SS）
    int32 status = 4;               //报告状态 0 未审核 1已审核
    string patientName = 5;         //患者姓名
    string patientAge = 6;          //患者年龄
    int32 sex = 7;                  //性别
    string deptName = 8;            //申请科室名称
    string clinicalDiagnosis = 9;   //临床诊断
    string reportDoctorName = 10;   //报告医生姓名
    string clinicSeq = 11;          //门诊就诊流水号
    string inpatientId = 12;        //住院号
    string checkDoctorName = 13;    //审核医生姓名
    int32 id = 14;                  //主键
}

//化验报告详情
message LaboratoryReportDetail {
    string itemId = 1;          //检验指标代码
    string itemName = 2;        //检验指标中文名称
    string orderNo = 3;         //排序号，不需要排序的话可设成全部为0
    string testResult = 4;      //检测结果
    string unit = 5;            //剂量单位
    string itemRef = 6;         //参考值范围
    int64 testDate = 7;         //检查日期（YYYY-MM-DD HH:MM:SS）
    string testEngName = 8;     //检验指标英文名称
    string specimType = 9;      //检验标本
    string resultFlag = 10;     //异常标识
    int32 id = 11;              //主键
}

//获取化验报告列表请求
message GetLaboratoryReportListRequest{
    int32 medicalCardId = 1;    //诊疗卡Id
    int32 userId = 2;           //用户Id
}

//获取化验报告列表响应
message GetLaboratoryReportListResponse{
    Result result = 1;
    repeated LaboratoryReport report = 2;   //化验报告
}

//获取化验报告详情请求
message GetLaboratoryReportDetailRequest{
    string inspectionId = 1;    //检验报告单id
}

//获取化验报告详情响应
message GetLaboratoryReportDetailResponse{
    Result result = 1;
    repeated LaboratoryReportDetail detail = 2; //化验报告详情
    string inspectionName = 3;                  //检验报告单标题名称
    int64 inspectionDate = 4;                   //检验报告单审核日期（YYYY-MM-DD HH:MM:SS）
    string clinicalDiagnosis = 5;               //临床诊断
    string reportDoctorName = 6;                //报告医生姓名
    string checkDoctorName = 7;                 //审核医生姓名
    int32 status = 8;                           //报告状态 0 未审核 1已审核
}

//根据门诊ID获取检查结果列表请求
message GetInspectionReportListByHisPatientIdRequest{
    string hisPatientId = 1;        //hisPatientId
}

//根据门诊ID获取检查结果列表响应
message GetInspectionReportListByHisPatientIdResponse{
    int32 code = 1;
    string msg = 2;
    repeated InspectionReport report = 3;
}

//根据门诊ID获取化验报告列表请求
message GetLaboratoryReportListByHisPatientIdRequest{
    string hisPatientId = 1;        //hisPatientId
}

//根据门诊ID获取化验报告列表响应
message GetLaboratoryReportListByHisPatientIdResponse{
    int32 code = 1;
    string msg = 2;
    repeated LaboratoryReport report = 3;   //化验报告
}

//根据就诊流水号获取门诊病历
message GetMedicalRecordByClinicCodeRequest{
    string clinicCode = 1;
}

//根据就诊流水号获取门诊病历
message GetMedicalRecordByClinicCodeResponse{
    Result result = 1;
    MedicalRecordsDetail detail = 2;    //病历详情

}

//根据用户名和密码登录Request
message LoginWithUserAndPsdRequest{
    string username = 1;
    string password = 2;
    string ip = 3;
    int32 type = 4;
}

//根据用户名和密码登录Response
message LoginWithUserAndPsdResponse{
    Result result = 1;
    int32 doctorId = 2;
    string doctorName = 3;
    string deptIds = 4;
    string deptName = 5;
    int32 checkSign = 6;
    string signUrl = 7;
    int32 doctorSignId = 8;
    string doctorAvatar = 9;
    int32 isFirstLogin = 10; //判断在这个平台是否是首次登录
}


//跟新密码Request
message UpdatePasswordRequest{
    string mobile = 1;
    string password = 2;
}

//修改密码Request
message ChangePasswordRequest{
    int32 userId = 1;
    string oldPassword = 2;
    string newPassword = 3;
    string verifyPassword = 4;
}

//根据code拉取用户信息请求
message GetUserInfoByCodeRequest{
    string code = 1;    //换取access_token的票据
    int32 type = 2;     //终端类型
}

//根据code拉取用户信息响应
message GetUserInfoByCodeResponse{
    Result result = 1;
    int32 userId = 2;
    string openId = 3;
    string unionId = 4;
    string nickname = 5;
    string realName = 6;
    string avatar = 7;
}

//根据openid拉取用户信息请求 
message GetUserInfoByOpenIdRequest{
    string openId = 1;      //openid
    int32 terminal = 2;     //终端类型
}
//根据openid拉取用户信息响应
message GetUserInfoByOpenIdResponse{
    Result result = 1;
    int32 userId = 2;
    string openId = 3;
    string unionId = 4;
    string nickname = 5;
    string realName = 6;
}

//根据用户ID和Terminal获取用户基本信息请求
message GetUserInfoByUserIdAndTerminalRequest{
    int32 userId = 1;      //userId
    int32 terminal = 2;     //终端类型
}

//根据用户ID和Terminal获取用户基本信息响应
message GetUserInfoByUserIdAndTerminalResponse{
    Result result = 1;
    int32 userId = 2;
    string openId = 3;
    string unionId = 4;
    string nickname = 5;
    string realName = 6;
}

// 有加诊排班的医生
message ScheduleDoctorInfo{
    int32 doctorId = 1;             //医生ID
    string name = 2;                //医生姓名
    string hospital = 3;            //医院
    string specialty = 4;           //擅长
    string title = 5;               //职称
    string dept = 6;                //部门
    string hospitalIds = 7;        //医院ID
    string deptIds = 8;            //部门ID
    string briefIntro = 9;         //简介
    string avatar = 10;              //医生头像
}

//获取加诊医生列表请求
message GetScheduleDoctorListRequest{
    int32 hospitalId = 1;       //医院Id
    int32 deptId = 2;           //科室Id
    string name = 3;            //医生姓名
    string areaIds = 4;         //地区Id，e.g. 100000,110000,110001
    int32 pageIndex = 5;        //当前页数
    int32 pageSize = 6;         //每页大小
}

//获取加诊医生列表响应
message GetScheduleDoctorListResponse{
    Result result = 1;                      //结果
    repeated ScheduleDoctorInfo scheduleDoctorInfo = 2;     //有加诊排班的医生列表
    int32 totalPages = 3;   //总页数
    int32 count = 4;        //总条数
}

//用户新建就诊人
message UserCreateMedicalRecordRequest{
    int32 userId = 1;   //用户ID
    int32 age = 2;      //年龄
    int32 sex = 3;      //性别
    string name = 4;    //姓名
    string mobile = 5;  //手机号
    int32 recordId = 6;  //病历ID
    string idNo = 7;     //身份证号
}

//团队成员    create by daiyihua
message TeamDoctor{
    int32 doctorId = 1;         //医生ID
    string name = 2;            //医生姓名
    string avatar = 3;          //医生头像
    string title = 4;           //医生职称
    string hospital = 5;        //医生所在医院（名称）
    string dept = 6;            //医生所在科室（名称）
    string specialty = 7;       //医生擅长
}

//搜索的医生信息    create by daiyihua
message SearchDoctorInfo{
    int32 doctorId = 1;         //医生ID
    string doctorName = 2;      //医生姓名
    string title = 3;           //医生职称
    string hospitalName = 4;    //医院名称
    string deptName = 5;        //科室名称
    string avatar = 6;          //医生头像
    string specialty = 7;       //医生擅长
}

//根据科室搜索医生信息Request    create by daiyihua
message GetDoctorListByDeptIdRequest{
    int32 deptId = 1;
    int32 pageIndex = 2;        //当前页
    int32 pageSize = 3;         //每页大小
}

//根据科室搜索医生信息Response    create by daiyihua
message GetDoctorListByDeptIdResponse{
    Result result = 1;
    repeated SearchDoctorInfo searchDoctorInfo = 2;     //医生信息
    int32 count =  3;                                   //总条数
    int32 totalPages = 4;                               //总页数
}

//根据医生ID得到医生团队数量Request  create by daiyihua
message GetDoctorTeamCountRequest{
    int32 doctorId = 1;     //医生ID
}

//根据医生ID得到医生加号数量Request     create by daiyihua
message GetDoctorAdditionalCountRequest{
    int32 doctorId = 1;     //医生ID
}


//根据医院ID得到医院对象Reqeust   create by daiyihua
message GetHospitalByIdRequest{
    int32 hospitalId = 1;
}

//根据医院ID得到医院对象Response   create by daiyihua
message GetHospitalByIdResponse{
    Result result = 1;
    int32 hospitalId = 2;       //医院ID
    string hospitalName = 3;    //医院名称
}

//太和医院绑定诊疗卡Reqeust  create by daiyihua
message AddTaiheMedicalCardRequest{
    int32 userId = 1;           //用户Id
    int32 hospitalId = 2;       //医院Id
    string cardNo = 3;          //卡号
    string realName = 4;        //姓名
    string mobile = 5;          //手机号
//    string hisPatientId = 6;    //his的病人ID
    string guardian = 7;        //监护人（家长姓名）
    string address = 8 ;        //家庭住址
    string idNo = 9;
    int32 idType = 10;
    int32 sex = 11;
    string birthday = 12;
//    string insureCardNo = 13;
}

// 提现到微信请求
message WithdrawToWeChatRequest {
    int32 userId = 1;// 用户id
    double amount = 2;// 金额
    string openid = 3;          //用户openid
    string spbillCreateIp = 4;  //Ip地址

}

// 提现到微信响应
message WithdrawToWeChatResponse {
    Result result = 1;
    string orderNo = 2;
}

message WithdrawOrderPayRequest {
    string orderNo = 1;
    string openid = 2;// openid
}

message WithdrawOrderPayResponse {
    Result result = 1;
}

//用户扫描关注医生Request
message UserAttentionDoctorRequest{
    int32 userId = 1;       //用户ID
    int32 doctorId = 2;     //医生ID
}

//用户点击关注、取消医生Request
message GeneralAttentionDoctorRequest{
    int32 userId = 1;       //用户ID
    int32 doctorId = 2;     //医生ID
}

//用户点击关注、取消医生Request
message GeneralAttentionHospitalRequest{
    int32 userId = 1;       //用户ID
    int32 hospitalId = 2;   //医院ID
}

// 用户个人资料
message UserPatient{
    int32 user_patient_id = 1;  // 添加或修改的个人资料ID
    int32 user_id = 2;          // 用户ID
    string mobile = 3;          // 手机号码
    string idNo = 4;            // 身份证号
    string parent_name = 5;     // 家长姓名
    string name = 6;            // 姓名
    int32 sex = 7;             // 性别，1-男，2-女，0-未知
    int32 relationship = 8;     //与本人关系
}

// 得到用户个人资料列表Request
message GetUserPatientListRequest{
    int32 user_id = 1;          // 用户ID
    int32 pageSize = 2;
    int32 pageIndex = 3;
}

// 得到用户个人资料列表Response
message GetUserPatientListResponse{
    Result result = 1;          // 用户ID
    repeated UserPatient userPatient = 2;
    int32 count =  3;                                   //总条数
    int32 totalPages = 4;                               //总页数
}

// 编辑用户个人资料Request
message UpdateUserPatientInfo{
    UserPatient userPatient = 1;
}

// 得到单个用户个人资料Request
message GetUserPatientByIdRequest{
    int32 user_patient_id = 1;          // 用户ID
}

// 得到单个用户个人资料Response
message GetUserPatientByIdResponse{
    Result result = 1;          // 用户ID
    UserPatient userPatient = 2;
}

//保存社交账号信息请求消息
message SaveSnsUserInfoRequest {
    string openId = 1;
    string unionId = 2;
    int32 userId = 3;
    string nickname = 4;
    int32 sex = 5;
    string province = 6;
    string city = 7;
    string country = 8;
    string avatar = 9;
    string language = 10;
    int32 snsType = 11; //1: 微信小程序；2: 微信公众号
    int32 terminal = 12;
}

//保存社交账号信息响应消息
message SaveSnsUserInfoRespose {
    int32 code = 1;
    string info = 2;
    int32 userId = 3;
}

// 删除个人资料
message DelUserPatientRequest{
    int32 userPatientId = 1;
    int32 userId = 2;
}

//根据unionId和terminal判断是否需要更新sns_user_info表的userId request
message CheckAndUpdateSnsUserIdRequest {
    int32 terminal = 1;//关联的其他终端
    string unionId = 2;
    int32 userId = 3;//当前终端的userId
}

//更新关注医生状态（关注/取消关注）Request
message UpdateFollowedStatusRequest{
    int32 userId = 1;       //用户ID
    int32 doctorId = 2;     //医生ID
    int32 status = 3;       //1-关注 2-取关
}

//保存小程序用户信息
message SaveMinAppUserRequest{
    string openId = 1;
    string unionId = 2;
    int32 userId = 3;
    string nickname = 4;
    int32 sex = 5;
    string province = 6;
    string city = 7;
    string country = 8;
    string avatar = 9;
    string language = 10;
    int32 snsType = 11; //1: 微信小程序；2: 微信公众号
    int32 terminal = 12;
}

//保存小程序用户信息
message SaveMinAppUserResponse{
    int32 code = 1;
    string msg = 2;
    int32 userId = 3;
    string mobile = 4;
}

// 第三方账户信息
message SnsUserInfo{
    int32 id = 1;
    string openId = 2;
    string unionId = 3;
    int32 userId = 4;
    string nickname = 5;
    int32 sex = 6;
    string province = 7;
    string city = 8;
    string country = 9;
    string avatar = 10;
    string language = 11;
    int32 snsType = 12;
    int32 status = 13;
    int64 createTime = 14;
    int32 terminal = 15;
}

message GetSnsUserInfoRequest{
    string openId = 1;
    string unionId = 2;
    int32 userId = 3;
    int32 terminal = 4;
}

message GetSnsUserInfoResponse{
    int32 code = 1;
    string msg = 2;
    SnsUserInfo snsUserInfo = 3;
}

message UpdateSnsUserInfoByUserIdRequest{
    int32 userId = 1;
    string nickname = 2;
    int32 sex = 3;
    string province = 4;
    string city = 5;
    string country = 6;
    string avatar = 7;
    string language = 8;
    int32 terminal = 9;
}

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

//实名认证
message AuthenticateRequest{
    string idCardNo = 1;
    string realName = 2;
    int32 userId = 3;
}

//实名认证
message AuthenticateResponse{
    int32 code = 1;
    string msg = 2;
}

// 根据 userId 和 terminal 获取 snsUserInfo
message GetSnsUserInfoByUserIdAndTerminalRequest{
    int32 userId = 1;
    int32 terminal = 2;
}

message GetSnsUserInfoByUserIdAndTerminalResponse {
    int32 code = 1;
    string msg = 2;
    SnsUserInfo snsUserInfo = 3;
}

message GetUserListRequest {
    int32 userId = 1;
    string userName = 2;
    string mobile = 3;
    int32 pageIndex = 4;
    int32 pageSize = 5;
}

message GetUserListResponse {
    Result result = 1;
    repeated User user = 2;
    int32 count = 3;
    int32 totalPages = 4;
}

//用户相关服务  // 对应 rpc 项目的 UserServiceImpl 类
service UserService {
    rpc findByPhone(UserRequest) returns (UserResponse); //根据手机号获取用户信息
    rpc findByUserId(UserRequest) returns (UserResponse); //根据用户ID获取用户信息
    rpc addUser(User) returns (Result); //添加用户
    rpc addBankCard(AddBankCardRequest) returns (AddBankCardResponse);    //添加银行卡
    rpc getBankCardList(BankCardListRequest) returns (BankCardListResponse);    //获取我的银行卡列表
    rpc getAccountBalance(AccountBalanceRequest) returns (ResultDouble);    //获取我的账户余额
    // 获取我的账户余额，返回总余额以及可提现余额
    rpc getAccountBalanceNew(AccountBalanceRequest) returns (AccountBalanceResponse);
    rpc getAccountDetailList(AccountDetailListRequest) returns (AccountDetailListResponse); //获取账户明细列表
    rpc withdraw(WithdrawRequest) returns (Result);  //申请提现
    rpc feedback(FeedbackRequest) returns (Result);  //用户留言反馈
    rpc getWithdrawRecordList(WithdrawRecordListRequest) returns (WithdrawRecordListResponse);   //获取我的提现记录列表
    rpc delBankCard(DelBankCardRequest) returns (Result);   //删除银行卡
    rpc getWxAppToken(GetWxAppTokenRequest) returns (GetWxAppTokenResponse); //获取微信小程序登录 token
    rpc bindWxAppMobile(BindWxAppMobileRequest) returns (Result);    //微信号关联手机号码
    rpc getSnsUser(GetSnsUserRequest) returns (GetSnsUserResponse);    //获取第三方账户信息
    rpc getSnsUserByOpenId(GetSnsUserByOpenIdRequest) returns (GetSnsUserResponse);//获取第三方账户信息
    rpc getSnsUserByUserId(GetSnsUserByUserIdRequest) returns (GetSnsUserResponse);//获取第三方账户信息
    rpc addMedicalCard(AddMedicalCardRequest) returns (ResultInt); //绑定诊疗卡
    rpc getMedicalCardList(GetMedicalCardListRequest) returns (GetMedicalCardListResponse);  //获取诊疗卡列表数据
    rpc loginByMobile(LoginByMobileRequest) returns (LoginResponse);  //手机号码登录系统
    rpc loginByUserName(LoginByUserNameRequest) returns (LoginResponse);  //通过用户名+密码登录系统
    rpc deleteMedicalCard(DeleteMedicalCardRequest) returns (Result);   //删除诊疗卡请求
    rpc addSnsUser(AddSnsUserRequest) returns (Result);  //
    rpc bindWx(BindWxRequest) returns (Result);
    rpc getOffcialUserInfo(GetOffcialUserInfoRequest) returns (GetOffcialUserInfoResponse);//获取公众号用户信息
    rpc getMedicalRecordsList(GetMedicalRecordsListRequest) returns (GetMedicalRecordsListResponse);//获取咨询医生列表
    rpc changeMobile(ChangeMobileRequest) returns (Result);//更换手机号码
    rpc getOfficialUserInfo(GetOfficialUserInfoRequest) returns (GetOfficialUserInfoResponse);//获取公众号用户信息

    //获取用户病历列表
    rpc getMedicalRecordListByUserId(GetMedicalRecordListByUserIdRequest) returns (GetMedicalRecordListByUserIdResponse);

    //获取病历详情
    rpc getMedicalRecordsDetail(GetMedicalRecordsDetailRequest) returns (GetMedicalRecordsDetailResponse);

    //获取检查结果列表
    rpc getInspectionReportList(GetInspectionReportListRequest) returns (GetInspectionReportListResponse);

    //根据门诊ID获取检查结果列表
    rpc getInspectionReportListByHisPatientId(GetInspectionReportListByHisPatientIdRequest) returns (GetInspectionReportListByHisPatientIdResponse);

    //获取检查结果详情
    rpc getInspectionReportDetail(GetInspectionReportDetailRequest) returns (GetInspectionReportDetailResponse);

    //获取化验结果列表
    rpc getLaboratoryReportList(GetLaboratoryReportListRequest) returns (GetLaboratoryReportListResponse);

    //根据门诊ID获取化验结果列表
    rpc getLaboratoryReportByListByHisPatientId(GetLaboratoryReportListByHisPatientIdRequest) returns (GetLaboratoryReportListByHisPatientIdResponse);

    //获取化验结果详情
    rpc getLaboratoryReportDetail(GetLaboratoryReportDetailRequest) returns (GetLaboratoryReportDetailResponse);

    //根据就诊流水号获取门诊病历
    rpc getMedicalRecordByClinicCode(GetMedicalRecordByClinicCodeRequest) returns (GetMedicalRecordByClinicCodeResponse);

    //根据用户名和密码登录
    rpc loginWithUserAndPsd(LoginWithUserAndPsdRequest) returns (LoginWithUserAndPsdResponse);

    //忘记密码
    rpc updatePassword(UpdatePasswordRequest) returns (Result);

    //修改密码
    rpc changePassword(ChangePasswordRequest) returns (Result);

    //根据code拉取用户信息
    rpc getUserInfoByCode(GetUserInfoByCodeRequest) returns (GetUserInfoByCodeResponse);

    //得到加诊排班医生列表    create by daiyihua
    rpc getScheduleDoctorList(GetScheduleDoctorListRequest) returns (GetScheduleDoctorListResponse);

    //用户创建就诊人   create by daiyihua
    rpc userCreateMedicalRecord(UserCreateMedicalRecordRequest) returns (Result);

    //根据科室ID搜索医生    create by daiyihua
    rpc getDoctorListByDeptId(GetDoctorListByDeptIdRequest) returns (GetDoctorListByDeptIdResponse);

    //根据医生ID得到医生团队数量    create by daiyihua
    rpc getDoctorTeamCount(GetDoctorTeamCountRequest) returns (Result);

    //根据医生ID得到医生加诊记录数量    create by daiyihua
    rpc getDoctorAdditionalCount(GetDoctorAdditionalCountRequest) returns (Result);

    //根据医院ID得到医院对象  create by daiyihua
    rpc getHospitalById(GetHospitalByIdRequest) returns (GetHospitalByIdResponse);

    //绑定太和的诊疗卡      create by daiyihua
    rpc addTaiheMedicalCard(AddTaiheMedicalCardRequest) returns (ResultInt);

    // 微信提现
    rpc withdrawToWeChat(WithdrawToWeChatRequest) returns (WithdrawToWeChatResponse);

    // 微信提现订单支付
    rpc withdrawOrderPay(WithdrawOrderPayRequest) returns (WithdrawOrderPayResponse);

    //添加关注(用户扫描关注医生)  created by daiyihua
    rpc userAttentionDoctor(UserAttentionDoctorRequest) returns (Result);

    //用户点击添加、取消关注医生
    rpc saveAttentionDoctorStatus(GeneralAttentionDoctorRequest) returns (Result);

    //用户点击添加、取消关注医院
    rpc saveAttentionHospitalStatus(GeneralAttentionHospitalRequest) returns (Result);

    // 得到单个用户个人资料
    rpc getUserPatientById(GetUserPatientByIdRequest) returns (GetUserPatientByIdResponse);

    // 修改单个用户个人资料
    rpc updateUserPatientInfo(UpdateUserPatientInfo) returns (Result);

    // 得到用户的个人资料列表
    rpc getUserPatientList(GetUserPatientListRequest) returns (GetUserPatientListResponse);

    //保存社交账号信息
    rpc saveSnsUserInfo(SaveSnsUserInfoRequest) returns (SaveSnsUserInfoRespose);

    // 判断添加个人资料
    rpc checkAndAddUserPatientInfo(UpdateUserPatientInfo) returns (Result);

    // 绑定微信体系账号
    rpc bindWxNew(BindWxRequest) returns (Result);

    // 删除个人资料
    rpc delUserPatient(DelUserPatientRequest) returns (Result);

    //根据unionId和terminal判断是否需要更新sns_user_info表的userId
    rpc checkAndUpdateSnsUserId (CheckAndUpdateSnsUserIdRequest) returns (Result);

    //根据openid拉取用户信息
    rpc getUserInfoByOpenId(GetUserInfoByOpenIdRequest) returns (GetUserInfoByOpenIdResponse);

    //根据用户ID和Terminal获取用户基本信息
    rpc getUserInfoByUserIdAndTerminal(GetUserInfoByUserIdAndTerminalRequest) returns (GetUserInfoByUserIdAndTerminalResponse);

    //更新关注医生状态（关注/取消关注）
    rpc updateFollowedStatus(UpdateFollowedStatusRequest) returns (Result);

    //保存小程序用户信息
    rpc saveMinAppUser(SaveMinAppUserRequest) returns (SaveMinAppUserResponse);

    //
    rpc getSnsUserInfo(GetSnsUserInfoRequest) returns (GetSnsUserInfoResponse);

    //根据用户ID更新用户小程序信息
    rpc updateSnsUserInfoByUserId(UpdateSnsUserInfoByUserIdRequest) returns (UpdateSnsUserInfoByUserIdResponse);

    //实名认证
    rpc authenticate(AuthenticateRequest) returns (AuthenticateResponse);

    // 根据 userId 和 terminal 获取 snsUserInfo
    rpc getSnsUserInfoByUserIdAndTerminal(GetSnsUserInfoByUserIdAndTerminalRequest) returns (GetSnsUserInfoByUserIdAndTerminalResponse);

    //获取用户列表
    rpc getUserList (GetUserListRequest) returns (GetUserListResponse);
}

