private void runData(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"; DateTime theDate = DateTime.Now; if (aDate != null && aDate.Length > 0) { theDate = DateTime.Parse(aDate); } List<Hashtable> allLetters; string []chartNumbers; foreach(DictionaryEntry entry in allChartNumbers){ chartNumbers = (string[]) entry.Value; theDate = ((DateTime) entry.Key); for (int i = 0; i < chartNumbers.Length; i++) { allLetters = intChart.downloadData(data["ENCOUNTER_DATA_FOLDER"], chartNumbers[i], theDate.ToString("yyyy-MM-dd"), this.forceDownload); } } this.currentStatus = "Complete"; }
private void runPermDiagnosticForDate(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"; intChart.downloadEncounter(data["ENCOUNTER_FOLDER_PERM"], aDate, this.forceDownload); //the below commented section is commented out because we don't need pdf analysis. /*this.currentStatus = "Getting Diagnosis"; intChart.getDiagnosis(aDate); this.currentStatus = "Complete"; patientDiagnostics = intChart.getPatientsByChartNumber(); // Open the log file for append and write the log StreamWriter sw = new StreamWriter(data["RUN_LOG"], true); MemoryStream stream = new MemoryStream(); bool hasErrors = false; foreach (DictionaryEntry ev in patientDiagnostics) { if (!(bool)((Hashtable)ev.Value)["HasAllDiagnosis"] || (bool)((Hashtable)ev.Value)["HasErrors"]) { hasErrors = true; break; } } StringWriter tw = new StringWriter(); Hashtable diagnosticData, errors, patientInfo; sw.WriteLine("{0} {1} {2}", DateTime.Now, hasErrors ? "Has Errors" : "Has No Errors", aDate); tw.WriteLine(String.Format("{0} {1} {2}", DateTime.Now, hasErrors ? "Has Errors" : "Has No Errors", aDate)); if (hasErrors) { foreach (DictionaryEntry ev in patientDiagnostics) { patientInfo = (Hashtable)ev.Value; diagnosticData = (Hashtable)patientInfo["Diagnosis"]; errors = (Hashtable)patientInfo["Errors"]; foreach (DictionaryEntry pv in diagnosticData) { if (!(bool)pv.Value) { sw.WriteLine("{0} {1} {2} {3}", DateTime.Now, patientInfo["ChartNumber"], patientInfo["AppointmentDateTime"], pv.Key); tw.WriteLine("{0} {1} {2} {3}", DateTime.Now, patientInfo["ChartNumber"], patientInfo["AppointmentDateTime"], pv.Key); } } foreach (DictionaryEntry pv in errors) { sw.WriteLine("{0} {1} {2} {3}", DateTime.Now, patientInfo["ChartNumber"], patientInfo["AppointmentDateTime"], pv.Value); tw.WriteLine("{0} {1} {2} {3}", DateTime.Now, patientInfo["ChartNumber"], patientInfo["AppointmentDateTime"], pv.Value); } } } sw.Close(); diagnosticResults += tw.ToString() + "\n";*/ }
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"; }
private void runTreatmentNotesForDate(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 Treatment Notes"; DateTime theDate = DateTime.Now; if (aDate != null && aDate.Length > 0) { theDate = DateTime.Parse(aDate); } List<Hashtable> allLetters; string[] thisChartNumbers; foreach (DictionaryEntry entry in allChartNumbers) { thisChartNumbers = (string[]) entry.Value; for (int i = 0; i < thisChartNumbers.Length; i++) { allLetters = intChart.downloadTreatmentNotes(data["TREATMENT_NOTES"], thisChartNumbers[i], ((DateTime)entry.Key).ToString("MM/dd/yyyy"), this.forceDownload); } } this.currentStatus = "Complete"; }