///<summary>Launches the program using a combination of command line characters and the patient.Cur data.</summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); //Example CerPI.exe -<patNum>;<fname>;<lname>;<birthday DD.MM.YYYY>; (Date format specified in the windows Regional Settings) if (pat == null) { try { Process.Start(path); //should start Cerec without bringing up a pt. } catch { MessageBox.Show(path + " is not available."); } return; } string info = " -"; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { info += pat.PatNum.ToString() + ";"; } else { info += pat.ChartNumber.ToString() + ";"; } info += pat.FName + ";" + pat.LName + ";" + pat.Birthdate.ToShortDateString() + ";"; try { Process.Start(path, info); } catch { MessageBox.Show(path + " is not available, or there is an error in the command line options."); } }
///<summary>Launches the main Patient Document window of Schick.</summary> public static void SendData(Program ProgramCur, Patient pat) { if (pat == null) { return; } List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum); ProgramProperty PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum"); string patID = ""; if (PPCur.PropertyValue == "0") { patID = pat.PatNum.ToString(); } else { patID = pat.ChartNumber; } try { string version4or5 = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Schick Version 4 or 5"); if (version4or5 == "5") { ShowExam(pat, patID); } else { VBbridges.Schick3.Launch(patID, pat.LName, pat.FName); } } catch { MessageBox.Show("Error launching Schick CDR Dicom."); } }
///<summary></summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { try { Process.Start(path); } catch { MessageBox.Show(path + " is not available."); } return; } string str = ""; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { str += "/ID:" + TidyAndEncapsulate(pat.PatNum.ToString()) + " "; } else { str += "/ID:" + TidyAndEncapsulate(pat.ChartNumber) + " "; } str += "/LN:" + TidyAndEncapsulate(pat.LName) + " "; str += "/N:" + TidyAndEncapsulate(pat.FName) + " "; try { Process.Start(path, str); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary>Launches the program using a combination of command line characters and the patient.Cur data.///</summary> /*The command line integration works as follows: * * C:\Program Files\MiDentView\Cmdlink.exe /ID=12345 /FN=JOHN /LN=DOE /BD=10/01/1985 /Sex=M * * Parameters:'/ID=' for ID number, '/FN=' for Firstname, '/LN=' for Lastname, '/BD=' for Birthdate, '/Sex=' for Sex. * * Example of a name with special characters (in this case, spaces): * C:\Program Files\MiDentView\Cmdlink.exe /ID=12345 /FN=Oscar /LN=De La Hoya /BD=10/01/1985 /Sex=M */ public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { try { Process.Start(path); //should start MiPACS without bringing up a pt. } catch { MessageBox.Show(path + " is not available."); } } string gender = (pat.Gender == PatientGender.Female)?"F":"M"; //M for Male, F for Female, M for Unknown. string info = ""; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { info += "/ID=" + pat.PatNum.ToString(); } else { info += "/ID=" + pat.ChartNumber; } info += " /FN=" + pat.FName //special characters claimed to be ok + " /LN=" + pat.LName + " /BD=" + pat.Birthdate.ToShortDateString() + " /Sex=" + gender; try { Process.Start(path, info); } catch { MessageBox.Show(path + " is not available."); } }
public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { try { ODFileUtils.ProcessStart(path); //shold start rayMage without bringing up a pt. } catch { MessageBox.Show(path + " is not available."); } } else { string info = " /PATID \""; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { info += pat.PatNum.ToString(); } else { info += pat.ChartNumber; } info += "\" /NAME \"" + pat.FName.Replace(" ", "").Replace("\"", "") + "\" /SURNAME \"" + pat.LName.Replace(" ", "").Replace("\"", "") + "\""; try { ODFileUtils.ProcessStart(path, ProgramCur.CommandLine + info); } catch { MessageBox.Show(path + " is not available, or there is an error in the command line options."); } } }
///<summary></summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { MsgBox.Show("Adstra", "Please select a patient first."); return; } string str = ""; str += Tidy(pat.LName) + ","; str += Tidy(pat.FName) + ","; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { str += pat.PatNum.ToString() + ",,"; } else { str += "," + Tidy(pat.ChartNumber) + ","; } //If birthdates are optional, only send them if they are valid. str += pat.Birthdate.ToString("yyyy/MM/dd"); //changed to match bridge format. Was MM/dd/yyy try { ODFileUtils.ProcessStart(path, str); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary>Launches the program using a combination of command line characters and the patient.Cur data.</summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { try { Process.Start(path); //should start i-Dixel without bringing up a pt. } catch { MessageBox.Show(path + " is not available."); } } else { string args = " "; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { args += pat.PatNum + " "; } else { args += pat.ChartNumber + " "; } args += pat.FName + " " + pat.LName + " " + (pat.Gender == PatientGender.Female ? "F" : "M"); try { Process.Start(path, args); } catch { MessageBox.Show(path + " is not available."); } } }
private void button1_Click(object sender, EventArgs e) { //test code string server = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWServer"); //this property will not exist if using Oracle, eCW will never use Oracle string port = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWPort"); //this property will not exist if using Oracle, eCW will never use Oracle string username = "******"; //"ecwUser"; string password = ""; //"l69Rr4Rmj4CjiCTLxrIblg==";//encrypted CentralConnections.GetConnections(); string connString = "Server=" + server + ";" + "Port=" + port + ";" //although this does seem to cause a bug in Mono. We will revisit this bug if needed to exclude the port option only for Mono. + "Database=mobiledoc;" //ecwMaster;" //+"Connect Timeout=20;" + "User ID=" + username + ";" + "Password="******";" + "CharSet=utf8;" + "Treat Tiny As Boolean=false;" + "Allow User Variables=true;" + "Default Command Timeout=300;"//default is 30seconds + "Pooling=false" ; string command = "select Description from account;"; string result = MySql.Data.MySqlClient.MySqlHelper.ExecuteDataRow(connString, command)["Description"].ToString(); MessageBox.Show(result); }
///<summary>This bridge has not yet been added to the database. CaptureLink reads the bridge parameters from the clipboard.</summary> //Command format: LName FName PatID public static void SendData(Program ProgramCur, Patient pat) { if (pat == null) { MessageBox.Show("No patient selected."); return; } string path = Programs.GetProgramPath(ProgramCur); string info = Tidy(pat.LName) + " "; info += Tidy(pat.FName) + " "; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { info += pat.PatNum.ToString(); } else { if (pat.ChartNumber == null || pat.ChartNumber == "") { MsgBox.Show("CaptureLink", "This patient does not have a chart number."); return; } info += Tidy(pat.ChartNumber); } Clipboard.Clear(); ODClipboard.SetClipboard(info); try { ODFileUtils.ProcessStart(path); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary></summary> public static void SendData(Program ProgramCur, Patient pat) { if (pat == null) { MsgBox.Show("OrthoCAD", "Please select a patient first."); return; } string path = Programs.GetProgramPath(ProgramCur); string cmd = ""; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { cmd += "-patient_id=" + POut.Long(pat.PatNum); } else { cmd += "-chart_number=" + pat.ChartNumber; } try { Process.Start(path, cmd); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary></summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { MsgBox.Show("Carestream", "Please select a patient first."); return; } string infoFile = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Patient.ini path"); if (infoFile.Length > 150) { MsgBox.Show("Carestream", "Patient.ini file folder path too long. Must be 150 characters or less."); return; } string id = ""; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { id = pat.PatNum.ToString(); } else { id = pat.ChartNumber; } StringBuilder sw = new StringBuilder(); sw.AppendLine("[PATIENT]"); sw.AppendLine("ID=" + Tidy(id, 15)); sw.AppendLine("FIRSTNAME=" + Tidy(pat.FName, 255)); if (!string.IsNullOrEmpty(pat.Preferred)) { sw.AppendLine("COMMONNAME=" + Tidy(pat.Preferred, 255)); } sw.AppendLine("LASTNAME=" + Tidy(pat.LName, 255)); if (!string.IsNullOrEmpty(pat.MiddleI)) { sw.AppendLine("MIDDLENAME=" + Tidy(pat.MiddleI, 255)); } if (pat.Birthdate.Year > 1880) { sw.AppendLine("DOB=" + pat.Birthdate.ToString("yyyyMMdd")); } if (pat.Gender == PatientGender.Female) { sw.Append("GENDER=F"); } else if (pat.Gender == PatientGender.Male) { sw.Append("GENDER=M"); } try { string arguments = @"-I """ + infoFile + @""""; ODFileUtils.WriteAllTextThenStart(infoFile, sw.ToString(), path, arguments); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private static string GetMimeTypeForImageQuality() { if (ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.XVWeb), ProgramProps.ImageQuality) == XVWebImageQuality.Highest.ToString()) { return("image/png"); } return("image/jpeg"); }
///<summary>Attempt to send a phone number to place a call using DentalTek. Already surrounded in try-catch. ///Returns false if unsuccessful or a phone number wasn't passed in.</summary> public static bool PlaceCall(string phoneNumber) { phoneNumber = new string(phoneNumber.Where(x => char.IsDigit(x)).ToArray()); string apiToken = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.DentalTekSmartOfficePhone), "Enter your API Token"); string request = ""; if (phoneNumber == "") { return(false); } using (WebClient client = new WebClient()) { string response = ""; try { client.Headers[HttpRequestHeader.ContentType] = "application/json"; client.Encoding = UnicodeEncoding.UTF8; if (apiToken == "") { string domainUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name; request = "https://extapi.dentaltek.com/v1/pbx/rest/ClickToCall?domainUser="******"&phoneNumber=" + phoneNumber; } else { if (apiToken.ToLower() == "premise") { string token = ""; string domainUsername = System.Security.Principal.WindowsIdentity.GetCurrent().Name; domainUsername = domainUsername.Replace(@"\", "-"); string privateIdentifier = domainUsername + "-6a9631ab-be94-4bbe-8822-be68034f9009"; try { using (NamedPipeClientStream clientPipes = new NamedPipeClientStream(privateIdentifier.ToString())) { StreamWriter writer = new StreamWriter(clientPipes); StreamReader reader = new StreamReader(clientPipes); clientPipes.Connect(1000); writer.WriteLine("!token!"); writer.Flush(); clientPipes.WaitForPipeDrain(); token = reader.ReadLine(); } } catch (Exception e) { MessageBox.Show(Lan.g("DentalTek", "Error occurred:") + " " + e.Message + "\r\n" + Lan.g("DentalTek", "Please login to your Xbeyon/DentalTek Application and try again.")); return(false); } request = "https://extapi.dentaltek.com/v1/pbx/rest/ClickToCall?phoneNumber=" + phoneNumber + "&token=" + token + "&premise=true"; } else { request = "https://extapi.dentaltek.com/v1/pbx/rest/ClickToCall?phoneNumber=" + phoneNumber + "&token=" + apiToken; } } response = client.DownloadString(request); //GET } catch (Exception) { //Can't think of anything useful to tell them about why the call attempt failed. } return(response.Contains("Success")); } }
///<summary></summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); string iniFile = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Import.ini path"); if (pat == null) { MsgBox.Show("Scanora", "Please select a patient first."); return; } //Start with a blank line per Scanora's example ini file, and then another blank line following the Header. string iniText = "\r\n[PracticeManagementInterface]\r\n\r\n" + "CLEAR_PRACTICE_MANAGEMENT_AUTOMATICALLY = 1\r\n" + "USE_PRACTICE_MANAGEMENT = 1\r\n" + "PATID = "; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { iniText += pat.PatNum.ToString(); } else { iniText += Tidy(pat.ChartNumber); } iniText += "\r\n"; iniText += "PATLNAME = " + Tidy(pat.LName) + "\r\n"; iniText += "PATMNAME = " + Tidy(pat.MiddleI) + "\r\n"; iniText += "PATFNAME = " + Tidy(pat.FName) + "\r\n"; iniText += "PATSOCSEC = "; if (pat.SSN.Replace("0", "").Trim() != "") { iniText += pat.SSN; } iniText += "\r\n"; //We changed the date format from yyyy-MM-dd to ToShortDateString() because of an email from Chris Bope (Product Manager for Sorodex). //Chris said that a valid date must be in ToShortDateString() because their program assumes that is the format when it gets saved. //The email copy can be found on PatNum 23172 on a commlog dated 12/29/2015. iniText += "PATBD = " + pat.Birthdate.ToShortDateString() + "\r\n"; iniText += "PROVIDER1 = " + Providers.GetFormalName(pat.PriProv) + "\r\n"; iniText += "PROVIDER2 = " + Providers.GetFormalName(pat.SecProv) + "\r\n"; iniText += "ADDRESS1 = " + Tidy(pat.Address) + "\r\n"; iniText += "ADDRESS2 = " + Tidy(pat.Address2) + "\r\n"; iniText += "CITY = " + Tidy(pat.City) + "\r\n"; iniText += "STATE = " + Tidy(pat.State) + "\r\n"; iniText += "ZIP = " + Tidy(pat.Zip) + "\r\n"; iniText += "HOMEPHONE = " + new string(pat.HmPhone.Where(x => char.IsDigit(x)).ToArray()) + "\r\n"; iniText += "WORKPHONE = " + new string(pat.WkPhone.Where(x => char.IsDigit(x)).ToArray()) + "\r\n"; iniText += "EMAIL1 = " + Tidy(pat.Email) + "\r\n"; //Chris Bope (Product Manager for Sorodex) said "ANSI" is the preferred encoding. //Code page 1252 is the most commonly used ANSI code page, and we use 1252 in other bridges as well. File.WriteAllText(iniFile, iniText, Encoding.GetEncoding(1252)); try { Process.Start(path); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary>Sends data for pat to the Dexis Integrator program using a DDE Execute command. Shows a message box if pat is null instructing user ///to first select a pat. Sends SET command with the following format: SET 17 LN="LName" FN="FName" MI="MiddleI" BD=19760205. The first ///parameter of the command is the patient ID defined by the program property as either PatNum or ChartNumber. The BD portion will only be added ///if the pat has a valid bday and adding it to the commmand won't increase the length of the command to >255 characters.</summary> public static void SendData(Program progCur, Patient pat) { if (pat == null) { MsgBox.Show("DexisIntegrator", "Please select a patient first."); return; } try { if (_client == null || _client.Context == null) { DdeContext context = new DdeContext(Application.OpenForms.OfType <FormOpenDental>().FirstOrDefault() ?? Application.OpenForms[0]); _client = new DdeClient("Dexis", "Patient", context); } if (!_client.IsConnected) { _client.Connect(); } string patId = pat.PatNum.ToString(); if (ProgramProperties.GetPropVal(progCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "1") { patId = pat.ChartNumber; } string ddeCommand = "SET " + patId + " LN=\"" + pat.LName + "\" FN=\"" + pat.FName + "\" MI=\"" + pat.MiddleI + "\""; if (pat.Birthdate.Year > 1880 && ddeCommand.Length < 244) //add optional bday only if valid and it won't increase the length to >255 characters { ddeCommand += " BD=" + pat.Birthdate.ToString("yyyyMMdd"); } _client.Execute(ddeCommand, 30000); //timeout 30 seconds //if execute was successfully sent, subscribe the PatientChangedEvent_Fired handler to the PatientChangedEvent.Fired event PatientChangedEvent.Fired -= PatientChangedEvent_Fired; PatientChangedEvent.Fired += PatientChangedEvent_Fired; UserodChangedEvent.Fired -= UserodChangedEvent_Fired; UserodChangedEvent.Fired += UserodChangedEvent_Fired; } catch (ObjectDisposedException ode) { if (_isRetry) { FriendlyException.Show(Lans.g("DexisIntegrator", "There was an error trying to launch Dexis with the selected patient."), ode); return; } _isRetry = true; if (_client != null && _client.IsConnected) { ODException.SwallowAnyException(new Action(() => _client.Disconnect())); //disconnect if necessary } ODException.SwallowAnyException(new Action(() => _client.Dispose())); _client = null; //will cause a new _client to be made with a new context SendData(progCur, pat); } catch (Exception ex) { FriendlyException.Show(Lans.g("DexisIntegrator", "There was an error trying to launch Dexis with the selected patient."), ex); return; } finally { _isRetry = false; } }
///<summary></summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { MsgBox.Show("Office", "Please select a patient first."); return; } string fileName = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Document folder"); string oldFileName = ODFileUtils.CombinePaths(fileName, Tidy(pat.LName + pat.FName)); //ProgramProperties.GetPropVal() is the way to get program properties. if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { fileName = ODFileUtils.CombinePaths(fileName, pat.PatNum.ToString()); oldFileName += pat.PatNum.ToString(); } else { fileName = ODFileUtils.CombinePaths(fileName, Tidy(pat.ChartNumber)); oldFileName += Tidy(pat.ChartNumber); } fileName += ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "File extension"); oldFileName += ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "File extension"); Process process = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo(); if (!File.Exists(fileName)) { if (File.Exists(oldFileName)) { fileName = oldFileName; } else { try { startInfo.WindowStyle = ProcessWindowStyle.Hidden; string cmdLocation = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\system32\cmd.exe"; //This is incase the user doesn't have C: as their default drive letter. startInfo.FileName = cmdLocation; //Path for the cmd prompt startInfo.Arguments = "/c copy nul " + fileName; process.StartInfo = startInfo; ODFileUtils.ProcessStart(process); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } } try { ODFileUtils.ProcessStart(path, fileName); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary>Launches the program using a combination of command line characters and the patient.Cur data.///</summary> /*Data like the following: * [Patient] * ID=A123456789 * Gender=Male * First=John * Last=Smith * Year=1955 * Month=1 * Day=23 * [Dentist] * ID=001 * Password=1234 * * Should appear in the following file: C:/Program Files/Digirex/Switch.ini * and should be accessed/opened by C:/Program Files/Digirex/digirex.ini */ public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { try { ODFileUtils.ProcessStart(path); //should start Apixia without bringing up a pt. } catch { MessageBox.Show(path + " is not available."); } } else { string iniString = "[Patient]\r\n"; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { iniString += "ID=" + pat.PatNum.ToString() + "\r\n"; } else { iniString += "ID=" + pat.ChartNumber + "\r\n"; } Provider priProv = Providers.GetProv(pat.PriProv); if (priProv == null) { MsgBox.Show("Apixia", "Invalid provider for the selected patient."); return; } iniString += "Gender=" + pat.Gender.ToString() + "\r\n" + "First=" + pat.FName + "\r\n" + "Last=" + pat.LName + "\r\n" + "Year=" + pat.Birthdate.Year.ToString() + "\r\n" + "Month=" + pat.Birthdate.Month.ToString() + "\r\n" + "Day=" + pat.Birthdate.Day.ToString() + "\r\n" + "[Dentist]\r\n" + "ID=" + priProv.Abbr + "\r\n"//Abbreviation is guaranteed non-blank, because of UI validation in the provider edit window. + "Password=digirex"; // Write the string to a file. string iniPath = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "System path to Apixia Digital Imaging ini file"); try { StreamWriter iniFile = new System.IO.StreamWriter(iniPath); iniFile.WriteLine(iniString); iniFile.Close(); ODFileUtils.ProcessStart(path); } catch (UnauthorizedAccessException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { ex.DoNothing(); MessageBox.Show(path + " is not available."); } } }
///<summary>Launches the program as a comObject, and passes CADI OLE commands to the program. ///See https://stackoverflow.com/questions/29787825/how-to-interact-with-another-programs-with-ole-automation-in-c </summary> public void SendData(Program ProgramCur, Patient pat) { try { if (_comObject == null) { Type progType = Type.GetTypeFromProgID(PROGRAM_ID); _comObject = Activator.CreateInstance(progType); //register the handle of this window with CADI to listen for application closing events int result = _comObject.OleClientWindowHandle(_windowHandle, OLECLIENTNOTIFY_APPLICATIONEXIT, WM_CLOSE, 0, 0); if (result != 0) //0=success; 14=Invalid argument; -1=Unspecified error. { throw new Exception("Unable to communicate with CADI. Verify it is installed and try again."); } } if (pat == null) { return; } //Set patient info _comObject.OleBringToFrontApp(); _comObject.OleBeginTransaction(); string id = ""; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, ProgramProperties.PropertyDescs.PatOrChartNum) == "0") { id = pat.PatNum.ToString(); } else { id = pat.ChartNumber; } _comObject.OleSetPatientName(pat.LName + ", " + pat.FName); _comObject.OleSetPatientDateOfBirth(pat.Birthdate.Subtract(TDATE_START).TotalDays); _comObject.OleSetPatientBiologicalAge(pat.Age); _comObject.OleSetPatientSex(pat.Gender == PatientGender.Female ? "F" : "M"); //Send patient images file path string imagePath = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, ProgramProperties.PropertyDescs.ImageFolder); _comObject.OleLoadPicLib(CodeBase.ODFileUtils.CombinePaths(imagePath, id)); _comObject.OleEndTransaction(); } catch (COMException) { //_comObject cannot be referenced except to set to null in this context. Anything else would throw an exception. _comObject = null; CloseWindow(); throw new Exception("Unable to access CADI. Verify it is installed and try again."); } catch (Exception e) { //Not a COMException so it is ok to reference the _comObject. bool throwFriendly = _comObject == null; CloseWindow(); if (throwFriendly) { throw new Exception("Unable to open CADI. Verify it is installed and try again."); } throw e; } }
/// <summary></summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { //There are two options here, depending on the bridge //1. Launch program without any patient. try { Process.Start(path); //should start AaTemplate without bringing up a pt. } catch { MessageBox.Show(path + " is not available."); } //2. Tell user to pick a patient first. MsgBox.Show("AaTemplate", "Please select a patient first."); //return in both cases return; } //It's common to build a string string str = ""; //ProgramProperties.GetPropVal() is the way to get program properties. if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { str += "Id=" + pat.PatNum.ToString() + " "; } else { str += "Id=" + Tidy(pat.ChartNumber) + " "; } //Nearly always tidy the names in one way or another str += Tidy(pat.LName) + " "; //If birthdates are optional, only send them if they are valid. if (pat.Birthdate.Year > 1880) { str += pat.Birthdate.ToString("MM/dd/yyyy"); } //This patterns shows a way to handle gender unknown when gender is optional. if (pat.Gender == PatientGender.Female) { str += "F "; } else if (pat.Gender == PatientGender.Male) { str += "M "; } try { Process.Start(path, str); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary></summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); //filepath.exe -patid 123 -fname John -lname Doe -dob 01/25/1962 -ssn 123456789 -gender M if (pat == null) { MessageBox.Show("Please select a patient first"); return; } string info = "-patid "; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { info += pat.PatNum.ToString() + " "; } else { info += pat.ChartNumber + " "; } info += "-fname " + Tidy(pat.FName) + " " + "-lname " + Tidy(pat.LName) + " "; if (pat.Birthdate.Year > 1880) { info += "-dob " + pat.Birthdate.ToShortDateString() + " "; } else { info += "-dob "; } if (pat.SSN.Replace("0", "").Trim() != "") //An SSN which is all zeros will be treated as a blank SSN. Needed for eCW, since eCW sets SSN to 000-00-0000 if the patient does not have an SSN. { info += "-ssn " + pat.SSN + " "; } else { info += "-ssn "; } if (pat.Gender == PatientGender.Female) { info += "-gender F"; } else { info += "-gender M"; } try { ODFileUtils.ProcessStart(path, info); } catch { MessageBox.Show(path + " is not available."); } }
/// <summary></summary> public static void SendData(Program ProgramCur, Patient pat) { if (pat == null) { MsgBox.Show("Guru", "Please select a patient first."); return; } int errorNum = MVStart(); if (errorNum != 0) { MsgBox.Show("Guru", "An error has occured."); return; } MVPatient mvPatient = new MVPatient(); mvPatient.LastName = Tidy(pat.LName, 64); mvPatient.FirstName = Tidy(pat.FName, 64); if (pat.Gender == PatientGender.Male) { mvPatient.Sex = Tidy("M", 1); } else if (pat.Gender == PatientGender.Female) { mvPatient.Sex = Tidy("F", 1); } else if (pat.Gender == PatientGender.Unknown) { mvPatient.Sex = Tidy("0", 1); } mvPatient.BirthDate = Tidy(pat.Birthdate.ToString("MMddyyyy"), 8); if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { mvPatient.ID = Tidy(pat.PatNum.ToString(), 64); } else { mvPatient.ID = Tidy(pat.ChartNumber.ToString(), 64); } if (pat.ImageFolder == "") //Could happen if the images module has not been visited for a new patient. { Patient patOld = pat.Copy(); pat.ImageFolder = pat.LName + pat.FName + pat.PatNum; Patients.Update(pat, patOld); } string imagePath = CodeBase.ODFileUtils.CombinePaths(ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Guru image path"), pat.ImageFolder); mvPatient.Directory = Tidy(imagePath, 259); if (MVSendPatient(mvPatient) != 0) { MsgBox.Show("Guru", "An error has occured."); } }
/// <summary></summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) //Launch program without any patient. { try { ODFileUtils.ProcessStart(path); } catch { MessageBox.Show(path + " is not available."); } return; } //Documentation for command line arguments is very vague. //See \\serverfiles\Storage\OPEN DENTAL\Programmers Documents\Bridge Info\RemoteExecuter for documentation on how this is being used by NADG List <string> listArgs = new List <string>(); listArgs.Add(ProgramCur.CommandLine); listArgs.Add("-first=\"" + Tidy(pat.FName) + "\""); listArgs.Add("-last=\"" + Tidy(pat.LName) + "\""); if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { listArgs.Add("-id=\"" + pat.PatNum.ToString() + "\""); } else { listArgs.Add("-id=\"" + Tidy(pat.ChartNumber) + "\""); } //Required. Should update automatically based on pat id, in the case where first bridged with b-date 01/01/0001, although we don't know for sure listArgs.Add("-DOB=\"" + pat.Birthdate.ToString("yyyy-MM-dd") + "\""); if (pat.Gender == PatientGender.Female) { //Probably what they use for female, based on their example for male, although we do not know for sure because the specification does not say. listArgs.Add("-sex=\"f\""); } else if (pat.Gender == PatientGender.Male) { listArgs.Add("-sex=\"m\""); //This option is valid, because it is part of the example inside the specification. } else { //Probably what they use for unknown (if unknown is even an option), based on their example for male, although we do not know for sure because //the specification does not say. listArgs.Add("-sex=\"u\""); } try { ODFileUtils.ProcessStart(path, string.Join(" ", listArgs)); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary>Financial transaction segment.</summary> private void FT1(List <Procedure> listProcs, bool justPDF) { if (justPDF) { return; //FT1 segment is not necessary when sending only a PDF. } ProcedureCode procCode; for (int i = 0; i < listProcs.Count; i++) { seg = new SegmentHL7(SegmentNameHL7.FT1); seg.SetField(0, "FT1"); seg.SetField(1, (i + 1).ToString()); seg.SetField(4, listProcs[i].ProcDate.ToString("yyyyMMdd")); seg.SetField(5, listProcs[i].ProcDate.ToString("yyyyMMdd")); seg.SetField(6, "CG"); seg.SetField(10, "1.0"); seg.SetField(16, ""); //location code and description??? seg.SetField(19, listProcs[i].DiagnosticCode); Provider prov = Providers.GetProv(listProcs[i].ProvNum); seg.SetField(20, prov.EcwID, prov.LName, prov.FName, prov.MI); //performed by provider. seg.SetField(21, prov.EcwID, prov.LName, prov.FName, prov.MI); //ordering provider. seg.SetField(22, listProcs[i].ProcFee.ToString("F2")); procCode = ProcedureCodes.GetProcCode(listProcs[i].CodeNum); if (procCode.ProcCode.Length > 5 && procCode.ProcCode.StartsWith("D")) { seg.SetField(25, procCode.ProcCode.Substring(0, 5)); //Remove suffix from all D codes. } else { seg.SetField(25, procCode.ProcCode); } if (procCode.TreatArea == TreatmentArea.ToothRange) { seg.SetField(26, listProcs[i].ToothRange, ""); } else if (procCode.TreatArea == TreatmentArea.Surf) //probably not necessary { seg.SetField(26, Tooth.ToInternat(listProcs[i].ToothNum), Tooth.SurfTidyForClaims(listProcs[i].Surf, listProcs[i].ToothNum)); } //this property will not exist if using Oracle, eCW will never use Oracle else if (procCode.TreatArea == TreatmentArea.Quad && ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "IsQuadAsToothNum") == "1") { seg.SetField(26, listProcs[i].Surf, ""); } else { seg.SetField(26, Tooth.ToInternat(listProcs[i].ToothNum), listProcs[i].Surf); } msg.Segments.Add(seg); } }
///<summary>Launches the program using a combination of command line characters and the patient.Cur data. ///Arguments: tscan.exe [-fFirstname [-mMiddlename] -lLastname -iPatientid [-dBirthday] [-jBirthmonth] [-yBirthyear] [-gGender]] ///Example: tscan.exe -fBrent -lThompson -iBT1000 -d07 -j02 -y1962 -g2</summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { try { Process.Start(path); //should start Tscan without bringing up a pt. } catch { MessageBox.Show(path + " is not available."); } return; } string info = "-f" + Tidy(pat.FName) + " "; //First name can only be alpha-numeric, so we remove non-alpha-numeric characters. if (Tidy(pat.MiddleI) != "") //Only send middle name if available, since it is optional. { info += "-m" + Tidy(pat.MiddleI) + " "; //Middle name can only be alpha-numeric, so we remove non-alpha-numeric characters. } info += "-l" + Tidy(pat.LName) + " "; //Last name can only be alpha-numeric, so we remove non-alpha-numeric characters. if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { info += "-i" + pat.PatNum.ToString() + " "; } else { info += "-i" + Tidy(pat.ChartNumber) + " "; //Patient id only alpha-numeric as required. } //Birthdate is optional, so we only send if valid. if (pat.Birthdate.Year > 1880) { info += "-d" + pat.Birthdate.Day.ToString().PadLeft(2, '0') + " "; //The example in specification shows days with two digits, so we pad. info += "-j" + pat.Birthdate.Month.ToString().PadLeft(2, '0') + " "; //The example in specification shows months with two digits, so we pad. info += "-y" + pat.Birthdate.Year.ToString() + " "; //The example specification shows years 4 digits long. } //Gender is optional, so we only send if not Unknown. if (pat.Gender == PatientGender.Female) { info += "-g1 "; } else if (pat.Gender == PatientGender.Male) { info += "-g2 "; } try { Process.Start(path, info); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary>Sends data for Patient.Cur by command line interface.</summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { MsgBox.Show("VixWinNumbered", "Please select a patient first."); return; } string ppImagePath = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Image Path"); if (ppImagePath.Trim() == "") { MsgBox.Show("VixWinNumbered", "Missing Image Path."); return; } string subDirNumbers = (pat.PatNum % 100).ToString().PadLeft(2, '0'); //Take the rightmost 2 numbers, preceeding with 0 if patnum<10 string fullPath = ODFileUtils.CombinePaths(ppImagePath.Trim(), subDirNumbers, pat.PatNum.ToString()); if (!Directory.Exists(fullPath)) { try { Directory.CreateDirectory(fullPath); } catch { MessageBox.Show(Lan.g("VixWinNumbered", "Patient image path could not be created. This usually indicates a permission issue. Path") + ":\r\n" + fullPath); return; } } //Example: c:\vixwin\vixwin -I 123ABC -N Bill^Smith -P X:\VXImages\02\196402\ string info = "-I "; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0") { info += pat.PatNum.ToString(); } else { info += pat.ChartNumber; //max 64 char } info += " -N " + pat.FName.Replace(" ", "") + "^" + pat.LName.Replace(" ", ""); //no spaces allowed info += " -P " + fullPath; //This is the Numbered Mode subdirectory try { Process.Start(path, info); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\nFile and command line:\r\n" + path + " " + info); } }
///<summary>Launches Patterson Imaging, logs user in, and opens current patient.</summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); if (pat == null) { return; } string strPathToIni = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "System path to Patterson Imaging ini"); if (!strPathToIni.ToLower().EndsWith(".ini")) //A customer specified an exe path here once, and then the exe file was overwritten. { MsgBox.Show("Patterson", "System path to Patterson Imaging ini is invalid in program link setup."); return; } Provider prov = Providers.GetProv(pat.PriProv); string ssn = Tidy(pat.SSN.ToString(), 9); if (ssn.Replace("-", "").Replace("0", "").Trim() == "") { ssn = ""; //We do not send if the ssn is all zeros, because Patterson treats ssn like a primary key if present. If more than one patient have the same ssn, then they are treated as the same patient. } try { VBbridges.Patterson.Launch( Tidy(pat.FName, 40), "", //Tidy(pat.MiddleI,1),//When there is no SSN and the name changes, Patterson creates a whole new patient record, which is troublesome for our customers. Tidy(pat.LName, 40), "", //Tidy(pat.Preferred,40),//When there is no SSN and the name changes, Patterson creates a whole new patient record, which is troublesome for our customers. Tidy(pat.Address, 40), Tidy(pat.City, 30), Tidy(pat.State, 2), Tidy(pat.Zip, 10), ssn, //This only works with ssn in america with no punctuation Tidy((pat.Gender == PatientGender.Male?"M":(pat.Gender == PatientGender.Female?"F":" ")), 1), //uses "M" for male "F" for female and " " for unkown Tidy(pat.Birthdate.ToShortDateString(), 11), LTidy(pat.PatNum.ToString(), 5), LTidy(prov.ProvNum.ToString(), 3), //LTidy(pat.PatNum.ToString(),5),//Limit is 5 characters, but that would only be exceeded if they are using random primary keys or they have a lot of data, neither case is common. //LTidy(prov.ProvNum.ToString(),3),//Limit is 3 characters, but that would only be exceeded if they are using random primary keys or they have a lot of data, neither case is common. Tidy(prov.FName, 40), Tidy(prov.LName, 40), path, strPathToIni ); } catch { MessageBox.Show("Error launching Patterson Imaging."); } }
private static UriBuilder GetApiUri(bool isForToken = false) { string baseURL = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.XVWeb), ProgramProps.UrlPath); if (!baseURL.EndsWith("/")) { baseURL += "/"; } UriBuilder uriBuilder = new UriBuilder(baseURL); if (!isForToken) { uriBuilder.Path += "api/"; } return(uriBuilder); }
///<summary>Launches the program using command line.</summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); //usage: C:\cdm\cdm\cdmx\cdmx.exe ;patID;fname;lname;SSN;birthdate //example: ;5001;John;Smith;123456789;01012000 //We did not get this information from Camsight. if (pat == null) { MsgBox.Show("Camsight", "Please select a patient first."); return; } if (!File.Exists(path)) { MessageBox.Show(path + " not found."); return; } //List<ProgramProperty> listForProgram=ProgramProperties.GetListForProgram(ProgramCur.ProgramNum); string info = ";"; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "1") { if (pat.ChartNumber == "") { MsgBox.Show("Camsight", "This patient has no ChartNumber entered."); return; } info += pat.ChartNumber; } else { info += pat.PatNum.ToString(); } info += ";" + Tidy(pat.FName) + ";" + Tidy(pat.LName) + ";" + pat.SSN //dashes already missing + ";" + pat.Birthdate.ToString("MM/dd/yyyy"); Process process = new Process(); process.StartInfo = new ProcessStartInfo(path, info); try{ process.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
///<summary>PatNum will not be altered here. The pat passed in must either have PatNum=0, or must have a PatNum matching the segment. The reason that isStandalone is passed in is because if using tight integration mode (isStandalone=false), then we need to store the "alternate patient id" aka Account No. that comes in on PID.4 in the ChartNumber field so we can pass it back in PID.2 of the DFT charge message. However, if not using tight integration (isStandalone=true), the ChartNumber field is already occupied by the eCW patient ID, and we do not want to overwrite it.</summary> public static void ProcessPID(Patient pat, SegmentHL7 seg, bool isStandalone, List <PatientRace> listPatRaces) { long patNum = PIn.Long(seg.GetFieldFullText(2)); //Standalone mode may not have found a matching patient within the database and will be inserted later in the message processing. if (isStandalone && pat != null) { patNum = pat.PatNum; //Standalone mode cannot always trust the PatNum in field 2. Always use pat.PatNum because that will the OD PatNum. } //if(pat.PatNum==0) { // pat.PatNum=patNum; //} //else if (!isStandalone && //in standalone, the patnums won't match, so don't check pat.PatNum != 0 && pat.PatNum != patNum) { throw new ApplicationException("Invalid patNum"); } if (!isStandalone) //when in tight integration mode { pat.ChartNumber = seg.GetFieldFullText(4); } pat.LName = seg.GetFieldComponent(5, 0); pat.FName = seg.GetFieldComponent(5, 1); pat.MiddleI = seg.GetFieldComponent(5, 2); pat.Birthdate = DateParse(seg.GetFieldFullText(7)); pat.Gender = GenderParse(seg.GetFieldFullText(8)); if (patNum > 0) { listPatRaces.Clear(); listPatRaces.AddRange(RaceParse(seg.GetFieldFullText(10), patNum)); } pat.Address = seg.GetFieldComponent(11, 0); pat.Address2 = seg.GetFieldComponent(11, 1); pat.City = seg.GetFieldComponent(11, 2); pat.State = seg.GetFieldComponent(11, 3); pat.Zip = seg.GetFieldComponent(11, 4); pat.HmPhone = PhoneParse(seg.GetFieldFullText(13)); pat.WkPhone = PhoneParse(seg.GetFieldFullText(14)); pat.Position = MaritalStatusParse(seg.GetFieldFullText(16)); //pat.ChartNumber=seg.GetFieldFullText(18);//this is wrong. Would also break standalone mode pat.SSN = seg.GetFieldFullText(19); if (ProgramProperties.GetPropVal(ProgramName.eClinicalWorks, "FeeSchedulesSetManually") == "0") //if !FeeSchedulesSetManually { pat.FeeSched = FeeScheduleParse(seg.GetFieldFullText(22)); } }
///<summary>Launches the program using command line.</summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); //usage: C:\Program Files\CliniView\CliniView.exe -123;John;Smith;123456789;01/01/1980 //Critical not to have any spaces in argument string. //We got this info directly from the programmers at CliniView if (pat == null) { MsgBox.Show("Cliniview", "Please select a patient first."); return; } if (!File.Exists(path)) { MessageBox.Show(path + " not found."); return; } string info = "-"; if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "1") { if (pat.ChartNumber == "") { MsgBox.Show("Cliniview", "This patient has no ChartNumber entered."); return; } info += pat.ChartNumber; } else { info += pat.PatNum.ToString(); } info += ";" + Tidy(pat.FName) + ";" + Tidy(pat.LName) + ";" + pat.SSN //dashes already missing + ";" + pat.Birthdate.ToString("MM/dd/yyyy"); Process process = new Process(); process.StartInfo = new ProcessStartInfo(path, info); try{ process.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }