Ejemplo n.º 1
0
        private void AddHospitalUserInfo()
        {
            UserService userservice = new UserService();
            var         listUser    = GetUser();


            foreach (var item in listUser)
            {
//------------------------------------------------------------------------------------------------------------------------------------------------------
                //以前的注册表信息导入到授权表里面
                var registerdata       = userservice.GetUserregiserId();
                UserauthsSqlMapDao urd = new UserauthsSqlMapDao();    //授权表导入数据   登陆名,密码,以前的注册Id
                Userauths          ur  = new Userauths();
                ur.AuthsId       = new aers_sys_seedSqlMapDao().GetMaxID("Userauths");
                ur.LoginLastTime = Common.StrToDateTime();
                ur.LoginNumber   = item.LoginName;
                ur.LoginType     = 0; //院内账号类型是0;
                ur.Password      = item.Password;
                ur.RegisterId    = registerdata;
                ur.Verified      = 0;
                ur.ReguserId     = item.ReguserId;
                urd.Adduserauths(ur);


                //------------------------------------------------------------------------------------------------------------------------------------------------------
                aers_tbl_staffSqlMapDao sdao = new aers_tbl_staffSqlMapDao();
                aers_tbl_staff          s    = new aers_tbl_staff();
                var sdata = sdao.FindByRUid(item.ReguserId);
                //根据注册ID取出以前用户表里面的数据  科室id,姓名,性别,角色


                userregisterSqlMapDao urdao = new userregisterSqlMapDao(); //注册表导入姓名
                userregister          urr   = new userregister();
                urr.RegisterId = registerdata;                             //注册Id
                urr.Name       = sdata.Name;                               //添加姓名
                urdao.Updateuserregister(urr);

                userbasicinfoSqlMapDao ubdao = new userbasicinfoSqlMapDao();  //基本信息表导入性别
                UserBasicInfo          ub    = new UserBasicInfo();
                ub.RegisterId = registerdata;
                if (sdata.Sex == "107")
                {
                    ub.Sex = "女";
                }
                else if (sdata.Sex == "108")
                {
                    ub.Sex = "男";
                }
                else
                {
                    ub.Sex = "";
                }
                ub.Birthday = Common.StrToDateTime();
                ubdao.Updateuserbasicinfo(ub);

                UserrelrecordSqlMapDao urrrdao = new UserrelrecordSqlMapDao();   //组织关系表导入科室Id
                Userrelrecord          urrr    = new Userrelrecord();
                urrr.RegisterId   = registerdata;
                urrr.DepartmentId = sdata.DepId;     //科室Id
                urrr.Role         = sdata.RoleState; //还用以前的标记  角色

                aers_tbl_hospdepSqlMapDao ad = new aers_tbl_hospdepSqlMapDao();
                urrr.DepartmentName = ad.FindhospdepByDepId(sdata.DepId).HospdepName; //科室姓名
                var hospId = ad.FindhospdepByDepId(sdata.DepId).HospId;               //医院ID

                //  aers_tbl_hospitalSqlMapDao DDD = new aers_tbl_hospitalSqlMapDao(); //shit
                aers_tbl_events_ycSqlMapDao hdao = new aers_tbl_events_ycSqlMapDao();
                var hdat = hdao.hospitalFindByHospId(hospId);
                urrr.HospitalName = hdat.HospName; //医院姓名
                urrr.HospitalId   = hospId;        //医院Id

                //h.HospitalId = item.HospId;
                //h.Name = item.HospName;

                urrrdao.Updateuserrelrecord(urrr);
            }
        }