示例#1
0
        private void runLettersAndComm(string aDate)
        {
            intChart = new IntelleChartSpider(propertyFile); 
            this.currentStatus = "Retrieving all Patients";
            DateTime thisDate = DateTime.Parse(aDate);
            if (allChartNumbers.ContainsKey(thisDate))
            {
                intChart.getAllPatients(aDate, (string[])allChartNumbers[thisDate]);
            }
            this.currentStatus = "Downloading Encounter Forms";
            string patientNotes = "", pdfText;
             
            DateTime theDate = DateTime.Now;
 
            List<Hashtable> allLetters;
            string []chartNumbers;
            foreach(DictionaryEntry entry in allChartNumbers){
                chartNumbers = (string[]) entry.Value;
                theDate = ((DateTime) entry.Key);
                if (chartNumbers != null)
                {

                    for (int i = 0; i < chartNumbers.Length; i++)
                    {
                        allLetters = intChart.downloadLetters(data["LETTER_PATH"], chartNumbers[i], aDate, this.forceDownload);
                        for (int j = 0; j < allLetters.Count; j++)
                        {//delete blank letters
                            pdfText = UtilManager.getPDFText((string)allLetters[j]["FileName"]);
                            if (pdfText.Length < 130)
                            {
                                //File.Delete((string)allLetters[j]["FileName"]);
                            }
                        }
                        patientNotes = intChart.getPatientNotes(chartNumbers[i]);
                        FileInfo f = new FileInfo(patientNotes);
                        string text = UtilManager.getPDFText(patientNotes);
                        if (!text.Contains("Name"))
                        {
                            //File.Delete(patientNotes);
                        }
                        else
                        {
                            Directory.CreateDirectory(data["COMM_PATH"] + Path.DirectorySeparatorChar + theDate.ToString("yyyy-MM-dd"));
                            File.Move(f.FullName, data["COMM_PATH"] + Path.DirectorySeparatorChar + theDate.ToString("yyyy-MM-dd") + Path.DirectorySeparatorChar + f.Name);
                        }
                    }
                }
            } 
            this.currentStatus = "Complete"; 
        }