static void CheckResults(List<MSG> msg, ConfigParse config_line, IEnumerable<H_MSG> _history) { var keys = GetConfig().Select( s => s.Split( '|' )[ 0 ].Split( '^' )[ 0 ] ).ToArray(); foreach (var item in _history) { temp_log.Add( item.MSH_Block ); item.delete = true; } foreach (var msg_item in msg) { bool pt = PregnancyTest(config_line.PregnancyTest, msg_item.OBRs.ToList()); foreach (var obr_item in msg_item.OBRs) { foreach (var zlr_item in obr_item.ZLRs) { String logobx = ""; foreach (var obx_item in zlr_item.OBXs) { string[] ObservationIdentifier = obx_item.OBX_split_heder[3].Split('^'); String id_test = obx_item.obx_id; if (pt && keys.Contains(id_test)) // { obr_item.OBR_split[13] = "PROBABLE PREGNANCY"; obr_item.OBR_line = String.Join("|", obr_item.OBR_split); } var tmp_ = obx_item.OBX_split_heder.ToArray(); if (config_line.extension_test.Contains(id_test)) { String oi_1 = ObservationIdentifier[0]; String oi_4 = ObservationIdentifier[3]; String oi_3 = ObservationIdentifier[2]; String oi_6 = ObservationIdentifier[5]; ObservationIdentifier[0] = oi_4; ObservationIdentifier[3] = oi_1; ObservationIdentifier[2] = oi_6; ObservationIdentifier[5] = oi_3; /* obx_item.OBX_split_heder[3]*/ tmp_[3] = String.Join("^", ObservationIdentifier); if ( !obx_item.is_loged ) { logobx += String.Join( "|", /*obx_item.OBX_split_heder*/tmp_ ) + Environment.NewLine; obx_item.is_loged = true; } } } if (logobx.Length > 0) { String msgstr = msg_item.MSH_line + Environment.NewLine + msg_item.PID_line + Environment.NewLine + obr_item.OBR_line + Environment.NewLine + zlr_item.ZLR_heder + Environment.NewLine + logobx; string[] address = msg_item.PID_split[11].Split(new char[] { '^' }, StringSplitOptions.RemoveEmptyEntries); if ( address.Length < 4 ) { errlog( msgstr ); } //log(msgstr); temp_log.Add(msgstr); } } } } var str = String.Join(Environment.NewLine, temp_log.ToArray()); if (temp_log.Count() != config_line.extension_test.Count() && !config_line.any_test) { history.Add(new H_MSG() { MSH_Block = str, delete = false }); } else { log(str); } }
private static List<ConfigParse> Config() { var result = new List<ConfigParse>(); foreach (var line in File.ReadAllLines("config.ini").Where(s => !String.IsNullOrEmpty(s)).Where(s => s.Trim()[0] != ';').ToArray()) { var config_line = new ConfigParse(); string[] cline_split = line.Split('|'); string[] configkay = cline_split[0].Split('^'); config_line.key = configkay[0]; config_line.flag = configkay[1]; config_line.extension_test = cline_split[1].Contains('^') ? cline_split[1].Split('^') : cline_split[1].Split('#'); config_line.any_test = cline_split[1].Contains('^') || config_line.extension_test.Count() == 1; config_line.year_limit = cline_split.Count() > 2 ? Convert.ToInt32(cline_split[2]) : -1; config_line.PregnancyTest = cline_split.Count() == 4 ? cline_split[3].Split('^') : new string[] { }; result.Add(config_line); } return result; }