public List <string> PatientLogin(string prefix, string profix)
        {
            string        Mobile = prefix.Trim();
            int           Id     = int.Parse(profix.Trim());
            List <string> Doc    = new List <string>();

            try
            {
                PATIENT d = db.PATIENTS.Where(a => a.MobaileNumber == Mobile && a.Id == Id).FirstOrDefault();
                Doc.Add(d.Id.ToString());
                Doc.Add(d.FirstName);
            }
            catch { Doc.Add("error"); }
            return(Doc);
        }
        //Delete Pasien
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            object item    = dgPasien.SelectedItem;
            string temp_id = (dgPasien.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;

            int id = Convert.ToInt32(temp_id);

            PATIENT pasien = SearchByIdPasien(id);

            et.Entry(pasien).State = System.Data.Entity.EntityState.Deleted;
            et.SaveChanges();
            clearTextPasien();
            this.viewPasien(dgPasien);
            MessageBox.Show("Data Pasien Berhasil di hapus !", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Esempio n. 3
0
        private void LoadForm(int id)
        {
            ResetForm();

            listSurveyName.Enabled = false;

            SURVEYS survey = ServiceInterfaceManager.SURVEYS_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id);

            if (survey != null)
            {
                hideSurveyId.Value = survey.SURVEYS_ID.ToString();

                //TODO: Patient ID should not be null or 0 here, but may need to add logic
                //here at some point in case it is.
                if (survey.PATIENT_ID != null && survey.PATIENT_ID > 0)
                {
                    PATIENT p = ServiceInterfaceManager.PATIENT_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, survey.PATIENT_ID.Value);
                    if (p != null)
                    {
                        hidePatientId.Value = p.PATIENT_ID.ToString();

                        if (!string.IsNullOrEmpty(p.LAST_NAME) && !string.IsNullOrEmpty(p.FIRST_NAME))
                        {
                            txtPatientName.Text = p.LAST_NAME + ", " + p.FIRST_NAME;
                        }
                        else if (!string.IsNullOrEmpty(p.LAST_NAME))
                        {
                            txtPatientName.Text = p.LAST_NAME;
                        }
                        else if (!string.IsNullOrEmpty(p.FIRST_NAME))
                        {
                            txtPatientName.Text = p.FIRST_NAME;
                        }
                    }
                }

                foreach (ListItem li in listSurveyName.Items)
                {
                    if (li.Value == survey.STD_SURVEY_TYPE_ID.ToString())
                    {
                        li.Selected = true;
                        break;
                    }
                }

                txtSurveyDate.Text = survey.SURVEY_DATE.ToString("MM/dd/yyyy");
            }
        }
Esempio n. 4
0
        private void Button_Click_Ok(object sender, RoutedEventArgs e)
        {
            if (TextBoxFirstName.Text != "" && TextBoxLastName.Text != "" && TextBoxAddress.Text != "" && cldSample.SelectedDate != null)
            {
                string gender = "";
                if (FemaleCheckBox.IsChecked == true)
                {
                    gender = "F";
                }
                else if (MaleCheckBox.IsChecked == true)
                {
                    gender = "M";
                }
                else
                {
                    MessageBox.Show("Select your gender", "Exception", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }

                if (AddEditPatientLabel.Text == "Create Patient")
                {
                    patientToEdit = new PATIENT
                    {
                        NAME        = TextBoxFirstName.Text,
                        SURNAME     = TextBoxLastName.Text,
                        ADDRESS     = TextBoxAddress.Text,
                        GENDER      = gender,
                        DATEOFBIRTH = cldSample.SelectedDate.Value
                    };
                    main_.AddFinished(patientToEdit);
                    this.Close();
                }
                else if (AddEditPatientLabel.Text == "Edit Patient")
                {
                    patientToEdit.NAME        = TextBoxFirstName.Text;
                    patientToEdit.SURNAME     = TextBoxLastName.Text;
                    patientToEdit.ADDRESS     = TextBoxAddress.Text;
                    patientToEdit.GENDER      = gender;
                    patientToEdit.DATEOFBIRTH = cldSample.DisplayDate;
                    main_.EditFinished(patientToEdit);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Error. Choose all the properties for the patient");
            }
        }
Esempio n. 5
0
        public ActionResult Edit()
        {
            int userid = Global.CurrentUserID;

            if (userid < 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PATIENT p = db.PATIENT.Find(userid);

            if (p == null)
            {
                return(HttpNotFound());
            }
            return(View(p));
        }
Esempio n. 6
0
        public void updatePatient(PATIENT toEdit, PATIENT newpatient)
        {
            PATIENT query = (from patient in context.PATIENTs
                             where patient.IDP == toEdit.IDP
                             select patient).First();



            query.NAME        = newpatient.NAME;
            query.SURNAME     = newpatient.SURNAME;
            query.DATEOFBIRTH = newpatient.DATEOFBIRTH;
            query.ADDRESS     = newpatient.ADDRESS;
            query.GENDER      = newpatient.GENDER;

            context.SaveChanges();
        }
Esempio n. 7
0
        private void ResetForm()
        {
            hideSurveyId.Value = string.Empty;

            listSurveyName.ClearSelection();
            listSurveyName.Items.Clear();

            listSurveyName.Enabled = true;

            List <STD_SURVEY_TYPE> surveys = ServiceInterfaceManager.STD_SURVEY_TYPE_GET_ALL_BY_REGISTRY(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId);

            listSurveyName.Items.Add(new ListItem("", "0"));
            listSurveyName.AppendDataBoundItems = true;
            if (surveys != null)
            {
                listSurveyName.DataSource = surveys;
                listSurveyName.DataBind();
            }

            if (UserSession.CurrentPatientId > 0)
            {
                PATIENT p = ServiceInterfaceManager.PATIENT_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, UserSession.CurrentPatientId);
                if (p != null)
                {
                    hidePatientId.Value = p.PATIENT_ID.ToString();

                    if (!string.IsNullOrEmpty(p.LAST_NAME) && !string.IsNullOrEmpty(p.FIRST_NAME))
                    {
                        txtPatientName.Text = p.LAST_NAME + ", " + p.FIRST_NAME;
                    }
                    else if (!string.IsNullOrEmpty(p.LAST_NAME))
                    {
                        txtPatientName.Text = p.LAST_NAME;
                    }
                    else if (!string.IsNullOrEmpty(p.FIRST_NAME))
                    {
                        txtPatientName.Text = p.FIRST_NAME;
                    }
                }
            }
            else
            {
                txtPatientName.Text = string.Empty;
            }

            txtSurveyDate.Text = string.Empty;
        }
Esempio n. 8
0
        //[ValidateAntiForgeryToken]
        public ActionResult Edit(
            [Bind(Include = "PATIENT_ID,INSDATE,PATIENT_NM,AGE,GENDER,TEL,TEL2,EMAIL,ADDRESS,ALLERGIC_HISTORY,GENETIC_HISTORY,CAPITAL_OPERATION,EMERGENCY_NAME,EMERGENCY_TEL,COMMENT")]
            PATIENT info)
        {
            if (string.IsNullOrEmpty(info.PATIENT_NM))
            {
                ModelState.AddModelError("PATIENT_NM", "姓名不能为空");
                return(View(info));
            }
            if (info.AGE == null)
            {
                ModelState.AddModelError("AGE", "年龄不能为空");
                return(View(info));
            }
            if (string.IsNullOrEmpty(info.TEL) || string.IsNullOrEmpty(info.TEL2))
            {
                ModelState.AddModelError("TEL", "联系方式不能为空");
                return(View(info));
            }
            var p = new PATIENT()
            {
                PATIENT_ID        = info.PATIENT_ID,
                PATIENT_NM        = info.PATIENT_NM,
                AGE               = info.AGE,
                GENDER            = info.GENDER,
                TEL               = info.TEL,
                TEL2              = info.TEL2,
                EMAIL             = info.EMAIL,
                ADDRESS           = info.ADDRESS,
                ALLERGIC_HISTORY  = info.ALLERGIC_HISTORY,
                GENETIC_HISTORY   = info.GENETIC_HISTORY,
                CAPITAL_OPERATION = info.CAPITAL_OPERATION,
                EMERGENCY_NAME    = info.EMERGENCY_NAME,
                EMERGENCY_TEL     = info.EMERGENCY_TEL,
                COMMENT           = info.COMMENT,
                INSDATE           = DateTime.Now
            };

            if (ModelState.IsValid)
            {
                db.Entry(p).State = EntityState.Modified;
                db.Entry(p).Property(m => m.INSDATE).IsModified = false;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(p));
        }
        //get a patient by id
        public Patient getPatient(string id)
        {
            Patient p = new Patient();

            PATIENT selectPatient = LinqToSQL.selectPatientById(id);
            p.userName = selectPatient.user_name;
            p.weight = selectPatient.weight;

            //listpa.ForEach(c => {
            //    if (c.id == id)
            //    {
            //        p = c;
            //    }
            //});

            return p;
        }
Esempio n. 10
0
        public JObject getPatientInfo(string email, string id)
        {
            PATIENT  tmp      = (PATIENT)dao.getOnlyPatient(email)[0];
            PATIENT  patient  = tmp;
            DateTime birthday = patient.BIRTHDAY;
            string   newtime  = birthday.Year.ToString() + "年" + birthday.Month.ToString() + "月" + birthday.Day.ToString()
                                + "日";
            JObject result = new JObject();

            result.Add(new JProperty("id", id));
            result.Add(new JProperty("name", patient.NAME));
            result.Add(new JProperty("explanation", patient.EXPLANATION));
            result.Add(new JProperty("patid", patient.ID));
            result.Add(new JProperty("age", ((int)patient.AGE).ToString()));
            result.Add(new JProperty("email", patient.E_MAIL));
            result.Add(new JProperty("birthday", newtime));
            return(result);
        }
        public JsonResult PatientAjaxRegistration1(string Mobile, string FirstName, string LastName, string FatherName)
        {
            PATIENT pat = new PATIENT()
            {
                FirstName     = FirstName,
                LastName      = LastName,
                FatherName    = FatherName,
                MobaileNumber = Mobile
            };

            try
            {
                db.PATIENTS.Add(pat);
                db.SaveChanges();
                int PatId = db.PATIENTS.Max(a => a.Id);

                return(Json(PatId, JsonRequestBehavior.AllowGet));
            }
            catch { return(Json("فشل التسجيل !!", JsonRequestBehavior.AllowGet)); }
        }
        private void LoadPatient(int id)
        {
            PATIENT patient = ServiceInterfaceManager.PATIENT_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id);

            if (patient != null)
            {
                hidePatientId.Value = patient.PATIENT_ID.ToString();
                if (!string.IsNullOrEmpty(patient.LAST_NAME) && !string.IsNullOrEmpty(patient.FIRST_NAME))
                {
                    txtPatient.Text = patient.LAST_NAME + ", " + patient.FIRST_NAME;
                }
                else if (!string.IsNullOrEmpty(patient.LAST_NAME))
                {
                    txtPatient.Text = patient.LAST_NAME;
                }
                else if (!string.IsNullOrEmpty(patient.FIRST_NAME))
                {
                    txtPatient.Text = patient.FIRST_NAME;
                }
            }
        }
Esempio n. 13
0
        //Update Pasien
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            object item    = dgPasien.SelectedItem;
            string temp_id = (dgPasien.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;

            int id = Convert.ToInt32(temp_id);

            PATIENT pasien = SearchByIdPasien(id);

            pasien.NAME    = txtNamaP.Text;
            pasien.ADDRESS = txtAlamatP.Text;
            pasien.BIRTH   = Convert.ToDateTime(dtTanggalLahirP.Text);
            pasien.AGE     = Convert.ToInt32(txtUmurP.Text);
            pasien.GENDER  = getJenisKelaminPasien();

            et.Entry(pasien).State = System.Data.Entity.EntityState.Modified;
            et.SaveChanges();
            clearTextPasien();
            this.viewPasien(dgPasien);
            MessageBox.Show("Update Data Pasien Berhasil !", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
        }
        //create a patient
        public Boolean CreatPatient(Patient patient)
        {
            var result = true;
            if (login.Exists(t => t.userName == patient.userName))
            {
                result = false;
            }
            else
            {
                //listpa.Add(patient);

                PATIENT newPatient = new PATIENT();
                newPatient.id = patient.id;
                newPatient.user_name = patient.userName;
                newPatient.native_name = patient.nativeName;
                newPatient.password = patient.password";
                newPatient.gender = patient.gender;
                LinqToSQL.insert2patient(newPatient)
                login.Add(new LoginRequest { userName = patient.userName, password = patient.password });
            }
            return result;
        }
Esempio n. 15
0
        public static bool updatePatientById(string str_id, PATIENT newPatient)
        {
            bool   result        = true;
            string connectString = System.Configuration.ConfigurationManager.ConnectionStrings["LinqToSQLDBConnectionString"].ToString();

            ECMSDataContext db = new ECMSDataContext(connectString);

            try
            {
                //Get Patient for update
                PATIENT oldPatient = db.PATIENT.FirstOrDefault(e => e.id.Equals(str_id));

                oldPatient = newPatient;

                //Save changes to Database.
                db.SubmitChanges();
            }
            catch
            {
                result = false;
            }
            return(result);
        }
Esempio n. 16
0
        public static bool deletePatient(string str_id)
        {
            bool   result        = true;
            string connectString = System.Configuration.ConfigurationManager.ConnectionStrings["LinqToSQLDBConnectionString"].ToString();

            ECMSDataContext db = new ECMSDataContext(connectString);

            try {
                //Get PATIENT to Delete
                PATIENT deletePATIENT = db.PATIENT.FirstOrDefault(e => e.id.Equals(str_id));

                //Delete PATIENT
                db.PATIENT.DeleteOnSubmit(deletePATIENT);

                //Save changes to Database.
                db.SubmitChanges();
            }
            catch
            {
                result = false;
            }
            return(result);
        }
        public void LoadForm(int id)
        {
            ResetForm();

            PATIENT patient = ServiceInterfaceManager.PATIENT_GET_COMPLETE(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id);

            if (patient != null)
            {
                lblLastName.Text  = patient.LAST_NAME;
                lblFirstName.Text = patient.FIRST_NAME;

                if (patient.BIRTH_DATE != null)
                {
                    lblDateOfBirth.Text = patient.BIRTH_DATE.Value.ToString("MM/dd/yyyy");
                }

                if (patient.OEFOIF_IND != null)
                {
                    lblOefOif.Text = (patient.OEFOIF_IND.Value) ? "Yes" : "No";
                }

                if (patient.SPATIENT != null)
                {
                    lblIcn.Text      = patient.SPATIENT.PatientICN;
                    lblLastFour.Text = patient.SPATIENT.PatientLastFour;
                    if (patient.SPATIENT.LastServiceSeparationDate != null)
                    {
                        lblServiceSeparation.Text = patient.SPATIENT.LastServiceSeparationDate.Value.ToString("MM/dd/yyyy");
                    }
                }
            }
            else
            {
                linkViewDetails.Visible = false;
            }
        }
        public PATIENT ParseReaderCustom(DataRow row)
        {
            PATIENT objReturn = new PATIENT
            {
                BIRTH_DATE             = (DateTime?)GetNullableObject(row.Field <object>("PATIENT_BIRTH_DATE")),
                CELL_PHONE             = (string)GetNullableObject(row.Field <object>("PATIENT_CELL_PHONE")),
                CREATED                = (DateTime?)GetNullableObject(row.Field <object>("PATIENT_CREATED")),
                CREATEDBY              = (string)GetNullableObject(row.Field <object>("PATIENT_CREATEDBY")),
                DEATH_DATE             = (DateTime?)GetNullableObject(row.Field <object>("PATIENT_DEATH_DATE")),
                EMAIL_ADDRESS          = (string)GetNullableObject(row.Field <object>("PATIENT_EMAIL_ADDRESS")),
                FIRST_NAME             = (string)GetNullableObject(row.Field <object>("PATIENT_FIRST_NAME")),
                LAST_NAME              = (string)GetNullableObject(row.Field <object>("PATIENT_LAST_NAME")),
                MIDDLE_NAME            = (string)GetNullableObject(row.Field <object>("PATIENT_MIDDLE_NAME")),
                OEFOIF_IND             = (bool?)GetNullableObject(row.Field <object>("PATIENT_OEFOIF_IND")),
                PATIENT_ID             = (Int32)GetNullableObject(row.Field <object>("PATIENT_PATIENT_ID")),
                PATIENTSID             = (Int32?)GetNullableObject(row.Field <object>("PATIENT_PATIENTSID")),
                PERFERRED_ADDRESS_TYPE = (string)GetNullableObject(row.Field <object>("PATIENT_PERFERRED_ADDRESS_TYPE")),
                UPDATED                = (DateTime?)GetNullableObject(row.Field <object>("PATIENT_UPDATED")),
                UPDATEDBY              = (string)GetNullableObject(row.Field <object>("PATIENT_UPDATEDBY")),
                PatientICN             = (string)GetNullableObject(row.Field <object>("PATIENT_PatientICN"))
            };

            return(objReturn);
        }
Esempio n. 19
0
        public void startListening()
        {
            //socket.Emit("java_database", new object[] { "record" });

            Console.WriteLine("login listening");
            socket.On("login_apply", (data) =>
            {
                try
                {
                    /*Console.WriteLine("received login");
                     * socket.Emit("login_reply", new Object[] { "success"});*/
                    JObject jobe    = (JObject)data;
                    string id       = (string)jobe.GetValue("id");
                    string email    = (string)jobe.GetValue("email");
                    string password = (string)jobe.GetValue("password");
                    string random   = (string)jobe.GetValue("random");
                    string type     = (string)jobe.GetValue("type");
                    PATIENT user    = hospitalService.Login(email, password, random);
                    JObject result  = new JObject();
                    if (user == null)
                    {
                        result.Add(new JProperty("id", id));
                        result.Add(new JProperty("userId", ""));
                        result.Add(new JProperty("result", "failed"));
                        socket.Emit("login_reply", result);
                    }
                    else
                    {
                        result.Add(new JProperty("id", id));
                        result.Add(new JProperty("userId", ((int)user.ID).ToString()));
                        result.Add(new JProperty("result", "success"));
                        result.Add(new JProperty("lastLogintime", user.LASTLOGIN_TIME.ToString()));
                        result.Add(new JProperty("createTime", user.CREATION_TIME.ToString()));
                        result.Add(new JProperty("type", type));
                        socket.Emit("login_reply", result);
                        hospitalService.updLastLogin(user);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("login_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_login_doctor_apply", (data) =>
            {
                try
                {
                    /*Console.WriteLine("received login");
                     * socket.Emit("login_reply", new Object[] { "success"});*/
                    JObject jobe    = (JObject)data;
                    string id       = (string)jobe.GetValue("id");
                    string email    = (string)jobe.GetValue("email");
                    string password = (string)jobe.GetValue("password");
                    string random   = (string)jobe.GetValue("random");
                    string type     = (string)jobe.GetValue("type");
                    DOCTOR user     = hospitalService.DoctorLogin(email, password, random);
                    JObject result  = new JObject();
                    if (user == null)
                    {
                        result.Add(new JProperty("id", id));
                        result.Add(new JProperty("result", "failed"));
                        socket.Emit("web_login_doctor_reply", result);
                    }
                    else
                    {
                        result.Add(new JProperty("id", id));
                        result.Add(new JProperty("userId", ((int)user.ID).ToString()));
                        result.Add(new JProperty("result", "success"));
                        result.Add(new JProperty("lastLogintime", user.LASTLOGIN_TIME.ToString()));
                        result.Add(new JProperty("createTime", user.CREATION_TIME.ToString()));
                        result.Add(new JProperty("type", type));
                        socket.Emit("web_login_doctor_reply", result);
                        hospitalService.updDoctorLastLogin(user);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_login_doctor_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On(" web_login_nurse_apply", (data) =>
            {
                try
                {
                    /*Console.WriteLine("received login");
                     * socket.Emit("login_reply", new Object[] { "success"});*/
                    JObject jobe    = (JObject)data;
                    string id       = (string)jobe.GetValue("id");
                    string email    = (string)jobe.GetValue("email");
                    string password = (string)jobe.GetValue("password");
                    string random   = (string)jobe.GetValue("random");
                    string type     = (string)jobe.GetValue("type");
                    NURSE user      = hospitalService.NurseLogin(email, password, random);
                    JObject result  = new JObject();
                    if (user == null)
                    {
                        result.Add(new JProperty("id", id));
                        result.Add(new JProperty("result", "failed"));
                        socket.Emit("web_login_nurse_reply", result);
                    }
                    else
                    {
                        result.Add(new JProperty("id", id));
                        result.Add(new JProperty("userId", ((int)user.ID).ToString()));
                        result.Add(new JProperty("result", "success"));
                        result.Add(new JProperty("lastLogintime", user.LASTLOGIN_TIME.ToString()));
                        result.Add(new JProperty("createTime", user.CREATION_TIME.ToString()));
                        result.Add(new JProperty("type", type));
                        socket.Emit("web_login_nurse_reply", result);
                        hospitalService.updNurserLastLogin(user);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_login_nurse_apply: \n");
                    Console.WriteLine(e);
                }
            });
            //data 已改变
            socket.On("signup_apply", (data) =>
            {
                try
                {
                    JObject jobe    = (JObject)data;
                    string id       = (string)jobe.GetValue("id");
                    string name     = (string)jobe.GetValue("name");
                    string password = (string)jobe.GetValue("password");
                    string email    = (string)jobe.GetValue("email");
                    string year     = (string)jobe.GetValue("year");
                    string month    = (string)jobe.GetValue("month");
                    string day      = (string)jobe.GetValue("day");
                    string identity = (string)jobe.GetValue("identity");
                    string gender   = (string)jobe.GetValue("gender");
                    var result      = hospitalService.Register(name, password, email, year, month, day, identity, gender);
                    // todo email may has been used
                    JObject jobj = new JObject();
                    jobj.Add(new JProperty("id", id));
                    jobj.Add(new JProperty("result", result ? "success" : "failed"));
                    socket.Emit("signup_reply", jobj);
                }
                catch (Exception e)
                {
                    Console.WriteLine("signup_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_get_department_apply", (data) =>
            {
                try
                {
                    JObject jobe = (JObject)data;
                    string id    = (string)jobe.GetValue("id");
                    socket.Emit("web_get_department_reply", hospitalService.getAllDepartments(id));
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_get_department_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_get_expert_apply", (data) =>
            {
                try
                {
                    JObject jobe         = (JObject)data;
                    string id            = (string)jobe.GetValue("id");
                    ArrayList professors = hospitalService.findProfessor();
                    JArray res           = new JArray();
                    for (int i = 0; i < professors.Count; i++)
                    {
                        JObject temp = new JObject();
                        temp.Add(new JProperty("name", ((DOCTOR)professors[i]).NAME));
                        temp.Add(new JProperty("position", ((DOCTOR)professors[i]).POSITION));
                        temp.Add(new JProperty("email", ((DOCTOR)professors[i]).E_MAIL));
                        temp.Add(new JProperty("department", ((DOCTOR)professors[i]).DEPT_NAME));
                        res.Add(temp);
                    }
                    JObject result = new JObject();
                    result.Add(new JProperty("id", id));
                    result.Add(new JProperty("result", res));
                    socket.Emit("web_get_expert_reply", result);
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_get_expert_apply: \n");
                    Console.WriteLine(e);
                }
            });

            /*socket.On("web_add_expert_appoint_apply", (data) =>
             * {
             *  try
             *  {
             *      JObject jobe = (JObject)data;
             *      string id = (string)jobe.GetValue("id");
             *      string email = (string)jobe.GetValue("email");
             *      string expertemail = (string)jobe.GetValue("expert");
             *      bool res = hospitalService.bookCertainProfessor(email, expertemail);
             *      JObject result = new JObject();
             *      result.Add(new JProperty("id", id));
             *
             *      if (res)
             *      {
             *          result.Add(new JProperty("res", "success"));
             *          socket.Emit("web_add_expert_appoint_reply", result);
             *      }
             *      else
             *      {
             *          result.Add(new JProperty("res", "fail"));
             *          socket.Emit("web_add_expert_appoint_reply", result);
             *      }
             *  }
             *  catch (Exception e)
             *  {
             *      Console.WriteLine("web_add_expert_appoint_apply: \n");
             *      Console.WriteLine(e);
             *  }
             *
             * });*/
            socket.On("web_add_booking_apply", (data) =>
            {
                try
                {
                    JObject jobe   = (JObject)data;
                    string id      = (string)jobe.GetValue("id");
                    string email   = (string)jobe.GetValue("email");
                    bool res       = hospitalService.commonbook(email);
                    JObject result = new JObject();
                    result.Add(new JProperty("id", id));
                    if (res)
                    {
                        result.Add(new JProperty("res", "success"));
                        socket.Emit("web_add_booking_reply", result);
                    }
                    else
                    {
                        result.Add(new JProperty("book_result", "fail"));
                        socket.Emit("web_add_booking_reply", result);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_add_booking_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("show_treatementRecord_apply", (data) =>
            {
                try
                {
                    JObject jobe   = (JObject)data;
                    string id      = (string)jobe.GetValue("id");
                    int patientID  = (int)jobe.GetValue("pID");
                    var records    = hospitalService.getMedicalRecordOfPatient(patientID);
                    JObject result = new JObject();
                    result.Add(new JProperty("id", id));
                    JArray res = new JArray();
                    for (int i = 0; i < records.Count; i++)
                    {
                        JObject temp = new JObject();
                        temp.Add(new JProperty("TIME", ((MEDICAL_RECORD)records[i]).TIME));
                        temp.Add(new JProperty("DISEASE", ((MEDICAL_RECORD)records[i]).DISEASE));
                        temp.Add(new JProperty("DESCRIPTION", ((MEDICAL_RECORD)records[i]).DESCRIPTION));
                        temp.Add(new JProperty("DIAGNOSIS", ((MEDICAL_RECORD)records[i]).DIAGNOSIS));
                        temp.Add(new JProperty("STATE", ((MEDICAL_RECORD)records[i]).TREAT_STATE));
                        res.Add(temp);
                    }
                    result.Add(new JProperty("medical_record", res));
                    socket.Emit("show_treatementRecord_reply", result);
                }
                catch (Exception e)
                {
                    Console.WriteLine("show_treatementRecord_apply: \n");
                    Console.WriteLine(e);
                }
            });

            socket.On("web_pick_medicine_apply", (data) =>
            {
                try
                {
                    JObject jobe    = (JObject)data;
                    string id       = (string)jobe.GetValue("id");
                    string email    = (string)jobe.GetValue("patient");
                    string medicine = (string)jobe.GetValue("medicine");
                    int number      = (int)jobe.GetValue("count");
                    JObject res     = new JObject();
                    res.Add(new JProperty("id", id));
                    //if (hospitalService.getMedicineByCount(medicine, number))
                    //{
                    socket.Emit("web_pick_medicine_reply", res);
                    socket.Emit("java_drug_alert_reply", jobe);
                    //}
                    //else
                    //{
                    //	Console.WriteLine("fail");
                    //}

                    //查找病人和相关信息返回给JAVA
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_pick_medicine_apply: \n");
                    Console.WriteLine(e);
                }
            });

            socket.On("web_get_medicine_list_apply", (data) =>
            {
                try
                {
                    JObject jobe = (JObject)data;
                    string id    = (string)jobe.GetValue("id");
                    string email = (string)jobe.GetValue("patient");
                    socket.Emit("web_get_medicine_list_reply", hospitalService.getDrugByPatient(email, id));
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_get_medicine_list_apply: \n");
                    Console.WriteLine(e);
                }
            });


            socket.On("web_get_exam_apply", (data) =>
            {
                try
                {
                    JObject jobe   = (JObject)data;
                    string id      = (string)jobe.GetValue("id");
                    string email   = (string)jobe.GetValue("patient");
                    JObject result = new JObject();
                    result.Add(new JProperty("id", id));
                    result.Add(new JProperty("result", hospitalService.getExam(email)));
                    socket.Emit("web_get_exam_reply", result);
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_get_exam_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_get_fee_apply", (data) =>
            {
                try
                {
                    JObject jobe = (JObject)data;
                    string id    = (string)jobe.GetValue("id");
                    string email = (string)jobe.GetValue("email");
                    socket.Emit("web_get_fee_reply", hospitalService.getFee(email, id));
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_get_fee_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_get_patient_apply", (data) =>
            {
                try
                {
                    JObject jobe = (JObject)data;
                    string email = (string)jobe.GetValue("email");
                    string id    = (string)jobe.GetValue("id");
                    socket.Emit("web_get_patient_reply", hospitalService.getPatientInfo(email, id));
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_get_patient_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_get_all_patient_apply", (data) =>
            {
                try
                {
                    JObject jobe = (JObject)data;
                    string id    = (string)jobe.GetValue("id");
                    socket.Emit("web_get_all_patient_reply", hospitalService.getAllPatient(id));
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_get_all_patient_apply: \n");
                    Console.WriteLine(e);
                }
            });

            /*socket.On("web_change_right_apply", (data) =>
             * {
             *  try
             *  {
             *      JObject jobe = (JObject)data;
             *      string id = (string)jobe.GetValue("id");
             *      string email = (string)jobe.GetValue("email");
             *      string position = (string)jobe.GetValue("position");
             *      string department = (string)jobe.GetValue("department");
             *      socket.Emit("web_change_right_reply", hospitalService.changePatientToDoc(email, position, department, id));
             *  }catch(Exception e)
             *  {
             *      Console.WriteLine("web_change_right_apply: \n");
             *      Console.WriteLine(e);
             *  }
             * });*/
            socket.On("web_get_all_special_apply", (data) =>
            {
                try
                {
                    JObject jobe = (JObject)data;
                    string id    = (string)jobe.GetValue("id");
                    socket.Emit("web_get_all_special_reply", hospitalService.getAllSpecial(id));
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_get_all_special_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_add_doctor_apply", (data) =>
            {
                try
                {
                    JObject jobe     = (JObject)data;
                    string id        = (string)jobe.GetValue("id");
                    string name      = (string)jobe.GetValue("name");
                    string password  = (string)jobe.GetValue("password");
                    string email     = (string)jobe.GetValue("email");
                    string dept_name = (string)jobe.GetValue("dept_name");
                    string position  = (string)jobe.GetValue("position");
                    string age       = (string)jobe.GetValue("age");
                    string gender    = (string)jobe.GetValue("gender");
                    var result       = hospitalService.DoctorRegister(name, password, email, dept_name, position, gender, age);
                    // todo email may has been used
                    JObject jobj = new JObject();
                    jobj.Add(new JProperty("id", id));
                    jobj.Add(new JProperty("result", result ? "SUCCESS" : "FAIL"));
                    socket.Emit("web_add_doctor_reply", jobj);
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_add_doctor_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_add_nurse_apply", (data) =>
            {
                try
                {
                    JObject jobe     = (JObject)data;
                    string id        = (string)jobe.GetValue("id");
                    string name      = (string)jobe.GetValue("name");
                    string password  = (string)jobe.GetValue("password");
                    string email     = (string)jobe.GetValue("email");
                    string dept_name = (string)jobe.GetValue("dept_name");
                    string age       = (string)jobe.GetValue("age");
                    string gender    = (string)jobe.GetValue("gender");
                    var result       = hospitalService.NurserRegister(name, password, email, dept_name, gender, age);
                    // todo email may has been used
                    JObject jobj = new JObject();
                    jobj.Add(new JProperty("id", id));
                    jobj.Add(new JProperty("result", result ? "SUCCESS" : "FAIL"));
                    socket.Emit("web_add_nurse_reply", jobj);
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_add_nurse_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_rem_doctor_apply", (data) =>
            {
                try
                {
                    JObject jobe = (JObject)data;
                    string id    = (string)jobe.GetValue("id");
                    string email = (string)jobe.GetValue("doctor");
                    JObject jobj = new JObject();
                    var result   = hospitalService.RemoveDoctor(email);
                    jobj.Add(new JProperty("id", id));
                    jobj.Add(new JProperty("result", result ? "SUCCESS" : "FAIL"));
                    socket.Emit("web_rem_doctor_reply", jobj);
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_rem_doctor_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_rem_nurse_apply", (data) =>
            {
                try
                {
                    JObject jobe = (JObject)data;
                    string id    = (string)jobe.GetValue("id");
                    string email = (string)jobe.GetValue("nurse");
                    JObject jobj = new JObject();
                    var result   = hospitalService.RemoveNurse(email);
                    jobj.Add(new JProperty("id", id));
                    jobj.Add(new JProperty("result", result ? "SUCCESS" : "FAIL"));
                    socket.Emit("web_rem_nurse_reply", jobj);
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_rem_nurse_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_rem_doctor_apply", (data) =>
            {
                try
                {
                    JObject jobe    = (JObject)data;
                    string id       = (string)jobe.GetValue("id");
                    string email    = (string)jobe.GetValue("doctor");
                    string password = (string)jobe.GetValue("password");
                    JObject jobj    = new JObject();
                    var result      = hospitalService.changeDoctorPW(email, password);
                    jobj.Add(new JProperty("id", id));
                    jobj.Add(new JProperty("result", result ? "SUCCESS" : "FAIL"));
                    socket.Emit("web_rem_doctor_reply", jobj);
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_rem_doctor_apply: \n");
                    Console.WriteLine(e);
                }
            });
            socket.On("web_rem_nurser_apply", (data) =>
            {
                try
                {
                    JObject jobe    = (JObject)data;
                    string id       = (string)jobe.GetValue("id");
                    string email    = (string)jobe.GetValue("nurse");
                    string password = (string)jobe.GetValue("password");
                    JObject jobj    = new JObject();
                    var result      = hospitalService.changeNursePW(email, password);
                    jobj.Add(new JProperty("id", id));
                    jobj.Add(new JProperty("result", result ? "SUCCESS" : "FAIL"));
                    socket.Emit("web_rem_nurser_reply", jobj);
                }
                catch (Exception e)
                {
                    Console.WriteLine("web_rem_nurser_apply: \n");
                    Console.WriteLine(e);
                }
            });
        }
        public static bool PRPA_IN201305UV02(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 CURRENT_PATIENT_ID)
        {
            bool  objReturn = false;
            MviDB objDB     = new MviDB();

            PATIENT p = PATIENTManager.GetItemComplete(CURRENT_USER, CURRENT_REGISTRY_ID, CURRENT_PATIENT_ID);

            if (p != null)
            {
                if (p.SPATIENT == null)
                {
                    p.SPATIENT = new SPATIENT()
                    {
                        PatientICN = p.PatientICN
                    };
                }
                PRPA_IN201306UV02 prpaItem = objDB.PRPA_IN201305UV02(CURRENT_USER, CURRENT_REGISTRY_ID, p);
                if (prpaItem != null)
                {
                    if (prpaItem.controlActProcess != null && prpaItem.controlActProcess.queryAck != null && prpaItem.controlActProcess.queryAck.queryResponseCode != null && !string.IsNullOrEmpty(prpaItem.controlActProcess.queryAck.queryResponseCode.code))
                    {
                        switch (prpaItem.controlActProcess.queryAck.queryResponseCode.code.Trim().ToUpper())
                        {
                        case "OK":
                            int resultCurrentQuantity = 0;
                            int.TryParse(prpaItem.controlActProcess.queryAck.resultCurrentQuantity.value, out resultCurrentQuantity);
                            if (resultCurrentQuantity == 1)     //TODO: may need to handle multiple results at some point???...display list to user or something
                            {
                                if (prpaItem.controlActProcess.subject != null &&
                                    prpaItem.controlActProcess.subject[0].registrationEvent != null &&
                                    prpaItem.controlActProcess.subject[0].registrationEvent.subject1 != null &&
                                    prpaItem.controlActProcess.subject[0].registrationEvent.subject1.patient != null)
                                {
                                    //TODO: ID's
                                    if (prpaItem.controlActProcess.subject[0].registrationEvent.subject1.patient.Item != null)
                                    {
                                        if (prpaItem.controlActProcess.subject[0].registrationEvent.subject1.patient.Item is PRPA_MT201310UV02Person)
                                        {
                                            PRPA_MT201310UV02Person person = (PRPA_MT201310UV02Person)prpaItem.controlActProcess.subject[0].registrationEvent.subject1.patient.Item;

                                            //NAMES (First and Last)
                                            if (person.name != null && person.name.Length > 0 && person.name[0].Items != null && person.name[0].Items.Length > 0)
                                            {
                                                int givenCount = 0;

                                                for (int i = 0; i < person.name[0].Items.Length; i++)
                                                {
                                                    if (person.name[0].ItemsElementName.Length > i)
                                                    {
                                                        switch (person.name[0].ItemsElementName[i])
                                                        {
                                                        case ItemsChoiceType8.given:
                                                            if (givenCount == 0)
                                                            {
                                                                p.FIRST_NAME = p.SPATIENT.PatientFirstName = person.name[0].Items[i];
                                                            }
                                                            else if (givenCount > 0)
                                                            {
                                                                p.MIDDLE_NAME = person.name[0].Items[i];
                                                            }

                                                            givenCount++;
                                                            break;

                                                        case ItemsChoiceType8.family:
                                                            p.LAST_NAME = p.SPATIENT.PatientLastName = person.name[0].Items[i];
                                                            break;

                                                        default:
                                                            break;
                                                        }
                                                    }
                                                }
                                            }

                                            //PHONES
                                            if (person.telecom != null && person.telecom.Length > 0)
                                            {
                                                foreach (TEL tel in person.telecom)
                                                {
                                                    if (!string.IsNullOrEmpty(tel.value) && tel.use != null && tel.use.Length > 0)
                                                    {
                                                        switch (tel.use[0])
                                                        {
                                                        case "HP":
                                                            p.SPATIENT.PhoneResidence = RemoveChars(tel.value);
                                                            break;

                                                        default:
                                                            break;
                                                        }
                                                    }
                                                }
                                            }

                                            //GENDER
                                            if (person.administrativeGenderCode != null && !string.IsNullOrEmpty(person.administrativeGenderCode.code))
                                            {
                                                p.SPATIENT.Gender = person.administrativeGenderCode.code.Trim().ToUpper().Substring(0, 1);
                                            }

                                            //DOB
                                            if (person.birthTime != null && !string.IsNullOrEmpty(person.birthTime.value))
                                            {
                                                int y = 0;
                                                int m = 0;
                                                int d = 0;

                                                if (person.birthTime.value.Length >= 4)
                                                {
                                                    int.TryParse(person.birthTime.value.Substring(0, 4), out y);
                                                }

                                                if (person.birthTime.value.Length >= 6)
                                                {
                                                    int.TryParse(person.birthTime.value.Substring(4, 2), out m);
                                                }

                                                if (person.birthTime.value.Length >= 8)
                                                {
                                                    int.TryParse(person.birthTime.value.Substring(6, 2), out d);
                                                }

                                                DateTime?dob = null;

                                                if (p.SPATIENT.DateOfBirth != null)
                                                {
                                                    dob = p.SPATIENT.DateOfBirth;
                                                }
                                                else if (p.BIRTH_DATE != null)
                                                {
                                                    dob = p.BIRTH_DATE;
                                                }

                                                if (y == 0 && dob != null)
                                                {
                                                    y = dob.Value.Year;
                                                }
                                                if (m == 0 && dob != null)
                                                {
                                                    m = dob.Value.Month;
                                                }
                                                if (d == 0 && dob != null)
                                                {
                                                    d = dob.Value.Day;
                                                }

                                                if (y > 0 && m > 0 && d > 0 && dob != null)
                                                {
                                                    p.BIRTH_DATE = p.SPATIENT.DateOfBirth = new DateTime(y, m, d, dob.Value.Hour, dob.Value.Minute, dob.Value.Second);
                                                }
                                                else if (y > 0 && m > 0 && d > 0)
                                                {
                                                    p.BIRTH_DATE = p.SPATIENT.DateOfBirth = new DateTime(y, m, d);
                                                }
                                            }

                                            //ADDRESSES
                                            if (person.addr != null && person.addr.Length > 0)
                                            {
                                                foreach (AD a in person.addr)
                                                {
                                                    if (a.use != null && a.use.Length > 0)
                                                    {
                                                        if (a.use[0] == "PHYS")     //TODO: CRSe DB only stores one address, should we check for other MVI address types here???
                                                        {
                                                            if (a.Items != null && a.Items.Length > 0)
                                                            {
                                                                for (int i = 0; i < a.Items.Length; i++)
                                                                {
                                                                    switch (a.ItemsElementName[i])
                                                                    {
                                                                    case ItemsChoiceType7.streetAddressLine:
                                                                        p.SPATIENT.StreetAddress1 = a.Items[i].ToString();
                                                                        break;

                                                                    case ItemsChoiceType7.city:
                                                                        p.SPATIENT.City = a.Items[i].ToString();
                                                                        break;

                                                                    case ItemsChoiceType7.state:
                                                                        p.SPATIENT.State = a.Items[i].ToString();
                                                                        break;

                                                                    case ItemsChoiceType7.postalCode:
                                                                        p.SPATIENT.PostalCode = a.Items[i].ToString();
                                                                        break;

                                                                    case ItemsChoiceType7.country:
                                                                        p.SPATIENT.Country = a.Items[i].ToString();
                                                                        break;

                                                                    default:
                                                                        break;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }

                                            //OTHER IDS (SSN)
                                            if (person.asOtherIDs != null && person.asOtherIDs.Length > 0)
                                            {
                                                foreach (PRPA_MT201310UV02OtherIDs id in person.asOtherIDs)
                                                {
                                                    if (id.id != null && id.id.Length > 0)
                                                    {
                                                        if (id.classCode == "SSN")
                                                        {
                                                            p.SPATIENT.PatientSSN = id.id[0].extension;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                p.PATIENT_ID = PATIENTManager.SaveComplete(CURRENT_USER, CURRENT_REGISTRY_ID, p);

                                objReturn = true;
                            }
                            break;

                        case "NF":
                            break;

                        default:
                            break;
                        }
                    }
                }
            }

            objDB.Dispose();

            return(objReturn);
        }
Esempio n. 21
0
 public void deletePatient(PATIENT patToDel)
 {
     context.PATIENTs.Remove(patToDel);
     context.SaveChanges();
 }
Esempio n. 22
0
 public bool updPatientLastLoginTime(PATIENT patient)
 {
     return(basedao.setPatient((int)patient.ID, patient.PASSWORD, patient.EXPLANATION, patient.NAME, patient.LASTLOGIN_TIME, patient.CREATION_TIME, patient.E_MAIL, patient.BIRTHDAY, patient.IDENTITY, patient.GENDER, (int)patient.COUNT));
 }
        private PRPA_MT201306UV02ParameterList GetDemographicParameters(PATIENT p)
        {
            PRPA_MT201306UV02ParameterList objReturn = null;

            if (p != null)
            {
                objReturn = new PRPA_MT201306UV02ParameterList();

                if (p.SPATIENT != null)
                {
                    if (!string.IsNullOrEmpty(p.SPATIENT.Gender))
                    {
                        objReturn.livingSubjectAdministrativeGender = new PRPA_MT201306UV02LivingSubjectAdministrativeGender[]
                        {
                            new PRPA_MT201306UV02LivingSubjectAdministrativeGender()
                            {
                                value = new CE[] { new CE()
                                                   {
                                                       code = p.SPATIENT.Gender.Trim().ToUpper().Substring(0, 1)
                                                   } },
                                semanticsText = "Gender"
                            }
                        };
                    }

                    DateTime?dob = null;
                    if (p.SPATIENT.DateOfBirth != null)
                    {
                        dob = p.SPATIENT.DateOfBirth;
                    }
                    else if (p.BIRTH_DATE != null)
                    {
                        dob = p.BIRTH_DATE;
                    }

                    if (dob != null)
                    {
                        objReturn.livingSubjectBirthTime = new PRPA_MT201306UV02LivingSubjectBirthTime[]
                        {
                            new PRPA_MT201306UV02LivingSubjectBirthTime()
                            {
                                value = new IVL_TS[] { new IVL_TS()
                                                       {
                                                           value = dob.Value.ToString("yyyyMMdd")
                                                       } },
                                semanticsText = "Date of Birth"
                            }
                        };
                    }

                    if (!string.IsNullOrEmpty(p.SPATIENT.PatientSSN))
                    {
                        //TODO: May need to add additional SSN validation at some point
                        objReturn.livingSubjectId = new PRPA_MT201306UV02LivingSubjectId[]
                        {
                            new PRPA_MT201306UV02LivingSubjectId()
                            {
                                value = new II[] { new II()
                                                   {
                                                       extension = p.SPATIENT.PatientSSN.Trim().ToUpper(), root = "2.16.840.1.113883.4.1"
                                                   } },
                                semanticsText = "SSN"
                            }
                        };
                    }

                    string firstName = string.Empty;
                    //string middleName = string.Empty;
                    string lastName = string.Empty;

                    if (!string.IsNullOrEmpty(p.SPATIENT.PatientFirstName))
                    {
                        firstName = p.SPATIENT.PatientFirstName;
                    }
                    else if (!string.IsNullOrEmpty(p.FIRST_NAME))
                    {
                        firstName = p.FIRST_NAME;
                    }

                    //if (!string.IsNullOrEmpty(p.MIDDLE_NAME))
                    //    middleName = p.MIDDLE_NAME;

                    if (!string.IsNullOrEmpty(p.SPATIENT.PatientLastName))
                    {
                        lastName = p.SPATIENT.PatientLastName;
                    }
                    else if (!string.IsNullOrEmpty(p.LAST_NAME))
                    {
                        lastName = p.LAST_NAME;
                    }

                    objReturn.livingSubjectName = new PRPA_MT201306UV02LivingSubjectName[]
                    {
                        new PRPA_MT201306UV02LivingSubjectName()
                        {
                            value = new EN[]
                            {
                                new EN()
                                {
                                    use = new string[] { "L" },
                                    ItemsElementName = new ItemsChoiceType8[] { ItemsChoiceType8.given, ItemsChoiceType8.family },
                                    Items            = new string[] { firstName, lastName }
                                }
                            },
                            semanticsText = "Legal Name"
                        }
                    };
                }
            }

            return(objReturn);
        }
Esempio n. 24
0
 public void insertPatient(PATIENT patient)
 {
     service.insertPatient(patient);
 }
Esempio n. 25
0
 public void updLastLogin(PATIENT patient)
 {
     patient.LASTLOGIN_TIME = DateTime.Now;
     dao.updPatientLastLoginTime(patient);
 }
Esempio n. 26
0
        public bool changePatientCount(int patID, int count)
        {
            PATIENT pat = (PATIENT)(getPatientById(patID)[0]);

            return(basedao.setPatient(patID, pat.PASSWORD, pat.EXPLANATION, pat.NAME, pat.LASTLOGIN_TIME, pat.CREATION_TIME, pat.E_MAIL, pat.BIRTHDAY, pat.IDENTITY, pat.GENDER, count));
        }
Esempio n. 27
0
        private void ResetForm()
        {
            hideWorkstreamId.Value = string.Empty;

            listWorkstreamName.ClearSelection();
            listWorkstreamName.Items.Clear();

            listWorkstreamName.Enabled = true;

            List <STD_WKFCASETYPE> cases = ServiceInterfaceManager.STD_WKFCASETYPE_GET_ALL_BY_REGISTRY(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId);

            listWorkstreamName.Items.Add(new ListItem("", "0"));
            listWorkstreamName.AppendDataBoundItems = true;
            if (cases != null)
            {
                listWorkstreamName.DataSource = cases;
                listWorkstreamName.DataBind();
            }

            if (UserSession.CurrentReferralId > 0)
            {
                REFERRAL r = ServiceInterfaceManager.REFERRAL_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, UserSession.CurrentReferralId);
                if (r != null)
                {
                    hideReferralId.Value = r.REFERRAL_ID.ToString();

                    if (r.REFERRAL_DATE != null)
                    {
                        txtReferralDate.Text = r.REFERRAL_DATE.Value.ToString("MM/dd/yyyy");
                    }

                    if (UserSession.CurrentPatientId <= 0)
                    {
                        UserSession.CurrentPatientId = r.PATIENT_ID;
                    }
                }
            }
            else
            {
                txtReferralDate.Text = string.Empty;
            }

            if (UserSession.CurrentPatientId > 0)
            {
                PATIENT p = ServiceInterfaceManager.PATIENT_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, UserSession.CurrentPatientId);
                if (p != null)
                {
                    hidePatientId.Value = p.PATIENT_ID.ToString();

                    if (!string.IsNullOrEmpty(p.LAST_NAME) && !string.IsNullOrEmpty(p.FIRST_NAME))
                    {
                        txtPatientName.Text = p.LAST_NAME + ", " + p.FIRST_NAME;
                    }
                    else if (!string.IsNullOrEmpty(p.LAST_NAME))
                    {
                        txtPatientName.Text = p.LAST_NAME;
                    }
                    else if (!string.IsNullOrEmpty(p.FIRST_NAME))
                    {
                        txtPatientName.Text = p.FIRST_NAME;
                    }
                }
            }
            else
            {
                txtPatientName.Text = string.Empty;
            }

            txtCaseNumber.Text    = string.Empty;
            txtCaseStartDate.Text = string.Empty;
            txtCaseDueDate.Text   = string.Empty;
        }
Esempio n. 28
0
        private void btnTambahTransaksi_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                TRANSACTION transaksi = new TRANSACTION()
                {
                    PATIENT_ID       = Convert.ToInt32(txtIdPasienTransaksi.Text),
                    TRANSACTION_DATE = Convert.ToDateTime(dtTanggalTransaksi.Text),
                };

                et.TRANSACTIONs.Add(transaksi);
                et.SaveChanges();

                PATIENT pasien = SearchByIdPasienTransaksi(Convert.ToInt32(txtIdPasienTransaksi.Text));
                pasien.STATUS = 1;

                et.Entry(pasien).State = System.Data.Entity.EntityState.Modified;
                et.SaveChanges();

                ROOM     ruangan = SearchByIdRoomTransaksi(Convert.ToInt32(cmbNamaRuanganTransaksi.SelectedValue));
                MEDICINE obat    = SearchByIdObatTransaksi(Convert.ToInt32(cmbNamaObatTransaksi.SelectedValue));
                DOCTOR   dokter  = SearchByIdDokterTransaksi(Convert.ToInt32(cmbNamaDokterTransaksi.SelectedValue));
                NURSE    perawat = SearchByIdPerawatTransaksi(Convert.ToInt32(cmbNamaPerawatTransaksi.SelectedValue));

                TRANSACTION_DETAIL detil_transaksi = new TRANSACTION_DETAIL()
                {
                    ARRIVAL_DATE   = Convert.ToDateTime(dtKedatanganTransaksi.Text),
                    LEAVING_DATE   = Convert.ToDateTime(dtKepergianTransaksi.Text),
                    ROOM_ID        = Convert.ToInt32(cmbNamaRuanganTransaksi.SelectedValue),
                    TRANSACTION_ID = Convert.ToInt32(transaksi.TRANSACTION_ID),
                    PRICE_ROOM     = Convert.ToDouble(ruangan.TYPE_ROOM.PRICE),
                    QTY_MEDICINE   = Convert.ToInt32(txtQtyObat.Text),
                    TOTAL_PRICE    = totalPrice()
                };

                et.TRANSACTION_DETAIL.Add(detil_transaksi);

                /*detil_transaksi.MEDICINEs.Add(new MEDICINE { MEDICINE_ID = SearchByIdObatTransaksi(Convert.ToInt32(cmbNamaObatTransaksi.SelectedValue)).MEDICINE_ID });
                 * detil_transaksi.DOCTORs.Add(new DOCTOR { DOCTOR_ID = SearchByIdDokterTransaksi(Convert.ToInt32(cmbNamaDokterTransaksi.SelectedValue)).DOCTOR_ID });
                 * detil_transaksi.NURSEs.Add(new NURSE { NURSE_ID = SearchByIdPerawatTransaksi(Convert.ToInt32(cmbNamaPerawatTransaksi.SelectedValue)).NURSE_ID });*/

                TRANSACTION_DETAIL detil_transaksi1 = new TRANSACTION_DETAIL {
                    TRANSACTION_DETAIL_ID = detil_transaksi.TRANSACTION_DETAIL_ID
                };
                et.TRANSACTION_DETAIL.Add(detil_transaksi1);
                et.TRANSACTION_DETAIL.Attach(detil_transaksi1);

                MEDICINE obat1 = new MEDICINE {
                    MEDICINE_ID = obat.MEDICINE_ID
                };
                et.MEDICINEs.Add(obat1);
                //et.MEDICINEs.Attach(obat1);

                DOCTOR dokter1 = new DOCTOR {
                    DOCTOR_ID = dokter.DOCTOR_ID
                };
                et.DOCTORs.Add(dokter1);
                //et.DOCTORs.Attach(dokter1);

                NURSE perawat1 = new NURSE {
                    NURSE_ID = perawat.NURSE_ID
                };
                et.NURSEs.Add(perawat1);
                //et.NURSEs.Attach(perawat1);

                detil_transaksi1.MEDICINEs.Add(obat1);
                detil_transaksi1.DOCTORs.Add(dokter1);
                detil_transaksi1.NURSEs.Add(perawat1);

                et.SaveChanges();

                MEDICINE mEDICINE = SearchByIdObatTransaksi(Convert.ToInt32(cmbNamaObatTransaksi.SelectedValue));
                mEDICINE.STOCK = obat.STOCK - detil_transaksi.QTY_MEDICINE;

                et.Entry(mEDICINE).State = System.Data.Entity.EntityState.Modified;
                et.SaveChanges();

                clearTextTransaksi();
                this.viewBlmTransaksiPasien(dgTransaksiPasien);
                MessageBox.Show("Transaksi Berhasil !", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
            }



            //TRANSACTION_DETAIL detil_transaksi1 = new TRANSACTION_DETAIL { TRANSACTION_DETAIL_ID = detil_transaksi.TRANSACTION_DETAIL_ID };
            //detil_transaksi1.MEDICINEs.Add(new MEDICINE { MEDICINE_ID = obat.MEDICINE_ID });

            //et.TRANSACTION_DETAIL.Add(detil_transaksi1);
            //et.SaveChanges();
        }
        public PRPA_IN201306UV02 PRPA_IN201305UV02(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, PATIENT p)
        {
            PRPA_IN201306UV02 objReturn = null;

            try
            {
                PRPA_MT201306UV02ParameterList patientParameters = GetDemographicParameters(p);
                if (patientParameters == null)
                {
                    return(null);
                }
                QUQI_MT021001UV01DataEnterer[] currentUser = GetDataEnterer(CURRENT_USER, CURRENT_REGISTRY_ID);

                if (rsMain == null)
                {
                    InitProxy();
                }

                string createDateTime = DateTime.Now.ToString("yyyyMMddhhmmss");

                PRPA_IN201305UV02 PRPA_IN201305UV021 = new PRPA_IN201305UV02()
                {
                    id = new II()
                    {
                        root = vaRoot, extension = string.Format("{0}-{1}", "MCID", createDateTime)
                    },
                    creationTime = new TS()
                    {
                        value = createDateTime
                    },
                    versionCode = new CS()
                    {
                        code = verCode
                    },
                    interactionId = new II()
                    {
                        extension = "PRPA_IN201305UV02", root = iiRoot
                    },
                    processingCode = new CS()
                    {
                        code = prcCode
                    },
                    processingModeCode = new CS()
                    {
                        code = "T"
                    },
                    acceptAckCode = new CS()
                    {
                        code = "AL"
                    },

                    receiver = new MCCI_MT000100UV01Receiver[]
                    {
                        new MCCI_MT000100UV01Receiver()
                        {
                            typeCode = CommunicationFunctionType.RCV,
                            device   = new MCCI_MT000100UV01Device()
                            {
                                determinerCode = "INSTANCE",
                                classCode      = EntityClassDevice.DEV,
                                id             = new II[] { new II()
                                                            {
                                                                root = vaRoot
                                                            } }
                            }
                        }
                    },

                    sender = new MCCI_MT000100UV01Sender()
                    {
                        typeCode = CommunicationFunctionType.SND,
                        device   = new MCCI_MT000100UV01Device()
                        {
                            determinerCode = "INSTANCE",
                            classCode      = EntityClassDevice.DEV,
                            id             = new II[] { new II()
                                                        {
                                                            root = vaRoot, extension = "200CRSE"
                                                        } }
                        }
                    },

                    controlActProcess = new PRPA_IN201305UV02QUQI_MT021001UV01ControlActProcess()
                    {
                        dataEnterer = currentUser,
                        classCode   = ActClassControlAct.CACT,
                        moodCode    = x_ActMoodIntentEvent.EVN,
                        code        = new CD()
                        {
                            code = "PRPA_TE201305UV02", codeSystem = iiRoot
                        },

                        queryByParameter = new PRPA_MT201306UV02QueryByParameter()
                        {
                            queryId = new II()
                            {
                                root = vaRoot, extension = createDateTime
                            },
                            statusCode = new CS()
                            {
                                code = "new"
                            },
                            modifyCode = new CS()
                            {
                                code = "MVI.COMP1"
                            },
                            initialQuantity = new INT()
                            {
                                value = "1"
                            },
                            parameterList = patientParameters
                        },
                    }
                };

                ////Used for debugging request
                //SoapEnvelope envelope = new SoapEnvelope();
                //envelope.body = new Body();
                //envelope.body.PRPA_IN201305UV02 = PRPA_IN201305UV021;

                //XmlSerializer ser = new XmlSerializer(typeof(SoapEnvelope));
                //TextWriter writer = new StreamWriter("C:\\temp\\PRPA_IN201305UV02.xml");
                //ser.Serialize(writer, envelope);
                //writer.Close();

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                objReturn = rsMain.PRPA_IN201305UV02(PRPA_IN201305UV021);
                LogManager.LogTiming(logDetails);

                ////Used for debugging response
                //if (objReturn != null)
                //{
                //    envelope = new SoapEnvelope();
                //    envelope.body = new Body();
                //    envelope.body.PRPA_IN201306UV02 = objReturn;

                //    ser = new XmlSerializer(typeof(SoapEnvelope));
                //    writer = new StreamWriter("C:\\temp\\PRPA_IN201306UV02.xml");
                //    ser.Serialize(writer, envelope);
                //    writer.Close();
                //}
            }
            catch (WebException ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }

            return(objReturn);
        }
Esempio n. 30
0
        public PATIENT GetItemComplete(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 PATIENT_ID)
        {
            PATIENT objReturn = null;

            SqlConnection  sConn    = null;
            SqlCommand     sCmd     = null;
            SqlDataAdapter sAdapter = null;
            DataSet        objTemp  = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_PATIENT_getitemComplete", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID);
                sCmd.Parameters.AddWithValue("@PATIENT_ID", PATIENT_ID);

                objTemp  = new DataSet();
                sAdapter = new SqlDataAdapter(sCmd);

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                sAdapter.Fill(objTemp);
                LogManager.LogTiming(logDetails);
                CheckDataSet(objTemp);

                if (objTemp != null && objTemp.Tables.Count > 0 && objTemp.Tables[0].Rows.Count > 0)
                {
                    objReturn = ParseReaderComplete(objTemp.Tables[0].Rows[0]);
                }

                sConn.Close();
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }
            finally
            {
                if (sAdapter != null)
                {
                    sAdapter.Dispose();
                    sAdapter = null;
                }
                if (sCmd != null)
                {
                    sCmd.Dispose();
                    sCmd = null;
                }
                if (sConn != null)
                {
                    if (sConn.State != ConnectionState.Closed)
                    {
                        sConn.Close();
                    }
                    sConn.Dispose();
                    sConn = null;
                }
            }

            return(objReturn);
        }