예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DataSet dsEMRType = EMR_PatientMdlDAL.GetEMRType();
         this.ddlEMRType.DataTextField  = "name";
         this.ddlEMRType.DataValueField = "guid";
         this.ddlEMRType.DataSource     = dsEMRType.Tables[0];
         this.ddlEMRType.DataBind();
     }
 }
예제 #2
0
        private void InitUI()
        {
            DataSet dsEMRType = EMR_PatientMdlDAL.GetEMRType();

            this.rptEMRType.DataSource = dsEMRType.Tables[0];
            this.rptEMRType.DataBind();
            this.ddlEMRType.DataTextField  = "name";
            this.ddlEMRType.DataValueField = "guid";
            this.ddlEMRType.DataSource     = dsEMRType.Tables[0];
            this.ddlEMRType.DataBind();


            if (Page.Request.QueryString["patient_guid"] != null)
            {
                #region Come from the Worklist
                this.hidPatientGUID.Value = Page.Request.QueryString["patient_guid"];
                RefreshEMRListByPatientUidAndEMRType();
                EMR_PatientMdl mdl = EMR_PatientMdlDAL.GetModel(this.hidPatientGUID.Value);
                this.txtName.Text = mdl.name;
                if (mdl.gender == 0)
                {
                    this.txtGender.Text = "未知";
                }
                if (mdl.gender == 1)
                {
                    this.txtGender.Text = "女";
                }
                if (mdl.gender == 2)
                {
                    this.txtGender.Text = "男";
                }
                DateTime dtDOB = Convert.ToDateTime(mdl.birthday);
                this.txtAge.Text = dtDOB.ToString("yyyy-MM-dd");
                #endregion
            }
            else
            {
                #region Come from the Application Request Page
                if (Page.Request.QueryString["patname"] != null && Page.Request.QueryString["patname"].Trim().Length > 0)
                {
                    this.txtName.Text = Page.Request.QueryString["patname"];
                }
                else
                {
                    return;
                }
                if (Page.Request.QueryString["gender"] != null)
                {
                    this.txtGender.Text = Page.Request.QueryString["gender"];
                }
                else
                {
                    return;
                }
                if (Page.Request.QueryString["dob"] != null)
                {
                    this.txtAge.Text = Page.Request.QueryString["dob"];
                }
                else
                {
                    return;
                }

                string userGUID    = "";
                string patientName = "";
                if (Page.Request.QueryString["userid"] != null)
                {
                    userGUID = Page.Request.QueryString["userid"];
                }
                else
                {
                    return;
                }
                if (Page.Request.QueryString["patname"] != null)
                {
                    patientName = Page.Request.QueryString["patname"];
                }
                else
                {
                    return;
                }


                // First, check if the patient is exist or not
                #region Check Patient and Create New Patient
                if (EMR_PatientMdlDAL.IsExist(patientName, userGUID))
                {
                    this.hidPatientGUID.Value = EMR_PatientMdlDAL.GetPatientGUID(patientName, userGUID);
                }
                else
                {
                    // This patient is not exist, create new one
                    EMR_PatientMdl newPatient = new EMR_PatientMdl();
                    newPatient.patient_guid = Guid.NewGuid().ToString();
                    newPatient.user_guid    = userGUID;
                    newPatient.name         = patientName;
                    int nGender = 0;
                    int.TryParse(Page.Request.QueryString["genderType"], out nGender);
                    newPatient.gender = nGender;
                    DateTime dtDOB = DateTime.Now;
                    DateTime.TryParse(Page.Request.QueryString["dob"], out dtDOB);
                    newPatient.birthday = dtDOB;
                    EMR_PatientMdlDAL.Add(newPatient);
                    this.hidPatientGUID.Value = newPatient.patient_guid;
                }
                #endregion


                // Bind EMR Detail List
                RefreshEMRListByPatientUidAndEMRType();


                #endregion
            }
        }