Esempio n. 1
0
        private void btnPS_Click(object sender, EventArgs e)
        {
            this.knockTotal = 0;
            if ((ValuateOpcode != Globals.DoctorName) && (ValuateOpcode != null))
            {
                MessageBox.Show("不能给别人评过分的病历评分!", ErrorMessage.Warning);
                return;
            }
            if (MessageBox.Show("确认保存评分结果!", ErrorMessage.Warning,
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
                == DialogResult.Cancel)
            {
                return;
            }

            XmlDocument doc  = new XmlDocument();
            XmlElement  note = doc.CreateElement(ElementNames.EmrNote);

            // note.SetAttribute(AttributeNames.RegistryID, registryID);
            note.SetAttribute(AttributeNames.ArchiveNum, lblBH.Text);
            note.SetAttribute(AttributeNames.PSCYRQ, lblCyDate.Text);
            note.SetAttribute(AttributeNames.PSRQ, DateTime.Now.ToString());
            // note.SetAttribute(AttributeNames.DepartmentCode, departID);
            note.SetAttribute(AttributeNames.PSZJYS, Globals.DoctorName);
            note.SetAttribute(AttributeNames.BAPSBZ, "1");
            note.SetAttribute(AttributeNames.RegistryID, registryID);
            //note.SetAttribute(AttributeNames.SHBZ, shbz);
            //note.SetAttribute(AttributeNames.SHRQ, "");
            //note.SetAttribute(AttributeNames.SHRY, "");

            //if (noteID != "00") note.SetAttribute(AttributeNames.Series, series);

            foreach (DataGridViewRow row in dgvValuate.Rows)
            {
                if (row.Cells[4].Value == null || row.Cells[4].Value.ToString() == "" || row.Cells[4].Value.ToString() == "------------")
                {
                    continue;
                }

                this.knockTotal += Convert.ToDecimal(row.Cells[4].Value);
                XmlElement flaw = doc.CreateElement(ElementNames.Flaw);
                flaw.SetAttribute(AttributeNames.KFXM, row.Cells[0].Value.ToString());
                string   strqxmc = row.Cells[3].Value.ToString();
                string[] mcs     = strqxmc.Split('-');
                flaw.SetAttribute(AttributeNames.KFYY, mcs[0].ToString());
                flaw.SetAttribute(AttributeNames.KF, mcs[1].ToString());
                flaw.SetAttribute(AttributeNames.GLMC, row.Cells[5].Value.ToString());

                note.AppendChild(flaw);
            }
            MakeScore(this.knockTotal);
            note.SetAttribute(AttributeNames.PJ, lblPJ.Text);
            note.SetAttribute(AttributeNames.SDF, lblZDF.Text);
            note.SetAttribute(AttributeNames.GKF, knockTotal.ToString());
            // note.SetAttribute(AttributeNames.KFXM, lblPJ.Text);
            bool msg    = false;
            int  counts = 0;

            using (gjtEmrPatients.emrPatients ep = new gjtEmrPatients.emrPatients())
            {
                try
                {
                    if (Update)
                    {
                        //counts = ep.DelValuateNow(registryID);
                        //if (counts != 0)
                        //{

                        //    msg = ep.ValuateNowPS(note);
                        //    if (msg)
                        //    {
                        //        btnPS.Enabled = false;
                        //        btnUpate.Enabled = true;
                        //        btnChecked.Enabled = true;
                        //        Update = false;
                        //    }
                        //    else
                        //    {
                        //        MessageBox.Show("插入更新修改失败!!");
                        //    }
                        //}
                        //else
                        //{
                        //    MessageBox.Show("删除更新修改失败!");
                        //}
                        msg = ep.DeleteAndInsertValue(note);
                        if (msg)
                        {
                            btnPS.Enabled      = false;
                            btnUpate.Enabled   = true;
                            btnChecked.Enabled = true;
                            Update             = false;
                        }
                        else
                        {
                            MessageBox.Show("修改评分失败!!");
                        }
                    }
                    else
                    {
                        msg = ep.ValuateNowPS(note);
                        if (msg)
                        {
                            btnPS.Enabled      = false;
                            btnUpate.Enabled   = true;
                            btnChecked.Enabled = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Globals.logAdapter.Record("EX741852969", ex.Message + ">>" + ex.ToString(), true);
                }
            }
        }