Пример #1
0
 ///<summary>Inserts one RxDef into the database.  Returns the new priKey.</summary>
 internal static long Insert(RxDef rxDef)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         rxDef.RxDefNum=DbHelper.GetNextOracleKey("rxdef","RxDefNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(rxDef,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     rxDef.RxDefNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(rxDef,false);
     }
 }
Пример #2
0
 ///<summary>Inserts one RxDef into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(RxDef rxDef,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         rxDef.RxDefNum=ReplicationServers.GetKey("rxdef","RxDefNum");
     }
     string command="INSERT INTO rxdef (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="RxDefNum,";
     }
     command+="Drug,Sig,Disp,Refills,Notes,IsControlled,RxCui) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(rxDef.RxDefNum)+",";
     }
     command+=
          "'"+POut.String(rxDef.Drug)+"',"
         +"'"+POut.String(rxDef.Sig)+"',"
         +"'"+POut.String(rxDef.Disp)+"',"
         +"'"+POut.String(rxDef.Refills)+"',"
         +"'"+POut.String(rxDef.Notes)+"',"
         +    POut.Bool  (rxDef.IsControlled)+","
         +    POut.Long  (rxDef.RxCui)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         rxDef.RxDefNum=Db.NonQ(command,true);
     }
     return rxDef.RxDefNum;
 }
Пример #3
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<RxDef> TableToList(DataTable table){
			List<RxDef> retVal=new List<RxDef>();
			RxDef rxDef;
			for(int i=0;i<table.Rows.Count;i++) {
				rxDef=new RxDef();
				rxDef.RxDefNum    = PIn.Long  (table.Rows[i]["RxDefNum"].ToString());
				rxDef.Drug        = PIn.String(table.Rows[i]["Drug"].ToString());
				rxDef.Sig         = PIn.String(table.Rows[i]["Sig"].ToString());
				rxDef.Disp        = PIn.String(table.Rows[i]["Disp"].ToString());
				rxDef.Refills     = PIn.String(table.Rows[i]["Refills"].ToString());
				rxDef.Notes       = PIn.String(table.Rows[i]["Notes"].ToString());
				rxDef.IsControlled= PIn.Bool  (table.Rows[i]["IsControlled"].ToString());
				rxDef.RxCui       = PIn.Long  (table.Rows[i]["RxCui"].ToString());
				retVal.Add(rxDef);
			}
			return retVal;
		}
Пример #4
0
        ///<summary>Inserts one RxDef into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(RxDef rxDef, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                rxDef.RxDefNum = ReplicationServers.GetKey("rxdef", "RxDefNum");
            }
            string command = "INSERT INTO rxdef (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "RxDefNum,";
            }
            command += "Drug,Sig,Disp,Refills,Notes,IsControlled,RxCui,IsProcRequired,PatientInstruction) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(rxDef.RxDefNum) + ",";
            }
            command +=
                "'" + POut.String(rxDef.Drug) + "',"
                + "'" + POut.String(rxDef.Sig) + "',"
                + "'" + POut.String(rxDef.Disp) + "',"
                + "'" + POut.String(rxDef.Refills) + "',"
                + "'" + POut.String(rxDef.Notes) + "',"
                + POut.Bool(rxDef.IsControlled) + ","
                + POut.Long(rxDef.RxCui) + ","
                + POut.Bool(rxDef.IsProcRequired) + ","
                + DbHelper.ParamChar + "paramPatientInstruction)";
            if (rxDef.PatientInstruction == null)
            {
                rxDef.PatientInstruction = "";
            }
            OdSqlParameter paramPatientInstruction = new OdSqlParameter("paramPatientInstruction", OdDbType.Text, POut.StringParam(rxDef.PatientInstruction));

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramPatientInstruction);
            }
            else
            {
                rxDef.RxDefNum = Db.NonQ(command, true, "RxDefNum", "rxDef", paramPatientInstruction);
            }
            return(rxDef.RxDefNum);
        }
Пример #5
0
        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;
        }
Пример #6
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <RxDef> TableToList(DataTable table)
        {
            List <RxDef> retVal = new List <RxDef>();
            RxDef        rxDef;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                rxDef              = new RxDef();
                rxDef.RxDefNum     = PIn.Long(table.Rows[i]["RxDefNum"].ToString());
                rxDef.Drug         = PIn.String(table.Rows[i]["Drug"].ToString());
                rxDef.Sig          = PIn.String(table.Rows[i]["Sig"].ToString());
                rxDef.Disp         = PIn.String(table.Rows[i]["Disp"].ToString());
                rxDef.Refills      = PIn.String(table.Rows[i]["Refills"].ToString());
                rxDef.Notes        = PIn.String(table.Rows[i]["Notes"].ToString());
                rxDef.IsControlled = PIn.Bool(table.Rows[i]["IsControlled"].ToString());
                rxDef.RxCui        = PIn.Long(table.Rows[i]["RxCui"].ToString());
                retVal.Add(rxDef);
            }
            return(retVal);
        }
Пример #7
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <RxDef> TableToList(DataTable table)
        {
            List <RxDef> retVal = new List <RxDef>();
            RxDef        rxDef;

            foreach (DataRow row in table.Rows)
            {
                rxDef                = new RxDef();
                rxDef.RxDefNum       = PIn.Long(row["RxDefNum"].ToString());
                rxDef.Drug           = PIn.String(row["Drug"].ToString());
                rxDef.Sig            = PIn.String(row["Sig"].ToString());
                rxDef.Disp           = PIn.String(row["Disp"].ToString());
                rxDef.Refills        = PIn.String(row["Refills"].ToString());
                rxDef.Notes          = PIn.String(row["Notes"].ToString());
                rxDef.IsControlled   = PIn.Bool(row["IsControlled"].ToString());
                rxDef.RxCui          = PIn.Long(row["RxCui"].ToString());
                rxDef.IsProcRequired = PIn.Bool(row["IsProcRequired"].ToString());
                retVal.Add(rxDef);
            }
            return(retVal);
        }
Пример #8
0
 ///<summary>Returns true if Update(RxDef,RxDef) 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(RxDef rxDef, RxDef oldRxDef)
 {
     if (rxDef.Drug != oldRxDef.Drug)
     {
         return(true);
     }
     if (rxDef.Sig != oldRxDef.Sig)
     {
         return(true);
     }
     if (rxDef.Disp != oldRxDef.Disp)
     {
         return(true);
     }
     if (rxDef.Refills != oldRxDef.Refills)
     {
         return(true);
     }
     if (rxDef.Notes != oldRxDef.Notes)
     {
         return(true);
     }
     if (rxDef.IsControlled != oldRxDef.IsControlled)
     {
         return(true);
     }
     if (rxDef.RxCui != oldRxDef.RxCui)
     {
         return(true);
     }
     if (rxDef.IsProcRequired != oldRxDef.IsProcRequired)
     {
         return(true);
     }
     if (rxDef.PatientInstruction != oldRxDef.PatientInstruction)
     {
         return(true);
     }
     return(false);
 }
Пример #9
0
        ///<summary>Updates one RxDef in the database.</summary>
        public static void Update(RxDef rxDef)
        {
            string command = "UPDATE rxdef SET "
                             + "Drug              = '" + POut.String(rxDef.Drug) + "', "
                             + "Sig               = '" + POut.String(rxDef.Sig) + "', "
                             + "Disp              = '" + POut.String(rxDef.Disp) + "', "
                             + "Refills           = '" + POut.String(rxDef.Refills) + "', "
                             + "Notes             = '" + POut.String(rxDef.Notes) + "', "
                             + "IsControlled      =  " + POut.Bool(rxDef.IsControlled) + ", "
                             + "RxCui             =  " + POut.Long(rxDef.RxCui) + ", "
                             + "IsProcRequired    =  " + POut.Bool(rxDef.IsProcRequired) + ", "
                             + "PatientInstruction=  " + DbHelper.ParamChar + "paramPatientInstruction "
                             + "WHERE RxDefNum = " + POut.Long(rxDef.RxDefNum);

            if (rxDef.PatientInstruction == null)
            {
                rxDef.PatientInstruction = "";
            }
            OdSqlParameter paramPatientInstruction = new OdSqlParameter("paramPatientInstruction", OdDbType.Text, POut.StringParam(rxDef.PatientInstruction));

            Db.NonQ(command, paramPatientInstruction);
        }
Пример #10
0
        ///<summary>Inserts one RxDef into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(RxDef rxDef, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO rxdef (";

            if (!useExistingPK && isRandomKeys)
            {
                rxDef.RxDefNum = ReplicationServers.GetKeyNoCache("rxdef", "RxDefNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "RxDefNum,";
            }
            command += "Drug,Sig,Disp,Refills,Notes,IsControlled,RxCui,IsProcRequired) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(rxDef.RxDefNum) + ",";
            }
            command +=
                "'" + POut.String(rxDef.Drug) + "',"
                + "'" + POut.String(rxDef.Sig) + "',"
                + "'" + POut.String(rxDef.Disp) + "',"
                + "'" + POut.String(rxDef.Refills) + "',"
                + "'" + POut.String(rxDef.Notes) + "',"
                + POut.Bool(rxDef.IsControlled) + ","
                + POut.Long(rxDef.RxCui) + ","
                + POut.Bool(rxDef.IsProcRequired) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                rxDef.RxDefNum = Db.NonQ(command, true, "RxDefNum", "rxDef");
            }
            return(rxDef.RxDefNum);
        }
Пример #11
0
 ///<summary>Must have already saved it to db so that we have a RxDefNum to work with.</summary>
 public FormRxDefEdit(RxDef rxDefCur)
 {
     InitializeComponent();            // Required for Windows Form Designer support
     Lan.F(this);
     RxDefCur = rxDefCur.Copy();
 }
Пример #12
0
        ///<summary>Updates one RxDef 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(RxDef rxDef, RxDef oldRxDef)
        {
            string command = "";

            if (rxDef.Drug != oldRxDef.Drug)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Drug = '" + POut.String(rxDef.Drug) + "'";
            }
            if (rxDef.Sig != oldRxDef.Sig)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Sig = '" + POut.String(rxDef.Sig) + "'";
            }
            if (rxDef.Disp != oldRxDef.Disp)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Disp = '" + POut.String(rxDef.Disp) + "'";
            }
            if (rxDef.Refills != oldRxDef.Refills)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Refills = '" + POut.String(rxDef.Refills) + "'";
            }
            if (rxDef.Notes != oldRxDef.Notes)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Notes = '" + POut.String(rxDef.Notes) + "'";
            }
            if (rxDef.IsControlled != oldRxDef.IsControlled)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsControlled = " + POut.Bool(rxDef.IsControlled) + "";
            }
            if (rxDef.RxCui != oldRxDef.RxCui)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RxCui = " + POut.Long(rxDef.RxCui) + "";
            }
            if (rxDef.IsProcRequired != oldRxDef.IsProcRequired)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsProcRequired = " + POut.Bool(rxDef.IsProcRequired) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE rxdef SET " + command
                      + " WHERE RxDefNum = " + POut.Long(rxDef.RxDefNum);
            Db.NonQ(command);
            return(true);
        }
Пример #13
0
        ///<summary>Updates one RxDef 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(RxDef rxDef, RxDef oldRxDef)
        {
            string command = "";

            if (rxDef.Drug != oldRxDef.Drug)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Drug = '" + POut.String(rxDef.Drug) + "'";
            }
            if (rxDef.Sig != oldRxDef.Sig)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Sig = '" + POut.String(rxDef.Sig) + "'";
            }
            if (rxDef.Disp != oldRxDef.Disp)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Disp = '" + POut.String(rxDef.Disp) + "'";
            }
            if (rxDef.Refills != oldRxDef.Refills)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Refills = '" + POut.String(rxDef.Refills) + "'";
            }
            if (rxDef.Notes != oldRxDef.Notes)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Notes = '" + POut.String(rxDef.Notes) + "'";
            }
            if (rxDef.IsControlled != oldRxDef.IsControlled)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsControlled = " + POut.Bool(rxDef.IsControlled) + "";
            }
            if (rxDef.RxCui != oldRxDef.RxCui)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RxCui = " + POut.Long(rxDef.RxCui) + "";
            }
            if (rxDef.IsProcRequired != oldRxDef.IsProcRequired)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsProcRequired = " + POut.Bool(rxDef.IsProcRequired) + "";
            }
            if (rxDef.PatientInstruction != oldRxDef.PatientInstruction)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatientInstruction = " + DbHelper.ParamChar + "paramPatientInstruction";
            }
            if (command == "")
            {
                return(false);
            }
            if (rxDef.PatientInstruction == null)
            {
                rxDef.PatientInstruction = "";
            }
            OdSqlParameter paramPatientInstruction = new OdSqlParameter("paramPatientInstruction", OdDbType.Text, POut.StringParam(rxDef.PatientInstruction));

            command = "UPDATE rxdef SET " + command
                      + " WHERE RxDefNum = " + POut.Long(rxDef.RxDefNum);
            Db.NonQ(command, paramPatientInstruction);
            return(true);
        }
Пример #14
0
 ///<summary>Inserts one RxDef into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(RxDef rxDef)
 {
     return(InsertNoCache(rxDef, false));
 }
Пример #15
0
        private void RxSelected()
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                //this should never happen
                return;
            }
            RxDef RxDefCur = RxDefList[gridMain.GetSelectedIndex()];

            if (PrefC.GetBool(PrefName.ShowFeatureEhr) && RxDefCur.RxCui == 0)
            {
                string strMsgText = Lan.g(this, "The selected prescription is missing an RxNorm") + ".\r\n"
                                    + Lan.g(this, "Prescriptions without RxNorms cannot be exported in EHR documents") + ".\r\n"
                                    + Lan.g(this, "Edit RxNorm in Rx Template?");
                if (MsgBox.Show(this, true, strMsgText))
                {
                    FormRxDefEdit form = new FormRxDefEdit(RxDefCur);
                    form.ShowDialog();
                    RxDefCur = RxDefs.GetOne(RxDefCur.RxDefNum);                  //FormRxDefEdit does not modify the RxDefCur object, so we must get the updated RxCui from the db.
                }
            }
            //Alert
            if (!RxAlertL.DisplayAlerts(PatCur.PatNum, 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;
            }
            bool isProvOrder = false;

            if (Security.CurUser.ProvNum != 0)           //The user who is currently logged in is a provider.
            {
                isProvOrder = true;
            }
            _medOrderNum = MedicationPats.InsertOrUpdateMedOrderForRx(RxPatCur, RxDefCur.RxCui, isProvOrder);        //RxDefCur.RxCui can be 0.
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = DateTime.Now;
            newMeasureEvent.EventType  = EhrMeasureEventType.CPOE_MedOrdered;
            newMeasureEvent.PatNum     = PatCur.PatNum;
            newMeasureEvent.MoreInfo   = "";
            newMeasureEvent.FKey       = _medOrderNum;
            EhrMeasureEvents.Insert(newMeasureEvent);
            DialogResult = DialogResult.OK;
        }
Пример #16
0
 ///<summary>Inserts one RxDef into the database.  Returns the new priKey.</summary>
 public static long Insert(RxDef rxDef)
 {
     return(Insert(rxDef, false));
 }
Пример #17
0
        private void RxSelected()
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                //this should never happen
                return;
            }
            RxDef RxDefCur = (RxDef)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag;

            if (PrefC.GetBool(PrefName.ShowFeatureEhr) && RxDefCur.RxCui == 0)
            {
                string strMsgText = Lan.g(this, "The selected prescription is missing an RxNorm") + ".\r\n"
                                    + Lan.g(this, "Prescriptions without RxNorms cannot be exported in EHR documents") + ".\r\n";
                if (!Security.IsAuthorized(Permissions.RxEdit, true))
                {
                    //Show the message but don't allow to edit. Continue creating rx
                    MessageBox.Show(strMsgText);
                }
                else if (MessageBox.Show(strMsgText + Lan.g(this, "Edit RxNorm in Rx Template?"), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    FormRxDefEdit form = new FormRxDefEdit(RxDefCur);
                    form.ShowDialog();
                    RxDefCur = RxDefs.GetOne(RxDefCur.RxDefNum);                  //FormRxDefEdit does not modify the RxDefCur object, so we must get the updated RxCui from the db.
                }
            }
            if (RxDefCur == null)           //Can occur if the RxDef is deleted. Refresh list and fill grid
            {
                _arrayRxDefs = RxDefs.Refresh();
                FillGrid();
                return;
            }
            //Alert
            if (!RxAlertL.DisplayAlerts(PatCur.PatNum, RxDefCur.RxDefNum))
            {
                return;
            }
            //User OK with alert
            RxPat RxPatCur = new RxPat();

            RxPatCur.RxDate       = DateTime.Today;
            RxPatCur.PatNum       = PatCur.PatNum;
            RxPatCur.ClinicNum    = PatCur.ClinicNum;
            RxPatCur.Drug         = RxDefCur.Drug;
            RxPatCur.IsControlled = RxDefCur.IsControlled;
            if (PrefC.GetBool(PrefName.RxHasProc) && (Clinics.ClinicNum == 0 || Clinics.GetClinic(Clinics.ClinicNum).HasProcOnRx))
            {
                RxPatCur.IsProcRequired = RxDefCur.IsProcRequired;
            }
            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;
            }
            RxPatCur.PatientInstruction = RxDefCur.PatientInstruction;
            //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;
            }
            bool isProvOrder = false;

            if (Security.CurUser.ProvNum != 0)           //The user who is currently logged in is a provider.
            {
                isProvOrder = true;
            }
            _medOrderNum = MedicationPats.InsertOrUpdateMedOrderForRx(RxPatCur, RxDefCur.RxCui, isProvOrder);        //RxDefCur.RxCui can be 0.
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = DateTime.Now;
            newMeasureEvent.EventType  = EhrMeasureEventType.CPOE_MedOrdered;
            newMeasureEvent.PatNum     = PatCur.PatNum;
            newMeasureEvent.MoreInfo   = "";
            newMeasureEvent.FKey       = _medOrderNum;
            EhrMeasureEvents.Insert(newMeasureEvent);
            DialogResult = DialogResult.OK;
        }
Пример #18
0
 ///<summary>Updates one RxDef in the database.</summary>
 internal static void Update(RxDef rxDef)
 {
     string command="UPDATE rxdef SET "
         +"Drug        = '"+POut.String(rxDef.Drug)+"', "
         +"Sig         = '"+POut.String(rxDef.Sig)+"', "
         +"Disp        = '"+POut.String(rxDef.Disp)+"', "
         +"Refills     = '"+POut.String(rxDef.Refills)+"', "
         +"Notes       = '"+POut.String(rxDef.Notes)+"', "
         +"IsControlled=  "+POut.Bool  (rxDef.IsControlled)+", "
         +"RxCui       =  "+POut.Long  (rxDef.RxCui)+" "
         +"WHERE RxDefNum = "+POut.Long(rxDef.RxDefNum);
     Db.NonQ(command);
 }
Пример #19
0
 ///<summary>Updates one RxDef 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.</summary>
 internal static void Update(RxDef rxDef,RxDef oldRxDef)
 {
     string command="";
     if(rxDef.Drug != oldRxDef.Drug) {
         if(command!=""){ command+=",";}
         command+="Drug = '"+POut.String(rxDef.Drug)+"'";
     }
     if(rxDef.Sig != oldRxDef.Sig) {
         if(command!=""){ command+=",";}
         command+="Sig = '"+POut.String(rxDef.Sig)+"'";
     }
     if(rxDef.Disp != oldRxDef.Disp) {
         if(command!=""){ command+=",";}
         command+="Disp = '"+POut.String(rxDef.Disp)+"'";
     }
     if(rxDef.Refills != oldRxDef.Refills) {
         if(command!=""){ command+=",";}
         command+="Refills = '"+POut.String(rxDef.Refills)+"'";
     }
     if(rxDef.Notes != oldRxDef.Notes) {
         if(command!=""){ command+=",";}
         command+="Notes = '"+POut.String(rxDef.Notes)+"'";
     }
     if(rxDef.IsControlled != oldRxDef.IsControlled) {
         if(command!=""){ command+=",";}
         command+="IsControlled = "+POut.Bool(rxDef.IsControlled)+"";
     }
     if(rxDef.RxCui != oldRxDef.RxCui) {
         if(command!=""){ command+=",";}
         command+="RxCui = "+POut.Long(rxDef.RxCui)+"";
     }
     if(command==""){
         return;
     }
     command="UPDATE rxdef SET "+command
         +" WHERE RxDefNum = "+POut.Long(rxDef.RxDefNum);
     Db.NonQ(command);
 }