using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PTMedicalInsurance.Common; using PTMedicalInsurance.Entity; using PTMedicalInsurance.Helper; using PTMedicalInsurance.Variables; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace PTMedicalInsurance.Forms.ToPutOnRecord { public partial class FixedPointRecord : Form { private ToPutOnRecord mainForm; private String fixmedinsCode = Global.inf.hospitalNO; private String fixmedinsName = Global.inf.hospitalName; private String otherHospAreaCode; private String otherHospAreaName; private string diagCode; private string diagName; private InvokeHelper invoker = new InvokeHelper(); public FixedPointRecord() { InitializeComponent(); } public FixedPointRecord(Form frm) { InitializeComponent(); InitForm(frm); // mainForm.SetDBLKCombox(ref dblkcbxInsuranceType_1, mainForm.dtInsuranceType); //mainForm.SetDBLKCombox(ref dblkcbxDieaseCode_1, mainForm.dtDiagnose == null ? mainForm.AssignComboxDT(out mainForm.dtDiease, mainForm.GetDirectory("4")) : mainForm.dtDiagnose); } private void InitForm(Form frm) { mainForm = (ToPutOnRecord)frm; CheckForIllegalCrossThreadCalls = false; // 禁用关闭按钮 this.FormBorderStyle = FormBorderStyle.None; // 隐藏标题栏 this.ControlBox = false; // 其他可能需要的配置 this.TopLevel = false; this.Dock = DockStyle.Fill; // 根据需要设置 Dock 属性 // tbFixedHosp.Text = fixmedinsName; cbApplyType.SelectedIndex = 1; rbLocal.Checked = true; cbFixMainFlag.SelectedIndex = 1; cbFixLocalType.SelectedIndex = 0; cbFixEvtType.SelectedIndex = 0; } private void btReadCard_1_Click(object sender, EventArgs e) { string PatInfo = ""; if (mainForm.GetPersonInfo(out PatInfo) != 0) { MessageBox.Show("读卡失败:" + PatInfo); } tbName_1.Text = Global.pat.name; tbPsnNO_1.Text = Global.pat.psn_no; tbPsnNo2_1.Text = tbPsnNO_1.Text = Global.pat.psn_no; foreach (DataRow row in ((DataTable)dblkcbxInsuranceType_1.DataSource).Rows) { if (row["Code"].ToString() == Global.pat.insuType) { dblkcbxInsuranceType_1.Text = row["Name"].ToString(); } } } private void btApply_1_Click(object sender, EventArgs e) { PersonFixedPointRecordInput input = new PersonFixedPointRecordInput(); input.psn_no = tbPsnNO_1.Text; input.tel = tbTel_1.Text; input.addr = tbAddress_1.Text; input.biz_appy_type = tools.getDestPosStrBySpliter(cbApplyType.Text, 1, "."); input.begndate = dpStart.Value.ToString("yyyy-MM-dd"); input.enddate = dpEnd.Value.ToString("yyyy-MM-dd"); input.agnter_name = tbAgentName.Text; input.agnter_cert_type = tools.getDestPosStrBySpliter(cbAgentCertType.Text, 1, "."); input.agnter_certno = tbAgentCertNO.Text; input.agnter_tel = tbAgentTel.Text; input.agnter_addr = tbAgentAddr.Text; input.agnter_rlts = tools.getDestPosStrBySpliter(cbAgentRelation.Text, 1, "."); input.fix_srt_no = tbSortNO.Text; input.fixmedins_code = fixmedinsCode; input.fixmedins_name = fixmedinsName; input.memo = tbMemo.Text; input.fix_local_type = tools.getDestPosStrBySpliter(cbFixLocalType.Text, 1, "."); input.fix_main_scd_flag = tools.getDestPosStrBySpliter(cbFixMainFlag.Text, 1, "."); var joData = new { data = JToken.Parse(JsonConvert.SerializeObject(input, Formatting.None)) }; TradeEnum trade = rbLocal.Checked ? TradeEnum.FixedPointRecordOfLocal : TradeEnum.FixedPointRecord; ; JObject joRtn = invoker.invokeCenterService(trade, JObject.FromObject(joData)); string err; if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0) { MessageBox.Show(err); } else { //存到后台 JObject joDbIn = input.ConvertToDBJson(); string declareNo = JsonHelper.getDestValue(joRtn, "output.result.trt_dcla_detl_sn"); joDbIn.Add("DeclareNo", declareNo); joDbIn.Add("RecordType", "F"); joDbIn.Add("RecordStatus", "1"); joDbIn.Add("CreateUser", Global.user.ID); joDbIn.Add("PatientName", Global.pat.name); joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09030001", joDbIn).ToString(), "插入/更新慢性病表"); if (JsonHelper.parseIrisRtnValue(joRtn, out err) != 0) { MessageBox.Show("插入失败"); } //查询后在下方表格显示 string sqlStr = $"select * from BS_InsuPersonnelRecord where DeclareNo ='{declareNo}'"; dgvApplyResult.DataSource = mainForm.QueryRecord(sqlStr, "查询慢病备案记录"); MessageBox.Show("申请成功"); } } private void btClose_1_Click(object sender, EventArgs e) { mainForm.Close(); } private void btAlter_Click(object sender, EventArgs e) { PersonFixedPointAlterInput input = new PersonFixedPointAlterInput(); input.psn_no = tbPsnNO_1.Text; input.begndate = dpStart.Value.ToString("yyyy-MM-dd"); input.enddate = dpEnd.Value.ToString("yyyy-MM-dd"); input.fix_evt_type = tools.getDestPosStrBySpliter(cbFixEvtType.Text, 1, "."); input.fixmedins_code = fixmedinsCode; input.memo = tbMemo.Text; input.fix_local_type = tools.getDestPosStrBySpliter(cbFixLocalType.Text, 1, "."); input.fix_main_scd_flag = tools.getDestPosStrBySpliter(cbFixMainFlag.Text, 1, "."); var joData = new { data = JToken.Parse(JsonConvert.SerializeObject(input, Formatting.None)) }; JObject joRtn = invoker.invokeCenterService(TradeEnum.FixedPointAlter, JObject.FromObject(joData)); string err; if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0) { MessageBox.Show(err); } } private void btQueryCenterRecord_1_Click(object sender, EventArgs e) { JObject joTmp = new JObject(); joTmp.Add("psn_no", tbPsnNo2_1.Text); joTmp.Add("biz_appy_type", tools.getDestPosStrBySpliter(cbApplyType.Text, 1, ".")); JObject joData = new JObject(); joData.Add("data", joTmp); JObject joRtn = invoker.invokeCenterService(TradeEnum.QueryFixedPointRecord, joData); string err; if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0) { MessageBox.Show(err); } else { JArray jaPsnfixmedin = JArray.FromObject(joRtn["output"]["result"]["psnfixmedin"]); dgvApplyResult.DataSource = (DataTable)jaPsnfixmedin.ToObject(typeof(DataTable)); //存到后台 //查询后在下方表格显示 MessageBox.Show("申请成功"); } } } }