///<summary>Updates one RxPat in the database.</summary> public static void Update(RxPat rxPat) { string command = "UPDATE rxpat SET " + "PatNum = " + POut.Long(rxPat.PatNum) + ", " + "RxDate = " + POut.Date(rxPat.RxDate) + ", " + "Drug = '" + POut.String(rxPat.Drug) + "', " + "Sig = '" + POut.String(rxPat.Sig) + "', " + "Disp = '" + POut.String(rxPat.Disp) + "', " + "Refills = '" + POut.String(rxPat.Refills) + "', " + "ProvNum = " + POut.Long(rxPat.ProvNum) + ", " + "Notes = '" + POut.String(rxPat.Notes) + "', " + "PharmacyNum = " + POut.Long(rxPat.PharmacyNum) + ", " + "IsControlled = " + POut.Bool(rxPat.IsControlled) + ", " //DateTStamp can only be set by MySQL + "SendStatus = " + POut.Int((int)rxPat.SendStatus) + ", " + "RxCui = " + POut.Long(rxPat.RxCui) + ", " + "DosageCode = '" + POut.String(rxPat.DosageCode) + "', " + "ErxGuid = '" + POut.String(rxPat.ErxGuid) + "', " + "IsErxOld = " + POut.Bool(rxPat.IsErxOld) + ", " + "ErxPharmacyInfo= '" + POut.String(rxPat.ErxPharmacyInfo) + "', " + "IsProcRequired = " + POut.Bool(rxPat.IsProcRequired) + ", " + "ProcNum = " + POut.Long(rxPat.ProcNum) + ", " + "DaysOfSupply = " + POut.Int(rxPat.DaysOfSupply) + " " + "WHERE RxNum = " + POut.Long(rxPat.RxNum); Db.NonQ(command); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<RxPat> TableToList(DataTable table){ List<RxPat> retVal=new List<RxPat>(); RxPat rxPat; for(int i=0;i<table.Rows.Count;i++) { rxPat=new RxPat(); rxPat.RxNum = PIn.Long (table.Rows[i]["RxNum"].ToString()); rxPat.PatNum = PIn.Long (table.Rows[i]["PatNum"].ToString()); rxPat.RxDate = PIn.Date (table.Rows[i]["RxDate"].ToString()); rxPat.Drug = PIn.String(table.Rows[i]["Drug"].ToString()); rxPat.Sig = PIn.String(table.Rows[i]["Sig"].ToString()); rxPat.Disp = PIn.String(table.Rows[i]["Disp"].ToString()); rxPat.Refills = PIn.String(table.Rows[i]["Refills"].ToString()); rxPat.ProvNum = PIn.Long (table.Rows[i]["ProvNum"].ToString()); rxPat.Notes = PIn.String(table.Rows[i]["Notes"].ToString()); rxPat.PharmacyNum = PIn.Long (table.Rows[i]["PharmacyNum"].ToString()); rxPat.IsControlled= PIn.Bool (table.Rows[i]["IsControlled"].ToString()); rxPat.DateTStamp = PIn.DateT (table.Rows[i]["DateTStamp"].ToString()); rxPat.SendStatus = (OpenDentBusiness.RxSendStatus)PIn.Int(table.Rows[i]["SendStatus"].ToString()); rxPat.RxCui = PIn.Long (table.Rows[i]["RxCui"].ToString()); rxPat.DosageCode = PIn.String(table.Rows[i]["DosageCode"].ToString()); rxPat.NewCropGuid = PIn.String(table.Rows[i]["NewCropGuid"].ToString()); retVal.Add(rxPat); } return retVal; }
///<summary>Inserts one RxPat into the database. Returns the new priKey.</summary> internal static long Insert(RxPat rxPat) { if(DataConnection.DBtype==DatabaseType.Oracle) { rxPat.RxNum=DbHelper.GetNextOracleKey("rxpat","RxNum"); int loopcount=0; while(loopcount<100){ try { return Insert(rxPat,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ rxPat.RxNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(rxPat,false); } }
///<summary>Inserts one RxPat into the database. Returns the new priKey.</summary> public static long Insert(RxPat rxPat) { if (DataConnection.DBtype == DatabaseType.Oracle) { rxPat.RxNum = DbHelper.GetNextOracleKey("rxpat", "RxNum"); int loopcount = 0; while (loopcount < 100) { try { return(Insert(rxPat, true)); } catch (Oracle.ManagedDataAccess.Client.OracleException ex) { if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")) { rxPat.RxNum++; loopcount++; } else { throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return(Insert(rxPat, false)); } }
///<summary>Updates one RxPat in the database.</summary> public static void Update(RxPat rxPat) { string command = "UPDATE rxpat SET " + "PatNum = " + POut.Long(rxPat.PatNum) + ", " + "RxDate = " + POut.Date(rxPat.RxDate) + ", " + "Drug = '" + POut.String(rxPat.Drug) + "', " + "Sig = '" + POut.String(rxPat.Sig) + "', " + "Disp = '" + POut.String(rxPat.Disp) + "', " + "Refills = '" + POut.String(rxPat.Refills) + "', " + "ProvNum = " + POut.Long(rxPat.ProvNum) + ", " + "Notes = '" + POut.String(rxPat.Notes) + "', " + "PharmacyNum = " + POut.Long(rxPat.PharmacyNum) + ", " + "IsControlled = " + POut.Bool(rxPat.IsControlled) + ", " //DateTStamp can only be set by MySQL + "SendStatus = " + POut.Int((int)rxPat.SendStatus) + ", " + "RxCui = " + POut.Long(rxPat.RxCui) + ", " + "DosageCode = '" + POut.String(rxPat.DosageCode) + "', " + "ErxGuid = '" + POut.String(rxPat.ErxGuid) + "', " + "IsErxOld = " + POut.Bool(rxPat.IsErxOld) + ", " + "ErxPharmacyInfo = '" + POut.String(rxPat.ErxPharmacyInfo) + "', " + "IsProcRequired = " + POut.Bool(rxPat.IsProcRequired) + ", " + "ProcNum = " + POut.Long(rxPat.ProcNum) + ", " + "DaysOfSupply = '" + POut.Double(rxPat.DaysOfSupply) + "', " + "PatientInstruction= " + DbHelper.ParamChar + "paramPatientInstruction, " + "ClinicNum = " + POut.Long(rxPat.ClinicNum) + " " + "WHERE RxNum = " + POut.Long(rxPat.RxNum); if (rxPat.PatientInstruction == null) { rxPat.PatientInstruction = ""; } OdSqlParameter paramPatientInstruction = new OdSqlParameter("paramPatientInstruction", OdDbType.Text, POut.StringParam(rxPat.PatientInstruction)); Db.NonQ(command, paramPatientInstruction); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List <RxPat> TableToList(DataTable table) { List <RxPat> retVal = new List <RxPat>(); RxPat rxPat; for (int i = 0; i < table.Rows.Count; i++) { rxPat = new RxPat(); rxPat.RxNum = PIn.Long(table.Rows[i]["RxNum"].ToString()); rxPat.PatNum = PIn.Long(table.Rows[i]["PatNum"].ToString()); rxPat.RxDate = PIn.Date(table.Rows[i]["RxDate"].ToString()); rxPat.Drug = PIn.String(table.Rows[i]["Drug"].ToString()); rxPat.Sig = PIn.String(table.Rows[i]["Sig"].ToString()); rxPat.Disp = PIn.String(table.Rows[i]["Disp"].ToString()); rxPat.Refills = PIn.String(table.Rows[i]["Refills"].ToString()); rxPat.ProvNum = PIn.Long(table.Rows[i]["ProvNum"].ToString()); rxPat.Notes = PIn.String(table.Rows[i]["Notes"].ToString()); rxPat.PharmacyNum = PIn.Long(table.Rows[i]["PharmacyNum"].ToString()); rxPat.IsControlled = PIn.Bool(table.Rows[i]["IsControlled"].ToString()); rxPat.DateTStamp = PIn.DateT(table.Rows[i]["DateTStamp"].ToString()); rxPat.SendStatus = (RxSendStatus)PIn.Int(table.Rows[i]["SendStatus"].ToString()); rxPat.RxCui = PIn.Long(table.Rows[i]["RxCui"].ToString()); rxPat.DosageCode = PIn.String(table.Rows[i]["DosageCode"].ToString()); rxPat.NewCropGuid = PIn.String(table.Rows[i]["NewCropGuid"].ToString()); retVal.Add(rxPat); } return(retVal); }
private void butBlank_Click(object sender, System.EventArgs e) { RxPat RxPatCur = new RxPat(); RxPatCur.RxDate = DateTime.Today; RxPatCur.PatNum = PatCur.PatNum; RxPatCur.ClinicNum = PatCur.ClinicNum; if (PrefC.GetBool(PrefName.RxSendNewToQueue)) { RxPatCur.SendStatus = RxSendStatus.InElectQueue; } else { RxPatCur.SendStatus = RxSendStatus.Unsent; } FormRxEdit FormE = new FormRxEdit(PatCur, RxPatCur); FormE.IsNew = true; FormE.ShowDialog(); if (FormE.DialogResult != DialogResult.OK) { return; } //We do not need to make a medical order here, because butBlank is not visible in EHR mode. DialogResult = DialogResult.OK; }
///<summary></summary> public static void Insert(RxPat rx) { if (PrefB.RandomKeys) { rx.RxNum = MiscData.GetKey("rxpat", "RxNum"); } string command = "INSERT INTO rxpat ("; if (PrefB.RandomKeys) { command += "RxNum,"; } command += "PatNum,RxDate,Drug,Sig,Disp,Refills,ProvNum,Notes) VALUES("; if (PrefB.RandomKeys) { command += "'" + POut.PInt(rx.RxNum) + "', "; } command += "'" + POut.PInt(rx.PatNum) + "', " + POut.PDate(rx.RxDate) + ", " + "'" + POut.PString(rx.Drug) + "', " + "'" + POut.PString(rx.Sig) + "', " + "'" + POut.PString(rx.Disp) + "', " + "'" + POut.PString(rx.Refills) + "', " + "'" + POut.PInt(rx.ProvNum) + "', " + "'" + POut.PString(rx.Notes) + "')"; if (PrefB.RandomKeys) { General.NonQ(command); } else { rx.RxNum = General.NonQ(command, true); } }
///<summary>Converts a DataTable to a list of objects.</summary> public static List <RxPat> TableToList(DataTable table) { List <RxPat> retVal = new List <RxPat>(); RxPat rxPat; foreach (DataRow row in table.Rows) { rxPat = new RxPat(); rxPat.RxNum = PIn.Long(row["RxNum"].ToString()); rxPat.PatNum = PIn.Long(row["PatNum"].ToString()); rxPat.RxDate = PIn.Date(row["RxDate"].ToString()); rxPat.Drug = PIn.String(row["Drug"].ToString()); rxPat.Sig = PIn.String(row["Sig"].ToString()); rxPat.Disp = PIn.String(row["Disp"].ToString()); rxPat.Refills = PIn.String(row["Refills"].ToString()); rxPat.ProvNum = PIn.Long(row["ProvNum"].ToString()); rxPat.Notes = PIn.String(row["Notes"].ToString()); rxPat.PharmacyNum = PIn.Long(row["PharmacyNum"].ToString()); rxPat.IsControlled = PIn.Bool(row["IsControlled"].ToString()); rxPat.DateTStamp = PIn.DateT(row["DateTStamp"].ToString()); rxPat.SendStatus = (OpenDentBusiness.RxSendStatus)PIn.Int(row["SendStatus"].ToString()); rxPat.RxCui = PIn.Long(row["RxCui"].ToString()); rxPat.DosageCode = PIn.String(row["DosageCode"].ToString()); rxPat.ErxGuid = PIn.String(row["ErxGuid"].ToString()); rxPat.IsErxOld = PIn.Bool(row["IsErxOld"].ToString()); rxPat.ErxPharmacyInfo = PIn.String(row["ErxPharmacyInfo"].ToString()); rxPat.IsProcRequired = PIn.Bool(row["IsProcRequired"].ToString()); rxPat.ProcNum = PIn.Long(row["ProcNum"].ToString()); rxPat.DaysOfSupply = PIn.Int(row["DaysOfSupply"].ToString()); retVal.Add(rxPat); } return(retVal); }
///<summary></summary> public FormRxEdit(Patient patCur, RxPat rxPatCur) { //){// InitializeComponent(); RxPatCur = rxPatCur; PatCur = patCur; Lan.F(this); }
///<summary>Sorts the passed in RxPats by RxDate and then RxNum.</summary> private int SortByRxDate(RxPat rx1, RxPat rx2) { if (rx1.RxDate != rx2.RxDate) { return(rx2.RxDate.CompareTo(rx1.RxDate)); } return(rx2.RxNum.CompareTo(rx1.RxNum)); }
///<summary>Inserts one RxPat into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(RxPat rxPat, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO rxpat ("; if (!useExistingPK && isRandomKeys) { rxPat.RxNum = ReplicationServers.GetKeyNoCache("rxpat", "RxNum"); } if (isRandomKeys || useExistingPK) { command += "RxNum,"; } command += "PatNum,RxDate,Drug,Sig,Disp,Refills,ProvNum,Notes,PharmacyNum,IsControlled,SendStatus,RxCui,DosageCode,ErxGuid,IsErxOld,ErxPharmacyInfo,IsProcRequired,ProcNum,DaysOfSupply,PatientInstruction,ClinicNum) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(rxPat.RxNum) + ","; } command += POut.Long(rxPat.PatNum) + "," + POut.Date(rxPat.RxDate) + "," + "'" + POut.String(rxPat.Drug) + "'," + "'" + POut.String(rxPat.Sig) + "'," + "'" + POut.String(rxPat.Disp) + "'," + "'" + POut.String(rxPat.Refills) + "'," + POut.Long(rxPat.ProvNum) + "," + "'" + POut.String(rxPat.Notes) + "'," + POut.Long(rxPat.PharmacyNum) + "," + POut.Bool(rxPat.IsControlled) + "," //DateTStamp can only be set by MySQL + POut.Int((int)rxPat.SendStatus) + "," + POut.Long(rxPat.RxCui) + "," + "'" + POut.String(rxPat.DosageCode) + "'," + "'" + POut.String(rxPat.ErxGuid) + "'," + POut.Bool(rxPat.IsErxOld) + "," + "'" + POut.String(rxPat.ErxPharmacyInfo) + "'," + POut.Bool(rxPat.IsProcRequired) + "," + POut.Long(rxPat.ProcNum) + "," + "'" + POut.Double(rxPat.DaysOfSupply) + "'," + DbHelper.ParamChar + "paramPatientInstruction," + POut.Long(rxPat.ClinicNum) + ")"; if (rxPat.PatientInstruction == null) { rxPat.PatientInstruction = ""; } OdSqlParameter paramPatientInstruction = new OdSqlParameter("paramPatientInstruction", OdDbType.Text, POut.StringParam(rxPat.PatientInstruction)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramPatientInstruction); } else { rxPat.RxNum = Db.NonQ(command, true, "RxNum", "rxPat", paramPatientInstruction); } return(rxPat.RxNum); }
private void RxSelected() { if (gridMain.GetSelectedIndex() == -1) { //this should never happen return; } RxDef RxDefCur = RxDefList[gridMain.GetSelectedIndex()]; //Alert RxAlert[] alertList = RxAlerts.Refresh(RxDefCur.RxDefNum); Disease[] diseases = Diseases.Refresh(PatCur.PatNum); ArrayList matchAL = new ArrayList(); for (int i = 0; i < alertList.Length; i++) { for (int j = 0; j < diseases.Length; j++) { if (alertList[i].DiseaseDefNum == diseases[j].DiseaseDefNum) { matchAL.Add(DiseaseDefs.GetName(diseases[j].DiseaseDefNum)); } } } if (matchAL.Count > 0) { string alert = Lan.g(this, "This patient has the following medical conditions or allergies:\r\n"); for (int i = 0; i < matchAL.Count; i++) { alert += "\r\n" + matchAL[i]; } alert += "\r\n\r\n" + Lan.g(this, "Continue anyway?"); if (MessageBox.Show(alert, "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK) { return; } } //User OK with alert RxPat RxPatCur = new RxPat(); RxPatCur.RxDate = DateTime.Today; RxPatCur.PatNum = PatCur.PatNum; RxPatCur.Drug = RxDefCur.Drug; RxPatCur.Sig = RxDefCur.Sig; RxPatCur.Disp = RxDefCur.Disp; RxPatCur.Refills = RxDefCur.Refills; //Notes not copied: we don't want these kinds of notes cluttering things FormRxEdit FormE = new FormRxEdit(PatCur, RxPatCur); FormE.IsNew = true; FormE.ShowDialog(); if (FormE.DialogResult != DialogResult.OK) { return; } DialogResult = DialogResult.OK; }
///<summary></summary> public static void Update(RxPat rx) { string command = "UPDATE rxpat SET " + "PatNum = '" + POut.PInt(rx.PatNum) + "'" + ",RxDate = " + POut.PDate(rx.RxDate) + ",Drug = '" + POut.PString(rx.Drug) + "'" + ",Sig = '" + POut.PString(rx.Sig) + "'" + ",Disp = '" + POut.PString(rx.Disp) + "'" + ",Refills = '" + POut.PString(rx.Refills) + "'" + ",ProvNum = '" + POut.PInt(rx.ProvNum) + "'" + ",Notes = '" + POut.PString(rx.Notes) + "'" + " WHERE RxNum = '" + POut.PInt(rx.RxNum) + "'"; General.NonQ(command); }
///<summary>Inserts one RxPat into the database. Returns the new priKey. Doesn't use the cache.</summary> public static long InsertNoCache(RxPat rxPat) { if (DataConnection.DBtype == DatabaseType.MySql) { return(InsertNoCache(rxPat, false)); } else { if (DataConnection.DBtype == DatabaseType.Oracle) { rxPat.RxNum = DbHelper.GetNextOracleKey("rxpat", "RxNum"); //Cacheless method } return(InsertNoCache(rxPat, true)); } }
///<summary>Converts one RxPat object to its mobile equivalent. Warning! CustomerNum will always be 0.</summary> internal static RxPatm ConvertToM(RxPat rxPat) { RxPatm rxPatm = new RxPatm(); //CustomerNum cannot be set. Remains 0. rxPatm.RxNum = rxPat.RxNum; rxPatm.PatNum = rxPat.PatNum; rxPatm.RxDate = rxPat.RxDate; rxPatm.Drug = rxPat.Drug; rxPatm.Sig = rxPat.Sig; rxPatm.Disp = rxPat.Disp; rxPatm.Refills = rxPat.Refills; rxPatm.ProvNum = rxPat.ProvNum; return(rxPatm); }
///<summary>Inserts one RxPat into the database. Provides option to use the existing priKey.</summary> public static long Insert(RxPat rxPat, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { rxPat.RxNum = ReplicationServers.GetKey("rxpat", "RxNum"); } string command = "INSERT INTO rxpat ("; if (useExistingPK || PrefC.RandomKeys) { command += "RxNum,"; } command += "PatNum,RxDate,Drug,Sig,Disp,Refills,ProvNum,Notes,PharmacyNum,IsControlled,SendStatus,RxCui,DosageCode,ErxGuid,IsErxOld,ErxPharmacyInfo,IsProcRequired,ProcNum,DaysOfSupply) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(rxPat.RxNum) + ","; } command += POut.Long(rxPat.PatNum) + "," + POut.Date(rxPat.RxDate) + "," + "'" + POut.String(rxPat.Drug) + "'," + "'" + POut.String(rxPat.Sig) + "'," + "'" + POut.String(rxPat.Disp) + "'," + "'" + POut.String(rxPat.Refills) + "'," + POut.Long(rxPat.ProvNum) + "," + "'" + POut.String(rxPat.Notes) + "'," + POut.Long(rxPat.PharmacyNum) + "," + POut.Bool(rxPat.IsControlled) + "," //DateTStamp can only be set by MySQL + POut.Int((int)rxPat.SendStatus) + "," + POut.Long(rxPat.RxCui) + "," + "'" + POut.String(rxPat.DosageCode) + "'," + "'" + POut.String(rxPat.ErxGuid) + "'," + POut.Bool(rxPat.IsErxOld) + "," + "'" + POut.String(rxPat.ErxPharmacyInfo) + "'," + POut.Bool(rxPat.IsProcRequired) + "," + POut.Long(rxPat.ProcNum) + "," + POut.Int(rxPat.DaysOfSupply) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { rxPat.RxNum = Db.NonQ(command, true, "RxNum", "rxPat"); } return(rxPat.RxNum); }
private void butBlank_Click(object sender, System.EventArgs e) { RxPat RxPatCur = new RxPat(); RxPatCur.RxDate = DateTime.Today; RxPatCur.PatNum = PatCur.PatNum; FormRxEdit FormE = new FormRxEdit(PatCur, RxPatCur); FormE.IsNew = true; FormE.ShowDialog(); if (FormE.DialogResult != DialogResult.OK) { return; } DialogResult = DialogResult.OK; }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { if (gridMain.GetSelectedIndex() == -1) { //this should never happen return; } RxPat rx = _listRx[gridMain.GetSelectedIndex()]; FormRxEdit FormRxE = new FormRxEdit(_patCur, rx); FormRxE.ShowDialog(); if (FormRxE.DialogResult != DialogResult.OK) { return; } FillGrid(); }
/// <summary>For testing only</summary> private static void CreatePrescriptions(int PrescriptionCount) { long[] patNumArray = Patients.GetAllPatNums(); for (int i = 0; i < patNumArray.Length; i++) { for (int j = 0; j < PrescriptionCount; j++) { RxPat rxpat = new RxPat(); rxpat.Drug = "VicodinA VicodinB VicodinC" + j; rxpat.Disp = "50.50"; rxpat.IsControlled = true; rxpat.PatNum = patNumArray[i]; rxpat.RxDate = new DateTime(2010, 12, 1, 11, 0, 0); RxPats.Insert(rxpat); } } }
///<summary></summary> public static RxPat GetRx(int rxNum) { string command = "SELECT * FROM rxpat" + " WHERE RxNum = " + POut.PInt(rxNum); DataTable table = General.GetTable(command); RxPat rx = new RxPat(); rx.RxNum = PIn.PInt(table.Rows[0][0].ToString()); rx.PatNum = PIn.PInt(table.Rows[0][1].ToString()); rx.RxDate = PIn.PDate(table.Rows[0][2].ToString()); rx.Drug = PIn.PString(table.Rows[0][3].ToString()); rx.Sig = PIn.PString(table.Rows[0][4].ToString()); rx.Disp = PIn.PString(table.Rows[0][5].ToString()); rx.Refills = PIn.PString(table.Rows[0][6].ToString()); rx.ProvNum = PIn.PInt(table.Rows[0][7].ToString()); rx.Notes = PIn.PString(table.Rows[0][8].ToString()); return(rx); }
private void RxSelected() { if (gridMain.GetSelectedIndex() == -1) { //this should never happen return; } RxDef RxDefCur = RxDefList[gridMain.GetSelectedIndex()]; //Alert if (!RxAlertL.DisplayAlerts(PatCur.PatNum, 0, RxDefCur.RxDefNum)) { return; } //User OK with alert RxPat RxPatCur = new RxPat(); RxPatCur.RxDate = DateTime.Today; RxPatCur.PatNum = PatCur.PatNum; RxPatCur.Drug = RxDefCur.Drug; RxPatCur.IsControlled = RxDefCur.IsControlled; RxPatCur.Sig = RxDefCur.Sig; RxPatCur.Disp = RxDefCur.Disp; RxPatCur.Refills = RxDefCur.Refills; if (PrefC.GetBool(PrefName.RxSendNewToQueue)) { RxPatCur.SendStatus = RxSendStatus.InElectQueue; } else { RxPatCur.SendStatus = RxSendStatus.Unsent; } //Notes not copied: we don't want these kinds of notes cluttering things FormRxEdit FormE = new FormRxEdit(PatCur, RxPatCur); FormE.IsNew = true; FormE.ShowDialog(); if (FormE.DialogResult != DialogResult.OK) { return; } DialogResult = DialogResult.OK; }
///<summary>Updates one RxPat in the database.</summary> internal static void Update(RxPat rxPat) { string command = "UPDATE rxpat SET " + "PatNum = " + POut.Long(rxPat.PatNum) + ", " + "RxDate = " + POut.Date(rxPat.RxDate) + ", " + "Drug = '" + POut.String(rxPat.Drug) + "', " + "Sig = '" + POut.String(rxPat.Sig) + "', " + "Disp = '" + POut.String(rxPat.Disp) + "', " + "Refills = '" + POut.String(rxPat.Refills) + "', " + "ProvNum = " + POut.Long(rxPat.ProvNum) + ", " + "Notes = '" + POut.String(rxPat.Notes) + "', " + "PharmacyNum = " + POut.Long(rxPat.PharmacyNum) + ", " + "IsControlled= " + POut.Bool(rxPat.IsControlled) + ", " //DateTStamp can only be set by MySQL + "SendStatus = " + POut.Int((int)rxPat.SendStatus) + ", " + "RxCui = " + POut.Long(rxPat.RxCui) + ", " + "DosageCode = '" + POut.String(rxPat.DosageCode) + "' " + "WHERE RxNum = " + POut.Long(rxPat.RxNum); Db.NonQ(command); }
///<summary></summary> public static RxPat[] Refresh(int patNum) { string command = "SELECT * FROM rxpat" + " WHERE PatNum = '" + POut.PInt(patNum) + "'" + " ORDER BY RxDate"; DataTable table = General.GetTable(command); RxPat[] List = new RxPat[table.Rows.Count]; for (int i = 0; i < table.Rows.Count; i++) { List[i] = new RxPat(); List[i].RxNum = PIn.PInt(table.Rows[i][0].ToString()); List[i].PatNum = PIn.PInt(table.Rows[i][1].ToString()); List[i].RxDate = PIn.PDate(table.Rows[i][2].ToString()); List[i].Drug = PIn.PString(table.Rows[i][3].ToString()); List[i].Sig = PIn.PString(table.Rows[i][4].ToString()); List[i].Disp = PIn.PString(table.Rows[i][5].ToString()); List[i].Refills = PIn.PString(table.Rows[i][6].ToString()); List[i].ProvNum = PIn.PInt(table.Rows[i][7].ToString()); List[i].Notes = PIn.PString(table.Rows[i][8].ToString()); } return(List); }
private void butBlank_Click(object sender, System.EventArgs e) { RxPat RxPatCur = new RxPat(); RxPatCur.RxDate = DateTime.Today; RxPatCur.PatNum = PatCur.PatNum; if (PrefC.GetBool(PrefName.RxSendNewToQueue)) { RxPatCur.SendStatus = RxSendStatus.InElectQueue; } else { RxPatCur.SendStatus = RxSendStatus.Unsent; } FormRxEdit FormE = new FormRxEdit(PatCur, RxPatCur); FormE.IsNew = true; FormE.ShowDialog(); if (FormE.DialogResult != DialogResult.OK) { return; } DialogResult = DialogResult.OK; }
///<summary>Inserts one RxPat into the database. Provides option to use the existing priKey.</summary> internal static long Insert(RxPat rxPat,bool useExistingPK) { if(!useExistingPK && PrefC.RandomKeys) { rxPat.RxNum=ReplicationServers.GetKey("rxpat","RxNum"); } string command="INSERT INTO rxpat ("; if(useExistingPK || PrefC.RandomKeys) { command+="RxNum,"; } command+="PatNum,RxDate,Drug,Sig,Disp,Refills,ProvNum,Notes,PharmacyNum,IsControlled,SendStatus,RxCui,DosageCode) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(rxPat.RxNum)+","; } command+= POut.Long (rxPat.PatNum)+"," + POut.Date (rxPat.RxDate)+"," +"'"+POut.String(rxPat.Drug)+"'," +"'"+POut.String(rxPat.Sig)+"'," +"'"+POut.String(rxPat.Disp)+"'," +"'"+POut.String(rxPat.Refills)+"'," + POut.Long (rxPat.ProvNum)+"," +"'"+POut.String(rxPat.Notes)+"'," + POut.Long (rxPat.PharmacyNum)+"," + POut.Bool (rxPat.IsControlled)+"," //DateTStamp can only be set by MySQL + POut.Int ((int)rxPat.SendStatus)+"," + POut.Long (rxPat.RxCui)+"," +"'"+POut.String(rxPat.DosageCode)+"')"; if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { rxPat.RxNum=Db.NonQ(command,true); } return rxPat.RxNum; }
private void butSend_Click(object sender, EventArgs ea) { if (gridMain.SelectedIndices.Length != 1) { MsgBox.Show(this, "Exactly one Rx must be selected."); return; } Pharmacy pharmacy = Pharmacies.GetOne(listRx[gridMain.SelectedIndices[0]].PharmacyNum); StringBuilder strb = new StringBuilder(); //These characters will be replaced in a production by unprintable characters, but hardcoded for debugging. char f = ':'; //separates fields within a composite element char e = '+'; //(separates composite elements) SureScripts may require an unprintable character here. char d = '.'; //decimal notation char r = '/'; //release indicator char p = '*'; //repetition separator string s = "'\r\n"; //segment separator #if DEBUG if (true) { //Set false if you want to use unprintable characters to simulate running in release mode. } else { //f=''; we don't know the values for these characters yet. //e=''; //d=''; //r=''; //p=''; //s=''; } #else //f=''; we don't know the values for these characters yet. //e=''; //d=''; //r=''; //p=''; //s=''; #endif RxPat rx = listRx[gridMain.SelectedIndices[0]]; Patient pat = Patients.GetPat(rx.PatNum); Provider prov = Providers.GetProv(rx.ProvNum); PatPlan patPlan = PatPlans.GetPatPlan(pat.PatNum, 1); Family fam = Patients.GetFamily(pat.PatNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); InsSub sub = InsSubs.GetOne(patPlan.InsSubNum); InsPlan plan = InsPlans.GetPlan(sub.PlanNum, planList); Carrier car = Carriers.GetCarrier(plan.CarrierNum); DateTime msgTimeSent = DateTime.Now; //Hardcoded values should never change. Ex:Message type, version, release should always be SCRIPT:010:006 //Hardcoded values allowed to change until released version. //UNA:+./*'------------------------------------------------------------------------------------------------ strb.Append("UNA" + f + e + d + r + p + s); //UIB+UNOA:0++1234567+++77777777:C:PASSWORDQ+7701630:P+19971001:081522'------------------------------------ strb.Append("UIB" + e); //000 strb.Append("UNOA" + f + "0" + e); //010 Syntax identifier and version strb.Append(e); //020 not used strb.Append(Sout(POut.Long(rx.RxNum)) + e); //030 Transaction reference (Clinic system trace number.) Sender creates a Unique Trace number for each message sent. strb.Append(e); //040 not used strb.Append(e); //050 not used strb.Append("56873771" + f + "C" + f + "PASSWORDQ" + e); //060 Sender identification (This is the Clinic ID of the sender; C means it is a Clinic.) strb.Append(Sout(pharmacy.PharmID) + f + "P" + e); //070 Recipient ID (NCPDP Provider ID Number of pharmacy; P means it is a pharmacy.) strb.Append(Sout(msgTimeSent.ToString("yyyyMMdd")) + f + Sout(msgTimeSent.ToString("HHmmss")) + s); //080 Date of initiation CCYYMMDD:HHMMSS,S //UIH+SCRIPT:010:006:NEWRX+110072+++19971001:081522'------------------------------------------------------- strb.Append("UIH" + e); //000 strb.Append("SCRIPT" + f + "010" + f + "006" + f + "NEWRX" + e); //010 Message type:version:release:function. //Clinic's reference number for message. Usually this is the folio number for the patient. However, this is the ID by which the clinic will be able to refer to this prescription. strb.Append(Sout(rx.RxNum.ToString()) + e); //020 Message reference number (Must match number in UIT segment below, must be unique. Recommend using rx num) strb.Append(e); //030 conditional Dialogue Reference strb.Append(e); //040 not used strb.Append(Sout(msgTimeSent.ToString("yyyyMMdd")) + f + Sout(msgTimeSent.ToString("HHmmss")) + s); //050 Date of initiation //PVD+P1+7701630:D3+++++MAIN STREET PHARMACY++6152205656:TE'----------------------------------------------- strb.Append("PVD" + e); //000 strb.Append("P1" + e); //010 Provider coded (see external code list pg.109) strb.Append(Sout(pharmacy.PharmID) + f + "D3" + e); //020 Reference number and qualifier (Pharmacy ID) strb.Append(e); //030 not used strb.Append(e); //040 conditional Provider specialty strb.Append(e); //050 conditional The name of the prescriber or pharmacist or supervisor strb.Append(e); //060 not used strb.Append(e); //070 conditional The clinic or pharmacy name strb.Append(Sout(pharmacy.Address) + f + Sout(pharmacy.City) + f + Sout(pharmacy.State) + f + Sout(pharmacy.Zip) + e); //080 Address strb.Append(Regex.Replace(Sout(pharmacy.Phone), @"[-()]", string.Empty) + f + "TE" + s); //090 Communication number and qualifier //PVD+PC+6666666:0B+++JONES:MARK++++6152219800:TE'--------------------------------------------------------- strb.Append("PVD" + e); //000 strb.Append("PC" + e); //010 Provider coded strb.Append(Sout(prov.StateRxID) + f + "0B" + e); //020 Reference number and qualifier (0B: Provider State License Number) strb.Append(e); //030 not used strb.Append(e); //040 conditional Provider specialty strb.Append(Sout(prov.LName) + f + Sout(prov.FName) + e); //050 The name of the prescriber or pharmacist or supervisor strb.Append(e); //060 not used strb.Append(e); //070 conditional The clinic or pharmacy name strb.Append(e); //080 conditional Address strb.Append(Regex.Replace(Sout(PrefC.GetString(PrefName.PracticePhone)), @"[-()]", string.Empty) + f + "TE" + s); //090 Communication number and qualifier //PTT++19541225+SMITH:MARY+F+333445555:SY'----------------------------------------------------------------- strb.Append("PTT" + e); //000 strb.Append(e); //010 conditional Individual relationship strb.Append(Sout(pat.Birthdate.ToString("yyyyMMdd")) + e); //020 Birth date of patient YYYYMMDD strb.Append(Sout(pat.LName) + f + Sout(pat.FName) + e); //030 Name strb.Append(Sout(pat.Gender.ToString().Substring(0, 1)) + e); //040 Gender (M,F,U) strb.Append(Sout(pat.SSN.Replace("-", "")) + f + "SY" + s); //050 Patient ID and/or SSN and qualifier //COO+123456:BO+INSURANCE COMPANY NAME++123456789++AA112'-------------------------------------------------- strb.Append("COO" + e); //000 strb.Append(Sout(plan.RxBIN) + f + "BO" + e); //010 Payer ID Information and qualifier (Primary Payer's identification number? BO is for BIN Location Number.) strb.Append(Sout(car.CarrierName) + e); //020 Payer name strb.Append(e); //030 conditional Service type, coded strb.Append(Sout(sub.SubscriberID) + e); //040 Cardholder ID strb.Append(e); //050 conditional Cardholder name strb.Append(Sout(plan.GroupNum) + s); //060 Group ID //DRU------------------------------------------------------------------------------------------------------ //DRU+P:CALAN SR 240MG::::240:::::::AA:C42998:AB:C28253+::60:38:AC:C48542+:1 TID -TAKE ONE TABLET TWO TIMES A DAY UNTIL GONE+85:19971001:102*ZDS:30:804+0+R:1' strb.Append("DRU" + e); //000 //P means prescribed. Drug prescribed is Calan Sr 240mg. //240 is the strength (free text); AA is the Source for NCI Pharmaceutical Dosage Form. C42998 is the code for “Tablet dosing form”. //AB is the Source for NCI Units of Presentation. C28253 is the code for “Milligram”. So this means the prescription is for 240mg tablets. //There's AA, AB and AC - AC is Potency Unit //The definitions for C42998 and C28253 and be found @ http://nciterms.nci.nih.gov/ncitbrowser/pages/vocabulary.jsf?dictionary=NCI_Thesaurus strb.Append("P" + f + Sout(rx.Drug) + f + f + f + f + f + f + Sout(rx.RxCui.ToString()) + f + "SBD" + e); //f+f+f+f+"AA"+f+"C42998"+f+"AB"+f+"C28253"+e);//010 Item Description Identification //This means dispense 60 tablets. 38 is the code value for Original Qty. AC is the Source for NCI Potency Units. C48542 is the code for “Tablet dosing unit”. strb.Append("" + f + f + Sout(rx.Disp) + f + f + "AA" + f + Sout(rx.DosageCode) + e); //020 Quantity strb.Append(f + Sout(rx.Sig) + e); //030 Directions //85 qualifier for Date Issued (Written date) 102 is qualifier for CCYYMMDD format. //ZDS is the qualifier for Days Supply. 30 is the number of days supply. 804 is the qualifier for Quantity of Days. strb.Append("85" + f + Sout(rx.RxDate.ToString("yyyyMMdd")) + f + "102" + e); //+p+"ZDS"+f+"30"+f+"804"+e);//040 Date Note: It is strongly recommended that Days Supply (value “ZDS”) be supported. strb.Append("0" + e); //050 Product/Service substitution, coded strb.Append("R" + f + Sout(rx.Refills) + s); //060 Refill and quantity //UIT+110072+6'--------------------------------------------------------------------------------------------- strb.Append("UIT" + e); //000 strb.Append(Sout(rx.RxNum.ToString()) + e); //010 Message reference number strb.Append("5" + s); //020 Mandatory field. This is the count of the number of segments in the message including the UIH and UIT //UIZ++1'--------------------------------------------------------------------------------------------------- strb.Append("UIZ" + e); //000 strb.Append(e); //010 not used strb.Append("1" + s); //020 Number of messages per interchange. The count of UIH-UIT occurrences //Uncomment if you want to see the message text: //MsgBoxCopyPaste msgbox=new MsgBoxCopyPaste(strb.ToString()); //msgbox.ShowDialog(); Cursor = Cursors.WaitCursor; try { #if EHRTEST EHR.EhrEmail.Send("10.6 SCRIPT for NEWRX", "SCRIPT.txt", strb.ToString()); #else //can't send email unless in debug/ehrtest mode. #endif } catch (Exception ex) { Cursor = Cursors.Default; MessageBox.Show(ex.Message); return; } Cursor = Cursors.Default; MessageBox.Show("Sent"); rx.SendStatus = RxSendStatus.SentElect; //Removes the Rx from the grid. RxPats.Update(rx); FillGrid(); }
private void FormRxEdit_Load(object sender, System.EventArgs e) { RxPatCur.IsNew = IsNew; _rxPatOld = RxPatCur.Copy(); if (IsNew) { butAudit.Visible = false; butView.Visible = false; labelView.Visible = false; sheet = null; if (PrefC.GetBool(PrefName.ShowFeatureEhr) && Security.CurUser.ProvNum != 0) //Is CPOE { labelCPOE.Visible = true; comboProvNum.Enabled = false; butPickProv.Enabled = false; RxPatCur.ProvNum = Security.CurUser.ProvNum; } } else { sheet = Sheets.GetRx(RxPatCur.PatNum, RxPatCur.RxNum); if (sheet == null) { butView.Visible = false; labelView.Visible = false; } else { butPrint.Visible = false; } if (!Security.IsAuthorized(Permissions.RxEdit)) { textDate.Enabled = false; checkControlled.Enabled = false; checkProcRequired.Enabled = false; comboProcCode.Enabled = false; textDaysOfSupply.Enabled = false; textDrug.Enabled = false; textSig.Enabled = false; textDisp.Enabled = false; textRefills.Enabled = false; comboProvNum.Enabled = false; butPickProv.Enabled = false; textDosageCode.Enabled = false; textNotes.Enabled = false; butPick.Enabled = false; comboSendStatus.Enabled = false; butDelete.Enabled = false; } } //security is handled on the Rx button click in the Chart module _provNumSelected = RxPatCur.ProvNum; comboProvNum.Items.Clear(); _listProviders = Providers.GetDeepCopy(true); for (int i = 0; i < _listProviders.Count; i++) { comboProvNum.Items.Add(_listProviders[i].GetLongDesc()); //Only visible provs added to combobox. if (_listProviders[i].ProvNum == RxPatCur.ProvNum) { comboProvNum.SelectedIndex = i; //Sets combo text too. } } if (_provNumSelected == 0) //Is new { comboProvNum.SelectedIndex = 0; _provNumSelected = _listProviders[0].ProvNum; } if (comboProvNum.SelectedIndex == -1) //The provider exists but is hidden { comboProvNum.Text = Providers.GetLongDesc(_provNumSelected); //Appends "(hidden)" to the end of the long description. } textDate.Text = RxPatCur.RxDate.ToString("d"); checkControlled.Checked = RxPatCur.IsControlled; comboProcCode.Items.Clear(); if (PrefC.GetBool(PrefName.RxHasProc)) { checkProcRequired.Checked = RxPatCur.IsProcRequired; comboProcCode.Items.Add(Lan.g(this, "none")); comboProcCode.SelectedIndex = 0; List <ProcedureCode> listProcCodes = ProcedureCodes.GetListDeep(); DateTime rxDate = PIn.Date(textDate.Text); if (rxDate.Year < 1880) { rxDate = DateTime.Today; } _listInUseProcs = Procedures.Refresh(RxPatCur.PatNum) .FindAll(x => x.ProcNum == RxPatCur.ProcNum || (x.ProcStatus == ProcStat.C && x.DateComplete <= rxDate && x.DateComplete >= rxDate.AddYears(-1)) || x.ProcStatus == ProcStat.TP) .OrderBy(x => x.ProcStatus.ToString()) .ThenBy(x => (x.ProcStatus == ProcStat.C)?x.DateComplete:x.DateTP) .ToList(); foreach (Procedure proc in _listInUseProcs) { ProcedureCode procCode = ProcedureCodes.GetProcCode(proc.CodeNum, listProcCodes); string itemText = proc.ProcStatus.ToString().PadLeft(2, ' '); if (proc.ProcStatus == ProcStat.C) { itemText += " " + proc.DateComplete.ToShortDateString(); } else { itemText += " " + proc.DateTP.ToShortDateString(); } itemText += " " + Procedures.GetDescription(proc); comboProcCode.Items.Add(itemText); if (proc.ProcNum == RxPatCur.ProcNum) { comboProcCode.SelectedIndex = comboProcCode.Items.Count - 1; } } if (RxPatCur.DaysOfSupply != 0) { textDaysOfSupply.Text = RxPatCur.DaysOfSupply.ToString(); } } else { checkProcRequired.Enabled = false; labelProcedure.Enabled = false; comboProcCode.Enabled = false; labelDaysOfSupply.Enabled = false; textDaysOfSupply.Enabled = false; } for (int i = 0; i < Enum.GetNames(typeof(RxSendStatus)).Length; i++) { comboSendStatus.Items.Add(Enum.GetNames(typeof(RxSendStatus))[i]); } comboSendStatus.SelectedIndex = (int)RxPatCur.SendStatus; textDrug.Text = RxPatCur.Drug; textSig.Text = RxPatCur.Sig; textDisp.Text = RxPatCur.Disp; textRefills.Text = RxPatCur.Refills; if (PrefC.GetBool(PrefName.ShowFeatureEhr)) { textDosageCode.Text = RxPatCur.DosageCode; } else { labelDosageCode.Visible = false; textDosageCode.Visible = false; } textNotes.Text = RxPatCur.Notes; textPharmInfo.Text = RxPatCur.ErxPharmacyInfo; textPharmacy.Text = Pharmacies.GetDescription(RxPatCur.PharmacyNum); }
///<summary>Returns true if Update(RxPat,RxPat) would make changes to the database. ///Does not make any changes to the database and can be called before remoting role is checked.</summary> public static bool UpdateComparison(RxPat rxPat, RxPat oldRxPat) { if (rxPat.PatNum != oldRxPat.PatNum) { return(true); } if (rxPat.RxDate.Date != oldRxPat.RxDate.Date) { return(true); } if (rxPat.Drug != oldRxPat.Drug) { return(true); } if (rxPat.Sig != oldRxPat.Sig) { return(true); } if (rxPat.Disp != oldRxPat.Disp) { return(true); } if (rxPat.Refills != oldRxPat.Refills) { return(true); } if (rxPat.ProvNum != oldRxPat.ProvNum) { return(true); } if (rxPat.Notes != oldRxPat.Notes) { return(true); } if (rxPat.PharmacyNum != oldRxPat.PharmacyNum) { return(true); } if (rxPat.IsControlled != oldRxPat.IsControlled) { return(true); } //DateTStamp can only be set by MySQL if (rxPat.SendStatus != oldRxPat.SendStatus) { return(true); } if (rxPat.RxCui != oldRxPat.RxCui) { return(true); } if (rxPat.DosageCode != oldRxPat.DosageCode) { return(true); } if (rxPat.ErxGuid != oldRxPat.ErxGuid) { return(true); } if (rxPat.IsErxOld != oldRxPat.IsErxOld) { return(true); } if (rxPat.ErxPharmacyInfo != oldRxPat.ErxPharmacyInfo) { return(true); } if (rxPat.IsProcRequired != oldRxPat.IsProcRequired) { return(true); } if (rxPat.ProcNum != oldRxPat.ProcNum) { return(true); } if (rxPat.DaysOfSupply != oldRxPat.DaysOfSupply) { return(true); } return(false); }
///<summary>Updates one RxPat in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables. Returns true if an update occurred.</summary> public static bool Update(RxPat rxPat, RxPat oldRxPat) { string command = ""; if (rxPat.PatNum != oldRxPat.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(rxPat.PatNum) + ""; } if (rxPat.RxDate.Date != oldRxPat.RxDate.Date) { if (command != "") { command += ","; } command += "RxDate = " + POut.Date(rxPat.RxDate) + ""; } if (rxPat.Drug != oldRxPat.Drug) { if (command != "") { command += ","; } command += "Drug = '" + POut.String(rxPat.Drug) + "'"; } if (rxPat.Sig != oldRxPat.Sig) { if (command != "") { command += ","; } command += "Sig = '" + POut.String(rxPat.Sig) + "'"; } if (rxPat.Disp != oldRxPat.Disp) { if (command != "") { command += ","; } command += "Disp = '" + POut.String(rxPat.Disp) + "'"; } if (rxPat.Refills != oldRxPat.Refills) { if (command != "") { command += ","; } command += "Refills = '" + POut.String(rxPat.Refills) + "'"; } if (rxPat.ProvNum != oldRxPat.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(rxPat.ProvNum) + ""; } if (rxPat.Notes != oldRxPat.Notes) { if (command != "") { command += ","; } command += "Notes = '" + POut.String(rxPat.Notes) + "'"; } if (rxPat.PharmacyNum != oldRxPat.PharmacyNum) { if (command != "") { command += ","; } command += "PharmacyNum = " + POut.Long(rxPat.PharmacyNum) + ""; } if (rxPat.IsControlled != oldRxPat.IsControlled) { if (command != "") { command += ","; } command += "IsControlled = " + POut.Bool(rxPat.IsControlled) + ""; } //DateTStamp can only be set by MySQL if (rxPat.SendStatus != oldRxPat.SendStatus) { if (command != "") { command += ","; } command += "SendStatus = " + POut.Int((int)rxPat.SendStatus) + ""; } if (rxPat.RxCui != oldRxPat.RxCui) { if (command != "") { command += ","; } command += "RxCui = " + POut.Long(rxPat.RxCui) + ""; } if (rxPat.DosageCode != oldRxPat.DosageCode) { if (command != "") { command += ","; } command += "DosageCode = '" + POut.String(rxPat.DosageCode) + "'"; } if (rxPat.ErxGuid != oldRxPat.ErxGuid) { if (command != "") { command += ","; } command += "ErxGuid = '" + POut.String(rxPat.ErxGuid) + "'"; } if (rxPat.IsErxOld != oldRxPat.IsErxOld) { if (command != "") { command += ","; } command += "IsErxOld = " + POut.Bool(rxPat.IsErxOld) + ""; } if (rxPat.ErxPharmacyInfo != oldRxPat.ErxPharmacyInfo) { if (command != "") { command += ","; } command += "ErxPharmacyInfo = '" + POut.String(rxPat.ErxPharmacyInfo) + "'"; } if (rxPat.IsProcRequired != oldRxPat.IsProcRequired) { if (command != "") { command += ","; } command += "IsProcRequired = " + POut.Bool(rxPat.IsProcRequired) + ""; } if (rxPat.ProcNum != oldRxPat.ProcNum) { if (command != "") { command += ","; } command += "ProcNum = " + POut.Long(rxPat.ProcNum) + ""; } if (rxPat.DaysOfSupply != oldRxPat.DaysOfSupply) { if (command != "") { command += ","; } command += "DaysOfSupply = " + POut.Int(rxPat.DaysOfSupply) + ""; } if (command == "") { return(false); } command = "UPDATE rxpat SET " + command + " WHERE RxNum = " + POut.Long(rxPat.RxNum); Db.NonQ(command); return(true); }
///<summary>Inserts one RxPat into the database. Returns the new priKey.</summary> public static long Insert(RxPat rxPat) { return(Insert(rxPat, false)); }
///<summary>Inserts one RxPat into the database. Returns the new priKey. Doesn't use the cache.</summary> public static long InsertNoCache(RxPat rxPat) { return(InsertNoCache(rxPat, false)); }
///<summary>Updates one RxPat in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables. Returns true if an update occurred.</summary> public static bool Update(RxPat rxPat, RxPat oldRxPat) { string command = ""; if (rxPat.PatNum != oldRxPat.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(rxPat.PatNum) + ""; } if (rxPat.RxDate.Date != oldRxPat.RxDate.Date) { if (command != "") { command += ","; } command += "RxDate = " + POut.Date(rxPat.RxDate) + ""; } if (rxPat.Drug != oldRxPat.Drug) { if (command != "") { command += ","; } command += "Drug = '" + POut.String(rxPat.Drug) + "'"; } if (rxPat.Sig != oldRxPat.Sig) { if (command != "") { command += ","; } command += "Sig = '" + POut.String(rxPat.Sig) + "'"; } if (rxPat.Disp != oldRxPat.Disp) { if (command != "") { command += ","; } command += "Disp = '" + POut.String(rxPat.Disp) + "'"; } if (rxPat.Refills != oldRxPat.Refills) { if (command != "") { command += ","; } command += "Refills = '" + POut.String(rxPat.Refills) + "'"; } if (rxPat.ProvNum != oldRxPat.ProvNum) { if (command != "") { command += ","; } command += "ProvNum = " + POut.Long(rxPat.ProvNum) + ""; } if (rxPat.Notes != oldRxPat.Notes) { if (command != "") { command += ","; } command += "Notes = '" + POut.String(rxPat.Notes) + "'"; } if (rxPat.PharmacyNum != oldRxPat.PharmacyNum) { if (command != "") { command += ","; } command += "PharmacyNum = " + POut.Long(rxPat.PharmacyNum) + ""; } if (rxPat.IsControlled != oldRxPat.IsControlled) { if (command != "") { command += ","; } command += "IsControlled = " + POut.Bool(rxPat.IsControlled) + ""; } //DateTStamp can only be set by MySQL if (rxPat.SendStatus != oldRxPat.SendStatus) { if (command != "") { command += ","; } command += "SendStatus = " + POut.Int((int)rxPat.SendStatus) + ""; } if (rxPat.RxCui != oldRxPat.RxCui) { if (command != "") { command += ","; } command += "RxCui = " + POut.Long(rxPat.RxCui) + ""; } if (rxPat.DosageCode != oldRxPat.DosageCode) { if (command != "") { command += ","; } command += "DosageCode = '" + POut.String(rxPat.DosageCode) + "'"; } if (rxPat.ErxGuid != oldRxPat.ErxGuid) { if (command != "") { command += ","; } command += "ErxGuid = '" + POut.String(rxPat.ErxGuid) + "'"; } if (rxPat.IsErxOld != oldRxPat.IsErxOld) { if (command != "") { command += ","; } command += "IsErxOld = " + POut.Bool(rxPat.IsErxOld) + ""; } if (rxPat.ErxPharmacyInfo != oldRxPat.ErxPharmacyInfo) { if (command != "") { command += ","; } command += "ErxPharmacyInfo = '" + POut.String(rxPat.ErxPharmacyInfo) + "'"; } if (rxPat.IsProcRequired != oldRxPat.IsProcRequired) { if (command != "") { command += ","; } command += "IsProcRequired = " + POut.Bool(rxPat.IsProcRequired) + ""; } if (rxPat.ProcNum != oldRxPat.ProcNum) { if (command != "") { command += ","; } command += "ProcNum = " + POut.Long(rxPat.ProcNum) + ""; } if (rxPat.DaysOfSupply != oldRxPat.DaysOfSupply) { if (command != "") { command += ","; } command += "DaysOfSupply = '" + POut.Double(rxPat.DaysOfSupply) + "'"; } if (rxPat.PatientInstruction != oldRxPat.PatientInstruction) { if (command != "") { command += ","; } command += "PatientInstruction = " + DbHelper.ParamChar + "paramPatientInstruction"; } if (rxPat.ClinicNum != oldRxPat.ClinicNum) { if (command != "") { command += ","; } command += "ClinicNum = " + POut.Long(rxPat.ClinicNum) + ""; } if (command == "") { return(false); } if (rxPat.PatientInstruction == null) { rxPat.PatientInstruction = ""; } OdSqlParameter paramPatientInstruction = new OdSqlParameter("paramPatientInstruction", OdDbType.Text, POut.StringParam(rxPat.PatientInstruction)); command = "UPDATE rxpat SET " + command + " WHERE RxNum = " + POut.Long(rxPat.RxNum); Db.NonQ(command, paramPatientInstruction); return(true); }
///<summary>Updates one RxPat in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables. Returns true if an update occurred.</summary> public static bool Update(RxPat rxPat,RxPat oldRxPat){ string command=""; if(rxPat.PatNum != oldRxPat.PatNum) { if(command!=""){ command+=",";} command+="PatNum = "+POut.Long(rxPat.PatNum)+""; } if(rxPat.RxDate != oldRxPat.RxDate) { if(command!=""){ command+=",";} command+="RxDate = "+POut.Date(rxPat.RxDate)+""; } if(rxPat.Drug != oldRxPat.Drug) { if(command!=""){ command+=",";} command+="Drug = '"+POut.String(rxPat.Drug)+"'"; } if(rxPat.Sig != oldRxPat.Sig) { if(command!=""){ command+=",";} command+="Sig = '"+POut.String(rxPat.Sig)+"'"; } if(rxPat.Disp != oldRxPat.Disp) { if(command!=""){ command+=",";} command+="Disp = '"+POut.String(rxPat.Disp)+"'"; } if(rxPat.Refills != oldRxPat.Refills) { if(command!=""){ command+=",";} command+="Refills = '"+POut.String(rxPat.Refills)+"'"; } if(rxPat.ProvNum != oldRxPat.ProvNum) { if(command!=""){ command+=",";} command+="ProvNum = "+POut.Long(rxPat.ProvNum)+""; } if(rxPat.Notes != oldRxPat.Notes) { if(command!=""){ command+=",";} command+="Notes = '"+POut.String(rxPat.Notes)+"'"; } if(rxPat.PharmacyNum != oldRxPat.PharmacyNum) { if(command!=""){ command+=",";} command+="PharmacyNum = "+POut.Long(rxPat.PharmacyNum)+""; } if(rxPat.IsControlled != oldRxPat.IsControlled) { if(command!=""){ command+=",";} command+="IsControlled = "+POut.Bool(rxPat.IsControlled)+""; } //DateTStamp can only be set by MySQL if(rxPat.SendStatus != oldRxPat.SendStatus) { if(command!=""){ command+=",";} command+="SendStatus = "+POut.Int ((int)rxPat.SendStatus)+""; } if(rxPat.RxCui != oldRxPat.RxCui) { if(command!=""){ command+=",";} command+="RxCui = "+POut.Long(rxPat.RxCui)+""; } if(rxPat.DosageCode != oldRxPat.DosageCode) { if(command!=""){ command+=",";} command+="DosageCode = '"+POut.String(rxPat.DosageCode)+"'"; } if(rxPat.NewCropGuid != oldRxPat.NewCropGuid) { if(command!=""){ command+=",";} command+="NewCropGuid = '"+POut.String(rxPat.NewCropGuid)+"'"; } if(command==""){ return false; } command="UPDATE rxpat SET "+command +" WHERE RxNum = "+POut.Long(rxPat.RxNum); Db.NonQ(command); return true; }
///<summary>Updates one RxPat in the database.</summary> public static void Update(RxPat rxPat){ string command="UPDATE rxpat SET " +"PatNum = "+POut.Long (rxPat.PatNum)+", " +"RxDate = "+POut.Date (rxPat.RxDate)+", " +"Drug = '"+POut.String(rxPat.Drug)+"', " +"Sig = '"+POut.String(rxPat.Sig)+"', " +"Disp = '"+POut.String(rxPat.Disp)+"', " +"Refills = '"+POut.String(rxPat.Refills)+"', " +"ProvNum = "+POut.Long (rxPat.ProvNum)+", " +"Notes = '"+POut.String(rxPat.Notes)+"', " +"PharmacyNum = "+POut.Long (rxPat.PharmacyNum)+", " +"IsControlled= "+POut.Bool (rxPat.IsControlled)+", " //DateTStamp can only be set by MySQL +"SendStatus = "+POut.Int ((int)rxPat.SendStatus)+", " +"RxCui = "+POut.Long (rxPat.RxCui)+", " +"DosageCode = '"+POut.String(rxPat.DosageCode)+"', " +"NewCropGuid = '"+POut.String(rxPat.NewCropGuid)+"' " +"WHERE RxNum = "+POut.Long(rxPat.RxNum); Db.NonQ(command); }
///<summary>Converts one RxPat object to its mobile equivalent. Warning! CustomerNum will always be 0.</summary> internal static RxPatm ConvertToM(RxPat rxPat){ RxPatm rxPatm=new RxPatm(); //CustomerNum cannot be set. Remains 0. rxPatm.RxNum =rxPat.RxNum; rxPatm.PatNum =rxPat.PatNum; rxPatm.RxDate =rxPat.RxDate; rxPatm.Drug =rxPat.Drug; rxPatm.Sig =rxPat.Sig; rxPatm.Disp =rxPat.Disp; rxPatm.Refills =rxPat.Refills; rxPatm.ProvNum =rxPat.ProvNum; return rxPatm; }