Object design decision on complicated object C# - HL7 message

 ̄綄美尐妖づ 提交于 2020-01-30 12:00:25

问题


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

  1. creating an object that has fields that are lists of strings
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!