public IActionResult DeleteAppointmentDate(int Id) { ResultModel resultModel = new ResultModel(); if (Id != 0) { var appointmentDateData = _appointmentServices.GetAppointmentDateById(Id); _appointmentServices.DeleteAppointmentDate(appointmentDateData); resultModel.Status = 1; resultModel.Message = ValidationMessages.Success; resultModel.Response = "Appointmnet Date Deleted "; return(Ok(resultModel)); } else { resultModel.Message = ValidationMessages.Failure; resultModel.Status = 0; resultModel.Response = "Appointment Date not found"; return(Ok(resultModel)); } }
public ActionResult Create(PatientInfoModel model) { ResultModel resultModel = new ResultModel(); try { if (model.PatientInfoId == 0) { //Creating New Treatment record var TreatmentRecord = new TreatmentRecordMaster(); TreatmentRecord.AppointmentDateId = model.AppointmentDateId; TreatmentRecord.TreatmentStatusId = (int)TreatmentStatus.Started; TreatmentRecord.CreatedOn = DateTime.UtcNow; TreatmentRecord.Deleted = false; _treatmentRecordsServices.InsertTreatmentRecords(TreatmentRecord); TreatmentRecord.TreatmentRecordNo = _treatmentRecordsServices.GetTreatmentRecordNo(); _treatmentRecordsServices.UpdateTreatmentRecords(TreatmentRecord); //Bhawana(07/10/2019) //Change appointment status from Created to Treatment Started var appointmentdata = _appointmentServices.GetAppointmentDateById((int)model.AppointmentDateId); appointmentdata.AppointmentStatusId = (int)AppointmentStatus.TreatmentStarted; _appointmentServices.UpdateAppointmentDate(appointmentdata); //Inser Patient Data if patient is new var PatientMaster = new PatientMaster(); if (model.PatientMasterId == 0) { PatientMaster.PatientName = _encryptionService.EncryptText(model.PatientName); PatientMaster.Deleted = false; PatientMaster.CreatedOn = DateTime.UtcNow; _treatmentRecordsServices.InsertPatientMaster(PatientMaster); } else { PatientMaster.Id = (int)model.PatientMasterId; PatientMaster.PatientName = _encryptionService.EncryptText(model.PatientName); PatientMaster.Deleted = false; PatientMaster.LastUpdated = DateTime.UtcNow; _treatmentRecordsServices.UpdatePatientMaster(PatientMaster); } //Inser PatientInfo Data in Database var PatientInfo = new PatientInfo(); PatientInfo.Date = model.Date; PatientInfo.MR = _encryptionService.EncryptText(model.MR); PatientInfo.Deleted = false; PatientInfo.CreatedOn = DateTime.UtcNow; PatientInfo.LastUpdated = DateTime.UtcNow; PatientInfo.PatientMasterId = PatientMaster.Id; PatientInfo.NurseMasterId = (model.NurseMasterId != 0)? model.NurseMasterId:null; PatientInfo.HospitalMasterId = (model.HospitalMasterId != 0) ? model.HospitalMasterId:null; PatientInfo.DiagnosisId = model.DiagnosisId; PatientInfo.ProcedureId = model.ProcedureId; PatientInfo.MarkComplete = model.MarkComplete; PatientInfo.TreatmentRecordMasterId = TreatmentRecord.Id; _treatmentRecordsServices.InsertPatientInfo(PatientInfo); //Bhawana(09/10/2019) //Change treatment Record Status _reportService.UpdateTreatmentStatusID((int)PatientInfo.TreatmentRecordMasterId); //12/10/19 aakansha //model response model.PatientInfoId = PatientInfo.Id; model.PatientMasterId = PatientInfo.PatientMasterId; model.TreatmentRecordMasterId = PatientInfo.TreatmentRecordMasterId; model.TreatmentRecordNo = TreatmentRecord.TreatmentRecordNo; resultModel.Message = ValidationMessages.Success; resultModel.Status = 1; resultModel.Response = model; return(Ok(resultModel)); } else { var patientInfoData = _treatmentRecordsServices.GetPatientInfoById(model.PatientInfoId); if (patientInfoData != null) { patientInfoData.Date = model.Date; patientInfoData.LastUpdated = DateTime.UtcNow; patientInfoData.MR = _encryptionService.EncryptText(model.MR); patientInfoData.NurseMasterId = model.NurseMasterId; patientInfoData.HospitalMasterId = model.HospitalMasterId; patientInfoData.DiagnosisId = model.DiagnosisId; patientInfoData.ProcedureId = model.ProcedureId; patientInfoData.MarkComplete = model.MarkComplete; _treatmentRecordsServices.UpdatePatientInfo(patientInfoData); //Bhawana(09/10/2019) //Change treatment Record Status _reportService.UpdateTreatmentStatusID((int)patientInfoData.TreatmentRecordMasterId); } //12/10/19 aakansha //model response model.PatientInfoId = patientInfoData.Id; model.PatientMasterId = patientInfoData.PatientMasterId; model.TreatmentRecordMasterId = patientInfoData.TreatmentRecordMasterId; var treatmentdata = _treatmentRecordsServices.GetTreatmentRecordsById((int)patientInfoData.TreatmentRecordMasterId); model.TreatmentRecordNo = treatmentdata.TreatmentRecordNo; resultModel.Message = ValidationMessages.Success; resultModel.Status = 1; resultModel.Response = model; return(Ok(resultModel)); } } catch (Exception ex) { resultModel.Message = ex.ToString(); resultModel.Status = 0; resultModel.Response = null; return(Ok(resultModel)); } }