示例#1
0
 private EMKServise.HealthGroup ConvertHealthGroup(HealthGroup c)
 {
     if ((object)c != null)
     {
         EMKServise.HealthGroup eh = new EMKServise.HealthGroup();
         eh.Doctor          = ConvertMedicalStaff(c.Doctor);
         eh.HealthGroupInfo = ConvertHealthGroupInfo(c.HealthGroupInfo);
         return(eh);
     }
     else
     {
         return(null);
     }
 }
        public async Task <Result <HealthGroup> > GetHealthGroupByIdAsync(int healthGroupId)
        {
            if (healthGroupId == 0)
            {
                return(new Result <HealthGroup>("Неверный Id группы здаровья."));
            }

            var healthGroup = new HealthGroup();
            var nameProc    = @"[dbo].[spDiagnoses_GetById]";

            try
            {
                using (var con = _conService.GetConnection())
                    using (var cmd = new SqlCommand(nameProc, con))
                    {
                        var param = new SqlParameter();
                        param.ParameterName = "@id";
                        param.SqlDbType     = SqlDbType.Int;
                        param.Value         = healthGroupId;

                        cmd.Parameters.Add(param);
                        cmd.CommandType = CommandType.StoredProcedure;
                        await con.OpenAsync();

                        using (var reader = await cmd.ExecuteReaderAsync())
                        {
                            if (await reader.ReadAsync())
                            {
                                healthGroup.Id    = reader.GetInt32(0);
                                healthGroup.Title = reader.GetString(1);
                            }
                        }
                    }
            }
            catch (Exception ex)
            {
                return(new Result <HealthGroup>(ex.Message));
            }

            if (healthGroup.Id == 0)
            {
                return(new Result <HealthGroup>("Не найден с таким Id"));
            }
            else
            {
                return(new Result <HealthGroup>(healthGroup));
            }
        }
        Referral GetRefferal(HealthGroup healthGroup, int NAZ_R = 0)
        {
            //В ТАП реестра-счетов может быть не заполнено назначение, поэтому используется бизнес правило
            if (NAZ_R == 0)
            {
                switch (healthGroup)
                {
                case HealthGroup.ThirdA:
                case HealthGroup.ThirdB:
                    return(Referral.LocalClinic);

                default:
                    return(Referral.No);
                }
            }

            return((Referral)NAZ_R);
        }
        public async Task <Result <List <HealthGroup> > > GetHealthGroupsAsync()
        {
            var healthGroups = new List <HealthGroup>();
            var nameProc     = @"[dbo].[spHealthGroups_GetAll]";

            try
            {
                using (var con = _conService.GetConnection())
                    using (var cmd = new SqlCommand(nameProc, con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        await con.OpenAsync();

                        using (var reader = await cmd.ExecuteReaderAsync())
                        {
                            if (reader.HasRows)
                            {
                                while (await reader.ReadAsync())
                                {
                                    var d = new HealthGroup
                                    {
                                        Id    = reader.GetInt32(0),
                                        Title = reader.GetString(1),
                                    };
                                    healthGroups.Add(d);
                                }
                            }
                        }
                    }
            }
            catch (Exception ex)
            {
                return(new Result <List <HealthGroup> >(ex.Message));
            }

            return(new Result <List <HealthGroup> >(healthGroups));
        }
示例#5
0
        private void SetHealthGroupus()
        {
            var hg = new HealthGroup
            {
                Id    = 1,
                Title = "Первая группа",
            };

            HealthGroups.Add(hg);

            hg = new HealthGroup
            {
                Id    = 2,
                Title = "Вторая группа",
            };
            HealthGroups.Add(hg);

            hg = new HealthGroup
            {
                Id    = 3,
                Title = "Третья группа",
            };
            HealthGroups.Add(hg);
        }
示例#6
0
 private EMKServise.HealthGroup ConvertHealthGroup(HealthGroup c)
 {
     if ((object)c != null)
     {
         EMKServise.HealthGroup eh = new EMKServise.HealthGroup();
         eh.Doctor = ConvertMedicalStaff(c.Doctor);
         eh.HealthGroupInfo = ConvertHealthGroupInfo(c.HealthGroupInfo);
         return eh;
     }
     else
         return null;
 }
        /// <summary>
        /// Добавляет шаг-осмотра.
        /// </summary>
        /// <param name="patientId">Id пациента</param>
        /// <param name="step">Шаг осмотра</param>
        /// <param name="date">Дата осмотра</param>
        /// <param name="healthGroup">Группа здоровья, опционально</param>
        /// <param name="referral">Направление, опционально</param>
        /// <exception cref="WebServiceOperationException">Возникает если не возможно добавить шаг осмотра.</exception>
        protected async Task AddStepAsync(int patientId, StepKind step, DateTime date, HealthGroup healthGroup = 0, Referral referral = 0)
        {
            ThrowExceptionIfNotAuthorized();

            var contentParameters = new Dictionary <string, string>
            {
                { "stageId", ((int)step).ToString() },
                { "stageDate", date.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture) },
                { "resultId", ((int)healthGroup).ToString() },
                { "destId", referral == 0 ? string.Empty : ((int)referral).ToString() },
                { "dispId", patientId.ToString() },
            };

            var responseText = await SendPostAsync(@"disp/editDispStage", contentParameters);

            var response = JsonConvert.DeserializeObject <WebResponse>(responseText);

            if (response.IsError)
            {
                throw new WebServiceOperationException("Ошибка добавления шага выполнения осмотра.");
            }
        }