Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package netrika_iemk
- import (
- "bytes"
- "crypto/tls"
- "encoding/xml"
- "io/ioutil"
- "log"
- "net"
- "net/http"
- "time"
- )
- // against "unused imports"
- var _ time.Time
- var _ xml.Name
- type GetVersion struct {
- XMLName xml.Name `xml:"http://tempuri.org/ GetVersion"`
- }
- type GetVersionResponse struct {
- XMLName xml.Name `xml:"http://tempuri.org/ GetVersionResponse"`
- GetVersionResult *GetVersionResult `xml:"GetVersionResult,omitempty"`
- }
- type GetVersionResult struct {
- DatabaseVersion string `xml:"DatabaseVersion,omitempty"`
- ServiceVersion string `xml:"ServiceVersion,omitempty"`
- }
- type AddCase struct {
- XMLName xml.Name `xml:"http://tempuri.org/ AddCase"`
- Guid string `xml:"guid,omitempty"`
- CaseDto *CaseBase `xml:"caseDto,omitempty"`
- }
- type AddCaseResponse struct {
- XMLName xml.Name `xml:"http://tempuri.org/ AddCaseResponse"`
- }
- type CreateCase struct {
- XMLName xml.Name `xml:"http://tempuri.org/ CreateCase"`
- Guid string `xml:"guid,omitempty"`
- CreateCaseDto *CaseBase `xml:"createCaseDto,omitempty"`
- }
- type CreateCaseResponse struct {
- XMLName xml.Name `xml:"http://tempuri.org/ CreateCaseResponse"`
- }
- type CloseCase struct {
- XMLName xml.Name `xml:"http://tempuri.org/ CloseCase"`
- Guid string `xml:"guid,omitempty"`
- CaseDto *CaseBase `xml:"caseDto,omitempty"`
- }
- type CloseCaseResponse struct {
- XMLName xml.Name `xml:"http://tempuri.org/ CloseCaseResponse"`
- }
- type UpdateCase struct {
- XMLName xml.Name `xml:"http://tempuri.org/ UpdateCase"`
- Guid string `xml:"guid,omitempty"`
- CaseDto *CaseBase `xml:"caseDto,omitempty"`
- }
- type UpdateCaseResponse struct {
- XMLName xml.Name `xml:"http://tempuri.org/ UpdateCaseResponse"`
- }
- type AddMedRecord struct {
- XMLName xml.Name `xml:"http://tempuri.org/ AddMedRecord"`
- Guid string `xml:"guid,omitempty"`
- IdLpu string `xml:"idLpu,omitempty"`
- IdPatientMis string `xml:"idPatientMis,omitempty"`
- IdCaseMis string `xml:"idCaseMis,omitempty"`
- MedRecord *MedRecord `xml:"medRecord,omitempty"`
- }
- type AddMedRecordResponse struct {
- XMLName xml.Name `xml:"http://tempuri.org/ AddMedRecordResponse"`
- }
- type AddStepToCase struct {
- XMLName xml.Name `xml:"http://tempuri.org/ AddStepToCase"`
- Guid string `xml:"guid,omitempty"`
- IdLpu string `xml:"idLpu,omitempty"`
- IdPatientMis string `xml:"idPatientMis,omitempty"`
- IdCaseMis string `xml:"idCaseMis,omitempty"`
- Step *StepBase `xml:"step,omitempty"`
- }
- type AddStepToCaseResponse struct {
- XMLName xml.Name `xml:"http://tempuri.org/ AddStepToCaseResponse"`
- }
- type GetReferralList struct {
- XMLName xml.Name `xml:"http://tempuri.org/ GetReferralList"`
- Guid string `xml:"guid,omitempty"`
- IdLpu string `xml:"idLpu,omitempty"`
- IdReferralType byte `xml:"idReferralType,omitempty"`
- StartDate time.Time `xml:"startDate,omitempty"`
- EndDate time.Time `xml:"endDate,omitempty"`
- }
- type GetReferralListResponse struct {
- XMLName xml.Name `xml:"http://tempuri.org/ GetReferralListResponse"`
- GetReferralListResult *ArrayOfReferralTupleDto `xml:"GetReferralListResult,omitempty"`
- }
- type CancelCase struct {
- XMLName xml.Name `xml:"http://tempuri.org/ CancelCase"`
- Guid string `xml:"guid,omitempty"`
- IdLpu string `xml:"idLpu,omitempty"`
- IdPatientMis string `xml:"idPatientMis,omitempty"`
- IdCaseMis string `xml:"idCaseMis,omitempty"`
- }
- type CancelCaseResponse struct {
- XMLName xml.Name `xml:"http://tempuri.org/ CancelCaseResponse"`
- }
- type Char int32
- const ()
- type Duration *Duration
- const ()
- type Guid string
- const ()
- type VersionInfo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.Shared.Core VersionInfo"`
- DatabaseVersion string `xml:"DatabaseVersion,omitempty"`
- ServiceVersion string `xml:"ServiceVersion,omitempty"`
- }
- type CaseBase struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Case CaseBase"`
- OpenDate time.Time `xml:"OpenDate,omitempty"`
- CloseDate time.Time `xml:"CloseDate,omitempty"`
- HistoryNumber string `xml:"HistoryNumber,omitempty"`
- IdCaseMis string `xml:"IdCaseMis,omitempty"`
- IdCaseAidType byte `xml:"IdCaseAidType,omitempty"`
- IdPaymentType byte `xml:"IdPaymentType,omitempty"`
- Confidentiality byte `xml:"Confidentiality,omitempty"`
- DoctorConfidentiality byte `xml:"DoctorConfidentiality,omitempty"`
- CuratorConfidentiality byte `xml:"CuratorConfidentiality,omitempty"`
- IdLpu string `xml:"IdLpu,omitempty"`
- IdCaseResult byte `xml:"IdCaseResult,omitempty"`
- Comment string `xml:"Comment,omitempty"`
- DoctorInCharge *MedicalStaff `xml:"DoctorInCharge,omitempty"`
- Authenticator *Participant `xml:"Authenticator,omitempty"`
- Author *Participant `xml:"Author,omitempty"`
- LegalAuthenticator *Participant `xml:"LegalAuthenticator,omitempty"`
- Guardian *Guardian `xml:"Guardian,omitempty"`
- IdPatientMis string `xml:"IdPatientMis,omitempty"`
- AdmissionCondition byte `xml:"AdmissionCondition,omitempty"`
- CaseVisitType byte `xml:"CaseVisitType,omitempty"`
- }
- type CaseAmb struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Case CaseAmb"`
- *CaseBase
- IdCasePurpose byte `xml:"IdCasePurpose,omitempty"`
- IdCaseType byte `xml:"IdCaseType,omitempty"`
- IdAmbResult byte `xml:"IdAmbResult,omitempty"`
- IsActive bool `xml:"IsActive,omitempty"`
- Steps *ArrayOfStepAmb `xml:"Steps,omitempty"`
- MedRecords *ArrayOfMedRecord `xml:"MedRecords,omitempty"`
- }
- type CaseStat struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Case CaseStat"`
- *CaseBase
- DeliveryCode string `xml:"DeliveryCode,omitempty"`
- IdIntoxicationType byte `xml:"IdIntoxicationType,omitempty"`
- IdTypeFromDiseaseStart byte `xml:"IdTypeFromDiseaseStart,omitempty"`
- IdRepetition byte `xml:"IdRepetition,omitempty"`
- HospitalizationOrder byte `xml:"HospitalizationOrder,omitempty"`
- IdTransportIntern byte `xml:"IdTransportIntern,omitempty"`
- Steps *ArrayOfStepStat `xml:"Steps,omitempty"`
- HospResult byte `xml:"HospResult,omitempty"`
- MedRecords *ArrayOfMedRecord `xml:"MedRecords,omitempty"`
- IdHospChannel byte `xml:"IdHospChannel,omitempty"`
- RW1Mark bool `xml:"RW1Mark,omitempty"`
- AIDSMark bool `xml:"AIDSMark,omitempty"`
- PrehospitalDefects *ArrayOfunsignedByte `xml:"PrehospitalDefects,omitempty"`
- AdmissionComment string `xml:"AdmissionComment,omitempty"`
- DischargeCondition byte `xml:"DischargeCondition,omitempty"`
- DischargeComment string `xml:"DischargeComment,omitempty"`
- DietComment string `xml:"DietComment,omitempty"`
- TreatComment string `xml:"TreatComment,omitempty"`
- WorkComment string `xml:"WorkComment,omitempty"`
- OtherComment string `xml:"OtherComment,omitempty"`
- }
- type CaseAcps struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Case CaseAcps"`
- *CaseBase
- MedRecords *ArrayOfMedRecord `xml:"MedRecords,omitempty"`
- }
- type MedicalStaff struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto MedicalStaff"`
- Person *PersonWithIdentity `xml:"Person,omitempty"`
- IdLpu string `xml:"IdLpu,omitempty"`
- IdSpeciality uint16 `xml:"IdSpeciality,omitempty"`
- IdPosition uint16 `xml:"IdPosition,omitempty"`
- IdMedicalStaff int32 `xml:"IdMedicalStaff,omitempty"`
- SpecialityName string `xml:"SpecialityName,omitempty"`
- PositionName string `xml:"PositionName,omitempty"`
- }
- type PersonWithIdentity struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto PersonWithIdentity"`
- *Person
- Documents *ArrayOfIdentityDocument `xml:"Documents,omitempty"`
- }
- type Person struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto Person"`
- HumanName *HumanName `xml:"HumanName,omitempty"`
- Sex byte `xml:"Sex,omitempty"`
- Birthdate time.Time `xml:"Birthdate,omitempty"`
- IdPersonMis string `xml:"IdPersonMis,omitempty"`
- }
- type HumanName struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto HumanName"`
- GivenName string `xml:"GivenName,omitempty"`
- MiddleName string `xml:"MiddleName,omitempty"`
- FamilyName string `xml:"FamilyName,omitempty"`
- }
- type ArrayOfIdentityDocument struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto ArrayOfIdentityDocument"`
- IdentityDocument []*IdentityDocument `xml:"IdentityDocument,omitempty"`
- }
- type IdentityDocument struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto IdentityDocument"`
- DocN string `xml:"DocN,omitempty"`
- DocS string `xml:"DocS,omitempty"`
- DocumentName string `xml:"DocumentName,omitempty"`
- ExpiredDate time.Time `xml:"ExpiredDate,omitempty"`
- IdDocumentType byte `xml:"IdDocumentType,omitempty"`
- IdProvider int32 `xml:"IdProvider,omitempty"`
- IssuedDate time.Time `xml:"IssuedDate,omitempty"`
- ProviderName string `xml:"ProviderName,omitempty"`
- RegionCode string `xml:"RegionCode,omitempty"`
- StartDate time.Time `xml:"StartDate,omitempty"`
- }
- type Participant struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto Participant"`
- Doctor *MedicalStaff `xml:"Doctor,omitempty"`
- IdRole byte `xml:"IdRole,omitempty"`
- }
- type Guardian struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto Guardian"`
- Person *PersonWithIdentity `xml:"Person,omitempty"`
- IdRelationType byte `xml:"IdRelationType,omitempty"`
- UnderlyingDocument string `xml:"UnderlyingDocument,omitempty"`
- }
- type Quantity struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto Quantity"`
- IdUnit int32 `xml:"IdUnit,omitempty"`
- Value float64 `xml:"Value,omitempty"`
- }
- type ArrayOfMedicalStaff struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto ArrayOfMedicalStaff"`
- MedicalStaff []*MedicalStaff `xml:"MedicalStaff,omitempty"`
- }
- type ArrayOfStepAmb struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step ArrayOfStepAmb"`
- StepAmb []*StepAmb `xml:"StepAmb,omitempty"`
- }
- type StepAmb struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step StepAmb"`
- *StepBase
- IdVisitPlace byte `xml:"IdVisitPlace,omitempty"`
- IdVisitPurpose byte `xml:"IdVisitPurpose,omitempty"`
- MedRecords *ArrayOfMedRecord `xml:"MedRecords,omitempty"`
- }
- type StepBase struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step StepBase"`
- DateStart time.Time `xml:"DateStart,omitempty"`
- DateEnd time.Time `xml:"DateEnd,omitempty"`
- Comment string `xml:"Comment,omitempty"`
- IdPaymentType byte `xml:"IdPaymentType,omitempty"`
- Doctor *MedicalStaff `xml:"Doctor,omitempty"`
- IdStepMis string `xml:"IdStepMis,omitempty"`
- }
- type StepStat struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step StepStat"`
- *StepBase
- HospitalDepartmentName string `xml:"HospitalDepartmentName,omitempty"`
- IdHospitalDepartment string `xml:"IdHospitalDepartment,omitempty"`
- IdRegimen byte `xml:"IdRegimen,omitempty"`
- WardNumber string `xml:"WardNumber,omitempty"`
- BedNumber string `xml:"BedNumber,omitempty"`
- BedProfile byte `xml:"BedProfile,omitempty"`
- DaySpend uint16 `xml:"DaySpend,omitempty"`
- MedRecords *ArrayOfMedRecord `xml:"MedRecords,omitempty"`
- }
- type ArrayOfStepStat struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Step ArrayOfStepStat"`
- StepStat []*StepStat `xml:"StepStat,omitempty"`
- }
- type ArrayOfMedRecord struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ArrayOfMedRecord"`
- MedRecord []*MedRecord `xml:"MedRecord,omitempty"`
- }
- type MedRecord struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec MedRecord"`
- }
- type DeathInfo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec DeathInfo"`
- *MedRecord
- MkbCode string `xml:"MkbCode,omitempty"`
- }
- type Problem struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Problem"`
- *MedRecord
- IdProblemMis string `xml:"IdProblemMis,omitempty"`
- DiagnosisMkb string `xml:"DiagnosisMkb,omitempty"`
- Date time.Time `xml:"Date,omitempty"`
- Performer *MedicalStaff `xml:"Performer,omitempty"`
- Comment string `xml:"Comment,omitempty"`
- Status bool `xml:"Status,omitempty"`
- }
- type AppointedMedication struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec AppointedMedication"`
- *MedRecord
- AnatomicTherapeuticChemicalClassification string `xml:"AnatomicTherapeuticChemicalClassification,omitempty"`
- CourseDose *Quantity `xml:"CourseDose,omitempty"`
- DayDose *Quantity `xml:"DayDose,omitempty"`
- DaysCount uint16 `xml:"DaysCount,omitempty"`
- Doctor *MedicalStaff `xml:"Doctor,omitempty"`
- IssuedDate time.Time `xml:"IssuedDate,omitempty"`
- MedicineIssueType string `xml:"MedicineIssueType,omitempty"`
- MedicineName string `xml:"MedicineName,omitempty"`
- MedicineType uint16 `xml:"MedicineType,omitempty"`
- MedicineUseWay byte `xml:"MedicineUseWay,omitempty"`
- Number string `xml:"Number,omitempty"`
- OneTimeDose *Quantity `xml:"OneTimeDose,omitempty"`
- IdINN int32 `xml:"IdINN,omitempty"`
- Seria string `xml:"Seria,omitempty"`
- Status bool `xml:"Status,omitempty"`
- }
- type TfomsInfo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec TfomsInfo"`
- *MedRecord
- Count int32 `xml:"Count,omitempty"`
- IdTfomsType string `xml:"IdTfomsType,omitempty"`
- Tariff float64 `xml:"Tariff,omitempty"`
- }
- type Service struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Service"`
- *MedRecord
- DateEnd time.Time `xml:"DateEnd,omitempty"`
- DateStart time.Time `xml:"DateStart,omitempty"`
- IdServiceType string `xml:"IdServiceType,omitempty"`
- PaymentInfo *PaymentInfo `xml:"PaymentInfo,omitempty"`
- Performer *Participant `xml:"Performer,omitempty"`
- ServiceName string `xml:"ServiceName,omitempty"`
- Status bool `xml:"Status,omitempty"`
- }
- type PaymentInfo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec PaymentInfo"`
- HealthCareUnit byte `xml:"HealthCareUnit,omitempty"`
- IdPaymentType byte `xml:"IdPaymentType,omitempty"`
- PaymentState byte `xml:"PaymentState,omitempty"`
- Quantity int32 `xml:"Quantity,omitempty"`
- Tariff float64 `xml:"Tariff,omitempty"`
- }
- type NonDrugTreatment struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec NonDrugTreatment"`
- *MedRecord
- Name string `xml:"Name,omitempty"`
- Scheme string `xml:"Scheme,omitempty"`
- Start time.Time `xml:"Start,omitempty"`
- End time.Time `xml:"End,omitempty"`
- }
- type Procedure struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Procedure"`
- *MedRecord
- Code string `xml:"Code,omitempty"`
- Date time.Time `xml:"Date,omitempty"`
- Performers *ArrayOfMedicalStaff `xml:"Performers,omitempty"`
- }
- type Immunize struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Immunize"`
- *MedRecord
- Date time.Time `xml:"Date,omitempty"`
- Code int32 `xml:"Code,omitempty"`
- }
- type ResInstr struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ResInstr"`
- *MedRecord
- Date time.Time `xml:"Date,omitempty"`
- Type int32 `xml:"Type,omitempty"`
- Priority int32 `xml:"Priority,omitempty"`
- Text string `xml:"Text,omitempty"`
- Performer *MedicalStaff `xml:"Performer,omitempty"`
- Activities *ArrayOfResInstrActivity `xml:"Activities,omitempty"`
- }
- type ArrayOfResInstrActivity struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ArrayOfResInstr.Activity"`
- ResInstrActivity []*ResInstrActivity `xml:"ResInstr.Activity,omitempty"`
- }
- type ResInstrActivity struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ResInstr.Activity"`
- Code string `xml:"Code,omitempty"`
- Date time.Time `xml:"Date,omitempty"`
- }
- type Scores struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Scores"`
- *MedRecord
- Date time.Time `xml:"Date,omitempty"`
- Scale string `xml:"Scale,omitempty"`
- Value string `xml:"Value,omitempty"`
- }
- type AllergyDrug struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec AllergyDrug"`
- *AllergyBase
- IdINN int32 `xml:"IdINN,omitempty"`
- }
- type AllergyBase struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec AllergyBase"`
- *MedRecord
- Type int32 `xml:"Type,omitempty"`
- Comment string `xml:"Comment,omitempty"`
- Time time.Time `xml:"Time,omitempty"`
- ReactionCode int32 `xml:"ReactionCode,omitempty"`
- IdStep int32 `xml:"IdStep,omitempty"`
- }
- type AllergyNonDrug struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec AllergyNonDrug"`
- *AllergyBase
- Description string `xml:"Description,omitempty"`
- }
- type SocialAnamnesis struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec SocialAnamnesis"`
- *MedRecord
- Privileges *ArrayOfPrivilege `xml:"Privileges,omitempty"`
- Disability *Disability `xml:"Disability,omitempty"`
- SocialRiskFactors *ArrayOfint `xml:"SocialRiskFactors,omitempty"`
- OccupationalHazards *ArrayOfint `xml:"OccupationalHazards,omitempty"`
- BadHabits *ArrayOfint `xml:"BadHabits,omitempty"`
- RegistryArea int32 `xml:"RegistryArea,omitempty"`
- SocialGroup *SocialGroup `xml:"SocialGroup,omitempty"`
- }
- type ArrayOfPrivilege struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec ArrayOfPrivilege"`
- Privilege []*Privilege `xml:"Privilege,omitempty"`
- }
- type Privilege struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Privilege"`
- Code int32 `xml:"Code,omitempty"`
- Start time.Time `xml:"Start,omitempty"`
- End time.Time `xml:"End,omitempty"`
- }
- type Disability struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec Disability"`
- Code int32 `xml:"Code,omitempty"`
- Date time.Time `xml:"Date,omitempty"`
- Order int32 `xml:"Order,omitempty"`
- }
- type SocialGroup struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec SocialGroup"`
- Code int32 `xml:"Code,omitempty"`
- Text string `xml:"Text,omitempty"`
- }
- type Diagnosis struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag Diagnosis"`
- *MedRecord
- DiagnosisInfo *DiagnosisInfo `xml:"DiagnosisInfo,omitempty"`
- Doctor *MedicalStaff `xml:"Doctor,omitempty"`
- }
- type DiagnosisInfo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag DiagnosisInfo"`
- IdDiseaseType byte `xml:"IdDiseaseType,omitempty"`
- DiagnosedDate time.Time `xml:"DiagnosedDate,omitempty"`
- IdDiagnosisType byte `xml:"IdDiagnosisType,omitempty"`
- Comment string `xml:"Comment,omitempty"`
- DiagnosisChangeReason byte `xml:"DiagnosisChangeReason,omitempty"`
- DiagnosisStage byte `xml:"DiagnosisStage,omitempty"`
- IdDispensaryState byte `xml:"IdDispensaryState,omitempty"`
- IdTraumaType byte `xml:"IdTraumaType,omitempty"`
- MESImplementationFeature byte `xml:"MESImplementationFeature,omitempty"`
- MedicalStandard int32 `xml:"MedicalStandard,omitempty"`
- MkbCode string `xml:"MkbCode,omitempty"`
- }
- type ClinicMainDiagnosis struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag ClinicMainDiagnosis"`
- *Diagnosis
- Complications *ArrayOfDiagnosis `xml:"Complications,omitempty"`
- }
- type ArrayOfDiagnosis struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag ArrayOfDiagnosis"`
- Diagnosis []*Diagnosis `xml:"Diagnosis,omitempty"`
- }
- type AnatomopathologicalClinicMainDiagnosis struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.Diag AnatomopathologicalClinicMainDiagnosis"`
- *ClinicMainDiagnosis
- }
- type MedDocument struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc MedDocument"`
- *MedRecord
- CreationDate time.Time `xml:"CreationDate,omitempty"`
- FhirMedDocumentType string `xml:"FhirMedDocumentType,omitempty"`
- IdDocumentMis string `xml:"IdDocumentMis,omitempty"`
- IdMedDocument int32 `xml:"IdMedDocument,omitempty"`
- VitalParams *ArrayOfVitalParam `xml:"VitalParams,omitempty"`
- Attachment *MedDocumentDtoDocumentAttachment `xml:"Attachment,omitempty"`
- Author *MedicalStaff `xml:"Author,omitempty"`
- Header string `xml:"Header,omitempty"`
- }
- type ArrayOfVitalParam struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ArrayOfVitalParam"`
- VitalParam []*VitalParam `xml:"VitalParam,omitempty"`
- }
- type VitalParam struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc VitalParam"`
- Code string `xml:"Code,omitempty"`
- Value string `xml:"Value,omitempty"`
- DateTime time.Time `xml:"DateTime,omitempty"`
- }
- type AnyURI struct {
- }
- type MedDocumentDtoDocumentAttachment struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc MedDocumentDto.DocumentAttachment"`
- Data []byte `xml:"Data,omitempty"`
- Hash []byte `xml:"Hash,omitempty"`
- MimeType string `xml:"MimeType,omitempty"`
- Url *AnyURI `xml:"Url,omitempty"`
- }
- type ConsultNote struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ConsultNote"`
- *MedDocument
- }
- type DischargeSummary struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DischargeSummary"`
- *MedDocument
- }
- type LaboratoryReport struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc LaboratoryReport"`
- *MedDocument
- }
- type SickList struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc SickList"`
- *MedDocument
- SickListInfo *SickListInfo `xml:"SickListInfo,omitempty"`
- }
- type SickListInfo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc SickListInfo"`
- Number string `xml:"Number,omitempty"`
- DateStart time.Time `xml:"DateStart,omitempty"`
- Caregiver *Guardian `xml:"Caregiver,omitempty"`
- DateEnd time.Time `xml:"DateEnd,omitempty"`
- DisabilityDocReason byte `xml:"DisabilityDocReason,omitempty"`
- DisabilityDocState byte `xml:"DisabilityDocState,omitempty"`
- IsPatientTaker bool `xml:"IsPatientTaker,omitempty"`
- }
- type DispensaryOne struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DispensaryOne"`
- *DispensaryBase
- HasSecondStageRefferal bool `xml:"HasSecondStageRefferal,omitempty"`
- }
- type DispensaryBase struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DispensaryBase"`
- *MedDocument
- IsGuested bool `xml:"IsGuested,omitempty"`
- HasExtraResearchRefferal bool `xml:"HasExtraResearchRefferal,omitempty"`
- IsUnderObservation bool `xml:"IsUnderObservation,omitempty"`
- HasExpertCareRefferal bool `xml:"HasExpertCareRefferal,omitempty"`
- HasPrescribeCure bool `xml:"HasPrescribeCure,omitempty"`
- HasHealthResortRefferal bool `xml:"HasHealthResortRefferal,omitempty"`
- HealthGroup *HealthGroup `xml:"HealthGroup,omitempty"`
- Recommendations *ArrayOfRecommendation `xml:"Recommendations,omitempty"`
- }
- type HealthGroup struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc HealthGroup"`
- Doctor *MedicalStaff `xml:"Doctor,omitempty"`
- HealthGroupInfo *HealthGroupInfo `xml:"HealthGroupInfo,omitempty"`
- }
- type HealthGroupInfo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc HealthGroupInfo"`
- IdHealthGroup byte `xml:"IdHealthGroup,omitempty"`
- Date time.Time `xml:"Date,omitempty"`
- }
- type ArrayOfRecommendation struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ArrayOfRecommendation"`
- Recommendation []*Recommendation `xml:"Recommendation,omitempty"`
- }
- type Recommendation struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Recommendation"`
- Date time.Time `xml:"Date,omitempty"`
- Doctor *MedicalStaff `xml:"Doctor,omitempty"`
- Text string `xml:"Text,omitempty"`
- }
- type DispensaryTwo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DispensaryTwo"`
- *DispensaryBase
- }
- type DispensaryOnceByTwoYears struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc DispensaryOnceByTwoYears"`
- *DispensaryBase
- }
- type AmbulanceInfo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc AmbulanceInfo"`
- *MedDocument
- SubAmbulance string `xml:"SubAmbulance,omitempty"`
- BrigadeNumber string `xml:"BrigadeNumber,omitempty"`
- MedResult byte `xml:"MedResult,omitempty"`
- AssisList *ArrayOfAssisNote `xml:"AssisList,omitempty"`
- TransportTime time.Time `xml:"TransportTime,omitempty"`
- HospitalName string `xml:"HospitalName,omitempty"`
- }
- type ArrayOfAssisNote struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ArrayOfAssisNote"`
- AssisNote []*AssisNote `xml:"AssisNote,omitempty"`
- }
- type AssisNote struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc AssisNote"`
- AssisTimestamp time.Time `xml:"AssisTimestamp,omitempty"`
- MedAssistance string `xml:"MedAssistance,omitempty"`
- Effect string `xml:"Effect,omitempty"`
- }
- type Referral struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Referral"`
- *MedDocument
- ReferralInfo *ReferralInfo `xml:"ReferralInfo,omitempty"`
- DepartmentHead *MedicalStaff `xml:"DepartmentHead,omitempty"`
- IdSourceLpu string `xml:"IdSourceLpu,omitempty"`
- IdTargetLpu string `xml:"IdTargetLpu,omitempty"`
- ReferralID string `xml:"ReferralID,omitempty"`
- RelatedID string `xml:"RelatedID,omitempty"`
- }
- type ReferralInfo struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc ReferralInfo"`
- Reason string `xml:"Reason,omitempty"`
- IdReferralMis string `xml:"IdReferralMis,omitempty"`
- IdReferralType byte `xml:"IdReferralType,omitempty"`
- IssuedDateTime time.Time `xml:"IssuedDateTime,omitempty"`
- HospitalizationOrder byte `xml:"HospitalizationOrder,omitempty"`
- MkbCode string `xml:"MkbCode,omitempty"`
- }
- type Form027U struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Form027U"`
- *MedDocument
- }
- type Form1062U struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Form106_2U"`
- *MedDocument
- }
- type Form103U struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Form103U"`
- *MedDocument
- }
- type Form106U struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc Form106U"`
- *MedDocument
- }
- type PacsResult struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc PacsResult"`
- *MedDocument
- ProtocolDate time.Time `xml:"ProtocolDate,omitempty"`
- Code string `xml:"Code,omitempty"`
- Image *PacsResultImageData `xml:"Image,omitempty"`
- }
- type PacsResultImageData struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.MedRec.MedDoc PacsResult.ImageData"`
- Uid string `xml:"Uid,omitempty"`
- Pacs string `xml:"Pacs,omitempty"`
- TypeConclusion string `xml:"TypeConclusion,omitempty"`
- StatusReport string `xml:"StatusReport,omitempty"`
- }
- type ArrayOfint struct {
- XMLName xml.Name `xml:"http://schemas.microsoft.com/2003/10/Serialization/Arrays ArrayOfint"`
- Int []int32 `xml:"int,omitempty"`
- }
- type ArrayOfunsignedByte struct {
- XMLName xml.Name `xml:"http://schemas.microsoft.com/2003/10/Serialization/Arrays ArrayOfunsignedByte"`
- UnsignedByte []byte `xml:"unsignedByte,omitempty"`
- }
- type RequestFault struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Common RequestFault"`
- PropertyName string `xml:"PropertyName,omitempty"`
- Message string `xml:"Message,omitempty"`
- ErrorCode int32 `xml:"ErrorCode,omitempty"`
- Errors *ArrayOfRequestFault `xml:"Errors,omitempty"`
- }
- type ArrayOfRequestFault struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/N3.EMK.Dto.Common ArrayOfRequestFault"`
- RequestFault []*RequestFault `xml:"RequestFault,omitempty"`
- }
- type ArrayOfReferralTupleDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.ReferralList ArrayOfReferralTupleDto"`
- ReferralTupleDto []*ReferralTupleDto `xml:"ReferralTupleDto,omitempty"`
- }
- type ReferralTupleDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.ReferralList ReferralTupleDto"`
- Patient *PatientMinDto `xml:"Patient,omitempty"`
- Referrals *ArrayOfReferralDto `xml:"Referrals,omitempty"`
- }
- type PatientMinDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.ReferralList PatientMinDto"`
- Addresses *ArrayOfAddressDto `xml:"Addresses,omitempty"`
- BirthDate time.Time `xml:"BirthDate,omitempty"`
- Documents *ArrayOfDocumentDto `xml:"Documents,omitempty"`
- FamilyName string `xml:"FamilyName,omitempty"`
- GivenName string `xml:"GivenName,omitempty"`
- IdPrivilegeType byte `xml:"IdPrivilegeType,omitempty"`
- Job *JobDto `xml:"Job,omitempty"`
- MiddleName string `xml:"MiddleName,omitempty"`
- }
- type ArrayOfAddressDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto ArrayOfAddressDto"`
- AddressDto []*AddressDto `xml:"AddressDto,omitempty"`
- }
- type AddressDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto AddressDto"`
- Appartment string `xml:"Appartment,omitempty"`
- Building string `xml:"Building,omitempty"`
- City string `xml:"City,omitempty"`
- GeoData string `xml:"GeoData,omitempty"`
- IdAddressType byte `xml:"IdAddressType,omitempty"`
- PostalCode int32 `xml:"PostalCode,omitempty"`
- Street string `xml:"Street,omitempty"`
- StringAddress string `xml:"StringAddress,omitempty"`
- }
- type ArrayOfDocumentDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto ArrayOfDocumentDto"`
- DocumentDto []*DocumentDto `xml:"DocumentDto,omitempty"`
- }
- type DocumentDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto DocumentDto"`
- DocN string `xml:"DocN,omitempty"`
- DocS string `xml:"DocS,omitempty"`
- DocumentName string `xml:"DocumentName,omitempty"`
- ExpiredDate time.Time `xml:"ExpiredDate,omitempty"`
- IdDocumentType byte `xml:"IdDocumentType,omitempty"`
- IdProvider string `xml:"IdProvider,omitempty"`
- IssuedDate time.Time `xml:"IssuedDate,omitempty"`
- ProviderName string `xml:"ProviderName,omitempty"`
- RegionCode string `xml:"RegionCode,omitempty"`
- StartDate time.Time `xml:"StartDate,omitempty"`
- }
- type JobDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto JobDto"`
- CompanyName string `xml:"CompanyName,omitempty"`
- DateEnd time.Time `xml:"DateEnd,omitempty"`
- DateStart time.Time `xml:"DateStart,omitempty"`
- OgrnCode string `xml:"OgrnCode,omitempty"`
- Position string `xml:"Position,omitempty"`
- Sphere string `xml:"Sphere,omitempty"`
- }
- type ArrayOfReferralDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto ArrayOfReferralDto"`
- ReferralDto []*ReferralDto `xml:"ReferralDto,omitempty"`
- }
- type ReferralDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/EMKService.Data.Dto ReferralDto"`
- *MedRecordDto
- IdDoctorRef string `xml:"IdDoctorRef,omitempty"`
- IdRefDepartmentHead string `xml:"IdRefDepartmentHead,omitempty"`
- IdReferralMis string `xml:"IdReferralMis,omitempty"`
- IdReferralType int32 `xml:"IdReferralType,omitempty"`
- IdSourceLpu string `xml:"IdSourceLpu,omitempty"`
- IdTargetLpu string `xml:"IdTargetLpu,omitempty"`
- IdUrgencyType int32 `xml:"IdUrgencyType,omitempty"`
- IssuedDateTime time.Time `xml:"IssuedDateTime,omitempty"`
- MkbCode string `xml:"MkbCode,omitempty"`
- Reason string `xml:"Reason,omitempty"`
- }
- type MedRecordDto struct {
- XMLName xml.Name `xml:"http://schemas.datacontract.org/2004/07/MKService.Data.Dto MedRecordDto"`
- IdLPU string `xml:"IdLPU,omitempty"`
- }
- type IEmkService struct {
- client *SOAPClient
- }
- func NewIEmkService(url string, tls bool, auth *BasicAuth) *IEmkService {
- if url == "" {
- url = ""
- }
- client := NewSOAPClient(url, tls, auth)
- return &IEmkService{
- client: client,
- }
- }
- func (service *IEmkService) GetVersion(request *GetVersion) (*GetVersionResponse, error) {
- response := new(GetVersionResponse)
- err := service.client.Call("http://tempuri.org/IServiceSupport/GetVersion", request, response)
- if err != nil {
- return nil, err
- }
- return response, nil
- }
- // Error can be either of the following types:
- //
- // - RequestFaultFault
- // - ListOf_RequestFaultFault
- func (service *IEmkService) AddCase(request *AddCase) (*AddCaseResponse, error) {
- response := new(AddCaseResponse)
- err := service.client.Call("http://tempuri.org/IEmkService/AddCase", request, response)
- if err != nil {
- return nil, err
- }
- return response, nil
- }
- // Error can be either of the following types:
- //
- // - RequestFaultFault
- // - ListOf_RequestFaultFault
- func (service *IEmkService) CreateCase(request *CreateCase) (*CreateCaseResponse, error) {
- response := new(CreateCaseResponse)
- err := service.client.Call("http://tempuri.org/IEmkService/CreateCase", request, response)
- if err != nil {
- return nil, err
- }
- return response, nil
- }
- // Error can be either of the following types:
- //
- // - RequestFaultFault
- // - ListOf_RequestFaultFault
- func (service *IEmkService) CloseCase(request *CloseCase) (*CloseCaseResponse, error) {
- response := new(CloseCaseResponse)
- err := service.client.Call("http://tempuri.org/IEmkService/CloseCase", request, response)
- if err != nil {
- return nil, err
- }
- return response, nil
- }
- // Error can be either of the following types:
- //
- // - RequestFaultFault
- // - ListOf_RequestFaultFault
- func (service *IEmkService) UpdateCase(request *UpdateCase) (*UpdateCaseResponse, error) {
- response := new(UpdateCaseResponse)
- err := service.client.Call("http://tempuri.org/IEmkService/UpdateCase", request, response)
- if err != nil {
- return nil, err
- }
- return response, nil
- }
- // Error can be either of the following types:
- //
- // - RequestFaultFault
- // - ListOf_RequestFaultFault
- func (service *IEmkService) AddMedRecord(request *AddMedRecord) (*AddMedRecordResponse, error) {
- response := new(AddMedRecordResponse)
- err := service.client.Call("http://tempuri.org/IEmkService/AddMedRecord", request, response)
- if err != nil {
- return nil, err
- }
- return response, nil
- }
- // Error can be either of the following types:
- //
- // - RequestFaultFault
- // - ListOf_RequestFaultFault
- func (service *IEmkService) AddStepToCase(request *AddStepToCase) (*AddStepToCaseResponse, error) {
- response := new(AddStepToCaseResponse)
- err := service.client.Call("http://tempuri.org/IEmkService/AddStepToCase", request, response)
- if err != nil {
- return nil, err
- }
- return response, nil
- }
- // Error can be either of the following types:
- //
- // - RequestFaultFault
- // - ListOf_RequestFaultFault
- func (service *IEmkService) GetReferralList(request *GetReferralList) (*GetReferralListResponse, error) {
- response := new(GetReferralListResponse)
- err := service.client.Call("http://tempuri.org/IEmkService/GetReferralList", request, response)
- if err != nil {
- return nil, err
- }
- return response, nil
- }
- // Error can be either of the following types:
- //
- // - RequestFaultFault
- // - ListOf_RequestFaultFault
- func (service *IEmkService) CancelCase(request *CancelCase) (*CancelCaseResponse, error) {
- response := new(CancelCaseResponse)
- err := service.client.Call("http://tempuri.org/IEmkService/CancelCase", request, response)
- if err != nil {
- return nil, err
- }
- return response, nil
- }
- var timeout = time.Duration(30 * time.Second)
- func dialTimeout(network, addr string) (net.Conn, error) {
- return net.DialTimeout(network, addr, timeout)
- }
- type SOAPEnvelope struct {
- XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
- Body SOAPBody
- }
- type SOAPHeader struct {
- XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Header"`
- Header interface{}
- }
- type SOAPBody struct {
- XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"`
- Fault *SOAPFault `xml:",omitempty"`
- Content interface{} `xml:",omitempty"`
- }
- type SOAPFault struct {
- XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"`
- Code string `xml:"faultcode,omitempty"`
- String string `xml:"faultstring,omitempty"`
- Actor string `xml:"faultactor,omitempty"`
- Detail string `xml:"detail,omitempty"`
- }
- type BasicAuth struct {
- Login string
- Password string
- }
- type SOAPClient struct {
- url string
- tls bool
- auth *BasicAuth
- }
- func (b *SOAPBody) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
- if b.Content == nil {
- return xml.UnmarshalError("Content must be a pointer to a struct")
- }
- var (
- token xml.Token
- err error
- consumed bool
- )
- Loop:
- for {
- if token, err = d.Token(); err != nil {
- return err
- }
- if token == nil {
- break
- }
- switch se := token.(type) {
- case xml.StartElement:
- if consumed {
- return xml.UnmarshalError("Found multiple elements inside SOAP body; not wrapped-document/literal WS-I compliant")
- } else if se.Name.Space == "http://schemas.xmlsoap.org/soap/envelope/" && se.Name.Local == "Fault" {
- b.Fault = &SOAPFault{}
- b.Content = nil
- err = d.DecodeElement(b.Fault, &se)
- if err != nil {
- return err
- }
- consumed = true
- } else {
- if err = d.DecodeElement(b.Content, &se); err != nil {
- return err
- }
- consumed = true
- }
- case xml.EndElement:
- break Loop
- }
- }
- return nil
- }
- func (f *SOAPFault) Error() string {
- return f.String
- }
- func NewSOAPClient(url string, tls bool, auth *BasicAuth) *SOAPClient {
- return &SOAPClient{
- url: url,
- tls: tls,
- auth: auth,
- }
- }
- func (s *SOAPClient) Call(soapAction string, request, response interface{}) error {
- envelope := SOAPEnvelope{
- //Header: SoapHeader{},
- }
- envelope.Body.Content = request
- buffer := new(bytes.Buffer)
- encoder := xml.NewEncoder(buffer)
- //encoder.Indent(" ", " ")
- if err := encoder.Encode(envelope); err != nil {
- return err
- }
- if err := encoder.Flush(); err != nil {
- return err
- }
- log.Println(buffer.String())
- req, err := http.NewRequest("POST", s.url, buffer)
- if err != nil {
- return err
- }
- if s.auth != nil {
- req.SetBasicAuth(s.auth.Login, s.auth.Password)
- }
- req.Header.Add("Content-Type", "text/xml; charset=\"utf-8\"")
- if soapAction != "" {
- req.Header.Add("SOAPAction", soapAction)
- }
- req.Header.Set("User-Agent", "gowsdl/0.1")
- req.Close = true
- tr := &http.Transport{
- TLSClientConfig: &tls.Config{
- InsecureSkipVerify: s.tls,
- },
- Dial: dialTimeout,
- }
- client := &http.Client{Transport: tr}
- res, err := client.Do(req)
- if err != nil {
- return err
- }
- defer res.Body.Close()
- rawbody, err := ioutil.ReadAll(res.Body)
- if err != nil {
- return err
- }
- if len(rawbody) == 0 {
- log.Println("empty response")
- return nil
- }
- log.Println(string(rawbody))
- respEnvelope := new(SOAPEnvelope)
- respEnvelope.Body = SOAPBody{Content: response}
- err = xml.Unmarshal(rawbody, respEnvelope)
- if err != nil {
- return err
- }
- fault := respEnvelope.Body.Fault
- if fault != nil {
- return fault
- }
- return nil
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement