private bool SaveApplication() { try { ApplicationAllInOneMdl totalMdl = this.GetMdlFromGUI(); Consult_ApplicationMdl mdl = totalMdl.Consult_ApplicationMdl; Consult_ApplicationDAL dal = new Consult_ApplicationDAL(); // Save/Update the Patient info first #region MyRegion string patient_guid = EMR_PatientMdlDAL.GetPatientGUID(totalMdl.EMR_PatientMdl.name, totalMdl.EMR_PatientMdl.user_guid); if (string.IsNullOrEmpty(patient_guid)) { // New totalMdl.EMR_PatientMdl.patient_guid = Guid.NewGuid().ToString(); // Create new GUID totalMdl.Consult_ApplicationMdl.patient_guid = totalMdl.EMR_PatientMdl.patient_guid; // Copy GUID EMR_PatientMdlDAL.Add(totalMdl.EMR_PatientMdl); } else { // Update totalMdl.EMR_PatientMdl.patient_guid = patient_guid; // Create new GUID totalMdl.Consult_ApplicationMdl.patient_guid = totalMdl.EMR_PatientMdl.patient_guid; // Copy GUID EMR_PatientMdlDAL.Update(totalMdl.EMR_PatientMdl); } #endregion // Continue save the others info if (!dal.IsExist(mdl.guid)) { // Add Consult_ApplicationMdl dal.Add_consult_application(mdl); // Add consult_application_consultant dal.Add_consult_application_consultant(totalMdl.Consult_Application_ConsultantMdlCollection); // Add the Purpose Image dal.Add_consult_application_accessory(totalMdl.consult_application_accessoryMdl); return(true); } else { // Update Consult_ApplicationMdl dal.Update_consult_application(mdl); // Update consult_application_consultant dal.Update_consult_application_consultant(totalMdl.Consult_Application_ConsultantMdlCollection); // Update the Purpose Image dal.Update_consult_application_accessory(totalMdl.consult_application_accessoryMdl); return(true); } } catch (Exception ex) { Log4NetLogger.GetLogger().Error(ex.Message); this.lblErrorMsg.Text = ex.Message; } return(false); }
public static DataSet GetApplication(string guid) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * FROM [mhCloudEMR].[dbo].[consult_application] app left join emr_patient pat on app.patient_guid=pat.patient_guid "); strSql.Append(" where guid=@guid"); SqlParameter[] parameters = { new SqlParameter("@guid", SqlDbType.VarChar, 36) }; parameters[0].Value = guid; Consult_ApplicationMdl model = new Consult_ApplicationMdl(); DataSet ds = SqlHelper.ExecuteQuery(strSql.ToString(), parameters); return(ds); }
private void InitCtrl() { //DataSet dsProject = ApplicationDAL.GetProjectList(); //this.ddlProject.DataSource = dsProject; //this.ddlProject.DataBind(); //Session["dsProject"] = dsProject; this.CreateDropdownListGroup(); //DataSet dsLoction = ApplicationDAL.GetLoctionList("1"); //this.ddlLocation.DataSource = dsLoction; //this.ddlLocation.DataBind(); //Session["dsLoction"] = dsLoction; //ddlLocation_SelectedIndexChanged(null, null); lblStatus.Text = "未提交"; this.txtName.Enabled = false; this.txtMobile.Enabled = false; this.txtEmail.Enabled = false; // New app if (Request.QueryString["guid"] == null) { // When create new application, using current login user context // When view and update, should use last saved user context V_Sys_UserMdl model = V_Sys_UserDAL.GetModel(Session["USER_GUID"].ToString()); this.txtName.Text = model.name; this.txtMobile.Text = model.login_name; this.txtEmail.Text = model.email; this.hidUserGUID.Value = Session["USER_GUID"].ToString(); } // View and update app if (Request.QueryString["guid"] != null) { string guid = Request.QueryString["guid"]; Consult_ApplicationDAL dal = new Consult_ApplicationDAL(); Consult_ApplicationMdl mdl = dal.GetModel(guid); BindGUI(mdl); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Consult_ApplicationMdl GetModel(string guid) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * FROM [mhCloudEMR].[dbo].[consult_application] app left join emr_patient pat on app.patient_guid=pat.patient_guid "); strSql.Append(" where guid=@guid"); SqlParameter[] parameters = { new SqlParameter("@guid", SqlDbType.VarChar, 36) }; parameters[0].Value = guid; Consult_ApplicationMdl model = new Consult_ApplicationMdl(); DataSet ds = SqlHelper.ExecuteQuery(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
private void BindGUI(Consult_ApplicationMdl applicationMdl) { // Very importand, remember the uid this.hidGUID.Value = applicationMdl.guid; this.hidUserGUID.Value = applicationMdl.user_guid; this.hidStatus.Value = applicationMdl.status.ToString(); this.lblStatus.Text = GlobalConstant.dicApplicationStatus[applicationMdl.status]; // Check status and Open/Enable the GUI #region if (applicationMdl.status == 0) { this.panReject.Visible = true; } else if (applicationMdl.status == 1) { // 已提交,客服审核 this.panReject.Visible = true; this.panFirstpay.Visible = true; this.panReject.Enabled = true; this.panFirstpay.Enabled = true; this.txtRejectComments.Text = "补充资料"; } else if (applicationMdl.status == 3) { // 3 已付初审费,确认收费 this.panFirstpay.Visible = true; } else if (applicationMdl.status == 4) { // 4 初审中,计算会诊费 this.panFirstpay.Visible = true; this.panPreliminary_conclusions.Visible = true; this.panPreliminary_conclusions.Enabled = true; this.panConsultPay.Visible = true; this.panConsultPay.Enabled = true; } else if (applicationMdl.status == 6 || applicationMdl.status == 7 || applicationMdl.status == 8 || applicationMdl.status == 9 || applicationMdl.status == 99) { // 6 已付会诊费,确认收款 this.panFirstpay.Visible = true; this.panPreliminary_conclusions.Visible = true; this.panConsultPay.Visible = true; } #endregion // Bind System User Info #region MyRegion V_Sys_UserMdl model = V_Sys_UserDAL.GetModel(applicationMdl.user_guid); this.txtName.Text = model.name; this.txtMobile.Text = model.login_name; this.txtEmail.Text = model.email; #endregion // Bind Patient Info DataSet dsApplication = Consult_ApplicationDAL.GetApplication(applicationMdl.guid); #region MyRegion if (dsApplication != null && dsApplication.Tables.Count > 0 && dsApplication.Tables[0].Rows.Count > 0) { this.txtPatientName.Text = dsApplication.Tables[0].Rows[0]["name"].ToString().Trim(); WebCtrlUtil.SetDropDownText(this.ddlGender, dsApplication.Tables[0].Rows[0]["gender"].ToString().Trim()); DateTime dtDOB = DateTime.Now; if (!(dsApplication.Tables[0].Rows[0]["birthday"] is DBNull)) { DateTime.TryParse(dsApplication.Tables[0].Rows[0]["birthday"].ToString().Trim(), out dtDOB); } this.txtDOB.Text = dtDOB.ToString("yyyy-MM-dd"); this.txtApplicationPurpose.Text = dsApplication.Tables[0].Rows[0]["purpose"].ToString().Trim(); // Location type WebCtrlUtil.SetDropDownText(this.ddlLocalType, dsApplication.Tables[0].Rows[0]["location_type"].ToString().Trim()); } #endregion // Reject Info this.txtRejectComments.Text = dsApplication.Tables[0].Rows[0]["service_comments_for_user"].ToString().Trim(); this.txtPreliminary_conclusions.Text = dsApplication.Tables[0].Rows[0]["Preliminary_conclusions"].ToString().Trim(); // fill payinfo this.txtPreTypePay.Text = Consult_ApplicationDAL.getFirstPayInfo(applicationMdl.guid); this.txtConsultPay.Text = Consult_ApplicationDAL.getSecondPayInfo(applicationMdl.guid); // Bind consult_application_consultant Info #region MyRegion dsApplication = Consult_ApplicationDAL.GetApplicationConsultant(applicationMdl.guid); if (dsApplication != null && dsApplication.Tables.Count > 0 && dsApplication.Tables[0].Rows.Count > 0) { WebCtrlUtil.SetDropDownText(this.ddlHospitalCount, dsApplication.Tables[0].Rows.Count.ToString()); CreateDropdownListGroup(); for (int i = 0; i < dsApplication.Tables[0].Rows.Count; i++) { // Bind Hospital DropDownList ddlHospital = this.panDoctorGroup.FindControl("ddlHospital" + (i + 1)) as DropDownList; WebCtrlUtil.SetDropDownText(ddlHospital, dsApplication.Tables[0].Rows[i]["hospital_guid"].ToString().Trim()); ddlHospital_SelectedIndexChanged(ddlHospital, null); // Bind Doctor DropDownList ddlDoctor = this.panDoctorGroup.FindControl("ddlDoctor" + (i + 1)) as DropDownList; WebCtrlUtil.SetDropDownText(ddlDoctor, dsApplication.Tables[0].Rows[i]["doctor_guid"].ToString().Trim()); } } #endregion // Bind the PurposeImage DataSet dsPurposeImage = Consult_ApplicationDAL.GetPurposeThumbnail(applicationMdl.guid); if (dsPurposeImage != null && dsPurposeImage.Tables.Count > 0 && dsPurposeImage.Tables[0].Rows.Count > 0) { string strTempFolder = ImageUtils.GetTempFolderPath(); byte[] bImage = (byte[])(dsPurposeImage.Tables[0].Rows[0]["thumbnail"]); string strFileName = Guid.NewGuid().ToString() + ".jpg"; string strFilePath = Path.Combine(strTempFolder, strFileName); File.WriteAllBytes(strFilePath, bImage); ImageUtils.ShowThumbnail(this.litPurposeImg, strFileName); this.hidPurposeImg.Value = strFilePath; this.hidPurposeImgGUID.Value = dsPurposeImage.Tables[0].Rows[0]["guid"].ToString(); } }
private ApplicationAllInOneMdl GetMdlFromGUI() { ApplicationAllInOneMdl totalMdl = new ApplicationAllInOneMdl(); // Basic info Consult_ApplicationMdl consultAppMdl = new Consult_ApplicationMdl(); #region MyRegion // Try to get guid consultAppMdl.guid = this.hidGUID.Value.Trim(); if (string.IsNullOrEmpty(consultAppMdl.guid)) { // New Application Request consultAppMdl.guid = Guid.NewGuid().ToString(); consultAppMdl.created_dt = DateTime.Now; consultAppMdl.status = 1; // After save, the status will be changed to 1; this.hidGUID.Value = consultAppMdl.guid; } else { // Get exists data first, then using new GUI to update Consult_ApplicationDAL dal = new Consult_ApplicationDAL(); consultAppMdl = dal.GetModel(consultAppMdl.guid); // Update status from 0 to 1 if (consultAppMdl.status == 0) { consultAppMdl.status = 1; } } consultAppMdl.location_type = int.Parse(this.ddlLocalType.SelectedValue); consultAppMdl.user_guid = Session["USER_GUID"].ToString(); consultAppMdl.user_name = this.txtName.Text.Trim(); consultAppMdl.purpose = this.txtApplicationPurpose.Text; #endregion // Patient Info EMR_PatientMdl patientMdl = new EMR_PatientMdl(); #region MyRegion patientMdl.user_guid = this.hidUserGUID.Value; // Pateint belongs to User patientMdl.name = this.txtPatientName.Text.Trim(); patientMdl.gender = int.Parse(this.ddlGender.SelectedValue); string strDOB = this.txtDOB.Text; DateTime dtDOB = DateTime.Now; DateTime.TryParse(strDOB, out dtDOB); patientMdl.birthday = dtDOB; #endregion // Hospital Info List <Consult_Application_ConsultantMdl> consultantMdlCollection = new List <Consult_Application_ConsultantMdl>(); #region MyRegion int HospitalCount = int.Parse(this.ddlHospitalCount.SelectedValue); for (int i = 1; i <= HospitalCount; i++) { Consult_Application_ConsultantMdl consultantMdl = new Consult_Application_ConsultantMdl(); DropDownList ddlHospital = this.panDoctorGroup.FindControl("ddlHospital" + i.ToString()) as DropDownList; if (ddlHospital.SelectedItem != null) { consultantMdl.hospital_guid = ddlHospital.SelectedValue; consultantMdl.hospital_name = ddlHospital.SelectedItem.Text; string location_guid = ""; string location_name = ""; Consult_ApplicationDAL.GetLocationInfoByHospitalUID(consultantMdl.hospital_guid, ref location_guid, ref location_name); consultantMdl.location_guid = location_guid; consultantMdl.location_name = location_name; } DropDownList ddlDoctor = this.panDoctorGroup.FindControl("ddlDoctor" + i.ToString()) as DropDownList; if (ddlDoctor.SelectedItem != null) { consultantMdl.doctor_guid = ddlDoctor.SelectedValue; consultantMdl.doctor_name = ddlDoctor.SelectedItem.Text; } consultantMdl.consult_application_guid = consultAppMdl.guid; consultantMdlCollection.Add(consultantMdl); } #endregion // consult_application_accessory info #region MyRegion consult_application_accessoryMdl thumbnailMdl = null; if (!string.IsNullOrEmpty(this.hidPurposeImg.Value) && File.Exists(this.hidPurposeImg.Value)) { thumbnailMdl = new consult_application_accessoryMdl(); if (string.IsNullOrEmpty(this.hidPurposeImgGUID.Value)) { thumbnailMdl.guid = Guid.NewGuid().ToString(); } else { thumbnailMdl.guid = this.hidPurposeImgGUID.Value; } thumbnailMdl.consult_application_guid = consultAppMdl.guid; thumbnailMdl.type = 0; thumbnailMdl.content = File.ReadAllBytes(this.hidPurposeImg.Value); thumbnailMdl.thumbnail = ImageUtils.getThumbnail(thumbnailMdl.content); } #endregion totalMdl.Consult_ApplicationMdl = consultAppMdl; totalMdl.EMR_PatientMdl = patientMdl; totalMdl.Consult_Application_ConsultantMdlCollection = consultantMdlCollection; totalMdl.consult_application_accessoryMdl = thumbnailMdl; return(totalMdl); }
/// <summary> /// 得到一个对象实体 /// </summary> public Consult_ApplicationMdl DataRowToModel(DataRow row) { Consult_ApplicationMdl model = new Consult_ApplicationMdl(); if (row != null) { if (row["guid"] != null) { model.guid = row["guid"].ToString(); } if (row["user_guid"] != null) { model.user_guid = row["user_guid"].ToString(); } if (row["user_name"] != null) { model.user_name = row["user_name"].ToString(); } if (row["status"] != null && row["status"].ToString() != "") { model.status = int.Parse(row["status"].ToString()); } if (row["patient_guid"] != null) { model.patient_guid = row["patient_guid"].ToString(); } if (row["project_guid"] != null) { model.project_guid = row["project_guid"].ToString(); } if (row["project_name"] != null) { model.project_name = row["project_name"].ToString(); } if (row["location_type"] != null && row["location_type"].ToString() != "") { model.location_type = int.Parse(row["location_type"].ToString()); } if (row["purpose"] != null) { model.purpose = row["purpose"].ToString(); } if (row["purpose_t"] != null) { model.purpose_t = row["purpose_t"].ToString(); } if (row["local_hospital"] != null) { model.local_hospital = row["local_hospital"].ToString(); } if (row["local_hospital_t"] != null) { model.local_hospital_t = row["local_hospital_t"].ToString(); } if (row["preliminary_conclusions"] != null) { model.preliminary_conclusions = row["preliminary_conclusions"].ToString(); } if (row["preliminary_conclusions_t"] != null) { model.preliminary_conclusions_t = row["preliminary_conclusions_t"].ToString(); } if (row["final_conclusion"] != null) { model.final_conclusion = row["final_conclusion"].ToString(); } if (row["final_conclusion_t"] != null) { model.final_conclusion_t = row["final_conclusion_t"].ToString(); } if (row["created_dt"] != null && row["created_dt"].ToString() != "") { model.created_dt = DateTime.Parse(row["created_dt"].ToString()); } if (row["submitted_dt"] != null && row["submitted_dt"].ToString() != "") { model.submitted_dt = DateTime.Parse(row["submitted_dt"].ToString()); } if (row["accepted_dt"] != null && row["accepted_dt"].ToString() != "") { model.accepted_dt = DateTime.Parse(row["accepted_dt"].ToString()); } if (row["approved_dt"] != null && row["approved_dt"].ToString() != "") { model.approved_dt = DateTime.Parse(row["approved_dt"].ToString()); } if (row["concluded_dt"] != null && row["concluded_dt"].ToString() != "") { model.concluded_dt = DateTime.Parse(row["concluded_dt"].ToString()); } if (row["rejected_dt"] != null && row["rejected_dt"].ToString() != "") { model.rejected_dt = DateTime.Parse(row["rejected_dt"].ToString()); } if (row["completed_dt"] != null && row["completed_dt"].ToString() != "") { model.completed_dt = DateTime.Parse(row["completed_dt"].ToString()); } if (row["approver_guid"] != null) { model.approver_guid = row["approver_guid"].ToString(); } if (row["approver_name"] != null) { model.approver_name = row["approver_name"].ToString(); } if (row["contract_content"] != null) { model.contract_content = row["contract_content"].ToString(); } if (row["amount_payable"] != null && row["amount_payable"].ToString() != "") { model.amount_payable = decimal.Parse(row["amount_payable"].ToString()); } if (row["amount_receivable"] != null && row["amount_receivable"].ToString() != "") { model.amount_receivable = decimal.Parse(row["amount_receivable"].ToString()); } if (row["paid_dt"] != null && row["paid_dt"].ToString() != "") { model.paid_dt = DateTime.Parse(row["paid_dt"].ToString()); } if (row["amount_payable2"] != null && row["amount_payable2"].ToString() != "") { model.amount_payable2 = decimal.Parse(row["amount_payable2"].ToString()); } if (row["amount_receivable2"] != null && row["amount_receivable2"].ToString() != "") { model.amount_receivable2 = decimal.Parse(row["amount_receivable2"].ToString()); } if (row["paid_dt2"] != null && row["paid_dt2"].ToString() != "") { model.paid_dt2 = DateTime.Parse(row["paid_dt2"].ToString()); } if (row["service_comments_for_user"] != null) { model.service_comments_for_user = row["service_comments_for_user"].ToString(); } if (row["service_comments_for_consultant"] != null) { model.service_comments_for_consultant = row["service_comments_for_consultant"].ToString(); } if (row["service_comments_for_consultant_t"] != null) { model.service_comments_for_consultant_t = row["service_comments_for_consultant_t"].ToString(); } if (row["specified_notes"] != null) { model.specified_notes = row["specified_notes"].ToString(); } if (row["number_of_hospitals"] != null && row["number_of_hospitals"].ToString() != "") { model.number_of_hospitals = int.Parse(row["number_of_hospitals"].ToString()); } if (row["location_guid"] != null) { model.location_guid = row["location_guid"].ToString(); } if (row["location_name"] != null) { model.location_name = row["location_name"].ToString(); } } return(model); }
public bool IsExist(string guid) { Consult_ApplicationMdl mdl = GetModel(guid); return(mdl != null); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update_consult_application(Consult_ApplicationMdl model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update consult_application set "); strSql.Append("guid=@guid,"); strSql.Append("user_guid=@user_guid,"); strSql.Append("user_name=@user_name,"); strSql.Append("status=@status,"); strSql.Append("patient_guid=@patient_guid,"); strSql.Append("project_guid=@project_guid,"); strSql.Append("project_name=@project_name,"); strSql.Append("location_type=@location_type,"); strSql.Append("purpose=@purpose,"); strSql.Append("purpose_t=@purpose_t,"); strSql.Append("local_hospital=@local_hospital,"); strSql.Append("local_hospital_t=@local_hospital_t,"); strSql.Append("preliminary_conclusions=@preliminary_conclusions,"); strSql.Append("preliminary_conclusions_t=@preliminary_conclusions_t,"); strSql.Append("final_conclusion=@final_conclusion,"); strSql.Append("final_conclusion_t=@final_conclusion_t,"); strSql.Append("created_dt=@created_dt,"); strSql.Append("submitted_dt=@submitted_dt,"); strSql.Append("accepted_dt=@accepted_dt,"); strSql.Append("approved_dt=@approved_dt,"); strSql.Append("concluded_dt=@concluded_dt,"); strSql.Append("rejected_dt=@rejected_dt,"); strSql.Append("completed_dt=@completed_dt,"); strSql.Append("approver_guid=@approver_guid,"); strSql.Append("approver_name=@approver_name,"); strSql.Append("contract_content=@contract_content,"); strSql.Append("amount_payable=@amount_payable,"); strSql.Append("amount_receivable=@amount_receivable,"); strSql.Append("paid_dt=@paid_dt,"); strSql.Append("amount_payable2=@amount_payable2,"); strSql.Append("amount_receivable2=@amount_receivable2,"); strSql.Append("paid_dt2=@paid_dt2,"); strSql.Append("service_comments_for_user=@service_comments_for_user,"); strSql.Append("service_comments_for_consultant=@service_comments_for_consultant,"); strSql.Append("service_comments_for_consultant_t=@service_comments_for_consultant_t,"); strSql.Append("specified_notes=@specified_notes,"); strSql.Append("number_of_hospitals=@number_of_hospitals,"); strSql.Append("location_guid=@location_guid,"); strSql.Append("location_name=@location_name"); strSql.Append(" where guid=@guid"); SqlParameter[] parameters = { new SqlParameter("@guid", SqlDbType.VarChar, 36), new SqlParameter("@user_guid", SqlDbType.VarChar, 36), new SqlParameter("@user_name", SqlDbType.NVarChar, 64), new SqlParameter("@status", SqlDbType.Int, 4), new SqlParameter("@patient_guid", SqlDbType.VarChar, 36), new SqlParameter("@project_guid", SqlDbType.VarChar, 36), new SqlParameter("@project_name", SqlDbType.NVarChar, 64), new SqlParameter("@location_type", SqlDbType.Int, 4), new SqlParameter("@purpose", SqlDbType.NVarChar, -1), new SqlParameter("@purpose_t", SqlDbType.NVarChar, -1), new SqlParameter("@local_hospital", SqlDbType.NVarChar, 256), new SqlParameter("@local_hospital_t", SqlDbType.NVarChar, 256), new SqlParameter("@preliminary_conclusions", SqlDbType.NVarChar, -1), new SqlParameter("@preliminary_conclusions_t", SqlDbType.NVarChar, -1), new SqlParameter("@final_conclusion", SqlDbType.NVarChar, -1), new SqlParameter("@final_conclusion_t", SqlDbType.NVarChar, -1), new SqlParameter("@created_dt", SqlDbType.DateTime), new SqlParameter("@submitted_dt", SqlDbType.DateTime), new SqlParameter("@accepted_dt", SqlDbType.DateTime), new SqlParameter("@approved_dt", SqlDbType.DateTime), new SqlParameter("@concluded_dt", SqlDbType.DateTime), new SqlParameter("@rejected_dt", SqlDbType.DateTime), new SqlParameter("@completed_dt", SqlDbType.DateTime), new SqlParameter("@approver_guid", SqlDbType.VarChar, 36), new SqlParameter("@approver_name", SqlDbType.NVarChar, 64), new SqlParameter("@contract_content", SqlDbType.NVarChar, -1), new SqlParameter("@amount_payable", SqlDbType.Float, 8), new SqlParameter("@amount_receivable", SqlDbType.Float, 8), new SqlParameter("@paid_dt", SqlDbType.DateTime), new SqlParameter("@amount_payable2", SqlDbType.Float, 8), new SqlParameter("@amount_receivable2", SqlDbType.Float, 8), new SqlParameter("@paid_dt2", SqlDbType.DateTime), new SqlParameter("@service_comments_for_user", SqlDbType.NVarChar, -1), new SqlParameter("@service_comments_for_consultant", SqlDbType.NVarChar, -1), new SqlParameter("@service_comments_for_consultant_t", SqlDbType.NVarChar, -1), new SqlParameter("@specified_notes", SqlDbType.NVarChar, -1), new SqlParameter("@number_of_hospitals", SqlDbType.Int, 4), new SqlParameter("@location_guid", SqlDbType.VarChar, 36), new SqlParameter("@location_name", SqlDbType.NVarChar, 64) }; parameters[0].Value = model.guid; parameters[1].Value = model.user_guid; parameters[2].Value = model.user_name; parameters[3].Value = model.status; parameters[4].Value = model.patient_guid; parameters[5].Value = model.project_guid; parameters[6].Value = model.project_name; parameters[7].Value = model.location_type; parameters[8].Value = model.purpose; parameters[9].Value = model.purpose_t; parameters[10].Value = model.local_hospital; parameters[11].Value = model.local_hospital_t; parameters[12].Value = model.preliminary_conclusions; parameters[13].Value = model.preliminary_conclusions_t; parameters[14].Value = model.final_conclusion; parameters[15].Value = model.final_conclusion_t; parameters[16].Value = model.created_dt; parameters[17].Value = model.submitted_dt; parameters[18].Value = model.accepted_dt; parameters[19].Value = model.approved_dt; parameters[20].Value = model.concluded_dt; parameters[21].Value = model.rejected_dt; parameters[22].Value = model.completed_dt; parameters[23].Value = model.approver_guid; parameters[24].Value = model.approver_name; parameters[25].Value = model.contract_content; parameters[26].Value = model.amount_payable; parameters[27].Value = model.amount_receivable; parameters[28].Value = model.paid_dt; parameters[29].Value = model.amount_payable2; parameters[30].Value = model.amount_receivable2; parameters[31].Value = model.paid_dt2; parameters[32].Value = model.service_comments_for_user; parameters[33].Value = model.service_comments_for_consultant; parameters[34].Value = model.service_comments_for_consultant_t; parameters[35].Value = model.specified_notes; parameters[36].Value = model.number_of_hospitals; parameters[37].Value = model.location_guid; parameters[38].Value = model.location_name; int rows = SqlHelper.ExecuteNonQuery(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add_consult_application(Consult_ApplicationMdl model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into consult_application("); strSql.Append("guid,user_guid,user_name,status,patient_guid,project_guid,project_name,location_type,purpose,purpose_t,local_hospital,local_hospital_t,preliminary_conclusions,preliminary_conclusions_t,final_conclusion,final_conclusion_t,created_dt,submitted_dt,accepted_dt,approved_dt,concluded_dt,rejected_dt,completed_dt,approver_guid,approver_name,contract_content,amount_payable,amount_receivable,paid_dt,amount_payable2,amount_receivable2,paid_dt2,service_comments_for_user,service_comments_for_consultant,service_comments_for_consultant_t,specified_notes,number_of_hospitals,location_guid,location_name)"); strSql.Append(" values ("); strSql.Append("@guid,@user_guid,@user_name,@status,@patient_guid,@project_guid,@project_name,@location_type,@purpose,@purpose_t,@local_hospital,@local_hospital_t,@preliminary_conclusions,@preliminary_conclusions_t,@final_conclusion,@final_conclusion_t,@created_dt,@submitted_dt,@accepted_dt,@approved_dt,@concluded_dt,@rejected_dt,@completed_dt,@approver_guid,@approver_name,@contract_content,@amount_payable,@amount_receivable,@paid_dt,@amount_payable2,@amount_receivable2,@paid_dt2,@service_comments_for_user,@service_comments_for_consultant,@service_comments_for_consultant_t,@specified_notes,@number_of_hospitals,@location_guid,@location_name)"); SqlParameter[] parameters = { new SqlParameter("@guid", SqlDbType.VarChar, 36), new SqlParameter("@user_guid", SqlDbType.VarChar, 36), new SqlParameter("@user_name", SqlDbType.NVarChar, 64), new SqlParameter("@status", SqlDbType.Int, 4), new SqlParameter("@patient_guid", SqlDbType.VarChar, 36), new SqlParameter("@project_guid", SqlDbType.VarChar, 36), new SqlParameter("@project_name", SqlDbType.NVarChar, 64), new SqlParameter("@location_type", SqlDbType.Int, 4), new SqlParameter("@purpose", SqlDbType.NVarChar, -1), new SqlParameter("@purpose_t", SqlDbType.NVarChar, -1), new SqlParameter("@local_hospital", SqlDbType.NVarChar, 256), new SqlParameter("@local_hospital_t", SqlDbType.NVarChar, 256), new SqlParameter("@preliminary_conclusions", SqlDbType.NVarChar, -1), new SqlParameter("@preliminary_conclusions_t", SqlDbType.NVarChar, -1), new SqlParameter("@final_conclusion", SqlDbType.NVarChar, -1), new SqlParameter("@final_conclusion_t", SqlDbType.NVarChar, -1), new SqlParameter("@created_dt", SqlDbType.DateTime), new SqlParameter("@submitted_dt", SqlDbType.DateTime), new SqlParameter("@accepted_dt", SqlDbType.DateTime), new SqlParameter("@approved_dt", SqlDbType.DateTime), new SqlParameter("@concluded_dt", SqlDbType.DateTime), new SqlParameter("@rejected_dt", SqlDbType.DateTime), new SqlParameter("@completed_dt", SqlDbType.DateTime), new SqlParameter("@approver_guid", SqlDbType.VarChar, 36), new SqlParameter("@approver_name", SqlDbType.NVarChar, 64), new SqlParameter("@contract_content", SqlDbType.NVarChar, -1), new SqlParameter("@amount_payable", SqlDbType.Float, 8), new SqlParameter("@amount_receivable", SqlDbType.Float, 8), new SqlParameter("@paid_dt", SqlDbType.DateTime), new SqlParameter("@amount_payable2", SqlDbType.Float, 8), new SqlParameter("@amount_receivable2", SqlDbType.Float, 8), new SqlParameter("@paid_dt2", SqlDbType.DateTime), new SqlParameter("@service_comments_for_user", SqlDbType.NVarChar, -1), new SqlParameter("@service_comments_for_consultant", SqlDbType.NVarChar, -1), new SqlParameter("@service_comments_for_consultant_t", SqlDbType.NVarChar, -1), new SqlParameter("@specified_notes", SqlDbType.NVarChar, -1), new SqlParameter("@number_of_hospitals", SqlDbType.Int, 4), new SqlParameter("@location_guid", SqlDbType.VarChar, 36), new SqlParameter("@location_name", SqlDbType.NVarChar, 64) }; parameters[0].Value = model.guid; parameters[1].Value = model.user_guid; parameters[2].Value = model.user_name; parameters[3].Value = model.status; parameters[4].Value = model.patient_guid; parameters[5].Value = model.project_guid; parameters[6].Value = model.project_name; parameters[7].Value = model.location_type; parameters[8].Value = model.purpose; parameters[9].Value = model.purpose_t; parameters[10].Value = model.local_hospital; parameters[11].Value = model.local_hospital_t; parameters[12].Value = model.preliminary_conclusions; parameters[13].Value = model.preliminary_conclusions_t; parameters[14].Value = model.final_conclusion; parameters[15].Value = model.final_conclusion_t; parameters[16].Value = model.created_dt; parameters[17].Value = model.submitted_dt; parameters[18].Value = model.accepted_dt; parameters[19].Value = model.approved_dt; parameters[20].Value = model.concluded_dt; parameters[21].Value = model.rejected_dt; parameters[22].Value = model.completed_dt; parameters[23].Value = model.approver_guid; parameters[24].Value = model.approver_name; parameters[25].Value = model.contract_content; parameters[26].Value = model.amount_payable; parameters[27].Value = model.amount_receivable; parameters[28].Value = model.paid_dt; parameters[29].Value = model.amount_payable2; parameters[30].Value = model.amount_receivable2; parameters[31].Value = model.paid_dt2; parameters[32].Value = model.service_comments_for_user; parameters[33].Value = model.service_comments_for_consultant; parameters[34].Value = model.service_comments_for_consultant_t; parameters[35].Value = model.specified_notes; parameters[36].Value = model.number_of_hospitals; parameters[37].Value = model.location_guid; parameters[38].Value = model.location_name; int rows = SqlHelper.ExecuteNonQuery(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }