|
| 1 | +defmodule Hl7.V2_1.Segments.ZSegment do |
| 2 | + @moduledoc """ |
| 3 | + HL7 segment data structure for handling non-standard Z-Segments |
| 4 | + """ |
| 5 | + use Hl7.Segment, fields: [segment: nil, values: nil], undefined_struct: true |
| 6 | +end |
| 7 | + |
| 8 | +defmodule Hl7.V2_1.Segments.UnknownSegment do |
| 9 | + @moduledoc """ |
| 10 | + HL7 segment data structure for handling unknown segment types |
| 11 | + """ |
| 12 | + use Hl7.Segment, fields: [segment: nil, values: nil], undefined_struct: true |
| 13 | +end |
| 14 | + |
| 15 | +defmodule Hl7.V2_1.Segments do |
| 16 | + alias Hl7.V2_1.Segments |
| 17 | + |
| 18 | + def parse(nested_lists), do: parse(nested_lists |> unlist, nested_lists) |
| 19 | + def parse("ACC", nested_lists), do: Segments.ACC.new(nested_lists) |
| 20 | + def parse("ADD", nested_lists), do: Segments.ADD.new(nested_lists) |
| 21 | + def parse("BHS", nested_lists), do: Segments.BHS.new(nested_lists) |
| 22 | + def parse("BLG", nested_lists), do: Segments.BLG.new(nested_lists) |
| 23 | + def parse("BTS", nested_lists), do: Segments.BTS.new(nested_lists) |
| 24 | + def parse("DG1", nested_lists), do: Segments.DG1.new(nested_lists) |
| 25 | + def parse("DSC", nested_lists), do: Segments.DSC.new(nested_lists) |
| 26 | + def parse("DSP", nested_lists), do: Segments.DSP.new(nested_lists) |
| 27 | + def parse("ERR", nested_lists), do: Segments.ERR.new(nested_lists) |
| 28 | + def parse("EVN", nested_lists), do: Segments.EVN.new(nested_lists) |
| 29 | + def parse("FHS", nested_lists), do: Segments.FHS.new(nested_lists) |
| 30 | + def parse("FT1", nested_lists), do: Segments.FT1.new(nested_lists) |
| 31 | + def parse("FTS", nested_lists), do: Segments.FTS.new(nested_lists) |
| 32 | + def parse("GT1", nested_lists), do: Segments.GT1.new(nested_lists) |
| 33 | + def parse("IN1", nested_lists), do: Segments.IN1.new(nested_lists) |
| 34 | + def parse("MRG", nested_lists), do: Segments.MRG.new(nested_lists) |
| 35 | + def parse("MSA", nested_lists), do: Segments.MSA.new(nested_lists) |
| 36 | + def parse("MSH", nested_lists), do: Segments.MSH.new(nested_lists) |
| 37 | + def parse("NCK", nested_lists), do: Segments.NCK.new(nested_lists) |
| 38 | + def parse("NK1", nested_lists), do: Segments.NK1.new(nested_lists) |
| 39 | + def parse("NPU", nested_lists), do: Segments.NPU.new(nested_lists) |
| 40 | + def parse("NSC", nested_lists), do: Segments.NSC.new(nested_lists) |
| 41 | + def parse("NST", nested_lists), do: Segments.NST.new(nested_lists) |
| 42 | + def parse("NTE", nested_lists), do: Segments.NTE.new(nested_lists) |
| 43 | + def parse("OBR", nested_lists), do: Segments.OBR.new(nested_lists) |
| 44 | + def parse("OBX", nested_lists), do: Segments.OBX.new(nested_lists) |
| 45 | + def parse("ORC", nested_lists), do: Segments.ORC.new(nested_lists) |
| 46 | + def parse("ORO", nested_lists), do: Segments.ORO.new(nested_lists) |
| 47 | + def parse("PID", nested_lists), do: Segments.PID.new(nested_lists) |
| 48 | + def parse("PR1", nested_lists), do: Segments.PR1.new(nested_lists) |
| 49 | + def parse("PV1", nested_lists), do: Segments.PV1.new(nested_lists) |
| 50 | + def parse("QRD", nested_lists), do: Segments.QRD.new(nested_lists) |
| 51 | + def parse("QRF", nested_lists), do: Segments.QRF.new(nested_lists) |
| 52 | + def parse("RX1", nested_lists), do: Segments.RX1.new(nested_lists) |
| 53 | + def parse("UB1", nested_lists), do: Segments.UB1.new(nested_lists) |
| 54 | + def parse("URD", nested_lists), do: Segments.URD.new(nested_lists) |
| 55 | + def parse("URS", nested_lists), do: Segments.URS.new(nested_lists) |
| 56 | + def parse(<<"Z", _::binary>>, nested_lists), do: Segments.ZSegment.new(nested_lists) |
| 57 | + def parse(_, nested_lists), do: Segments.UnknownSegment.new(nested_lists) |
| 58 | + |
| 59 | + def unlist([h | _]) do |
| 60 | + unlist(h) |
| 61 | + end |
| 62 | + |
| 63 | + def unlist(v) do |
| 64 | + v |
| 65 | + end |
| 66 | +end |
0 commit comments