Ejemplo n.º 1
0
 public EventDetail(PatientBasedData parent)
 {
     _firstDate = DateTime.MinValue;
     parentPatientBasedData = parent;
 }
Ejemplo n.º 2
0
        void analyzeCDfilesInOneGroup(string Rgroup, string Hgroup)
        {
            var CDFileQuery = from q in inputFile
                              where q.FileType == "CD"
                                && q.@group == Rgroup
                                && q.hashGroup == Hgroup
                              select q;
            foreach (var CDFile in CDFileQuery)
            {
                using (var sr = new StreamReader(CDFile.path, Encoding.Default))
                {
                    string[] title = sr.ReadLine().Split('\t');
                    int indexID = Array.IndexOf(title, "ID");
                    int indexBirthday = Array.FindIndex(title, x => x.IndexOf("BIRTHDAY") >= 0);
                    int indexSex = Array.FindIndex(title, x => x.IndexOf("SEX") >= 0);
                    int indexDate = Array.FindIndex(title, x => x.IndexOf("FUNC_DATE") >= 0);
                    int indexICDs = Array.FindIndex(title, x => x.IndexOf("ACODE_ICD9") >= 0);

                    string[] groupTitle = Array.FindAll(title, x => x.IndexOf("[order]") >= 0);
                    int[] indexGroups = new int[orderGroupList.Count];
                    for (int i = 0; i < orderGroupList.Count; i++)
                    {
                        string matchedGroupTitle = groupTitle.FirstOrDefault(x => x.Remove(0, 7) == orderGroupList[i].name);
                        if (matchedGroupTitle != default(string))
                        {
                            indexGroups[i] = Array.IndexOf(title, matchedGroupTitle);
                        }
                        else
                        {
                            indexGroups[i] = -1;
                        }

                    }


                    while (!sr.EndOfStream)
                    {
                        string[] splitline = sr.ReadLine().Split('\t');
                        string ID = splitline[indexID];
                        string Birthday = splitline[indexBirthday];
                        string gender = splitline[indexSex];
                        string[] ICDs = new string[] { splitline[indexICDs], splitline[indexICDs + 1], splitline[indexICDs + 2] };
                        string[] orders = new string[orderGroupList.Count];
                        for (int i = 0; i < orderGroupList.Count; i++)
                        {
                            if (indexGroups[i] >= 0)
                            {
                                orders[i] = splitline[indexGroups[i]];
                            }

                            else
                            {
                                orders[i] = "";
                            }
                        }

                        string date = splitline[indexDate];
                        var NewPatient = new PatientBasedData() { ID = ID, Birthday = Birthday };

                        int index = PatientList.BinarySearch(NewPatient);
                        if (index < 0)
                        {
                            index = ~index;
                            NewPatient.setDiagnosisDetail(diagnosisGroupList.Count);
                            NewPatient.setOrderDetail(orderGroupList.Count);
                            //--custom
                            NewPatient.setCustomDetials(0);
                            //--custom
                            PatientList.Insert(index, NewPatient);
                        }
                        PatientList[index].CDcount++;
                        PatientList[index].gender = gender;
                        for (int i = 0; i < diagnosisGroupList.Count; i++)
                        {
                            if (diagnosisGroupList[i].isThisGroupMatched(ICDs))
                            {
                                PatientList[index].diagnosisDetails[i].CDCount++;
                                PatientList[index].diagnosisDetails[i].firstDate = date;
                            }
                        }
                        for (int i = 0; i < orderGroupList.Count; i++)
                        {
                            if (orders[i] != "" && Convert.ToInt32(orders[i]) > 0)
                            {
                                PatientList[index].orderDetails[i].CDCount++;
                                PatientList[index].orderDetails[i].firstDate = date;
                            }
                        }
                        //customGroup計算
                    }
                }
            }
        }