Example #1
0
        /// <summary>
        /// The get msh.
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <returns>
        /// The <see cref="MSH"/>.
        /// </returns>
        private MSH GetMsh(Statement statement, Message message)
        {
            var msh = new MSH();

            // MSH.1
            msh.FieldDivider = Hl7Helper.BHS_Delimiter;

            // MSH.2
            msh.SpecialSymbol = Hl7Helper.BHS_CodeSymbols;

            var tfoms = statement.PointDistributionPolicy.Parent.Parent;

            // MSH.3
            msh.OriginApplicationName = new BHS3 {
                Application = "СРЗ " + tfoms.Code
            };

            // MSH.4
            msh.OriginOrganizationName = new BHS4 {
                CodeOfRegion = tfoms.Code, TableCode = Oid.Pvp, Iso = "ISO"
            };

            // MSH.5
            msh.ApplicationName = new BHS5 {
                Application = "ЦК ЕРП"
            };

            // MSH.6
            msh.OrganizationName = new BHS6 {
                FomsCode = "00", TableCode = Oid.Pvp, Iso = "ISO"
            };

            // MSH.7
            msh.DateTimeCreation = Hl7Helper.FormatCurrentDateTime();

            // MSH.9
            msh.MessageType = new MessageType {
                MessType = "ADT", TransactionCode = "A08", StructureType = "ADT_A01",
            };

            // MSH.10
            msh.Identificator = message.Id.ToString();

            // MSH.11
            msh.TypeWork = new TypeWork {
                Type = "P"
            };

            // MSH.12
            msh.VersionStandartId = new VersionStandartId();

            // MSH.15
            msh.ConfirmationTypeGateWay = "AL";

            // MSH.16
            msh.ConfirmationTypeFoms = "AL";

            return(msh);
        }
Example #2
0
 /// <summary>
 /// Формирует Evn
 /// </summary>
 /// <param name="time">
 /// The time.
 /// </param>
 /// <returns>
 /// The <see cref="Evn"/>.
 /// </returns>
 protected virtual Evn GetEvn(DateTime time)
 {
     return(new Evn
     {
         CodeReasonEvent = ReasonType,
         DateRegistrationEvent = Hl7Helper.FormatDateTime(time)
     });
 }
Example #3
0
        /// <summary>
        /// The get evn.
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        /// <returns>
        /// The <see cref="Evn"/>.
        /// </returns>
        private Evn GetEvn(Statement statement)
        {
            var reason = ObjectFactory.GetInstance <IConceptCacheManager>().GetById(ReasonType.П01);

            return(new Evn
            {
                CodeReasonEvent = reason != null ? reason.Code : string.Empty,
                DateRegistrationEvent =
                    statement.DateFiling.HasValue
                   ? Hl7Helper.FormatDateTime(statement.DateFiling.Value)
                   : string.Empty
            });
        }
Example #4
0
        /// <summary>
        /// The get msh.
        /// </summary>
        /// <param name="messageId">
        ///   The message Id.
        /// </param>
        /// <returns>
        /// The <see cref="MSH"/>.
        /// </returns>
        protected virtual MSH GetMsh(Guid messageId)
        {
            var msh = new MSH();

            // MSH.1
            msh.FieldDivider = Hl7Helper.BHS_Delimiter;

            // MSH.2
            msh.SpecialSymbol = Hl7Helper.BHS_CodeSymbols;

            ////// MSH.3
            ////msh.OriginApplicationName = new BHS3 { Application = "СРЗ " + sender.Code };

            ////// MSH.4
            ////msh.OriginOrganizationName = new BHS4 { CodeOfRegion = sender.Code };

            ////// MSH.5
            ////msh.ApplicationName.Application = "ЦК ЕРП";

            ////// MSH.6
            ////msh.OrganizationName = new BHS6 { FomsCode = "00" };

            // MSH.7
            msh.DateTimeCreation = Hl7Helper.FormatCurrentDateTime();

            // MSH.9
            msh.MessageType = MessType;

            // MSH.10
            msh.Identificator = messageId.ToString();

            // MSH.11
            msh.TypeWork = new TypeWork {
                Type = ConfigManager.TypeWork
            };

            // MSH.12
            msh.VersionStandartId = new VersionStandartId();

            // MSH.15
            msh.ConfirmationTypeGateWay = "AL";

            // MSH.16
            msh.ConfirmationTypeFoms = "AL";

            return(msh);
        }
Example #5
0
        /// <summary>
        /// The get bhs.
        /// </summary>
        /// <param name="batchId">
        /// The batch id.
        /// </param>
        /// <param name="statement">
        /// The statement.
        /// </param>
        /// <returns>
        /// The <see cref="BHS"/>.
        /// </returns>
        private BHS GetBhs(Guid batchId, Statement statement)
        {
            var bhs = new BHS();

            // BHS.1
            bhs.FieldSeparator = Hl7Helper.BHS_Delimiter;

            // BHS.2
            bhs.SpecialSymbol = Hl7Helper.BHS_CodeSymbols;

            var tfoms = statement.PointDistributionPolicy.Parent.Parent;

            // BHS.3
            bhs.OriginApplicationName = new BHS3 {
                Application = "СРЗ " + tfoms.Code
            };

            // BHS.4
            bhs.OriginOrganizationName = new BHS4 {
                CodeOfRegion = tfoms.Code, TableCode = Oid.Pvp, Iso = "ISO"
            };

            // BHS.5
            bhs.ApplicationName = new BHS5 {
                Application = "ЦК ЕРП"
            };

            // BHS.6
            bhs.OrganizationName = new BHS6 {
                FomsCode = "00", TableCode = Oid.Pvp, Iso = "ISO"
            };

            // BHS.7
            bhs.DateTimeNow = Hl7Helper.FormatCurrentDateTime();

            // BHS.9
            bhs.TypeWork = "P";

            // BHS.11
            bhs.Identificator = batchId.ToString();

            return(bhs);
        }
Example #6
0
        /// <summary>
        /// Возвращает текущую страховку
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        /// <param name="medicalInsurance">
        /// The medical Insurance.
        /// </param>
        /// <param name="id">
        /// Номер страховки в сегменте
        /// </param>
        /// <returns>
        /// Страховка
        /// </returns>
        protected ADT_A01_INSURANCE GetInsuranceCurrent(Statement statement, MedicalInsurance medicalInsurance, int id = 1)
        {
            var in1 = new IN1();

            // IN1.1	SI	Да	Порядковый номер сегмента
            in1.Id = id.ToString(CultureInfo.InvariantCulture);

            // IN1.2	CWE	Да	Идентификатор плана страхования
            in1.PlanId = new PlanId();

            // IN1.3	CX	Да	Идентификатор организации
            in1.CompanyId = new CompanyId {
                Id = medicalInsurance.Smo.Ogrn, CompanyIdType = "NII"
            };

            // IN1.4	XON	Нет	Наименование организации
            in1.CompanyName = new CompanyName {
                Name = medicalInsurance.Smo.FullName
            };

            // IN1.12	DT	Да	Дата начала действия страховки
            in1.DateBeginInsurence = Hl7Helper.FormatDate(medicalInsurance.DateFrom);

            // IN1.13	DT	Да	Дата окончания действия страховки
            in1.DateEndInsurence = medicalInsurance.DateTo.Year == 2200 ? string.Empty : Hl7Helper.FormatDate(medicalInsurance.DateTo);

            // IN1.15	IS	Да	Код территории страхования
            in1.CodeOfRegion = medicalInsurance.Smo.Parent.Okato;

            // IN1.35	IS	Нет	Тип страховки
            in1.InsuranceType = medicalInsurance.PolisType != null ? medicalInsurance.PolisType.Code : string.Empty;

            // IN1.36	ST	Да	Номер страховки
            in1.InsuranceSerNum = medicalInsurance.SeriesNumber;

            return(new ADT_A01_INSURANCE {
                In1 = in1
            });
        }
Example #7
0
        static void Main(string[] args)
        {
            // Template text. Use Document Parser SDK (https://bytescout.com/products/developer/documentparsersdk/index.html)
            // to create templates.
            // Read template from file:
            String templateText = File.ReadAllText(@".\TestReportFormat.yml");

            // Create standard .NET web client instance
            WebClient webClient = new WebClient();

            // Set API Key
            webClient.Headers.Add("x-api-key", API_KEY);

            // 1. RETRIEVE THE PRESIGNED URL TO UPLOAD THE FILE.
            // * If you already have a direct file URL, skip to the step 3.

            // Prepare URL for `Get Presigned URL` API call
            string query = Uri.EscapeUriString(string.Format(
                                                   "https://localhost/file/upload/get-presigned-url?contenttype=application/octet-stream&name={0}",
                                                   Path.GetFileName(SourceFile)));

            try
            {
                // Execute request
                string response = webClient.DownloadString(query);

                // Parse JSON response
                JObject json = JObject.Parse(response);

                if (json["error"].ToObject <bool>() == false)
                {
                    // Get URL to use for the file upload
                    string uploadUrl       = json["presignedUrl"].ToString();
                    string uploadedFileUrl = json["url"].ToString();

                    // 2. UPLOAD THE FILE TO CLOUD.

                    webClient.Headers.Add("content-type", "application/octet-stream");
                    webClient.UploadFile(uploadUrl, "PUT", SourceFile);                     // You can use UploadData() instead if your file is byte[] or Stream
                    webClient.Headers.Remove("content-type");

                    // 3. PARSE UPLOADED PDF DOCUMENT

                    // URL of `Document Parser` API call
                    string url = "https://localhost/pdf/documentparser";

                    Dictionary <string, object> requestBody = new Dictionary <string, object>();
                    requestBody.Add("template", templateText);
                    requestBody.Add("name", Path.GetFileName(DestinationFile));
                    requestBody.Add("url", uploadedFileUrl);
                    requestBody.Add("async", Async);

                    // Convert dictionary of params to JSON
                    string jsonPayload = JsonConvert.SerializeObject(requestBody);

                    // Execute request
                    response = webClient.UploadString(url, "POST", jsonPayload);

                    // Parse JSON response
                    json = JObject.Parse(response);

                    if (json["error"].ToObject <bool>() == false)
                    {
                        // Asynchronous job ID
                        string jobId = json["jobId"].ToString();
                        // Get URL of generated JSON file
                        string resultFileUrl = json["url"].ToString();

                        // Check the job status in a loop.
                        // If you don't want to pause the main thread you can rework the code
                        // to use a separate thread for the status checking and completion.
                        do
                        {
                            string status = CheckJobStatus(webClient, jobId); // Possible statuses: "working", "failed", "aborted", "success".

                            // Display timestamp and status (for demo purposes)
                            Console.WriteLine(DateTime.Now.ToLongTimeString() + ": " + status);

                            if (status == "success")
                            {
                                // Download JSON file
                                webClient.DownloadFile(resultFileUrl, DestinationFile);

                                // Parse document data in JSON format
                                string jsonString = System.IO.File.ReadAllText(DestinationFile);

                                // Step 2: Parse Json fileds in class format
                                var oInpModel = JsonParserHelper.ParseJsonHL7Fields(jsonString);

                                // Step 3: Get Data in HL7 Format
                                var oHL7Format = Hl7Helper.GetHL7Format(oInpModel);

                                // Store HL7 File and open with default associated program
                                var outputFile = "outputHl7.txt";
                                System.IO.File.WriteAllText(outputFile, oHL7Format);

                                Console.WriteLine("Generated HL7 file saved as \"{0}\" file.", outputFile);
                                break;
                            }
                            else if (status == "working")
                            {
                                // Pause for a few seconds
                                Thread.Sleep(3000);
                            }
                            else
                            {
                                Console.WriteLine(status);
                                break;
                            }
                        }while (true);
                    }
                    else
                    {
                        Console.WriteLine(json["message"].ToString());
                    }
                }
                else
                {
                    Console.WriteLine(json["message"].ToString());
                }
            }
            catch (WebException e)
            {
                Console.WriteLine(e.ToString());
            }

            webClient.Dispose();


            Console.WriteLine();
            Console.WriteLine("Press any key...");
            Console.ReadKey();
        }
Example #8
0
        /// <summary>
        /// The get insurance previos.
        /// </summary>
        /// <param name="statement">
        /// The statement current.
        /// </param>
        /// <param name="medicalInsurance">
        /// The medical insurance.
        /// </param>
        /// <returns>
        /// The <see cref="ADT_A01_INSURANCE"/>.
        /// </returns>
        private ADT_A01_INSURANCE GetInsurancePrevios(Statement statement, MedicalInsurance medicalInsurance)
        {
            var in1 = new IN1();

            // IN1.1	SI	Да	Порядковый номер сегмента
            in1.Id = "1";

            // IN1.2	CWE	Да	Идентификатор плана страхования
            in1.PlanId = new PlanId();

            // IN1.3	CX	Да	Идентификатор организации
            in1.CompanyId = new CompanyId {
                Id = medicalInsurance.Smo.Ogrn, CompanyIdType = "NII"
            };

            // IN1.4	XON	Нет	Наименование организации
            in1.CompanyName = new CompanyName {
                Name = medicalInsurance.Smo.FullName
            };

            // IN1.12	DT	Да	Дата начала действия страховки
            in1.DateBeginInsurence = Hl7Helper.FormatDate(medicalInsurance.DateFrom);

            // IN1.13	DT	Да	Дата окончания действия страховки
            in1.DateEndInsurence = medicalInsurance.DateTo.Year == 2200 ? null : Hl7Helper.FormatDate(medicalInsurance.DateTo);

            // IN1.15	IS	Да	Код территории страхования
            in1.CodeOfRegion = medicalInsurance.Smo.Parent.Okato;

            // IN1.35	IS	Нет	Тип страховки
            in1.InsuranceType = medicalInsurance.PolisType != null ? medicalInsurance.PolisType.Code : string.Empty;

            // IN1.36	ST	Да	Номер страховки
            in1.InsuranceSerNum = medicalInsurance.SeriesNumber;

            var personData = statement.InsuredPersonData;

            // IN1.16	XPN	Да	Фамилия, имя, отчество
            in1.FioList = new List <Fio>
            {
                new Fio(
                    new Surname(personData.FirstName),
                    personData.LastName,
                    personData.MiddleName,
                    "L")
            };

            // IN1.18	DTM	Да	Дата рождения
            in1.BirthDay = personData.Birthday.HasValue ? Hl7Helper.FormatDate(personData.Birthday.Value) : null;

            var adr  = statement.Address;
            var adr2 = statement.Address2 ?? adr;

            in1.AddressList = new List <Address>
            {
                adr.IsHomeless.HasValue&& adr.IsHomeless.Value
                            ? new Address {
                    AddressType = "L"
                }
                            : new Address {
                    Region = adr.Okato, Country = "RUS", AddressType = "L",
                }
            };

            if (!(adr.IsHomeless.HasValue && adr.IsHomeless.Value))
            {
                in1.AddressList.Add(new Address {
                    Region = adr2.Okato, Country = "RUS", AddressType = "H",
                });
            }

            // IN1.42
            in1.Employment = new Employment {
                employment = CategoryPerson.IsWorking(personData.Category.Id) ? "1" : "0"
            };

            // IN1.43	IS	Усл	Пол
            in1.Sex = personData.Gender.Code;

            // IN1.49	CX	Да	Список идентификаторов
            in1.IdentificatorsList = new List <Identificators>();

            var document = statement.DocumentUdl;

            in1.IdentificatorsList.Add(
                new Identificators
            {
                identificator     = document.SeriesNumber,
                identificatorType = document.DocumentType.Code,
                identificatorFrom = Hl7Helper.FormatDate(document.DateIssue),
                identificatorTo   =
                    document.DateExp.HasValue
                                       ? Hl7Helper.FormatDate(document.DateExp.Value)
                                       : null
            });

            document = statement.DocumentRegistration;

            if (document != null)
            {
                in1.IdentificatorsList.Add(
                    new Identificators
                {
                    identificator     = document.SeriesNumber,
                    identificatorType = document.DocumentType.Code,
                    identificatorFrom = Hl7Helper.FormatDate(document.DateIssue),
                    identificatorTo   =
                        document.DateExp.HasValue
                                         ? Hl7Helper.FormatDate(document.DateExp.Value)
                                         : null
                });
            }

            // Номер полиса
            if (!string.IsNullOrEmpty(statement.InsuredPerson.MainPolisNumber))
            {
                in1.IdentificatorsList.Add(
                    new Identificators
                {
                    identificatorType = "NI",
                    identificator     = statement.InsuredPerson.MainPolisNumber
                });
            }

            // СНИЛС
            if (!string.IsNullOrEmpty(personData.Snils))
            {
                in1.IdentificatorsList.Add(new Identificators {
                    identificatorType = "PEN", identificator = personData.Snils
                });
            }

            // IN1.52	ST	Да	Место рождения
            in1.PlaceOfBirth = personData.Birthplace;

            return(new ADT_A01_INSURANCE {
                In1 = in1
            });
        }
Example #9
0
        /// <summary>
        /// The get pid.
        /// </summary>
        /// <param name="statementCurrent">
        /// Текущее заявление
        /// </param>
        /// <returns>
        /// The <see cref="MessagePid"/>.
        /// </returns>
        protected virtual MessagePid GetPid(Statement statementCurrent)
        {
            var personData = statementCurrent.InsuredPersonData;

            var deadInfo      = statementCurrent.InsuredPerson.DeadInfo;
            var insuredPerson = statementCurrent.InsuredPerson;

            var pid = new MessagePid();

            // PID.11
            var adr  = statementCurrent.Address;
            var adr2 = statementCurrent.Address2 ?? adr;

            pid.AddressList = new List <Address>
            {
                adr.IsHomeless.HasValue&& adr.IsHomeless.Value
                            ? new Address {
                    AddressType = "L"
                }
                            : new Address {
                    Region = adr.GetOkatoRegion(), Country = "RUS", AddressType = "L",
                }
            };

            if (!(adr.IsHomeless.HasValue && adr.IsHomeless.Value))
            {
                pid.AddressList.Add(new Address {
                    Region = adr2.GetOkatoRegion(), Country = "RUS", AddressType = "H",
                });
            }

            // PID.7
            pid.BirthDay = personData.Birthday.HasValue ? Hl7Helper.FormatDate(personData.Birthday.Value) : string.Empty;

            // PID.29
            if (deadInfo != null && deadInfo.ActRecordDate.HasValue)
            {
                pid.DeadDay = Hl7Helper.FormatDate(deadInfo.ActRecordDate.Value);
            }

            // PID.5
            pid.FioList = new List <Fio>
            {
                new Fio(
                    new Surname(personData.FirstName),
                    personData.LastName,
                    personData.MiddleName,
                    "L")
            };

            // PID.3
            pid.IdentificatorsList = new List <Identificators>();

            // Документ УДЛ
            var document = statementCurrent.DocumentUdl;

            pid.IdentificatorsList.Add(
                new Identificators
            {
                identificator     = document.SeriesNumber,
                identificatorType = document.DocumentType.Code,
                identificatorFrom = Hl7Helper.FormatDate(document.DateIssue),
                identificatorTo   =
                    document.DateExp.HasValue
                                       ? Hl7Helper.FormatDate(document.DateExp.Value)
                                       : null
            });

            document = statementCurrent.ResidencyDocument;
            if (document != null)
            {
                pid.IdentificatorsList.Add(
                    new Identificators
                {
                    identificator     = document.SeriesNumber,
                    identificatorType = document.DocumentType.Code,
                    identificatorFrom = Hl7Helper.FormatDate(document.DateIssue),
                    identificatorTo   =
                        document.DateExp.HasValue
                                         ? Hl7Helper.FormatDate(document.DateExp.Value)
                                         : null
                });
            }

            // Номер ЕНП
            if (!string.IsNullOrEmpty(insuredPerson.MainPolisNumber))
            {
                pid.IdentificatorsList.Add(
                    new Identificators
                {
                    identificatorType = "NI",
                    identificator     = insuredPerson.MainPolisNumber
                });
            }

            // СНИЛС
            if (!string.IsNullOrEmpty(personData.Snils))
            {
                pid.IdentificatorsList.Add(new Identificators {
                    identificatorType = "PEN", identificator = personData.Snils
                });
            }

            // PID.30
            pid.IsDead = deadInfo != null ? "1" : "0";

            // PID.26"
            if (!personData.IsRefugee)
            {
                pid.Nationality = new National
                {
                    Nationality = personData.IsNotCitizenship ? "Б/Г" : personData.Citizenship.Code,
                    TableCode   = Oid.Страна
                };
            }
            else
            {
                pid.Nationality = new National
                {
                    // Является беженцем
                    Nationality = "1",
                    TableCode   = "1.2.643.2.40.3.3.0.6.19"
                };
            }

            // PID.23
            pid.PlaceOfBirth = personData.Birthplace;

            // PID.32
            pid.ReliabilityIdList = new List <string>();

            // PID.8
            pid.Sex = personData.Gender.Code;

            return(pid);
        }
Example #10
0
        /// <summary>
        /// The get in 1.
        /// </summary>
        /// <param name="statement">
        /// The statement.
        /// </param>
        /// <param name="insurance">
        /// The insurance.
        /// </param>
        /// <returns>
        /// The <see cref="IN1"/>.
        /// </returns>
        private IN1 GetIn1(Statement statement, MedicalInsurance insurance)
        {
            var pvp               = statement.PointDistributionPolicy;
            var smo               = pvp.Parent;
            var personData        = statement.InsuredPersonData;
            var insuredPerson     = statement.InsuredPerson;
            var residencyDocument = statement.ResidencyDocument;
            var polisEndDate      = statement.ResidencyDocument != null && statement.ResidencyDocument.DateExp.HasValue
                           ? Hl7Helper.FormatDate(statement.ResidencyDocument.DateExp.Value)
                           : Hl7Helper.FormatDate(new DateTime(2200, 1, 1));
            var contact     = statement.ContactInfo;
            var tfoms       = statement.PointDistributionPolicy.Parent.Parent;
            var documentUdl = statement.DocumentUdl;

            var in1 = new IN1();

            // IN1.1	SI	Да	Порядковый номер сегмента
            in1.Id = "1";

            // IN1.2	CWE	Да	Идентификатор плана страхования
            in1.PlanId = new PlanId {
                Id = "ОМС", Oid = "1.2.643.2.40.5.100.72"
            };

            // IN1.3	CX	Да	Идентификатор организации
            in1.CompanyId = new CompanyId {
                Id = smo.Ogrn, CompanyIdType = "NII"
            };

            // IN1.4	XON	Нет	Наименование организации
            in1.CompanyName = new CompanyName {
                Name = smo.FullName
            };

            // IN1.5	XAD	Усл	Адрес СМО
            // IN1.6	XPN	Усл	Контактное лицо в СМО
            // IN1.7	XTN	Усл	Контактные телефоны СМО

            // IN1.12	DT	Да	Дата начала действия страховки
            in1.DateBeginInsurence = statement.DateFiling.HasValue
                                 ? Hl7Helper.FormatDate(statement.DateFiling.Value)
                                 : string.Empty;

            // IN1.13	DT	Да	Дата окончания действия страховки
            in1.DateEndInsurence = polisEndDate;

            // IN1.15	IS	Да	Код территории страхования
            in1.CodeOfRegion = smo.Parent.Okato;

            // IN1.16	XPN	Да	Фамилия, имя, отчество
            in1.FioList = new List <Fio>
            {
                new Fio(
                    new Surname(personData.FirstName),
                    personData.LastName,
                    personData.MiddleName,
                    "L")
            };

            // IN1.18	DTM	Да	Дата рождения
            in1.BirthDay = personData.Birthday.HasValue ? Hl7Helper.FormatDate(personData.Birthday.Value) : null;

            var adr  = statement.Address;
            var adr2 = statement.Address2 ?? adr;

            in1.AddressList = new List <Address>
            {
                adr.IsHomeless.HasValue&& adr.IsHomeless.Value
                            ? new Address {
                    AddressType = "L"
                }
                            : new Address
                {
                    Region      = tfoms.Okato,
                    Country     = "RUS",
                    AddressType = "L",
                }
            };

            if (!(adr.IsHomeless.HasValue && adr.IsHomeless.Value))
            {
                in1.AddressList.Add(new Address {
                    Region = tfoms.Okato, Country = "RUS", AddressType = "H",
                });
            }

            // IN1.35	IS	Нет	Тип страховки
            in1.InsuranceType = insurance.PolisType != null ? insurance.PolisType.Code : string.Empty;

            // IN1.36	ST	Да	Номер страховки
            in1.InsuranceSerNum = insurance.SeriesNumber;

            // IN1.42
            in1.Employment = new Employment {
                employment = CategoryPerson.IsWorking(personData.Category.Id) ? "1" : "0"
            };

            // IN1.43	IS	Усл	Пол
            in1.Sex = personData.Gender.Code;

            var documentManager = ObjectFactory.GetInstance <IDocumentManager>();

            // IN1.49	CX	Да	Список идентификаторов
            in1.IdentificatorsList = new List <Identificators>();

            in1.IdentificatorsList.Add(
                new Identificators
            {
                identificator     = documentUdl.SeriesNumber,
                identificatorType = documentUdl.DocumentType.Code,
                identificatorFrom = Hl7Helper.FormatDate(documentUdl.DateIssue),
                identificatorTo   =
                    documentUdl.DateExp.HasValue
                                       ? Hl7Helper.FormatDate(documentUdl.DateExp.Value)
                                       : null
            });

            // Номер полиса
            if (!string.IsNullOrEmpty(insuredPerson.MainPolisNumber))
            {
                in1.IdentificatorsList.Add(
                    new Identificators
                {
                    identificatorType = "NI",
                    identificator     = insuredPerson.MainPolisNumber
                });
            }

            // СНИЛС
            if (!string.IsNullOrEmpty(personData.Snils))
            {
                in1.IdentificatorsList.Add(new Identificators {
                    identificatorType = "PEN", identificator = personData.Snils
                });
            }

            // IN1.52	ST	Да	Место рождения
            in1.PlaceOfBirth = personData.Birthplace;

            return(in1);
        }
Example #11
0
 /// <summary>
 /// The is error fatal.
 /// </summary>
 /// <param name="error">
 /// The error.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public static bool IsErrorFatal(ErrorHl7 error)
 {
     return(Hl7Helper.IsSeverityFatal(GetErrorSeverityLevel(error)));
 }