示例#1
0
        public static List <Practice_Doctors_Model> Get_Doctors_for_ID_Array(string[] doctor_ids, SessionSecurityTicket securityTicket)
        {
            var    TenantID   = securityTicket.TenantID.ToString();
            var    serializer = new JsonNetSerializer();
            var    connection = Elastic_Utils.ElsaticConnection();
            string queryS     = string.Empty;

            if (Elastic_Utils.IfIndexOrTypeExists(TenantID, connection) && Elastic_Utils.IfIndexOrTypeExists(TenantID + "/" + elasticType, connection))
            {
                queryS = QueryBuilderDoctors.BuildGetDoctorsForIDArrayQuery(doctor_ids);
                return(serializer.ToSearchResult <Practice_Doctors_Model>(connection.Post(Commands.Search(TenantID, elasticType), queryS)).Documents.ToList());
            }

            return(new List <Practice_Doctors_Model>());
        }
示例#2
0
        public static List <Practice_Doctors_Model> Get_Doctors_for_SearchCriteria_and_Potential_Doctors(string search_criteria, IEnumerable <String> potential_doctors, SessionSecurityTicket securityTicket)
        {
            var    TenantID   = securityTicket.TenantID.ToString();
            var    serializer = new JsonNetSerializer();
            var    connection = Elastic_Utils.ElsaticConnection();
            string query      = string.Empty;

            List <Practice_Doctors_Model> modelForSendL = new List <Practice_Doctors_Model>();

            if (Elastic_Utils.IfIndexOrTypeExists(TenantID, connection) && Elastic_Utils.IfIndexOrTypeExists(TenantID + "/" + elasticType, connection))
            {
                query = QueryBuilderDoctors.BuildGetDoctorsQuerySearch(search_criteria, potential_doctors);

                string searchCommand = Commands.Search(TenantID, elasticType).Pretty();
                string result        = connection.Post(searchCommand, query);

                var foundResults_Doctors = serializer.ToSearchResult <Practice_Doctors_Model>(result);

                modelForSendL = foundResults_Doctors.Documents.ToList();
            }

            return(modelForSendL);
        }
示例#3
0
        public static List <Practice_Doctors_Model> Get_Doctors_and_PracticesList(ElasticParameterObject sort_parameter, SessionSecurityTicket securityTicket)
        {
            var    TenantID   = securityTicket.TenantID.ToString();
            var    serializer = new JsonNetSerializer();
            var    connection = Elastic_Utils.ElsaticConnection();
            string queryS     = string.Empty;

            List <Practice_Doctors_Model> modelForSendL = new List <Practice_Doctors_Model>();

            if (Elastic_Utils.IfIndexOrTypeExists(TenantID, connection) && Elastic_Utils.IfIndexOrTypeExists(TenantID + "/" + elasticType, connection))
            {
                if (sort_parameter.filter_by == null && String.IsNullOrEmpty(sort_parameter.search_params))
                {
                    queryS = QueryBuilderDoctors.BuildGetDoctorsQuery(sort_parameter.start_row_index, 100, sort_parameter.sort_by, sort_parameter.isAsc);
                }
                else
                {
                    sort_parameter.search_params = sort_parameter.search_params != null?sort_parameter.search_params.ToLower() : sort_parameter.search_params;

                    queryS = QueryBuilderDoctors.BuildGetDoctorsQueryFilter(sort_parameter.start_row_index, 100, sort_parameter.sort_by, sort_parameter.isAsc, sort_parameter.search_params, sort_parameter.filter_by);
                }

                string searchCommand_Doc_Practices = Commands.Search(TenantID, elasticType).Pretty();
                string result = connection.Post(searchCommand_Doc_Practices, queryS);

                var foundResults_Doctors = serializer.ToSearchResult <Practice_Doctors_Model>(result);
                try
                {
                    foreach (var item in foundResults_Doctors.Documents)
                    {
                        item.order_name = sort_parameter.sort_by;

                        if (sort_parameter.sort_by.Equals("bank_untouched"))
                        {
                            item.group_name = string.IsNullOrEmpty(item.bank) ? "-" : item.bank;
                        }
                        else if (sort_parameter.sort_by.Equals("type"))
                        {
                            item.group_name = item.type.Equals("Doctor") ? "Arzt" : "Praxis";
                        }
                        else if (sort_parameter.sort_by.Equals("account_status"))
                        {
                            item.group_name = item.account_status;
                        }
                        else if (sort_parameter.sort_by.Equals("contract"))
                        {
                            item.group_name = item.contract.ToString();
                        }
                        else
                        {
                            item.group_name = string.IsNullOrEmpty(item.name_untouched) ? "-" : item.name_untouched.Substring(0, 1).ToUpper();
                        }
                        if (item.type == "Doctor")
                        {
                            item.doctor_count_or_practice_name = item.practice_name_for_doctor;
                        }
                        else
                        {
                            var query = new QueryBuilder <Practice_Doctors_Model>()
                                        .Query(q => q
                                               .Bool(b => b
                                                     .Must(must => must.Terms(t => t.Field(f1 => f1.type).Values("doctor").MinimumMatch(1))
                                                           .Terms(t1 => t1.Field(f => f.practice_for_doctor_id).Values(item.id).MinimumMatch(1))
                                                           )));

                            var doctor_count = serializer.ToCountResult(connection.Post(Commands.Count(securityTicket.TenantID.ToString(), elasticType), query.BuildBeautified()).Result);
                            item.doctor_count_or_practice_name = doctor_count.count.ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    var a = ex.StackTrace;
                }

                modelForSendL = foundResults_Doctors.Documents.ToList();
            }

            return(modelForSendL);
        }