问题
I'm attempting to create an object of an HL7 message by parsing a raw text string.
The object model is a follows.
The object I want to create would be a representation of this, allowing calling methods to access information based on indexes. If information from the 2nd sub-subfield in the 3rd subfield of the 5th field of the segment named "PID" for the message you'd do it like this:
HL7Message h = HL7Message(messageRawText);
Console.Writeline(h.GetInfo("PID",5,3,2)+" is sub-subfield I'm looking for")
I'd also like to access at higher levels e.g.
Console.Writeline(h.GetInfo("PID",5)+" is field I'm looking for")
Approaches I've considered are
- creating an object that has fields that are lists of strings
- creating an object that has fields that other user defined objects of Segments, Fields, Subfields...
What would be the best approach? I imagine the scenario must exist somewhere, but can't find a neat fit for my solution.
来源:https://stackoverflow.com/questions/57552056/object-design-decision-on-complicated-object-c-sharp-hl7-message