Exemple #1
0
        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;
        }