public bool Put([FromBody] hmisPatientBase patientEntity) { if (patientEntity.ID != Guid.Empty) { return(_patientService.UpdatePatient(patientEntity.ID, patientEntity)); } return(false); }
public HttpResponseMessage Post([FromBody] hmisPatientBase patientEntity) { string name = ConfigurationManager.AppSettings["ResgistrationNumFormat"]; patientEntity.patient_registration_no = name; var createResult = _patientService.CreatePatient(patientEntity); if (createResult.Length > 0) { string[] returnData = createResult.ToString().Split(':'); patientEntity.ID = new Guid(returnData[0].ToString()); patientEntity.patient_registration_no = returnData[1].ToString(); // _patientService.CreatePatientAdditionalInfo(patientEntity); var patientObject = _patientService.CreatePatientAdditionalInfo(patientEntity); } return(Request.CreateResponse(HttpStatusCode.OK, patientEntity.patient_registration_no)); }
public hmisPatientBase PopulateData(dynamic patientInfo) { var patientUnit = new hmisPatientBase(); patientUnit = new hmisPatientBase { ID = patientInfo["ID"] == null ? Guid.Empty : new Guid(patientInfo["ID"].ToString()), patient_city = patientInfo["patient_city"] == null ? "" : patientInfo["patient_city"].ToString() ?? "", patient_first_name = patientInfo["patient_first_name"] == null ? "" : patientInfo["patient_first_name"].ToString() ?? "", patient_last_name = patientInfo["patient_last_name"] == null ? "" : patientInfo["patient_last_name"].ToString() ?? "", patient_registration_no = patientInfo["patient_registration_no"] == null ? "" : patientInfo["patient_registration_no"].ToString() ?? "", patient_address = patientInfo["patient_address"] == null ? "" : patientInfo["patient_address"].ToString() ?? "", patient_dob = patientInfo["patient_dob"] == null ? null : Convert.ToDateTime(patientInfo["patient_dob"].ToString()), patient_blood_type = patientInfo["patient_blood_type"] == null ? "" : patientInfo["patient_blood_type"].ToString() ?? "", patient_sex = patientInfo["patient_sex"] == null ? "" : patientInfo["patient_sex"].ToString() ?? "", patient_phone = patientInfo["patient_phone"] == null ? "" : patientInfo["patient_phone"].ToString() ?? "", Reffered_Doctor = patientInfo["Reffered_Doctor"] == null ? "" : patientInfo["Reffered_Doctor"].ToString() ?? "", patient_notes = patientInfo["patient_notes"] == null ? false : patientInfo["patient_notes"].ToString(), Is_Bpl_holder = patientInfo["Is_Bpl_holder"] == null ? false : Convert.ToBoolean(patientInfo["Is_Bpl_holder"].ToString()), Is_Consent_Signed = patientInfo["Is_Bpl_holder"] == null ? false : Convert.ToBoolean(patientInfo["Is_Bpl_holder"].ToString()) }; return(patientUnit); }
public ActionResult RegisterPatient(hmisPatientBase patientObject) { //HttpResponseMessage response1 = GlobalVarriables.WebApiClient.PostAsJsonAsync("Admin", user).Result; var Token = ""; if (Session != null) { if (Session["AuthUserToken"] == null) { Token = Session["AuthUserToken"].ToString(); } } var Name = Request.Form.Get("RefferedDoctor"); Dictionary <string, string> getAllAdditionalInfo = new Dictionary <string, string>(); foreach (string key in Request.Form.AllKeys) { if (key.Contains("RefferedDoctor") && key.Equals("RefferedDoctor")) { getAllAdditionalInfo.Add("RefferedDoctor", Request.Form[key]); var patientHMISExt = new hmisPatientExt { attribute_name = "RefferedDoctor", attribute_value = Request.Form[key] }; patientObject.hmis_patient_ext.Add(patientHMISExt); } if (key.Contains("MothersName") && key.Equals("MothersName")) { getAllAdditionalInfo.Add("MothersName", Request.Form[key]); var patientHMISExt = new hmisPatientExt { attribute_name = "MothersName", attribute_value = Request.Form[key] }; patientObject.hmis_patient_ext.Add(patientHMISExt); } if (key.Contains("FathersName") && key.Equals("FathersName")) { getAllAdditionalInfo.Add("FathersName", Request.Form[key]); var patientHMISExt = new hmisPatientExt { attribute_name = "FathersName", attribute_value = Request.Form[key] }; patientObject.hmis_patient_ext.Add(patientHMISExt); } if (key.Contains("bpl_card_holder") && key.Equals("bpl_card_holder")) { getAllAdditionalInfo.Add("BPLCardHolder", Request.Form[key]); var patientHMISExt = new hmisPatientExt { attribute_name = "BPLCardHolder", attribute_value = Request.Form[key] }; patientObject.hmis_patient_ext.Add(patientHMISExt); } } patientObject.patient_registration_no = "CAL-MED-20992"; HttpResponseMessage response1 = GlobalVarriables.WebApiClient.PostAsJsonAsync("Patient", patientObject).Result; if (response1.IsSuccessStatusCode) { //Storing the response details recieved from web api var EmpResponse = response1.Content.ReadAsStringAsync().Result; var readTask = response1.Content.ReadAsAsync <IList <UserEntity> >(); // var Users = JsonConvert.DeserializeObject<List<UserEntity>>(EmpResponse); GlobalVarriables.WebApiClient.DefaultRequestHeaders.Add("Token", "1"); } return(View()); }