using System.Collections.Generic;
namespace DRG.DRGInterfaceClient
{
/// 根据机构信息 + 默认值构建业务 session。
internal static class SessionBuilder
{
/// 完整 session:机构字段来自 hospital,其余来自默认值。
public static Dictionary Build(HospitalInfoItem hosp, SessionDefaults d)
{
hosp = hosp ?? new HospitalInfoItem();
d = d ?? new SessionDefaults();
return new Dictionary
{
{ "userID", d.userID ?? "" },
{ "userCode", d.userCode ?? "" },
{ "userName", d.userName ?? "" },
{ "locID", d.locID ?? "" },
{ "locDesc", d.locDesc ?? "" },
{ "groupID", d.groupID ?? "" },
{ "groupDesc", d.groupDesc ?? "" },
{ "hospID", hosp.id ?? "" },
{ "hospCode", hosp.hospCode ?? "" },
{ "hospDesc", hosp.descripts ?? "" },
{ "langID", d.langID },
{ "langDesc", d.langDesc ?? "" },
{ "changeFlag", d.changeFlag ?? "N" },
{ "changeDesc", d.changeDesc ?? "" },
{ "lastLoginDate", d.lastLoginDate ?? "" },
{ "lastLoginTime", d.lastLoginTime ?? "" },
{ "directorAuth", d.directorAuth ?? "N" },
{ "defaultMenuType", d.defaultMenuType ?? "" },
{ "titleDesc", d.titleDesc ?? "" },
{ "userYBCode", d.userYBCode ?? "" },
{ "hospYBCode", hosp.code ?? "" },
{ "provID", d.provID ?? "" },
{ "cityID", d.cityID ?? "" },
{ "areaCode", d.areaCode ?? "" },
{ "medinsLv", hosp.MedinsLv ?? "" },
{ "path", d.path ?? "" },
{ "sessionID", d.sessionID ?? "" },
{ "errorMessageTime", d.errorMessageTime ?? "" },
{ "language", d.language ?? "CN" },
{ "messageTime", d.messageTime }
};
}
/// 默认 session(机构字段为空),用于首次加载机构列表 01010064。
public static Dictionary BuildDefault(SessionDefaults d)
{
return Build(new HospitalInfoItem(), d);
}
}
}