Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 43.85 KB | None | 0 0
  1. package netrika_iemk
  2.  
  3. import (
  4.     "bytes"
  5.     "crypto/tls"
  6.     "encoding/xml"
  7.     "io/ioutil"
  8.     "log"
  9.     "net"
  10.     "net/http"
  11.     "time"
  12. )
  13.  
  14. // against "unused imports"
  15. var _ time.Time
  16. var _ xml.Name
  17.  
  18. type GetVersion struct {
  19.     XMLName xml.Name `xml:"http://tempuri.org/ GetVersion"`
  20. }
  21.  
  22. type GetVersionResponse struct {
  23.     XMLName xml.Name `xml:"http://tempuri.org/ GetVersionResponse"`
  24.  
  25.     GetVersionResult *GetVersionResult `xml:"GetVersionResult,omitempty"`
  26. }
  27.  
  28. type GetVersionResult struct {
  29.     DatabaseVersion string `xml:"DatabaseVersion,omitempty"`
  30.     ServiceVersion  string `xml:"ServiceVersion,omitempty"`
  31. }
  32.  
  33. type AddCase struct {
  34.     XMLName xml.Name `xml:"http://tempuri.org/ AddCase"`
  35.  
  36.     Guid    string    `xml:"guid,omitempty"`
  37.     CaseDto *CaseBase `xml:"caseDto,omitempty"`
  38. }
  39.  
  40. type AddCaseResponse struct {
  41.     XMLName xml.Name `xml:"http://tempuri.org/ AddCaseResponse"`
  42. }
  43.  
  44. type CreateCase struct {
  45.     XMLName xml.Name `xml:"http://tempuri.org/ CreateCase"`
  46.  
  47.     Guid          string    `xml:"guid,omitempty"`
  48.     CreateCaseDto *CaseBase `xml:"createCaseDto,omitempty"`
  49. }
  50.  
  51. type CreateCaseResponse struct {
  52.     XMLName xml.Name `xml:"http://tempuri.org/ CreateCaseResponse"`
  53. }
  54.  
  55. type CloseCase struct {
  56.     XMLName xml.Name `xml:"http://tempuri.org/ CloseCase"`
  57.  
  58.     Guid    string    `xml:"guid,omitempty"`
  59.     CaseDto *CaseBase `xml:"caseDto,omitempty"`
  60. }
  61.  
  62. type CloseCaseResponse struct {
  63.     XMLName xml.Name `xml:"http://tempuri.org/ CloseCaseResponse"`
  64. }
  65.  
  66. type UpdateCase struct {
  67.     XMLName xml.Name `xml:"http://tempuri.org/ UpdateCase"`
  68.  
  69.     Guid    string    `xml:"guid,omitempty"`
  70.     CaseDto *CaseBase `xml:"caseDto,omitempty"`
  71. }
  72.  
  73. type UpdateCaseResponse struct {
  74.     XMLName xml.Name `xml:"http://tempuri.org/ UpdateCaseResponse"`
  75. }
  76.  
  77. type AddMedRecord struct {
  78.     XMLName xml.Name `xml:"http://tempuri.org/ AddMedRecord"`
  79.  
  80.     Guid         string     `xml:"guid,omitempty"`
  81.     IdLpu        string     `xml:"idLpu,omitempty"`
  82.     IdPatientMis string     `xml:"idPatientMis,omitempty"`
  83.     IdCaseMis    string     `xml:"idCaseMis,omitempty"`
  84.     MedRecord    *MedRecord `xml:"medRecord,omitempty"`
  85. }
  86.  
  87. type AddMedRecordResponse struct {
  88.     XMLName xml.Name `xml:"http://tempuri.org/ AddMedRecordResponse"`
  89. }
  90.  
  91. type AddStepToCase struct {
  92.     XMLName xml.Name `xml:"http://tempuri.org/ AddStepToCase"`
  93.  
  94.     Guid         string    `xml:"guid,omitempty"`
  95.     IdLpu        string    `xml:"idLpu,omitempty"`
  96.     IdPatientMis string    `xml:"idPatientMis,omitempty"`
  97.     IdCaseMis    string    `xml:"idCaseMis,omitempty"`
  98.     Step         *StepBase `xml:"step,omitempty"`
  99. }
  100.  
  101. type AddStepToCaseResponse struct {
  102.     XMLName xml.Name `xml:"http://tempuri.org/ AddStepToCaseResponse"`
  103. }
  104.  
  105. type GetReferralList struct {
  106.     XMLName xml.Name `xml:"http://tempuri.org/ GetReferralList"`
  107.  
  108.     Guid           string    `xml:"guid,omitempty"`
  109.     IdLpu          string    `xml:"idLpu,omitempty"`
  110.     IdReferralType byte      `xml:"idReferralType,omitempty"`
  111.     StartDate      time.Time `xml:"startDate,omitempty"`
  112.     EndDate        time.Time `xml:"endDate,omitempty"`
  113. }
  114.  
  115. type GetReferralListResponse struct {
  116.     XMLName xml.Name `xml:"http://tempuri.org/ GetReferralListResponse"`
  117.  
  118.     GetReferralListResult *ArrayOfReferralTupleDto `xml:"GetReferralListResult,omitempty"`
  119. }
  120.  
  121. type CancelCase struct {
  122.     XMLName xml.Name `xml:"http://tempuri.org/ CancelCase"`
  123.  
  124.     Guid         string `xml:"guid,omitempty"`
  125.     IdLpu        string `xml:"idLpu,omitempty"`
  126.     IdPatientMis string `xml:"idPatientMis,omitempty"`
  127.     IdCaseMis    string `xml:"idCaseMis,omitempty"`
  128. }
  129.  
  130. type CancelCaseResponse struct {
  131.     XMLName xml.Name `xml:"http://tempuri.org/ CancelCaseResponse"`
  132. }
  133.  
  134. type Char int32
  135.  
  136. const ()
  137.  
  138. type Duration *Duration
  139.  
  140. const ()
  141.  
  142. type Guid string
  143.  
  144. const ()
  145.  
  146. type VersionInfo struct {
  147.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.Shared.Core VersionInfo"`
  148.  
  149.     DatabaseVersion string `xml:"DatabaseVersion,omitempty"`
  150.     ServiceVersion  string `xml:"ServiceVersion,omitempty"`
  151. }
  152.  
  153. type CaseBase struct {
  154.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Case CaseBase"`
  155.  
  156.     OpenDate               time.Time     `xml:"OpenDate,omitempty"`
  157.     CloseDate              time.Time     `xml:"CloseDate,omitempty"`
  158.     HistoryNumber          string        `xml:"HistoryNumber,omitempty"`
  159.     IdCaseMis              string        `xml:"IdCaseMis,omitempty"`
  160.     IdCaseAidType          byte          `xml:"IdCaseAidType,omitempty"`
  161.     IdPaymentType          byte          `xml:"IdPaymentType,omitempty"`
  162.     Confidentiality        byte          `xml:"Confidentiality,omitempty"`
  163.     DoctorConfidentiality  byte          `xml:"DoctorConfidentiality,omitempty"`
  164.     CuratorConfidentiality byte          `xml:"CuratorConfidentiality,omitempty"`
  165.     IdLpu                  string        `xml:"IdLpu,omitempty"`
  166.     IdCaseResult           byte          `xml:"IdCaseResult,omitempty"`
  167.     Comment                string        `xml:"Comment,omitempty"`
  168.     DoctorInCharge         *MedicalStaff `xml:"DoctorInCharge,omitempty"`
  169.     Authenticator          *Participant  `xml:"Authenticator,omitempty"`
  170.     Author                 *Participant  `xml:"Author,omitempty"`
  171.     LegalAuthenticator     *Participant  `xml:"LegalAuthenticator,omitempty"`
  172.     Guardian               *Guardian     `xml:"Guardian,omitempty"`
  173.     IdPatientMis           string        `xml:"IdPatientMis,omitempty"`
  174.     AdmissionCondition     byte          `xml:"AdmissionCondition,omitempty"`
  175.     CaseVisitType          byte          `xml:"CaseVisitType,omitempty"`
  176. }
  177.  
  178. type CaseAmb struct {
  179.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Case CaseAmb"`
  180.  
  181.     *CaseBase
  182.  
  183.     IdCasePurpose byte              `xml:"IdCasePurpose,omitempty"`
  184.     IdCaseType    byte              `xml:"IdCaseType,omitempty"`
  185.     IdAmbResult   byte              `xml:"IdAmbResult,omitempty"`
  186.     IsActive      bool              `xml:"IsActive,omitempty"`
  187.     Steps         *ArrayOfStepAmb   `xml:"Steps,omitempty"`
  188.     MedRecords    *ArrayOfMedRecord `xml:"MedRecords,omitempty"`
  189. }
  190.  
  191. type CaseStat struct {
  192.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Case CaseStat"`
  193.  
  194.     *CaseBase
  195.  
  196.     DeliveryCode           string               `xml:"DeliveryCode,omitempty"`
  197.     IdIntoxicationType     byte                 `xml:"IdIntoxicationType,omitempty"`
  198.     IdTypeFromDiseaseStart byte                 `xml:"IdTypeFromDiseaseStart,omitempty"`
  199.     IdRepetition           byte                 `xml:"IdRepetition,omitempty"`
  200.     HospitalizationOrder   byte                 `xml:"HospitalizationOrder,omitempty"`
  201.     IdTransportIntern      byte                 `xml:"IdTransportIntern,omitempty"`
  202.     Steps                  *ArrayOfStepStat     `xml:"Steps,omitempty"`
  203.     HospResult             byte                 `xml:"HospResult,omitempty"`
  204.     MedRecords             *ArrayOfMedRecord    `xml:"MedRecords,omitempty"`
  205.     IdHospChannel          byte                 `xml:"IdHospChannel,omitempty"`
  206.     RW1Mark                bool                 `xml:"RW1Mark,omitempty"`
  207.     AIDSMark               bool                 `xml:"AIDSMark,omitempty"`
  208.     PrehospitalDefects     *ArrayOfunsignedByte `xml:"PrehospitalDefects,omitempty"`
  209.     AdmissionComment       string               `xml:"AdmissionComment,omitempty"`
  210.     DischargeCondition     byte                 `xml:"DischargeCondition,omitempty"`
  211.     DischargeComment       string               `xml:"DischargeComment,omitempty"`
  212.     DietComment            string               `xml:"DietComment,omitempty"`
  213.     TreatComment           string               `xml:"TreatComment,omitempty"`
  214.     WorkComment            string               `xml:"WorkComment,omitempty"`
  215.     OtherComment           string               `xml:"OtherComment,omitempty"`
  216. }
  217.  
  218. type CaseAcps struct {
  219.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Case CaseAcps"`
  220.  
  221.     *CaseBase
  222.  
  223.     MedRecords *ArrayOfMedRecord `xml:"MedRecords,omitempty"`
  224. }
  225.  
  226. type MedicalStaff struct {
  227.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto MedicalStaff"`
  228.  
  229.     Person         *PersonWithIdentity `xml:"Person,omitempty"`
  230.     IdLpu          string              `xml:"IdLpu,omitempty"`
  231.     IdSpeciality   uint16              `xml:"IdSpeciality,omitempty"`
  232.     IdPosition     uint16              `xml:"IdPosition,omitempty"`
  233.     IdMedicalStaff int32               `xml:"IdMedicalStaff,omitempty"`
  234.     SpecialityName string              `xml:"SpecialityName,omitempty"`
  235.     PositionName   string              `xml:"PositionName,omitempty"`
  236. }
  237.  
  238. type PersonWithIdentity struct {
  239.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto PersonWithIdentity"`
  240.  
  241.     *Person
  242.  
  243.     Documents *ArrayOfIdentityDocument `xml:"Documents,omitempty"`
  244. }
  245.  
  246. type Person struct {
  247.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto Person"`
  248.  
  249.     HumanName   *HumanName `xml:"HumanName,omitempty"`
  250.     Sex         byte       `xml:"Sex,omitempty"`
  251.     Birthdate   time.Time  `xml:"Birthdate,omitempty"`
  252.     IdPersonMis string     `xml:"IdPersonMis,omitempty"`
  253. }
  254.  
  255. type HumanName struct {
  256.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto HumanName"`
  257.  
  258.     GivenName  string `xml:"GivenName,omitempty"`
  259.     MiddleName string `xml:"MiddleName,omitempty"`
  260.     FamilyName string `xml:"FamilyName,omitempty"`
  261. }
  262.  
  263. type ArrayOfIdentityDocument struct {
  264.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto ArrayOfIdentityDocument"`
  265.  
  266.     IdentityDocument []*IdentityDocument `xml:"IdentityDocument,omitempty"`
  267. }
  268.  
  269. type IdentityDocument struct {
  270.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto IdentityDocument"`
  271.  
  272.     DocN           string    `xml:"DocN,omitempty"`
  273.     DocS           string    `xml:"DocS,omitempty"`
  274.     DocumentName   string    `xml:"DocumentName,omitempty"`
  275.     ExpiredDate    time.Time `xml:"ExpiredDate,omitempty"`
  276.     IdDocumentType byte      `xml:"IdDocumentType,omitempty"`
  277.     IdProvider     int32     `xml:"IdProvider,omitempty"`
  278.     IssuedDate     time.Time `xml:"IssuedDate,omitempty"`
  279.     ProviderName   string    `xml:"ProviderName,omitempty"`
  280.     RegionCode     string    `xml:"RegionCode,omitempty"`
  281.     StartDate      time.Time `xml:"StartDate,omitempty"`
  282. }
  283.  
  284. type Participant struct {
  285.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto Participant"`
  286.  
  287.     Doctor *MedicalStaff `xml:"Doctor,omitempty"`
  288.     IdRole byte          `xml:"IdRole,omitempty"`
  289. }
  290.  
  291. type Guardian struct {
  292.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto Guardian"`
  293.  
  294.     Person             *PersonWithIdentity `xml:"Person,omitempty"`
  295.     IdRelationType     byte                `xml:"IdRelationType,omitempty"`
  296.     UnderlyingDocument string              `xml:"UnderlyingDocument,omitempty"`
  297. }
  298.  
  299. type Quantity struct {
  300.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto Quantity"`
  301.  
  302.     IdUnit int32   `xml:"IdUnit,omitempty"`
  303.     Value  float64 `xml:"Value,omitempty"`
  304. }
  305.  
  306. type ArrayOfMedicalStaff struct {
  307.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto ArrayOfMedicalStaff"`
  308.  
  309.     MedicalStaff []*MedicalStaff `xml:"MedicalStaff,omitempty"`
  310. }
  311.  
  312. type ArrayOfStepAmb struct {
  313.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step ArrayOfStepAmb"`
  314.  
  315.     StepAmb []*StepAmb `xml:"StepAmb,omitempty"`
  316. }
  317.  
  318. type StepAmb struct {
  319.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step StepAmb"`
  320.  
  321.     *StepBase
  322.  
  323.     IdVisitPlace   byte              `xml:"IdVisitPlace,omitempty"`
  324.     IdVisitPurpose byte              `xml:"IdVisitPurpose,omitempty"`
  325.     MedRecords     *ArrayOfMedRecord `xml:"MedRecords,omitempty"`
  326. }
  327.  
  328. type StepBase struct {
  329.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step StepBase"`
  330.  
  331.     DateStart     time.Time     `xml:"DateStart,omitempty"`
  332.     DateEnd       time.Time     `xml:"DateEnd,omitempty"`
  333.     Comment       string        `xml:"Comment,omitempty"`
  334.     IdPaymentType byte          `xml:"IdPaymentType,omitempty"`
  335.     Doctor        *MedicalStaff `xml:"Doctor,omitempty"`
  336.     IdStepMis     string        `xml:"IdStepMis,omitempty"`
  337. }
  338.  
  339. type StepStat struct {
  340.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step StepStat"`
  341.  
  342.     *StepBase
  343.  
  344.     HospitalDepartmentName string            `xml:"HospitalDepartmentName,omitempty"`
  345.     IdHospitalDepartment   string            `xml:"IdHospitalDepartment,omitempty"`
  346.     IdRegimen              byte              `xml:"IdRegimen,omitempty"`
  347.     WardNumber             string            `xml:"WardNumber,omitempty"`
  348.     BedNumber              string            `xml:"BedNumber,omitempty"`
  349.     BedProfile             byte              `xml:"BedProfile,omitempty"`
  350.     DaySpend               uint16            `xml:"DaySpend,omitempty"`
  351.     MedRecords             *ArrayOfMedRecord `xml:"MedRecords,omitempty"`
  352. }
  353.  
  354. type ArrayOfStepStat struct {
  355.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step ArrayOfStepStat"`
  356.  
  357.     StepStat []*StepStat `xml:"StepStat,omitempty"`
  358. }
  359.  
  360. type ArrayOfMedRecord struct {
  361.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ArrayOfMedRecord"`
  362.  
  363.     MedRecord []*MedRecord `xml:"MedRecord,omitempty"`
  364. }
  365.  
  366. type MedRecord struct {
  367.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec MedRecord"`
  368. }
  369.  
  370. type DeathInfo struct {
  371.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec DeathInfo"`
  372.  
  373.     *MedRecord
  374.  
  375.     MkbCode string `xml:"MkbCode,omitempty"`
  376. }
  377.  
  378. type Problem struct {
  379.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Problem"`
  380.  
  381.     *MedRecord
  382.  
  383.     IdProblemMis string        `xml:"IdProblemMis,omitempty"`
  384.     DiagnosisMkb string        `xml:"DiagnosisMkb,omitempty"`
  385.     Date         time.Time     `xml:"Date,omitempty"`
  386.     Performer    *MedicalStaff `xml:"Performer,omitempty"`
  387.     Comment      string        `xml:"Comment,omitempty"`
  388.     Status       bool          `xml:"Status,omitempty"`
  389. }
  390.  
  391. type AppointedMedication struct {
  392.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec AppointedMedication"`
  393.  
  394.     *MedRecord
  395.  
  396.     AnatomicTherapeuticChemicalClassification string        `xml:"AnatomicTherapeuticChemicalClassification,omitempty"`
  397.     CourseDose                                *Quantity     `xml:"CourseDose,omitempty"`
  398.     DayDose                                   *Quantity     `xml:"DayDose,omitempty"`
  399.     DaysCount                                 uint16        `xml:"DaysCount,omitempty"`
  400.     Doctor                                    *MedicalStaff `xml:"Doctor,omitempty"`
  401.     IssuedDate                                time.Time     `xml:"IssuedDate,omitempty"`
  402.     MedicineIssueType                         string        `xml:"MedicineIssueType,omitempty"`
  403.     MedicineName                              string        `xml:"MedicineName,omitempty"`
  404.     MedicineType                              uint16        `xml:"MedicineType,omitempty"`
  405.     MedicineUseWay                            byte          `xml:"MedicineUseWay,omitempty"`
  406.     Number                                    string        `xml:"Number,omitempty"`
  407.     OneTimeDose                               *Quantity     `xml:"OneTimeDose,omitempty"`
  408.     IdINN                                     int32         `xml:"IdINN,omitempty"`
  409.     Seria                                     string        `xml:"Seria,omitempty"`
  410.     Status                                    bool          `xml:"Status,omitempty"`
  411. }
  412.  
  413. type TfomsInfo struct {
  414.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec TfomsInfo"`
  415.  
  416.     *MedRecord
  417.  
  418.     Count       int32   `xml:"Count,omitempty"`
  419.     IdTfomsType string  `xml:"IdTfomsType,omitempty"`
  420.     Tariff      float64 `xml:"Tariff,omitempty"`
  421. }
  422.  
  423. type Service struct {
  424.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Service"`
  425.  
  426.     *MedRecord
  427.  
  428.     DateEnd       time.Time    `xml:"DateEnd,omitempty"`
  429.     DateStart     time.Time    `xml:"DateStart,omitempty"`
  430.     IdServiceType string       `xml:"IdServiceType,omitempty"`
  431.     PaymentInfo   *PaymentInfo `xml:"PaymentInfo,omitempty"`
  432.     Performer     *Participant `xml:"Performer,omitempty"`
  433.     ServiceName   string       `xml:"ServiceName,omitempty"`
  434.     Status        bool         `xml:"Status,omitempty"`
  435. }
  436.  
  437. type PaymentInfo struct {
  438.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec PaymentInfo"`
  439.  
  440.     HealthCareUnit byte    `xml:"HealthCareUnit,omitempty"`
  441.     IdPaymentType  byte    `xml:"IdPaymentType,omitempty"`
  442.     PaymentState   byte    `xml:"PaymentState,omitempty"`
  443.     Quantity       int32   `xml:"Quantity,omitempty"`
  444.     Tariff         float64 `xml:"Tariff,omitempty"`
  445. }
  446.  
  447. type NonDrugTreatment struct {
  448.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec NonDrugTreatment"`
  449.  
  450.     *MedRecord
  451.  
  452.     Name   string    `xml:"Name,omitempty"`
  453.     Scheme string    `xml:"Scheme,omitempty"`
  454.     Start  time.Time `xml:"Start,omitempty"`
  455.     End    time.Time `xml:"End,omitempty"`
  456. }
  457.  
  458. type Procedure struct {
  459.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Procedure"`
  460.  
  461.     *MedRecord
  462.  
  463.     Code       string               `xml:"Code,omitempty"`
  464.     Date       time.Time            `xml:"Date,omitempty"`
  465.     Performers *ArrayOfMedicalStaff `xml:"Performers,omitempty"`
  466. }
  467.  
  468. type Immunize struct {
  469.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Immunize"`
  470.  
  471.     *MedRecord
  472.  
  473.     Date time.Time `xml:"Date,omitempty"`
  474.     Code int32     `xml:"Code,omitempty"`
  475. }
  476.  
  477. type ResInstr struct {
  478.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ResInstr"`
  479.  
  480.     *MedRecord
  481.  
  482.     Date       time.Time                `xml:"Date,omitempty"`
  483.     Type       int32                    `xml:"Type,omitempty"`
  484.     Priority   int32                    `xml:"Priority,omitempty"`
  485.     Text       string                   `xml:"Text,omitempty"`
  486.     Performer  *MedicalStaff            `xml:"Performer,omitempty"`
  487.     Activities *ArrayOfResInstrActivity `xml:"Activities,omitempty"`
  488. }
  489.  
  490. type ArrayOfResInstrActivity struct {
  491.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ArrayOfResInstr.Activity"`
  492.  
  493.     ResInstrActivity []*ResInstrActivity `xml:"ResInstr.Activity,omitempty"`
  494. }
  495.  
  496. type ResInstrActivity struct {
  497.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ResInstr.Activity"`
  498.  
  499.     Code string    `xml:"Code,omitempty"`
  500.     Date time.Time `xml:"Date,omitempty"`
  501. }
  502.  
  503. type Scores struct {
  504.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Scores"`
  505.  
  506.     *MedRecord
  507.  
  508.     Date  time.Time `xml:"Date,omitempty"`
  509.     Scale string    `xml:"Scale,omitempty"`
  510.     Value string    `xml:"Value,omitempty"`
  511. }
  512.  
  513. type AllergyDrug struct {
  514.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec AllergyDrug"`
  515.  
  516.     *AllergyBase
  517.  
  518.     IdINN int32 `xml:"IdINN,omitempty"`
  519. }
  520.  
  521. type AllergyBase struct {
  522.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec AllergyBase"`
  523.  
  524.     *MedRecord
  525.  
  526.     Type         int32     `xml:"Type,omitempty"`
  527.     Comment      string    `xml:"Comment,omitempty"`
  528.     Time         time.Time `xml:"Time,omitempty"`
  529.     ReactionCode int32     `xml:"ReactionCode,omitempty"`
  530.     IdStep       int32     `xml:"IdStep,omitempty"`
  531. }
  532.  
  533. type AllergyNonDrug struct {
  534.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec AllergyNonDrug"`
  535.  
  536.     *AllergyBase
  537.  
  538.     Description string `xml:"Description,omitempty"`
  539. }
  540.  
  541. type SocialAnamnesis struct {
  542.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec SocialAnamnesis"`
  543.  
  544.     *MedRecord
  545.  
  546.     Privileges          *ArrayOfPrivilege `xml:"Privileges,omitempty"`
  547.     Disability          *Disability       `xml:"Disability,omitempty"`
  548.     SocialRiskFactors   *ArrayOfint       `xml:"SocialRiskFactors,omitempty"`
  549.     OccupationalHazards *ArrayOfint       `xml:"OccupationalHazards,omitempty"`
  550.     BadHabits           *ArrayOfint       `xml:"BadHabits,omitempty"`
  551.     RegistryArea        int32             `xml:"RegistryArea,omitempty"`
  552.     SocialGroup         *SocialGroup      `xml:"SocialGroup,omitempty"`
  553. }
  554.  
  555. type ArrayOfPrivilege struct {
  556.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ArrayOfPrivilege"`
  557.  
  558.     Privilege []*Privilege `xml:"Privilege,omitempty"`
  559. }
  560.  
  561. type Privilege struct {
  562.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Privilege"`
  563.  
  564.     Code  int32     `xml:"Code,omitempty"`
  565.     Start time.Time `xml:"Start,omitempty"`
  566.     End   time.Time `xml:"End,omitempty"`
  567. }
  568.  
  569. type Disability struct {
  570.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Disability"`
  571.  
  572.     Code  int32     `xml:"Code,omitempty"`
  573.     Date  time.Time `xml:"Date,omitempty"`
  574.     Order int32     `xml:"Order,omitempty"`
  575. }
  576.  
  577. type SocialGroup struct {
  578.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec SocialGroup"`
  579.  
  580.     Code int32  `xml:"Code,omitempty"`
  581.     Text string `xml:"Text,omitempty"`
  582. }
  583.  
  584. type Diagnosis struct {
  585.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag Diagnosis"`
  586.  
  587.     *MedRecord
  588.  
  589.     DiagnosisInfo *DiagnosisInfo `xml:"DiagnosisInfo,omitempty"`
  590.     Doctor        *MedicalStaff  `xml:"Doctor,omitempty"`
  591. }
  592.  
  593. type DiagnosisInfo struct {
  594.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag DiagnosisInfo"`
  595.  
  596.     IdDiseaseType            byte      `xml:"IdDiseaseType,omitempty"`
  597.     DiagnosedDate            time.Time `xml:"DiagnosedDate,omitempty"`
  598.     IdDiagnosisType          byte      `xml:"IdDiagnosisType,omitempty"`
  599.     Comment                  string    `xml:"Comment,omitempty"`
  600.     DiagnosisChangeReason    byte      `xml:"DiagnosisChangeReason,omitempty"`
  601.     DiagnosisStage           byte      `xml:"DiagnosisStage,omitempty"`
  602.     IdDispensaryState        byte      `xml:"IdDispensaryState,omitempty"`
  603.     IdTraumaType             byte      `xml:"IdTraumaType,omitempty"`
  604.     MESImplementationFeature byte      `xml:"MESImplementationFeature,omitempty"`
  605.     MedicalStandard          int32     `xml:"MedicalStandard,omitempty"`
  606.     MkbCode                  string    `xml:"MkbCode,omitempty"`
  607. }
  608.  
  609. type ClinicMainDiagnosis struct {
  610.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag ClinicMainDiagnosis"`
  611.  
  612.     *Diagnosis
  613.  
  614.     Complications *ArrayOfDiagnosis `xml:"Complications,omitempty"`
  615. }
  616.  
  617. type ArrayOfDiagnosis struct {
  618.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag ArrayOfDiagnosis"`
  619.  
  620.     Diagnosis []*Diagnosis `xml:"Diagnosis,omitempty"`
  621. }
  622.  
  623. type AnatomopathologicalClinicMainDiagnosis struct {
  624.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag AnatomopathologicalClinicMainDiagnosis"`
  625.  
  626.     *ClinicMainDiagnosis
  627. }
  628.  
  629. type MedDocument struct {
  630.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc MedDocument"`
  631.  
  632.     *MedRecord
  633.  
  634.     CreationDate        time.Time                         `xml:"CreationDate,omitempty"`
  635.     FhirMedDocumentType string                            `xml:"FhirMedDocumentType,omitempty"`
  636.     IdDocumentMis       string                            `xml:"IdDocumentMis,omitempty"`
  637.     IdMedDocument       int32                             `xml:"IdMedDocument,omitempty"`
  638.     VitalParams         *ArrayOfVitalParam                `xml:"VitalParams,omitempty"`
  639.     Attachment          *MedDocumentDtoDocumentAttachment `xml:"Attachment,omitempty"`
  640.     Author              *MedicalStaff                     `xml:"Author,omitempty"`
  641.     Header              string                            `xml:"Header,omitempty"`
  642. }
  643.  
  644. type ArrayOfVitalParam struct {
  645.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ArrayOfVitalParam"`
  646.  
  647.     VitalParam []*VitalParam `xml:"VitalParam,omitempty"`
  648. }
  649.  
  650. type VitalParam struct {
  651.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc VitalParam"`
  652.  
  653.     Code     string    `xml:"Code,omitempty"`
  654.     Value    string    `xml:"Value,omitempty"`
  655.     DateTime time.Time `xml:"DateTime,omitempty"`
  656. }
  657.  
  658. type AnyURI struct {
  659. }
  660.  
  661. type MedDocumentDtoDocumentAttachment struct {
  662.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc MedDocumentDto.DocumentAttachment"`
  663.  
  664.     Data     []byte  `xml:"Data,omitempty"`
  665.     Hash     []byte  `xml:"Hash,omitempty"`
  666.     MimeType string  `xml:"MimeType,omitempty"`
  667.     Url      *AnyURI `xml:"Url,omitempty"`
  668. }
  669.  
  670. type ConsultNote struct {
  671.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ConsultNote"`
  672.  
  673.     *MedDocument
  674. }
  675.  
  676. type DischargeSummary struct {
  677.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DischargeSummary"`
  678.  
  679.     *MedDocument
  680. }
  681.  
  682. type LaboratoryReport struct {
  683.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc LaboratoryReport"`
  684.  
  685.     *MedDocument
  686. }
  687.  
  688. type SickList struct {
  689.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc SickList"`
  690.  
  691.     *MedDocument
  692.  
  693.     SickListInfo *SickListInfo `xml:"SickListInfo,omitempty"`
  694. }
  695.  
  696. type SickListInfo struct {
  697.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc SickListInfo"`
  698.  
  699.     Number              string    `xml:"Number,omitempty"`
  700.     DateStart           time.Time `xml:"DateStart,omitempty"`
  701.     Caregiver           *Guardian `xml:"Caregiver,omitempty"`
  702.     DateEnd             time.Time `xml:"DateEnd,omitempty"`
  703.     DisabilityDocReason byte      `xml:"DisabilityDocReason,omitempty"`
  704.     DisabilityDocState  byte      `xml:"DisabilityDocState,omitempty"`
  705.     IsPatientTaker      bool      `xml:"IsPatientTaker,omitempty"`
  706. }
  707.  
  708. type DispensaryOne struct {
  709.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DispensaryOne"`
  710.  
  711.     *DispensaryBase
  712.  
  713.     HasSecondStageRefferal bool `xml:"HasSecondStageRefferal,omitempty"`
  714. }
  715.  
  716. type DispensaryBase struct {
  717.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DispensaryBase"`
  718.  
  719.     *MedDocument
  720.  
  721.     IsGuested                bool                   `xml:"IsGuested,omitempty"`
  722.     HasExtraResearchRefferal bool                   `xml:"HasExtraResearchRefferal,omitempty"`
  723.     IsUnderObservation       bool                   `xml:"IsUnderObservation,omitempty"`
  724.     HasExpertCareRefferal    bool                   `xml:"HasExpertCareRefferal,omitempty"`
  725.     HasPrescribeCure         bool                   `xml:"HasPrescribeCure,omitempty"`
  726.     HasHealthResortRefferal  bool                   `xml:"HasHealthResortRefferal,omitempty"`
  727.     HealthGroup              *HealthGroup           `xml:"HealthGroup,omitempty"`
  728.     Recommendations          *ArrayOfRecommendation `xml:"Recommendations,omitempty"`
  729. }
  730.  
  731. type HealthGroup struct {
  732.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc HealthGroup"`
  733.  
  734.     Doctor          *MedicalStaff    `xml:"Doctor,omitempty"`
  735.     HealthGroupInfo *HealthGroupInfo `xml:"HealthGroupInfo,omitempty"`
  736. }
  737.  
  738. type HealthGroupInfo struct {
  739.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc HealthGroupInfo"`
  740.  
  741.     IdHealthGroup byte      `xml:"IdHealthGroup,omitempty"`
  742.     Date          time.Time `xml:"Date,omitempty"`
  743. }
  744.  
  745. type ArrayOfRecommendation struct {
  746.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ArrayOfRecommendation"`
  747.  
  748.     Recommendation []*Recommendation `xml:"Recommendation,omitempty"`
  749. }
  750.  
  751. type Recommendation struct {
  752.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Recommendation"`
  753.  
  754.     Date   time.Time     `xml:"Date,omitempty"`
  755.     Doctor *MedicalStaff `xml:"Doctor,omitempty"`
  756.     Text   string        `xml:"Text,omitempty"`
  757. }
  758.  
  759. type DispensaryTwo struct {
  760.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DispensaryTwo"`
  761.  
  762.     *DispensaryBase
  763. }
  764.  
  765. type DispensaryOnceByTwoYears struct {
  766.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DispensaryOnceByTwoYears"`
  767.  
  768.     *DispensaryBase
  769. }
  770.  
  771. type AmbulanceInfo struct {
  772.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc AmbulanceInfo"`
  773.  
  774.     *MedDocument
  775.  
  776.     SubAmbulance  string            `xml:"SubAmbulance,omitempty"`
  777.     BrigadeNumber string            `xml:"BrigadeNumber,omitempty"`
  778.     MedResult     byte              `xml:"MedResult,omitempty"`
  779.     AssisList     *ArrayOfAssisNote `xml:"AssisList,omitempty"`
  780.     TransportTime time.Time         `xml:"TransportTime,omitempty"`
  781.     HospitalName  string            `xml:"HospitalName,omitempty"`
  782. }
  783.  
  784. type ArrayOfAssisNote struct {
  785.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ArrayOfAssisNote"`
  786.  
  787.     AssisNote []*AssisNote `xml:"AssisNote,omitempty"`
  788. }
  789.  
  790. type AssisNote struct {
  791.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc AssisNote"`
  792.  
  793.     AssisTimestamp time.Time `xml:"AssisTimestamp,omitempty"`
  794.     MedAssistance  string    `xml:"MedAssistance,omitempty"`
  795.     Effect         string    `xml:"Effect,omitempty"`
  796. }
  797.  
  798. type Referral struct {
  799.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Referral"`
  800.  
  801.     *MedDocument
  802.  
  803.     ReferralInfo   *ReferralInfo `xml:"ReferralInfo,omitempty"`
  804.     DepartmentHead *MedicalStaff `xml:"DepartmentHead,omitempty"`
  805.     IdSourceLpu    string        `xml:"IdSourceLpu,omitempty"`
  806.     IdTargetLpu    string        `xml:"IdTargetLpu,omitempty"`
  807.     ReferralID     string        `xml:"ReferralID,omitempty"`
  808.     RelatedID      string        `xml:"RelatedID,omitempty"`
  809. }
  810.  
  811. type ReferralInfo struct {
  812.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ReferralInfo"`
  813.  
  814.     Reason               string    `xml:"Reason,omitempty"`
  815.     IdReferralMis        string    `xml:"IdReferralMis,omitempty"`
  816.     IdReferralType       byte      `xml:"IdReferralType,omitempty"`
  817.     IssuedDateTime       time.Time `xml:"IssuedDateTime,omitempty"`
  818.     HospitalizationOrder byte      `xml:"HospitalizationOrder,omitempty"`
  819.     MkbCode              string    `xml:"MkbCode,omitempty"`
  820. }
  821.  
  822. type Form027U struct {
  823.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Form027U"`
  824.  
  825.     *MedDocument
  826. }
  827.  
  828. type Form1062U struct {
  829.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Form106_2U"`
  830.  
  831.     *MedDocument
  832. }
  833.  
  834. type Form103U struct {
  835.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Form103U"`
  836.  
  837.     *MedDocument
  838. }
  839.  
  840. type Form106U struct {
  841.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Form106U"`
  842.  
  843.     *MedDocument
  844. }
  845.  
  846. type PacsResult struct {
  847.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc PacsResult"`
  848.  
  849.     *MedDocument
  850.  
  851.     ProtocolDate time.Time            `xml:"ProtocolDate,omitempty"`
  852.     Code         string               `xml:"Code,omitempty"`
  853.     Image        *PacsResultImageData `xml:"Image,omitempty"`
  854. }
  855.  
  856. type PacsResultImageData struct {
  857.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc PacsResult.ImageData"`
  858.  
  859.     Uid            string `xml:"Uid,omitempty"`
  860.     Pacs           string `xml:"Pacs,omitempty"`
  861.     TypeConclusion string `xml:"TypeConclusion,omitempty"`
  862.     StatusReport   string `xml:"StatusReport,omitempty"`
  863. }
  864.  
  865. type ArrayOfint struct {
  866.     XMLName xml.Name `xml:"http://schemas.microsoft.com/2003/10/Serialization/Arrays ArrayOfint"`
  867.  
  868.     Int []int32 `xml:"int,omitempty"`
  869. }
  870.  
  871. type ArrayOfunsignedByte struct {
  872.     XMLName xml.Name `xml:"http://schemas.microsoft.com/2003/10/Serialization/Arrays ArrayOfunsignedByte"`
  873.  
  874.     UnsignedByte []byte `xml:"unsignedByte,omitempty"`
  875. }
  876.  
  877. type RequestFault struct {
  878.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Common RequestFault"`
  879.  
  880.     PropertyName string               `xml:"PropertyName,omitempty"`
  881.     Message      string               `xml:"Message,omitempty"`
  882.     ErrorCode    int32                `xml:"ErrorCode,omitempty"`
  883.     Errors       *ArrayOfRequestFault `xml:"Errors,omitempty"`
  884. }
  885.  
  886. type ArrayOfRequestFault struct {
  887.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Common ArrayOfRequestFault"`
  888.  
  889.     RequestFault []*RequestFault `xml:"RequestFault,omitempty"`
  890. }
  891.  
  892. type ArrayOfReferralTupleDto struct {
  893.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.ReferralList ArrayOfReferralTupleDto"`
  894.  
  895.     ReferralTupleDto []*ReferralTupleDto `xml:"ReferralTupleDto,omitempty"`
  896. }
  897.  
  898. type ReferralTupleDto struct {
  899.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.ReferralList ReferralTupleDto"`
  900.  
  901.     Patient   *PatientMinDto      `xml:"Patient,omitempty"`
  902.     Referrals *ArrayOfReferralDto `xml:"Referrals,omitempty"`
  903. }
  904.  
  905. type PatientMinDto struct {
  906.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.ReferralList PatientMinDto"`
  907.  
  908.     Addresses       *ArrayOfAddressDto  `xml:"Addresses,omitempty"`
  909.     BirthDate       time.Time           `xml:"BirthDate,omitempty"`
  910.     Documents       *ArrayOfDocumentDto `xml:"Documents,omitempty"`
  911.     FamilyName      string              `xml:"FamilyName,omitempty"`
  912.     GivenName       string              `xml:"GivenName,omitempty"`
  913.     IdPrivilegeType byte                `xml:"IdPrivilegeType,omitempty"`
  914.     Job             *JobDto             `xml:"Job,omitempty"`
  915.     MiddleName      string              `xml:"MiddleName,omitempty"`
  916. }
  917.  
  918. type ArrayOfAddressDto struct {
  919.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto ArrayOfAddressDto"`
  920.  
  921.     AddressDto []*AddressDto `xml:"AddressDto,omitempty"`
  922. }
  923.  
  924. type AddressDto struct {
  925.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto AddressDto"`
  926.  
  927.     Appartment    string `xml:"Appartment,omitempty"`
  928.     Building      string `xml:"Building,omitempty"`
  929.     City          string `xml:"City,omitempty"`
  930.     GeoData       string `xml:"GeoData,omitempty"`
  931.     IdAddressType byte   `xml:"IdAddressType,omitempty"`
  932.     PostalCode    int32  `xml:"PostalCode,omitempty"`
  933.     Street        string `xml:"Street,omitempty"`
  934.     StringAddress string `xml:"StringAddress,omitempty"`
  935. }
  936.  
  937. type ArrayOfDocumentDto struct {
  938.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto ArrayOfDocumentDto"`
  939.  
  940.     DocumentDto []*DocumentDto `xml:"DocumentDto,omitempty"`
  941. }
  942.  
  943. type DocumentDto struct {
  944.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto DocumentDto"`
  945.  
  946.     DocN           string    `xml:"DocN,omitempty"`
  947.     DocS           string    `xml:"DocS,omitempty"`
  948.     DocumentName   string    `xml:"DocumentName,omitempty"`
  949.     ExpiredDate    time.Time `xml:"ExpiredDate,omitempty"`
  950.     IdDocumentType byte      `xml:"IdDocumentType,omitempty"`
  951.     IdProvider     string    `xml:"IdProvider,omitempty"`
  952.     IssuedDate     time.Time `xml:"IssuedDate,omitempty"`
  953.     ProviderName   string    `xml:"ProviderName,omitempty"`
  954.     RegionCode     string    `xml:"RegionCode,omitempty"`
  955.     StartDate      time.Time `xml:"StartDate,omitempty"`
  956. }
  957.  
  958. type JobDto struct {
  959.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto JobDto"`
  960.  
  961.     CompanyName string    `xml:"CompanyName,omitempty"`
  962.     DateEnd     time.Time `xml:"DateEnd,omitempty"`
  963.     DateStart   time.Time `xml:"DateStart,omitempty"`
  964.     OgrnCode    string    `xml:"OgrnCode,omitempty"`
  965.     Position    string    `xml:"Position,omitempty"`
  966.     Sphere      string    `xml:"Sphere,omitempty"`
  967. }
  968.  
  969. type ArrayOfReferralDto struct {
  970.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto ArrayOfReferralDto"`
  971.  
  972.     ReferralDto []*ReferralDto `xml:"ReferralDto,omitempty"`
  973. }
  974.  
  975. type ReferralDto struct {
  976.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto ReferralDto"`
  977.  
  978.     *MedRecordDto
  979.  
  980.     IdDoctorRef         string    `xml:"IdDoctorRef,omitempty"`
  981.     IdRefDepartmentHead string    `xml:"IdRefDepartmentHead,omitempty"`
  982.     IdReferralMis       string    `xml:"IdReferralMis,omitempty"`
  983.     IdReferralType      int32     `xml:"IdReferralType,omitempty"`
  984.     IdSourceLpu         string    `xml:"IdSourceLpu,omitempty"`
  985.     IdTargetLpu         string    `xml:"IdTargetLpu,omitempty"`
  986.     IdUrgencyType       int32     `xml:"IdUrgencyType,omitempty"`
  987.     IssuedDateTime      time.Time `xml:"IssuedDateTime,omitempty"`
  988.     MkbCode             string    `xml:"MkbCode,omitempty"`
  989.     Reason              string    `xml:"Reason,omitempty"`
  990. }
  991.  
  992. type MedRecordDto struct {
  993.     XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/MKService.Data.Dto MedRecordDto"`
  994.  
  995.     IdLPU string `xml:"IdLPU,omitempty"`
  996. }
  997.  
  998. type IEmkService struct {
  999.     client *SOAPClient
  1000. }
  1001.  
  1002. func NewIEmkService(url string, tls bool, auth *BasicAuth) *IEmkService {
  1003.     if url == "" {
  1004.         url = ""
  1005.     }
  1006.     client := NewSOAPClient(url, tls, auth)
  1007.  
  1008.     return &IEmkService{
  1009.         client: client,
  1010.     }
  1011. }
  1012.  
  1013. func (service *IEmkService) GetVersion(request *GetVersion) (*GetVersionResponse, error) {
  1014.     response := new(GetVersionResponse)
  1015.     err := service.client.Call("http://tempuri.org/IServiceSupport/GetVersion", request, response)
  1016.     if err != nil {
  1017.         return nil, err
  1018.     }
  1019.  
  1020.     return response, nil
  1021. }
  1022.  
  1023. // Error can be either of the following types:
  1024. //
  1025. //   - RequestFaultFault
  1026. //   - ListOf_RequestFaultFault
  1027.  
  1028. func (service *IEmkService) AddCase(request *AddCase) (*AddCaseResponse, error) {
  1029.     response := new(AddCaseResponse)
  1030.     err := service.client.Call("http://tempuri.org/IEmkService/AddCase", request, response)
  1031.     if err != nil {
  1032.         return nil, err
  1033.     }
  1034.  
  1035.     return response, nil
  1036. }
  1037.  
  1038. // Error can be either of the following types:
  1039. //
  1040. //   - RequestFaultFault
  1041. //   - ListOf_RequestFaultFault
  1042.  
  1043. func (service *IEmkService) CreateCase(request *CreateCase) (*CreateCaseResponse, error) {
  1044.     response := new(CreateCaseResponse)
  1045.     err := service.client.Call("http://tempuri.org/IEmkService/CreateCase", request, response)
  1046.     if err != nil {
  1047.         return nil, err
  1048.     }
  1049.  
  1050.     return response, nil
  1051. }
  1052.  
  1053. // Error can be either of the following types:
  1054. //
  1055. //   - RequestFaultFault
  1056. //   - ListOf_RequestFaultFault
  1057.  
  1058. func (service *IEmkService) CloseCase(request *CloseCase) (*CloseCaseResponse, error) {
  1059.     response := new(CloseCaseResponse)
  1060.     err := service.client.Call("http://tempuri.org/IEmkService/CloseCase", request, response)
  1061.     if err != nil {
  1062.         return nil, err
  1063.     }
  1064.  
  1065.     return response, nil
  1066. }
  1067.  
  1068. // Error can be either of the following types:
  1069. //
  1070. //   - RequestFaultFault
  1071. //   - ListOf_RequestFaultFault
  1072.  
  1073. func (service *IEmkService) UpdateCase(request *UpdateCase) (*UpdateCaseResponse, error) {
  1074.     response := new(UpdateCaseResponse)
  1075.     err := service.client.Call("http://tempuri.org/IEmkService/UpdateCase", request, response)
  1076.     if err != nil {
  1077.         return nil, err
  1078.     }
  1079.  
  1080.     return response, nil
  1081. }
  1082.  
  1083. // Error can be either of the following types:
  1084. //
  1085. //   - RequestFaultFault
  1086. //   - ListOf_RequestFaultFault
  1087.  
  1088. func (service *IEmkService) AddMedRecord(request *AddMedRecord) (*AddMedRecordResponse, error) {
  1089.     response := new(AddMedRecordResponse)
  1090.     err := service.client.Call("http://tempuri.org/IEmkService/AddMedRecord", request, response)
  1091.     if err != nil {
  1092.         return nil, err
  1093.     }
  1094.  
  1095.     return response, nil
  1096. }
  1097.  
  1098. // Error can be either of the following types:
  1099. //
  1100. //   - RequestFaultFault
  1101. //   - ListOf_RequestFaultFault
  1102.  
  1103. func (service *IEmkService) AddStepToCase(request *AddStepToCase) (*AddStepToCaseResponse, error) {
  1104.     response := new(AddStepToCaseResponse)
  1105.     err := service.client.Call("http://tempuri.org/IEmkService/AddStepToCase", request, response)
  1106.     if err != nil {
  1107.         return nil, err
  1108.     }
  1109.  
  1110.     return response, nil
  1111. }
  1112.  
  1113. // Error can be either of the following types:
  1114. //
  1115. //   - RequestFaultFault
  1116. //   - ListOf_RequestFaultFault
  1117.  
  1118. func (service *IEmkService) GetReferralList(request *GetReferralList) (*GetReferralListResponse, error) {
  1119.     response := new(GetReferralListResponse)
  1120.     err := service.client.Call("http://tempuri.org/IEmkService/GetReferralList", request, response)
  1121.     if err != nil {
  1122.         return nil, err
  1123.     }
  1124.  
  1125.     return response, nil
  1126. }
  1127.  
  1128. // Error can be either of the following types:
  1129. //
  1130. //   - RequestFaultFault
  1131. //   - ListOf_RequestFaultFault
  1132.  
  1133. func (service *IEmkService) CancelCase(request *CancelCase) (*CancelCaseResponse, error) {
  1134.     response := new(CancelCaseResponse)
  1135.     err := service.client.Call("http://tempuri.org/IEmkService/CancelCase", request, response)
  1136.     if err != nil {
  1137.         return nil, err
  1138.     }
  1139.  
  1140.     return response, nil
  1141. }
  1142.  
  1143. var timeout = time.Duration(30 * time.Second)
  1144.  
  1145. func dialTimeout(network, addr string) (net.Conn, error) {
  1146.     return net.DialTimeout(network, addr, timeout)
  1147. }
  1148.  
  1149. type SOAPEnvelope struct {
  1150.     XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
  1151.  
  1152.     Body SOAPBody
  1153. }
  1154.  
  1155. type SOAPHeader struct {
  1156.     XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Header"`
  1157.  
  1158.     Header interface{}
  1159. }
  1160.  
  1161. type SOAPBody struct {
  1162.     XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"`
  1163.  
  1164.     Fault   *SOAPFault  `xml:",omitempty"`
  1165.     Content interface{} `xml:",omitempty"`
  1166. }
  1167.  
  1168. type SOAPFault struct {
  1169.     XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"`
  1170.  
  1171.     Code   string `xml:"faultcode,omitempty"`
  1172.     String string `xml:"faultstring,omitempty"`
  1173.     Actor  string `xml:"faultactor,omitempty"`
  1174.     Detail string `xml:"detail,omitempty"`
  1175. }
  1176.  
  1177. type BasicAuth struct {
  1178.     Login    string
  1179.     Password string
  1180. }
  1181.  
  1182. type SOAPClient struct {
  1183.     url  string
  1184.     tls  bool
  1185.     auth *BasicAuth
  1186. }
  1187.  
  1188. func (b *SOAPBody) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
  1189.     if b.Content == nil {
  1190.         return xml.UnmarshalError("Content must be a pointer to a struct")
  1191.     }
  1192.  
  1193.     var (
  1194.         token    xml.Token
  1195.         err      error
  1196.         consumed bool
  1197.     )
  1198.  
  1199. Loop:
  1200.     for {
  1201.         if token, err = d.Token(); err != nil {
  1202.             return err
  1203.         }
  1204.  
  1205.         if token == nil {
  1206.             break
  1207.         }
  1208.  
  1209.         switch se := token.(type) {
  1210.         case xml.StartElement:
  1211.             if consumed {
  1212.                 return xml.UnmarshalError("Found multiple elements inside SOAP body; not wrapped-document/literal WS-I compliant")
  1213.             } else if se.Name.Space == "http://schemas.xmlsoap.org/soap/envelope/" && se.Name.Local == "Fault" {
  1214.                 b.Fault = &SOAPFault{}
  1215.                 b.Content = nil
  1216.  
  1217.                 err = d.DecodeElement(b.Fault, &se)
  1218.                 if err != nil {
  1219.                     return err
  1220.                 }
  1221.  
  1222.                 consumed = true
  1223.             } else {
  1224.                 if err = d.DecodeElement(b.Content, &se); err != nil {
  1225.                     return err
  1226.                 }
  1227.  
  1228.                 consumed = true
  1229.             }
  1230.         case xml.EndElement:
  1231.             break Loop
  1232.         }
  1233.     }
  1234.  
  1235.     return nil
  1236. }
  1237.  
  1238. func (f *SOAPFault) Error() string {
  1239.     return f.String
  1240. }
  1241.  
  1242. func NewSOAPClient(url string, tls bool, auth *BasicAuth) *SOAPClient {
  1243.     return &SOAPClient{
  1244.         url:  url,
  1245.         tls:  tls,
  1246.         auth: auth,
  1247.     }
  1248. }
  1249.  
  1250. func (s *SOAPClient) Call(soapAction string, request, response interface{}) error {
  1251.     envelope := SOAPEnvelope{
  1252.         //Header:        SoapHeader{},
  1253.     }
  1254.  
  1255.     envelope.Body.Content = request
  1256.     buffer := new(bytes.Buffer)
  1257.  
  1258.     encoder := xml.NewEncoder(buffer)
  1259.     //encoder.Indent("  ", "    ")
  1260.  
  1261.     if err := encoder.Encode(envelope); err != nil {
  1262.         return err
  1263.     }
  1264.  
  1265.     if err := encoder.Flush(); err != nil {
  1266.         return err
  1267.     }
  1268.  
  1269.     log.Println(buffer.String())
  1270.  
  1271.     req, err := http.NewRequest("POST", s.url, buffer)
  1272.     if err != nil {
  1273.         return err
  1274.     }
  1275.     if s.auth != nil {
  1276.         req.SetBasicAuth(s.auth.Login, s.auth.Password)
  1277.     }
  1278.  
  1279.     req.Header.Add("Content-Type", "text/xml; charset=\"utf-8\"")
  1280.     if soapAction != "" {
  1281.         req.Header.Add("SOAPAction", soapAction)
  1282.     }
  1283.  
  1284.     req.Header.Set("User-Agent", "gowsdl/0.1")
  1285.     req.Close = true
  1286.  
  1287.     tr := &http.Transport{
  1288.         TLSClientConfig: &tls.Config{
  1289.             InsecureSkipVerify: s.tls,
  1290.         },
  1291.         Dial: dialTimeout,
  1292.     }
  1293.  
  1294.     client := &http.Client{Transport: tr}
  1295.     res, err := client.Do(req)
  1296.     if err != nil {
  1297.         return err
  1298.     }
  1299.     defer res.Body.Close()
  1300.  
  1301.     rawbody, err := ioutil.ReadAll(res.Body)
  1302.     if err != nil {
  1303.         return err
  1304.     }
  1305.     if len(rawbody) == 0 {
  1306.         log.Println("empty response")
  1307.         return nil
  1308.     }
  1309.  
  1310.     log.Println(string(rawbody))
  1311.     respEnvelope := new(SOAPEnvelope)
  1312.     respEnvelope.Body = SOAPBody{Content: response}
  1313.     err = xml.Unmarshal(rawbody, respEnvelope)
  1314.     if err != nil {
  1315.         return err
  1316.     }
  1317.  
  1318.     fault := respEnvelope.Body.Fault
  1319.     if fault != nil {
  1320.         return fault
  1321.     }
  1322.  
  1323.     return nil
  1324. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement