syntax = "proto3";

import "base.proto";

package com.ywt.gapi.system;

option java_generic_services = true;
option java_multiple_files = true;
option java_package = "com.ywt.gapi.system";
option go_package = "/gapi";
message Hospital{
	int32 hospitalId = 1;		//医院Id
	string hospitalName = 2;	//医院名称
	string areaIds = 3;			//地区Id
	int32 level = 4;			//医院等级
	string logo = 5;			//医院Logo
	string address = 6;			//详细地址
	int32 registerable = 7;	    //能否挂号
    int32 status = 8;           //状态(暂用于表示用户是否关注)
}

message Dept{
	int32 deptId = 1;
	string deptName = 2;
	string deptCode = 3;
	string yiDaCode = 4;	//医达科室code
	int32 parentId = 5;
}

message HospitalDept{
	int32 deptId = 1;
	string deptName = 2;
	repeated Dept deptList = 3;
	string deptCode = 4;
}

message HospitalListRequest{
	int32 pageIndex = 1;
	int32 pageSize = 2;	
}

message HospitalListResponse{
	Result result = 1;
	repeated Hospital hospitalList = 2;
	int32 count = 3;
    int32 totalPages = 4;
}


//根据条件查找医院列表Request
message GetHospitalListRequest{
    int32 pageIndex = 1;
    int32 pageSize = 2;
    string name = 3;        //医院名称
    string areaIds = 4;     //医院地址
	int32 userId = 5;		//用户ID
}

message DeptListRequest{
	int32 hospitalId = 1;
}

message DeptListResponse{
	Result result = 1;
	repeated Dept deptList = 2;
}

message HospitalDeptListRequest{
	int32 hospitalId = 1;
}

message HospitalDeptListResponse{
	Result result = 1;
	repeated HospitalDept hospitalDeptList = 2;
}

message CheckAppVersionRequest{
	int32 clientType = 1;
	string appVersion = 2;
}

message CheckAppVersionResponse{
	int32 clientType = 1;	//客户端类型
	string version = 2;		//最新版本号
	string detail = 3;		//更新内容
	string downloadUrl = 4;	//下载地址
	int32 updateStatus = 5;	//是否强制更新
}

//地区
message Area{
	int32 id = 1; 			//唯一标识
	string name = 2;		//名称
	int32 weight = 3;		//权重
	int32 status = 4;		//状态
	int32 parentId = 5;		//上级Id
	int32 display = 6;		//显示
	int32 level = 7;		//地区级别
}

//获取地区列表请求
message GetAreaListRequest{
	
}

//获取地区列表响应
message GetAreaListResponse{
	Result result = 1;
	repeated Area area = 2;	//地区列表
}

//地址
message Address{
	int32 id = 1;			//唯一标识
	string province = 2;	//省
	string city = 3;		//市
	string area = 4;		//区
	string address = 5;		//详细地址
	string contact = 6;		//联系人
	string appellation = 7;	//称呼
	string mobile = 8;		//联系手机号
	int32 userId = 9;		//用户Id
	int32 status = 10;		//状态
	int64 createTime = 11;	//添加时间
	int64 updateTime = 12;	//修改时间
	int32 provinceId = 13;	//省Id
	int32 cityId = 14;		//市Id
	int32 areaId = 15;		//区Id
}

//获取地址列表请求
message GetAddressListRequest{
	int32 userId = 1;
}

//获取地址列表响应
message GetAddressListResponse{
	Result result = 1;
	repeated Address address = 2;
}

//保存收货地址请求
message SaveAddressRequest{
	int32 userId = 1;		//用户Id
	string province = 2;	//省
	string city = 3;		//市
	string area = 4;		//区
	string address = 5;		//详细地址
	string contact = 6;		//联系人
	string appellation = 7;	//称呼
	string mobile = 8;		//联系手机号
	int32 id = 9;			//地址Id，大于0时表示修改，为0表示新增
	int32 provinceId = 10;	//省Id
	int32 cityId = 11;		//市Id
	int32 areaId = 12;		//区Id
}

//删除收货地址请求
message DeleteAddressRequest{
	int32 userId = 1;		//用户Id
	int32 addressId = 2;	//地址唯一标识
}

//获取地址详情请求
message GetAddressRequest{
	int32 addressId = 1;
}

//获取地址详情响应
message GetAddressResponse{
	Result result = 1;
	Address address = 2;
}

//树结点
message TreeNode{
	int32 id = 1;
	string label = 2;
	int32 parentId = 3;
	repeated TreeNode children = 4;
}

//获取地区列表（树状结构）请求
message GetAreaTreeNodeListRequest{
	
}

//获取地区列表（树状结构）响应
message GetAreaTreeNodeListResponse{
	Result result = 1;
	string treeString = 2;
	repeated TreeNode area = 3;

}

message AreaHospital{
	int32 hospitalId = 1;
	string hospitalName = 2;
	string areaIds = 3;
}

// 根据地区获取医院
message AreaHospitalListRequest{
	int32 pageIndex = 1;
	int32 pageSize = 2;
	string areaIds = 3;
}
//根据地区返回医院
message AreaHospitalListResponse{
	Result result = 1;
	repeated AreaHospital areaHospitalList = 2;
	int32 count = 3;
    int32 totalPages = 4;
}

//获取地区列表请求--APP专用
message AreaListRequest{

}

//获取地区列表响应--APP专用
message AreaListResponse{
	Result result = 1;
	repeated Area area = 2;	//地区列表
}

//微信相关配置
message WeChatConfig{
	string appId = 1;				//患者端公众号appId（南方医务通）
	string secret = 2;				//患者端公众号secret（南方医务通）
	string doctorAppId = 3;			//医生端公众号appId（我的工作站）
	string doctorSecret = 4;		//医生端公众号secret（我的工作站）
}

//获取微信配置请求
message GetWeChatConfigRequest{
	
}

//获取微信配置响应
message GetWeChatConfigResponse{
	Result result = 1;
	WeChatConfig config = 2;
}

//根据医达科室Code获取科室信息请求
message GetDeptByYiDaCodeRequest{
	string yiDaCode = 1;
}

//根据医达科室Code获取科室信息响应
message GetDeptByYiDaCodeResponse{
	Result result = 1;
	Dept dept = 2;
}

message YiDaDoctorCode{
	string doctorId = 1;
	string yiDaDoctorCode = 2;
	string yiDaDoctorName = 3;
}

//获取医达医生Id请求
message GetYiDaDoctorCodeRequest{
	repeated string doctorId = 1;
}

//获取医达医生Id响应
message GetYiDaDoctorCodeResponse{
	Result result = 1;
	repeated YiDaDoctorCode doctorCode = 2;
}

//国际疾病分类(International Classification of Diseases，ICD)
message IcdCode{
	int32 id = 1;					//唯一标识
	string code = 2;				//icd编码
    string name = 3;				//名称
    string pyCode = 4;				//拼音编码
    string dCode = 5;				//自定义编码
    int32 flag = 6;					//标志，0-诊断
    int32 icdVer = 7;				//icd版本
    string wbCode = 8;				//五笔编码
    string parentCode = 9;			//上级code
    int32 sortSn = 10;				//排序
}

//获取国际疾病分类请求
message GetIcdCodeListRequest{

}

//获取国际疾病分类响应
message GetIcdCodeListResponse{
 	Result result = 1;
 	repeated IcdCode code = 2;
}

//修改默认地址Request create by daiyihua
message SettingDefaultAddressRequest{
	int32 userId = 1;
	int32 addressId = 2;
}


//消息模板
message MsgTpl{
	int32 id = 1;			//id
	string title = 2;		//模板名称
	string content = 3;		//模板内容
	int32 type = 4;			//类型
	int32 module = 5;		//模块
	int64 createTime = 6;	//创建时间
	bool format = 7; 		//是否格式化参数
}

//获取消息模板列表请求
message GetMsgTplListByModuleRequest{
	int32 module = 1;
}

//获取消息模板列表响应
message GetMsgTplListByModuleResponse{
	Result result = 1;
	repeated MsgTpl msgTpl = 2;
}

//得到医生地址Request create by daiyihua
message GetDoctorAddressRequest{
	int32 userId = 1;
}

//得到医生默认或最近添加地地址
message GetDoctorDefaultAddressResponse{
	Result result = 1;
	Address address = 2;
}

//通过medicalCardId同步诊疗卡信息
message SynchronizingInformationRequest{
	int32 medicalCardId = 1;	//诊疗卡表主键ID
}

//得到医院信息Request		create by daiyihua
message GetHospitalRequest{
	int32 hospitalId = 1;
}

//得到医院信息Response		create by daiyihua
message GetHospitalResponse{
	Result result = 1;
	Hospital hospital = 2;
}

//同步太和检查结果请求
message SyncTaiheInspectionReportRequest{
	string hisPatientId = 1;
	int32 registrationId = 2;
}

//同步太和检验结果请求
message SyncTaiheLaboratoryReportRequest{
	string hisPatientId = 1;
	int32 registrationId = 2;
}

//
message CreateHisAddRegisteredFlagRequest{
	string hisPatientId = 1;
	string hisCardNo = 2;
}

//医生团队（展示的）领衔医生所在的一级科室
message GetTeamDeptListRequest{

}

//医生团队（展示的）领衔医生所在的一级科室
message GetTeamDeptListResponse{
	int32 code = 1;
	string msg = 2;
	repeated Dept dept = 3;
}

//保存收获地址Respose
message SaveAddressResponse{
	int32 code = 1;
	string msg = 2;
	int32 addressId = 3;
}

message SaveMiniProgramLogRequest{
	string type = 1;
	string apiInfo = 2;
	string sysInfo = 3;
	string openId = 4;
	string unionId = 5;
	int32 userId = 6;
}

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

//获取科室Request
message GetDeptRequest{
	int32 deptId = 1;
}
//获取科室Response
message GetDeptResponse{
	int32 code = 1;
	string msg = 2;
 	Dept dept = 3;
}

// 对应 rpc 项目的 SystemServiceImpl 类
service SystemService{
	rpc getHospitalList(HospitalListRequest) returns (HospitalListResponse);	//获取医院列表
	rpc getDeptList(DeptListRequest) returns (DeptListResponse);	//获取医院科室列表
	rpc getHospitalDeptList(HospitalDeptListRequest) returns (HospitalDeptListResponse);	//获取医院所有科室列表
	rpc checkAppVersion(CheckAppVersionRequest) returns (CheckAppVersionResponse);	//检测APP是否需要更新
	rpc getAreaList(GetAreaListRequest) returns (GetAreaListResponse);	//获取地区列表
	rpc getAddressList(GetAddressListRequest) returns (GetAddressListResponse);	//获取地址列表
	rpc saveAddress(SaveAddressRequest) returns (SaveAddressResponse);	//保存收货地址
	rpc deleteAddress(DeleteAddressRequest) returns (Result);	//删除收货地址
	rpc getAddress(GetAddressRequest) returns (GetAddressResponse); //获取地址详情
	rpc getAreaTreeNodeList(GetAreaTreeNodeListRequest) returns (GetAreaTreeNodeListResponse);	//获取地区列表（树状结构）
	rpc getAppAreaList(AreaListRequest) returns (AreaListResponse);	//获取地区
	rpc getAreaHospitalList(AreaHospitalListRequest) returns (AreaHospitalListResponse);	//根据地区获取医院列表
	rpc getWeChatConfig(GetWeChatConfigRequest) returns (GetWeChatConfigResponse);		//获取微信配置

	//根据医达科室Code获取科室信息
	rpc getDeptByYiDaCode(GetDeptByYiDaCodeRequest) returns (GetDeptByYiDaCodeResponse);

	//
	rpc getYiDaDoctorCode(GetYiDaDoctorCodeRequest) returns (GetYiDaDoctorCodeResponse);

	//获取国际疾病分类
	rpc getIcdCodeList(GetIcdCodeListRequest) returns (GetIcdCodeListResponse);

	//得到所有地区集合，包括区、县
	rpc getAllAreaList(GetAreaListRequest) returns (GetAreaListResponse);

	//获取医生地址列表 create by daiyihua
	rpc getDoctorAddressList(GetAddressListRequest) returns (GetAddressListResponse);

	//医生保存地址 create by daiyihua
	rpc doctorSaveAddress(SaveAddressRequest) returns (Result);

	//医生设置默认地址 create by daiyihua
	rpc settingDefaultAddress(SettingDefaultAddressRequest) returns (Result);

	//获取消息模板列表
	rpc getMsgTplListByModule(GetMsgTplListByModuleRequest) returns (GetMsgTplListByModuleResponse);

	//得到医生默认或最近添加的地址  create by daiyhua
	rpc getDoctorDefaultAddress(GetDoctorAddressRequest) returns (GetDoctorDefaultAddressResponse);

	//同步诊疗卡信息		create by daiyihua
	rpc synchronizingInformation(SynchronizingInformationRequest) returns (Result);

	//根据医院ID得到医院信息		create by daiyihua
	rpc getHospital(GetHospitalRequest) returns (GetHospitalResponse);

	//同步太和检查结果
	rpc syncTaiheInspectionReport(SyncTaiheInspectionReportRequest) returns (Result);

	//同步太和检验结果
	rpc syncTaiheLaboratoryReport(SyncTaiheLaboratoryReportRequest) returns (Result);

	//
	rpc createHisAddRegisteredFlag(CreateHisAddRegisteredFlagRequest) returns (Result);

	//医生团队（展示的）领衔医生所在的一级科室
	rpc getTeamDeptList(GetTeamDeptListRequest) returns (GetTeamDeptListResponse);

    //根据条件查找医院列表
    rpc findHospitalList(GetHospitalListRequest) returns (HospitalListResponse);

    //得到普通用户关注的医院列表
    rpc getGeneralAttentionHospitalList(GetHospitalListRequest) returns (HospitalListResponse);

	//保存小程序日志
	rpc saveMiniProgramLog(SaveMiniProgramLogRequest) returns (SaveMiniProgramLogResponse);

	//获取科室
	rpc getDept(GetDeptRequest) returns (GetDeptResponse);
}
