Exemplo n.º 1
0
        // GetDoctorInfo返回医生基本信息 ZYF 2014-12-4
        public DoctorInfo GetDoctorInfo(DataConnection pclsCache, string DoctorId)
        {
            DoctorInfo ret = new DoctorInfo();

            try
            {
                if (!pclsCache.Connect())
                {
                    return(null);
                }
                ret.DoctorId    = Ps.DoctorInfo.GetDoctorInfo(pclsCache.CacheConnectionObject, DoctorId)[0].ToString();
                ret.DoctorName  = Ps.DoctorInfo.GetDoctorInfo(pclsCache.CacheConnectionObject, DoctorId)[1].ToString();
                ret.Birthday    = Ps.DoctorInfo.GetDoctorInfo(pclsCache.CacheConnectionObject, DoctorId)[2].ToString();
                ret.Gender      = Ps.DoctorInfo.GetDoctorInfo(pclsCache.CacheConnectionObject, DoctorId)[3].ToString();
                ret.IDNo        = Ps.DoctorInfo.GetDoctorInfo(pclsCache.CacheConnectionObject, DoctorId)[4].ToString();
                ret.InvalidFlag = Ps.DoctorInfo.GetDoctorInfo(pclsCache.CacheConnectionObject, DoctorId)[5].ToString();
                //DataCheck ZAM 2015-1-7

                //
                //list.Rows.Add(CacheList[0].ToString(), CacheList[1].ToString(), CacheList[2].ToString(), CacheList[3].ToString(), CacheList[4], CacheList[5]);
                return(ret);
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString(), "获取名称失败!");
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PsDoctorInfo.GetDoctorInfo", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return(null);
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }
Exemplo n.º 2
0
        public List <DoctorInfo> GetFakeDoctors()
        {
            var list    = new List <DoctorInfo>();
            var doctor1 = new DoctorInfo
            {
                Id             = 1,
                FirstName      = "name1",
                LastName       = "name2",
                ProfessionName = "therapist",
                EmployingDate  = new DateTime(2018, 12, 25, 10, 30, 50),
                StartHour      = new TimeSpan(5, 15, 15),
                EndHour        = new TimeSpan(5, 15, 15),
                Image          = "1.jpg"
            };
            var doctor2 = new DoctorInfo
            {
                Id             = 2,
                FirstName      = "name3",
                LastName       = "name4",
                ProfessionName = "therapist",
                EmployingDate  = new DateTime(2012, 12, 25, 10, 30, 50),
                StartHour      = new TimeSpan(5, 15, 15),
                EndHour        = new TimeSpan(5, 15, 15),
                Image          = "2.jpg"
            };

            list.Add(doctor1);
            list.Add(doctor2);
            return(list);
        }
        public async Task <ActionResult> CreateDoctores(DoctorInfoView doctorInfoView)
        {
            using (var client = new HttpClient())
            {
                var ck = ControllerContext.HttpContext.Request.Cookies["Token"];
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ck);
                client.BaseAddress = new Uri("https://localhost:44349");

                var handler   = new JwtSecurityTokenHandler();
                var jsonToken = handler.ReadJwtToken(ck);
                var tokens    = jsonToken as JwtSecurityToken;

                var doctorInfo = new DoctorInfo
                {
                    Apellido        = doctorInfoView.Apellido,
                    Email           = doctorInfoView.Email,
                    Password        = doctorInfoView.Password,
                    ConfirmPassword = doctorInfoView.ConfirmPassword,
                    Nombre          = doctorInfoView.Nombre,
                    PhoneNumber     = doctorInfoView.PhoneNumber,
                    UserName        = doctorInfoView.UserName,
                    AdminId         = tokens.Claims.First(claim => claim.Type == "UserId").Value,
                    EspecialidadId  = Convert.ToInt32(doctorInfoView.EspecialidadId)
                };

                var postTask = await client.PostAsJsonAsync <DoctorInfo>("api/Accounts/CreateDoctor", doctorInfo);

                if (postTask.IsSuccessStatusCode)
                {
                    return(RedirectToAction("DoctoresHospital", "Hospitals"));
                }
                ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");
                return(RedirectToAction("CreateDoctores"));
            }
        }
Exemplo n.º 4
0
        public List <DoctorInfo> GetDoctors()
        {
            const string cmd    = "GETINFOABOUTDOCTORS";
            var          param  = new Dictionary <string, object>();
            var          str    = _dbContext.ExecuteSqlQuery(cmd, '*', param);
            var          values = str.Split('*');
            var          list   = new List <DoctorInfo>();

            for (int i = 0; i < (values.Length - 1); i += 8)
            {
                var doctor = new DoctorInfo
                {
                    Id             = Convert.ToInt32(values.GetValue(0 + i)),
                    FirstName      = values.GetValue(1 + i).ToString(),
                    LastName       = values.GetValue(i + 2).ToString(),
                    ProfessionName = values.GetValue(i + 3).ToString(),
                    StartHour      = TimeSpan.Parse(values.GetValue(i + 4).ToString()),
                    EndHour        = TimeSpan.Parse(values.GetValue(i + 5).ToString()),
                    EmployingDate  = Convert.ToDateTime(values.GetValue(i + 6).ToString()),
                    Image          = values.GetValue(i + 7).ToString()
                };
                list.Add(doctor);
            }
            return(list);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds new doctor in database.
        /// </summary>
        public void AddDoctor()
        {
            var specialityInfoList = _clinicServiceClient.GetSpecialities(CurrentUserInfo.sessionTokenInfo.Guid);

            for (var i = 1; i <= specialityInfoList.Count; i++)
            {
                Console.WriteLine("{0} {1}", i, specialityInfoList[i - 1].Title);
            }
            Console.WriteLine("Выберите специальноть нового врача");
            var specialityNumber = Validation.ValidateInput(1, specialityInfoList.Count);
            var specialityInfo   = specialityInfoList[specialityNumber - 1];
            var doctorInfo       = new DoctorInfo();

            Console.WriteLine("Введите фамилию");
            doctorInfo.LastName = Validation.ValidateInput(@"^[а-я]{3,20}$",
                                                           "Длина строки должна быть от 3 до 20 символов и содержать только буквы");
            Console.WriteLine("Введите имя");
            doctorInfo.FirstName = Validation.ValidateInput(@"^[а-я]{3,20}$",
                                                            "Длина строки должна быть от 3 до 20 символов и содержать только буквы");
            Console.WriteLine("Введите кабинет");
            doctorInfo.Room = Validation.ValidateInput(@"^[0-9а-я]{1,4}$",
                                                       "Длина строки должна быть от 1 до 4 символов ");
            doctorInfo.AddressInfo    = new CommonAction(_clinicServiceClient).SetAddress();
            doctorInfo.specialityInfo = specialityInfo;
            if (_clinicServiceClient.AddDoctor(doctorInfo, CurrentUserInfo.sessionTokenInfo.Guid))
            {
                Console.WriteLine("Врач добавлен");
            }
        }
Exemplo n.º 6
0
 public static List <DoctorInfo> GetListOfDoctors(UserToken userToken)
 {
     if (userToken.ID.Equals(AuthenticationManager.SavedUsers.Find(item => item.userInfo.Username.Equals(userToken.userInfo.Username))))
     {
         try
         {
             using (var db = new DatabaseMedAssistEntities())
             {
                 List <DoctorInfo> doctorInfos = new List <DoctorInfo>();
                 var query = from dbDoctor in db.DatabaseDoctors
                             select dbDoctor;
                 foreach (var item in query)
                 {
                     DoctorInfo doctorInfo = new DoctorInfo(item.DoctorName, item.DoctorID.GetValueOrDefault(), Convert.ToInt32(item.DoctorAge), item.DoctorPicture, item.DoctorHospital,
                                                            item.DoctorType == "Psikolog" ? DoctorType.Psikolog : DoctorType.DokterUmum);
                     doctorInfos.Add(doctorInfo);
                 }
                 doctorInfos.OrderBy(item => item.DoctorHospital);
                 return(doctorInfos);
             }
         }
         catch (Exception ex)
         {
             //ui error happened
             return(null);
         }
     }
     else
     {
         //textbox login expired to UI
         return(null);
     }
 }
Exemplo n.º 7
0
        public async Task <ActionResult <CreatedUserDTO> > CreateDoctorAccount([FromBody] DoctorInfo doctorInfo)
        {
            var user = new ApplicationUser {
                Apellido    = doctorInfo.Apellido,
                Email       = doctorInfo.Email,
                Nombre      = doctorInfo.Nombre,
                PhoneNumber = doctorInfo.PhoneNumber,
                UserName    = doctorInfo.UserName,
            };
            var result = await _userManager.CreateAsync(user, doctorInfo.Password);

            if (result.Succeeded)
            {
                var userData = await _userManager.FindByEmailAsync(doctorInfo.Email);

                await _userManager.AddClaimAsync(userData, new Claim(ClaimTypes.Role, "Doctor"));

                var hospital = await context.HospitalAdministrador.FirstOrDefaultAsync(x => x.AdminId.Equals(doctorInfo.AdminId));

                await context.HospitalDoctor.AddAsync(new HospitalDoctor {
                    HospitalId     = hospital.HospitalId,
                    EspecialidadId = doctorInfo.EspecialidadId,
                    DoctorId       = userData.Id
                });

                await context.SaveChangesAsync();

                await _userManager.AddToRoleAsync(userData, "Doctor");

                var clinicAdminDTO = mapper.Map <CreatedUserDTO>(userData);
                return(new CreatedAtRouteResult($"GetAccountInfo", new { id = clinicAdminDTO.Id }, clinicAdminDTO));
            }
            return(BadRequest("Datos incorrectos"));
        }
        /// <summary>
        /// Insert a DoctorInfo
        /// </summary>
        /// <param name="DoctorInfo">DoctorInfo</param>
        public void InsertDoctorInfo(DoctorInfo doctorInfo)
        {
            if (doctorInfo == null)
            {
                throw new ArgumentNullException(nameof(doctorInfo));
            }

            _doctorInfoRepository.Insert(doctorInfo);
        }
        /// <summary>
        /// Updates the DoctorInfo
        /// </summary>
        /// <param name="DoctorInfo">DoctorInfo</param>
        public void UpdateDoctorInfo(DoctorInfo doctorInfo)
        {
            if (doctorInfo == null)
            {
                throw new ArgumentNullException(nameof(doctorInfo));
            }

            _doctorInfoRepository.Update(doctorInfo);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 查询医生信息(按拼音)
        /// </summary>
        /// <param name="queryName">拼音代码或医生名称</param>
        /// <param name="values">医生信息</param>
        /// <param name="msg">出错信息</param>
        /// <returns>0:成功  大于0:出错  小于0:异常</returns>
        public int DB_ListDoctor(string queryName, out ArrayList values, out string msg)
        {
            msg = "";

            OracleConnection connection = new OracleConnection(WebConfigParameter.ConnectionHisString);
            OracleDataReader dr         = null;

            try
            {
                int ret = -99;

                string findId1 = _builder.QueryDoctorInfoSql(queryName);

                dr = DbHelperOra.ExecuteReader(findId1, connection);

                if (dr.HasRows)
                {
                    values = new ArrayList();
                    while (dr.Read())
                    {
                        DoctorInfo pd = new DoctorInfo();

                        pd.dm = !dr.IsDBNull(0) ? dr.GetString(0) : "";
                        pd.xm = !dr.IsDBNull(1) ? dr.GetString(1) : "";
                        pd.jb = !dr.IsDBNull(2) ? dr.GetString(2) : "";

                        values.Add(pd);
                    }
                    ret = 0;
                }
                else
                {
                    msg    = "亲,没有记录";
                    values = null;
                    ret    = 2;
                }

                dr.Close();
                return(ret);
            }
            catch (Exception ex)
            {
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);

                msg    = GetExceptionInfo(ex);
                values = null;
                return(-99);
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }
                connection.Close();
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 查询医生详细信息
        /// </summary>
        /// <param name="ysdm">医生代码</param>
        /// <param name="values">医生信息</param>
        /// <param name="msg">出错信息</param>
        /// <returns>0:成功  大于0:出错  小于0:异常</returns>
        public int DB_QueryDoctor(string ysdm, out ArrayList values, out string msg)
        {
            msg = "";

            OracleConnection connection = new OracleConnection(WebConfigParameter.ConnectionHisString);
            OracleDataReader dr         = null;

            try
            {
                int ret = -99;

                string findId1 = _builder.QueryDoctorInfoByDmSql(ysdm);

                dr = DbHelperOra.ExecuteReader(findId1, connection);

                if (dr.HasRows)
                {
                    values = new ArrayList();
                    while (dr.Read())
                    {
                        DoctorInfo pd = new DoctorInfo();

                        pd.jj = !dr.IsDBNull(0) ? dr.GetString(0) : "";
                        pd.sc = !dr.IsDBNull(1) ? dr.GetString(1) : "";

                        values.Add(pd);
                    }
                    ret = 0;
                }
                else
                {
                    msg    = "亲,没有记录";
                    values = null;
                    ret    = 2;
                }

                dr.Close();
                return(ret);
            }
            catch (Exception ex)
            {
                msg    = GetExceptionInfo(ex);
                values = null;
                return(-99);
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }
                connection.Close();
            }
        }
        public async Task <ActionResult> Edit(DoctorInfo DoctorInfo)
        {
            if (ModelState.IsValid)
            {
                await MobileService.GetTable <DoctorInfo>().UpdateAsync(DoctorInfo);

                return(RedirectToAction("Index"));
            }

            return(View(DoctorInfo));
        }
Exemplo n.º 13
0
 public ActionResult Create(DoctorInfo model)
 {
     try
     {
         // TODO: Add insert logic here
         var toReturn = obj.Save(model, out outmodel);
         return(Json(new { mdl = outmodel, pa = toReturn }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 14
0
        public Patient(string patientName, string admissionDate, string releaseDate, string doctorName, string doctorSpeciality, string workingAt)
        {
            PatientName   = patientName;
            AdmissionDate = admissionDate;
            ReleaseDate   = releaseDate;

            //Composition comes into picture now
            //It also means when we construct Patient, we also constructed DoctorInfo
            //Hence, scope of Doctorinfo is dependent on Patient
            DoctorInfo                  = new DoctorInfo(doctorName, doctorSpeciality, workingAt);
            DoctorInfo.DoctorName       = doctorName;
            DoctorInfo.DoctorSpeciality = doctorSpeciality;
            DoctorInfo.WorkingAt        = workingAt;
        }
Exemplo n.º 15
0
        public Patient(string patientName,string admissionDate,string releaseDate,string doctorName,string doctorSpeciality, string workingAt)
        {
            PatientName = patientName;
               AdmissionDate = admissionDate;
               ReleaseDate = releaseDate;

               //Composition comes into picture now
               //It also means when we construct Patient, we also constructed DoctorInfo
               //Hence, scope of Doctorinfo is dependent on Patient
               DoctorInfo = new DoctorInfo(doctorName,doctorSpeciality,workingAt);
               DoctorInfo.DoctorName = doctorName;
               DoctorInfo.DoctorSpeciality = doctorSpeciality;
               DoctorInfo.WorkingAt = workingAt;
        }
        public async Task <ActionResult> Create(DoctorInfo DoctorInfo)
        {
            if (ModelState.IsValid)
            {
                //db.DoctorInfos.Add(DoctorInfo);
                //db.SaveChanges();

                var table = MobileService.GetTable <DoctorInfo>();
                await table.InsertAsync(DoctorInfo);

                return(RedirectToAction("Index"));
            }

            return(View(DoctorInfo));
        }
Exemplo n.º 17
0
        private void ultraButtonRefresh_Click(object sender, EventArgs e)
        {
            dsDoctorList = new DataSet();

            try
            {
                objHospDB = new HospitalDB();
                DoctorInfo objDoctorInfo = new DoctorInfo(objHospDB);
                dtDoctorList = objDoctorInfo.GetAllAsDataTable();
                ultraGridDoctorList.DataSource = dtDoctorList;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error");
            }
        }
Exemplo n.º 18
0
    protected void btnAddDoctor_Click(object sender, EventArgs e)
    {
        // Create new DoctorInfo object
        var doctor = new DoctorInfo();

        doctor.DoctorFirstName    = "John";
        doctor.DoctorLastName     = "Smith";
        doctor.DoctorCodeName     = "JohnSmith";
        doctor.DoctorEmail        = "*****@*****.**";
        doctor.DoctorSpecialty    = "Family Medicine";
        doctor.DoctorLastModified = DateTime.Now;

        // Insert doctor
        DoctorInfoProvider.SetDoctorInfo(doctor);

        Response.Write(doctor.DoctorFirstName + " " + doctor.DoctorLastName + " was added.");
    }
Exemplo n.º 19
0
        /// <summary>
        /// 一身模型转化
        /// </summary>
        /// <param name="doctor"></param>
        /// <returns></returns>
        protected DoctorInfo ConvertDoctorInfo(TDoctor doctor)
        {
            DoctorInfo info = new DoctorInfo();

            info.avatar    = ObjectUtils.GetValueOrEmpty(doctor.Avatar);
            info.name      = ObjectUtils.GetValueOrEmpty(doctor.DoctorName);
            info.province  = ObjectUtils.GetValueOrEmpty(doctor.ProvinceName);
            info.sex       = ObjectUtils.GetValueOrDefault <int>(doctor.Sex);
            info.title     = ObjectUtils.GetValueOrEmpty(doctor.DoctorTitle);
            info.doctor_id = doctor.DocotorMID;
            info.city      = ObjectUtils.GetValueOrEmpty(doctor.CityName);
            info.hospital  = ObjectUtils.GetValueOrEmpty(doctor.HospitalName);
            info.introduce = ObjectUtils.GetValueOrEmpty(doctor.Introduce);
            info.user_id   = ObjectUtils.GetValueOrEmpty(doctor.DoctorGID);

            return((DoctorInfo)info);
        }
Exemplo n.º 20
0
        public static List <DoctorInfo> GetDoctorsByIdRule(string str)
        {
            var values = str.Split('*');
            var list   = new List <DoctorInfo>();

            for (int i = 0; i < (values.Length - 1); i += 4)
            {
                var doctor = new DoctorInfo
                {
                    Id             = Convert.ToInt32(values.GetValue(i)),
                    FirstName      = values.GetValue(1 + i).ToString(),
                    LastName       = values.GetValue(2 + i).ToString(),
                    ProfessionName = values.GetValue(3 + i).ToString(),
                };
                list.Add(doctor);
            }
            return(list);
        }
Exemplo n.º 21
0
        private void ultraButtonDelete_Click(object sender, EventArgs e)
        {
            try
            {
                ultraGridDoctorList.Rows[this.ultraGridDoctorList.ActiveRow.Index].Delete(true);
                objHospDB = new HospitalDB();
                DoctorInfo    objDoctorInfo    = new DoctorInfo(objHospDB);
                DoctorInfoRow objDoctroInfoRow = new DoctorInfoRow();

                objDoctroInfoRow.DoctorIDD = Convert.ToInt32(id);
                objDoctorInfo.Delete(objDoctroInfoRow);



                MessageBox.Show(":deleted");
            }catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 22
0
        public ActionResult Edit(DoctorInfo model)
        {
            try
            {
                obj.Update(model, out outmodel);
                if (!outmodel.Error)
                {
                    // TODO: Add update logic here

                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(model));
                }
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Remove ticket from database
        /// </summary>
        /// <param name="ticketList"></param>
        /// <param name="doctor"></param>
        public void RemoveTicket(List <TicketInfo> ticketList, DoctorInfo doctor)
        {
            Console.WriteLine("Введите номер талона");
            var removeTicketNumber = Validation.ValidateInput(1, ticketList.Count);

            if (ticketList[removeTicketNumber - 1].PatientInfo.FirstName == null)
            {
                Console.WriteLine("Талон не может быть удален т.к. он не забронирован");
                return;
            }
            //if (ticketList[removeTicketNumber - 1].PatientInfo != null &&
            //    ticketList[removeTicketNumber - 1].PatientInfo.LastName == "reserved")
            //{
            //    Console.WriteLine("Талон не может быть удален т.к. он забронирован");
            //    return;
            //}
            Console.WriteLine("------------------------------------------------------");
            Console.WriteLine("Талон №{0} дата:{1} врач: {2} {3} - {4}, каб. {5}",
                              removeTicketNumber, ticketList[removeTicketNumber - 1].DateTime, doctor.LastName,
                              doctor.FirstName, doctor.specialityInfo.Title, doctor.Room);
            Console.WriteLine("Удалить?");
            Console.WriteLine("1-Да");
            Console.WriteLine("2-Нет");
            var action = Validation.ValidateInput(1, 2);

            switch (action)
            {
            case 1:
                if (_clinicServiceClient.RemoveTicket(ticketList[removeTicketNumber - 1].Id, CurrentUserInfo.sessionTokenInfo.Guid))
                {
                    Console.WriteLine("Талон удален");
                    return;
                }
                break;

            case 2:
            default:
                return;
            }
        }
        private void ultraButtonRegister_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (this.strFormMode == "Edit")
                {
                    objHospDB = new HospitalDB();
                    DoctorInfo    objDoctorInfo    = new DoctorInfo(objHospDB);
                    DoctorInfoRow objDoctorInfoRow = new DoctorInfoRow();
                    objDoctorInfoRow.DoctorIDD = Convert.ToInt32(classtextEditorID.Text);
                    objDoctorInfoRow.Name      = ultraTextEditorName.Text;
                    objDoctorInfoRow.Address   = ultraTextEditorAddress.Text;
                    objDoctorInfoRow.Phone     = classtePhone.Text;
                    objDoctorInfo.Update(objDoctorInfoRow);


                    MessageBox.Show(":updated");
                    openfrmDoctorList();
                }
                else
                {
                    objHospDB = new HospitalDB();
                    DoctorInfo    objDoctorInfo    = new DoctorInfo(objHospDB);
                    DoctorInfoRow objDoctorInfoRow = new DoctorInfoRow();
                    // SqlCommand cmd = objHospDB.CreateCommand("insert into DoctorInfo values('" + ultraTextEditorName.Text + "','" + ultraTextEditorAddress.Text + "','" + classtePhone.Text + "');");
                    objDoctorInfoRow.Name    = ultraTextEditorName.Text;
                    objDoctorInfoRow.Address = ultraTextEditorAddress.Text;
                    objDoctorInfoRow.Phone   = classtePhone.Text;

                    objDoctorInfo.Insert(objDoctorInfoRow);
                    MessageBox.Show(":Registerd");
                    openfrmDoctorList();
                }
            }catch (Exception ex)
            {
                MessageBox.Show("Error");
            }
        }
Exemplo n.º 25
0
        public Result <DoctorInfo> DoctorInfo(BaseParams search)
        {
            if (IsAuthrized)
            {
                Result <DoctorInfo> result = Result <DoctorInfo> .CreateInstance(ResultCode.Fail);

                String  searchUserID = search.to_user_id == null ? search.user_id : search.to_user_id;
                TDoctor doctor       = GetService <DoctorService>().GetDoctorByGID(searchUserID);
                if (doctor != null)
                {
                    DoctorInfo info = ConvertDoctorInfo(doctor);
                    result.SetSuccess();
                    result.result_data = info;
                }
                else
                {
                    result.message = "没有查询到该医生信息";
                }

                return(result);
            }
            return(GetAuthFilterResult <DoctorInfo>());
        }
Exemplo n.º 26
0
        public static int CreateDoctor(ScheduleInfo obj)
        {
            DoctorInfo newDoctor = new DoctorInfo();

            if (obj.Surgeon == null || !Regex.IsMatch(obj.Surgeon, @"^[\p{L}\p{M}' \.\-]+$"))
            {
                Session.Session.errorMessage = "Invalid Doctor name";
                return -1;
            }

            string[] name = Regex.Split(obj.Surgeon, @"^[.,!?;:]\s*|\s+");

            if (name.Length > 1)
            {
                newDoctor.FirstName = name[0];
                newDoctor.LastName = name[1];
                newDoctor.DoctorName = obj.Surgeon;
                newDoctor.HospitalId = obj.LocationId;
                newDoctor.DoctorType = obj.SurgeryType;
                newDoctor.Distributor = iTraycerSection.Session.Session.userInfo.CustomerId;
            }
            return DataLayer.Controller.InsertDoctor(newDoctor);
        }
Exemplo n.º 27
0
 public bool AddDoctor(DoctorInfo doctorInfo, Guid guid)
 {
     return(DBHelper.Execute(context =>
     {
         var address = context.Address.Add(new Address
         {
             City = doctorInfo.AddressInfo.City,
             Street = doctorInfo.AddressInfo.Street,
             Home = doctorInfo.AddressInfo.Home,
             HousingBody = doctorInfo.AddressInfo.HousingBody,
             Apartament = doctorInfo.AddressInfo.Apartament
         });
         context.SaveChanges();
         context.Doctor.Add(new Doctor
         {
             AddressId = address.Id,
             LastName = doctorInfo.LastName,
             FirstName = doctorInfo.FirstName,
             Room = doctorInfo.Room,
             SpecialityId = doctorInfo.specialityInfo.Id
         });
         return context.SaveChanges() > 0;
     }, guid));
 }
Exemplo n.º 28
0
        public async Task <bool> UpdateDoctorService(DoctorInfo doctorInfo)
        {
            if (doctorInfo.DoctorId != 0)
            {
                var DoctorImageText = await _serviceMoneyListrepository.FirstOrDefaultAsync(a => a.DoctorID == doctorInfo.DoctorId && a.ServiceType == "ImageText" && a.IsDelete == false);

                var DoctorPhone = await _serviceMoneyListrepository.FirstOrDefaultAsync(a => a.DoctorID == doctorInfo.DoctorId && a.ServiceType == "Phone" && a.IsDelete == false);

                var DoctorInfo = await _repository.FirstOrDefaultAsync(a => a.Id == doctorInfo.DoctorId);

                // 实际接单数
                int  ChangeNumer = 0;
                bool ImageFull   = false; // 图文是否满单
                bool PhoneFull   = false; // 电话是否满单
                if (doctorInfo.OrderType == "order")
                {
                    ChangeNumer = 1;
                }
                else
                {
                    ChangeNumer = -1;
                }
                if (doctorInfo.ServiceType == "ImageText")
                {
                    // 图文
                    DoctorImageText.ActualNumber = DoctorImageText.ActualNumber + ChangeNumer;
                    if (DoctorImageText.ActualNumber > DoctorImageText.ServiceFrequency)
                    {
                        // 超过了接单数
                        return(false);
                    }
                    else
                    {
                        if (DoctorImageText.ServiceFrequency == DoctorImageText.ActualNumber)
                        {
                            ImageFull = true;
                        }
                        await _serviceMoneyListrepository.UpdateAsync(DoctorImageText);

                        return(true);
                    }
                }
                else if (doctorInfo.ServiceType == "Phone")
                {
                    //电话
                    DoctorPhone.ActualNumber = DoctorPhone.ActualNumber + ChangeNumer;
                    if (DoctorPhone.ActualNumber > DoctorPhone.ServiceFrequency)
                    {
                        // 超过了接单数
                        return(false);
                    }
                    else
                    {
                        if (DoctorPhone.ServiceFrequency == DoctorPhone.ActualNumber)
                        {
                            PhoneFull = true;
                        }
                        await _serviceMoneyListrepository.UpdateAsync(DoctorPhone);

                        return(true);
                    }
                }
                // 当图文、电话服务关闭 所有服务是关闭
                if (!DoctorImageText.ServiceState && !DoctorPhone.ServiceState)
                {
                    DoctorInfo.ServiceState = false;
                }
                else
                {
                    DoctorInfo.ServiceState = true;
                }
                // 判断是否满单
                if (DoctorImageText.ServiceState)
                {
                    if (ImageFull && (!DoctorPhone.ServiceState || PhoneFull))
                    {
                        DoctorInfo.ReceiptState = false;
                    }
                    else
                    {
                        DoctorInfo.ReceiptState = true;
                    }
                }
                if (DoctorPhone.ServiceState)
                {
                    if (PhoneFull && (!DoctorImageText.ServiceState || ImageFull))
                    {
                        DoctorInfo.ReceiptState = false;
                    }
                    else
                    {
                        DoctorInfo.ReceiptState = true;
                    }
                }
                await _repository.UpdateAsync(DoctorInfo);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 29
0
        public static void RequestDoctor(UserToken userToken, GeoCoordinate location, string locationDetail, DoctorType doctorType, DateTime appointmentDate, DateTime requestDate)
        {
            if (userToken.ID.Equals(AuthenticationManager.SavedUsers.Find(item => item.userInfo.Username.Equals(userToken.userInfo.Username))))
            {
                try
                {
                    using (var db = new DatabaseMedAssistEntities())
                    {
                        string day   = appointmentDate.DayOfWeek.ToString();
                        var    query = from dbDoctor in db.DatabaseDoctors
                                       where dbDoctor.DoctorType == doctorType.ToString() &&
                                       (day == "Monday" ? dbDoctor.AppointmentMonday :
                                        day == "Tuesday" ? dbDoctor.AppointmentTuesday :
                                        day == "Wednesday" ? dbDoctor.AppointmentWednesday :
                                        day == "Thursday" ? dbDoctor.AppointmentThursday :
                                        day == "Friday" ? dbDoctor.AppointmentFriday :
                                        day == "Saturday" ? dbDoctor.AppointmentSaturday : dbDoctor.AppointmentSunday) == false
                                       select dbDoctor;
                        int count = query.Count();
                        if (count == 0)
                        {
                            //ui doctor not available
                        }
                        else
                        {
                            var        selectedDoctor = query.OrderBy(item => GetDistance(Convert.ToDouble(item.HospitalLatitude), Convert.ToDouble(item.HospitalLongitude), location)).ThenByDescending(freeday => Convert.ToInt16(freeday.AppointmentMonday) + Convert.ToInt16(freeday.AppointmentTuesday) + Convert.ToInt16(freeday.AppointmentWednesday) + Convert.ToInt16(freeday.AppointmentThursday) + Convert.ToInt16(freeday.AppointmentFriday) + Convert.ToInt16(freeday.AppointmentSaturday) + Convert.ToInt16(freeday.AppointmentSunday)).First();
                            DoctorInfo doctorInfo     = new DoctorInfo(selectedDoctor.DoctorName, selectedDoctor.DoctorID.GetValueOrDefault(), Convert.ToInt32(selectedDoctor.DoctorAge), selectedDoctor.DoctorPicture, selectedDoctor.DoctorHospital,
                                                                       selectedDoctor.DoctorType == "Psikolog" ? DoctorType.Psikolog : DoctorType.DokterUmum);
                            var             healthcare      = db.DatabaseUsers.SingleOrDefault(k => k.Nama == selectedDoctor.DoctorHospital);
                            DatabaseRequest databaseRequest = new DatabaseRequest
                            {
                                IsLocked          = false,
                                SenderID          = userToken.userInfo.UserID,
                                ReceiverID        = healthcare.UserID,
                                LocationLatitude  = Convert.ToSingle(location.Latitude),
                                LocationLongitude = Convert.ToSingle(location.Longitude),
                                LocationDetail    = locationDetail,
                                Request           = "Dokter",
                                RequestDetail     = selectedDoctor.DoctorID.ToString() + "," + appointmentDate.ToShortDateString() + "," + requestDate.ToShortDateString()
                            };
                            switch (day)
                            {
                            case "Monday":
                                selectedDoctor.AppointmentMonday = true;
                                break;

                            case "Tuesday":
                                selectedDoctor.AppointmentTuesday = true;
                                break;

                            case "Wednesday":
                                selectedDoctor.AppointmentWednesday = true;
                                break;

                            case "Thursday":
                                selectedDoctor.AppointmentThursday = true;
                                break;

                            case "Friday":
                                selectedDoctor.AppointmentFriday = true;
                                break;

                            case "Saturday":
                                selectedDoctor.AppointmentSaturday = true;
                                break;

                            case "Sunday":
                                selectedDoctor.AppointmentSunday = true;
                                break;
                            }
                            db.DatabaseRequests.Add(databaseRequest);
                            db.SaveChanges();
                        }
                    }
                }
                catch (Exception ex)
                {
                    //ui error happened
                }
            }
            else
            {
                //textbox login expired to UI
            }
        }
Exemplo n.º 30
0
        public DoctorInfo GetDoctorInfo(string UserId)
        {
            DoctorInfo ret = repository.GetDoctorInfo(pclsCache, UserId);

            return(ret);
        }
Exemplo n.º 31
0
        /// <summary>
        /// Adds new ticket in database.
        /// </summary>
        /// <param name="ticketList"></param>
        /// <param name="doctor"></param>
        public void AddNewTicket(List <TicketInfo> ticketList, DoctorInfo doctor)
        {
            var ticketNumber = 0;
            int ticketId     = 0;

            for (; ;)
            {
                Console.WriteLine("Введите номер талона");
                ticketNumber = Validation.ValidateInput(1, ticketList.Count);
                if (ticketList[ticketNumber - 1].PatientInfo == null)
                {
                    Console.WriteLine("------------------------------------------------------");
                    Console.WriteLine("Талон №{0} дата:{1} врач: {2} {3} - {4}, каб. {5}",
                                      ticketNumber, ticketList[ticketNumber - 1].DateTime.ToString("dd MMM HH:mm"), doctor.LastName,
                                      doctor.FirstName, doctor.specialityInfo.Title, doctor.Room);
                    Console.WriteLine("------------------------------------------------------");
                    Console.WriteLine("1-Продолжить");
                    Console.WriteLine("2-Ввести еще раз");
                    Console.WriteLine("3-Выход");
                    var actionWithAvaliableTicket = Validation.ValidateInput(1, 3);
                    switch (actionWithAvaliableTicket)
                    {
                    case 1:
                        ticketId = _clinicServiceClient.SetReservation(ticketList[ticketNumber - 1], CurrentUserInfo.sessionTokenInfo.Guid);  //create temporary ticket
                        break;

                    case 2:
                        continue;

                    case 3:
                        return;
                    }
                    break;
                }
                Console.WriteLine("Талон уже забронирован");
                Console.WriteLine("1-Повторить выбор талона");
                Console.WriteLine("2-Выход");
                var action = Validation.ValidateInput(1, 2);
                switch (action)
                {
                case 1:
                    break;

                case 2:
                    return;

                default:
                    Console.WriteLine("Ввод не распознан");
                    break;
                }
            }

            for (; ;)
            {
                Console.WriteLine("------------------------------------------------------");
                Console.WriteLine("Выберите действие:");
                Console.WriteLine("1-Выбрать медицинскую карту пациента");
                Console.WriteLine("2-Добавить медицинскую карту пациента");
                Console.WriteLine("0-Вернуться в главное меню");
                var actionWithMedicalCard = Validation.ValidateInput(0, 2);
                var patientInfo           = new PatientInfo();
                switch (actionWithMedicalCard)
                {
                case 1:
                    patientInfo = new CommonAction(_clinicServiceClient).GetMedicalRecords();
                    break;

                case 2:
                    patientInfo = AddMedicalRecord();
                    break;

                case 0:
                    _clinicServiceClient.AbortReservation(ticketId);
                    return;
                }
                if (patientInfo == null)
                {
                    continue;
                }
                var newTicket = new TicketInfo
                {
                    Id         = ticketId,
                    DoctorInfo = new DoctorInfo {
                        Id = doctor.Id
                    },
                    DateTime    = ticketList[ticketNumber - 1].DateTime,
                    PatientInfo = new PatientInfo {
                        Id = patientInfo.Id
                    }
                };
                if (_clinicServiceClient.AddTicket(newTicket, CurrentUserInfo.sessionTokenInfo.Guid))
                {
                    Console.WriteLine("------------------------------------------------------");
                    Console.WriteLine("Талон сохранен");
                    Console.WriteLine("Дата:{0} врач: {1} {2} - {3}, каб. {4}",
                                      ticketList[ticketNumber - 1].DateTime, doctor.LastName,
                                      doctor.FirstName, doctor.specialityInfo.Title, doctor.Room);
                    Console.WriteLine("Пациент: {0} {1}", patientInfo.LastName, patientInfo.FirstName);
                    Console.WriteLine("------------------------------------------------------");
                    return;
                }
            }
        }
Exemplo n.º 32
0
 public bool AddDoctor(DoctorInfo doctorInfo, Guid guid)
 {
     return(Invoker.Invoke(AdminService.AddDoctor, doctorInfo, guid));
 }