/// <summary> /// 获取病人信息 /// </summary> /// <param name="filterDate"></param> /// <param name="filterSampleId"></param> /// <returns></returns> public static PatientInfo GetSampleInfo(TdfInfo tdfInfo) { var sampleResult = BdfParser.Parse(tdfInfo.BdfFilePath); sampleResult.BasicInfo.ScannedTime = tdfInfo.ScannedTime; return(sampleResult); }
public static bool Parse(string file, out TdfInfo tdfInfo) { //scannedTime = DateTime.MaxValue; //sampleId = string.Empty; tdfInfo = null; try { using (var sr = new StreamReader(file)) { var content = sr.ReadToEnd(); var m = TdfRegex.Match(content); if (m.Success) { string time = m.Groups[3].Value.Trim(); int index = time.LastIndexOf(':'); if (index > 0) { time = time.Substring(0, index); } tdfInfo = new TdfInfo { GelId = m.Groups[1].Value, SampleNum = m.Groups[2].Value, ScannedTime = DateTime.Parse(time), SampleId = m.Groups[4].Value != string.Empty ? m.Groups[4].Value : m.Groups[5].Value, BdfFilePath = Path.ChangeExtension(file, ".BDF") }; if (tdfInfo.SampleId == "") { var s = PatientIdRegex.Match(content); if (s.Success) { tdfInfo.SampleId = s.Groups[2].Value; } } return(true); } } } catch (Exception ex) { } return(false); }
private bool IsMatched(string tdfFile, DateTime filterDate, string filterSampleId, out TdfInfo tdfInfo) { if (TdfParser.Parse(tdfFile, out tdfInfo)) { return(tdfInfo != null && filterDate.Date == tdfInfo.ScannedTime.Date && (filterSampleId == null || filterSampleId == tdfInfo.SampleId)); } return(false); }