private void LogonQuality() { XmlDocument doc = new XmlDocument(); string patientListFileName = udt.MakePatientListFileName(doctorID); if (File.Exists(patientListFileName)) { File.Delete(patientListFileName); } ThisAddIn.xmlPatientWriterQL(doctorID, 2, patientListFileName); if (!File.Exists(patientListFileName)) { return; } doc.Load(patientListFileName); XmlNode qualityInfo = doc.CreateElement(ElementNames.QualityInfo); if (!ThisAddIn.GetQualityInfo(doc.DocumentElement, ref qualityInfo, null, null)) { return; } XmlNodeList patients = qualityInfo.SelectNodes(ElementNames.Patient); int height = 0; //string commT = ""; foreach (XmlNode patient in patients) { string registryID = patient.Attributes[AttributeNames.RegistryID].Value; string patientName = patient.Attributes[AttributeNames.PatientName].Value; int index = dgvQuality.Rows.Add(registryID + " " + patientName, "", "", "", "", ""); dgvQuality.Rows[index].DefaultCellStyle.BackColor = Color.BurlyWood; height += dgvQuality.Rows[index].Height; XmlNodeList notes = patient.SelectNodes(ElementNames.EmrNote); foreach (XmlNode note in notes) { int restTime = Convert.ToInt16(note.Attributes[AttributeNames.RestTime].Value); Color foreColor = WhichColor(note.Attributes[AttributeNames.Score].Value, restTime); ///////////////////////////////////////////20090807 int ResetTime = 0; if (note.Attributes[AttributeNames.StartTime].Value != "") { string strStart = note.Attributes[AttributeNames.StartTime].Value; string strEnd = ""; //if (note.Attributes[AttributeNames.CommitTime] != null && note.Attributes[AttributeNames.CommitTime].Value != "") //{ // commT = note.Attributes[AttributeNames.CommitTime].Value; // if (commT != "####") // { // strEnd = note.Attributes[AttributeNames.CommitTime].Value; // } // else // { // strEnd = DateTime.Now.ToString(); // } //} //else //{ strEnd = DateTime.Now.ToString(); //} DateTime dtStart = Convert.ToDateTime(strStart); DateTime dtEnd = Convert.ToDateTime(strEnd); TimeSpan spResult = dtEnd - dtStart; int hCount = spResult.Days * 24 + spResult.Hours; if (note.Attributes[AttributeNames.TimeLimit].Value != "") { if (note.Attributes[AttributeNames.TimeLimit].Value != "0") { int x = hCount - Convert.ToInt32(note.Attributes[AttributeNames.TimeLimit].Value); if (x > 0) { note.Attributes[AttributeNames.RestTime].Value = Convert.ToString(Convert.ToDouble(x)); } } } } ///////////////////////////////////////////20090807 int index1 = dgvQuality.Rows.Add("", note.Attributes[AttributeNames.NoteName].Value, note.Attributes[AttributeNames.StartTime].Value, note.Attributes[AttributeNames.WrittenTime].Value, // commT, note.Attributes[AttributeNames.TimeLimit].Value + EmrManagement.TimeLimitUnit, note.Attributes[AttributeNames.RestTime].Value + EmrManagement.TimeLimitUnit, note.Attributes[AttributeNames.Score].Value); dgvQuality.Rows[index1].DefaultCellStyle.ForeColor = foreColor; height += dgvQuality.Rows[index1].Height; } } if (dgvQuality.Rows.Count == 0) { return; } dgvQuality.Height = height + dgvQuality.ColumnHeadersHeight + dgvQuality.Rows[0].Height; dgvQuality.Height = Math.Min(dgvQuality.Height, height0); dgvQuality.Rows[0].Cells[0].Selected = false; this.Height = dgvQuality.Height + 12; this.Top = (768 - this.Height) / 2; }
private void btnSelect_Click(object sender, EventArgs e) { startDate = dtpStart.Value.ToString(EmrConstant.StringGeneral.DateFormat); //criteria += " 00:00:00" + EmrConstant.Delimiters.Seperator; endDate = dpendTime.Value.ToString(EmrConstant.StringGeneral.DateFormat); // criteria += " 23:59:59" + EmrConstant.Delimiters.Seperator; if (dgvQuality.Rows.Count != 0) { dgvQuality.Rows.Clear(); } Cursor.Current = Cursors.WaitCursor; //} string departCode = cboDepart.SelectedValue.ToString(); //医师条件 科室全部 if (!string.IsNullOrEmpty(departCode)) { if (cboDoctor.Text.Equals("-----") && !string.IsNullOrEmpty(cboDoctor.Text.ToString())) { string doctorFiles = Path.Combine(Globals.linkListFolder, ResourceName.DoctorsXml); if (!File.Exists(doctorFiles)) { return; } XmlNode patients = ThisAddIn.GetPatients(gjtEmrPatients.PatientGettingMode.PatientsInDepartment, departCode); XmlNode depart = udt.jj.DoctorsAndTheirPatients(doctorFiles, patients); XmlDocument doc = new XmlDocument(); XmlElement qi = doc.CreateElement(ElementNames.QualityControl); doc.AppendChild(qi); ThisAddIn.ResetBeginTime(); if (depart != null) { foreach (XmlNode doctor in depart.ChildNodes) { XmlNode qinfo = null; ThisAddIn.GetQualityInfo(doctor, ref qinfo, startDate, endDate); if (qinfo.ChildNodes.Count > 0) { XmlElement qcinfo = qi.OwnerDocument.CreateElement(ElementNames.QualityInfo); qcinfo.SetAttribute(AttributeNames.Name, doctor.Attributes[AttributeNames.Name].Value); qcinfo.InnerXml = qinfo.InnerXml; qi.AppendChild(qcinfo); } } } qualityInfo = qi; } else { ThisAddIn.ResetBeginTime(); XmlDocument doc = new XmlDocument(); doctorID = cboDoctor.SelectedValue.ToString(); string patientListFileName = udt.MakePatientListFileName(doctorID); if (File.Exists(patientListFileName)) { File.Delete(patientListFileName); } ThisAddIn.xmlPatientWriterQL(doctorID, 2, patientListFileName); if (!File.Exists(patientListFileName)) { return; } doc.Load(patientListFileName); XmlNode qualityInfos = doc.CreateElement(ElementNames.QualityInfo); if (!ThisAddIn.GetQualityInfo(doc.DocumentElement, ref qualityInfos, startDate, endDate)) { return; } XmlNodeList patientss = qualityInfos.SelectNodes(ElementNames.Patient); patients = patientss; doctorID = cboDoctor.SelectedValue.ToString(); //qualityInfo = qualityInfos; XmlDocument docc = new XmlDocument(); XmlElement qi = docc.CreateElement(ElementNames.QualityControl); docc.AppendChild(qi); if (qualityInfos.ChildNodes.Count > 0) { XmlElement qcinfo = qi.OwnerDocument.CreateElement(ElementNames.QualityInfo); //qcinfo.SetAttribute(AttributeNames.Name, ""); qcinfo.InnerXml = qualityInfos.InnerXml; qi.AppendChild(qcinfo); } qualityInfo = qi; } } displayPatients(); Cursor.Current = Cursors.Default; }