| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- 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;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using PTMedicalInsurance.Helper;
- using PTMedicalInsurance.Variables;
- using PTMedicalInsurance.Common;
- using PTMedicalInsurance.Business;
- using PTMedicalInsurance.Entity;
- using PTMedicalInsurance.Forms.Setters.ToPutOnRecord;
- namespace PTMedicalInsurance.Forms.ToPutOnRecord
- {
- public partial class Trauma : Form
- {
- InvokeHelper invoker = new InvokeHelper();
- private MIIrisServices mis = new MIIrisServices();
- private Form mainForm;
- public string insuType, InsuplcAdmdvs;
- public Trauma()
- {
- InitializeComponent();
- }
- public Trauma(Form frm)
- {
- InitializeComponent();
- mainForm = frm;
- CheckForIllegalCrossThreadCalls = false;
- // 禁用关闭按钮
- this.FormBorderStyle = FormBorderStyle.None;
- // 隐藏标题栏
- this.ControlBox = false;
- // 其他可能需要的配置
- this.TopLevel = false;
- this.Dock = DockStyle.Fill; // 根据需要设置 Dock 属性
- GridViewSetter grd = new GridViewSetter();
- grd.SetHeaderTextOfTraumaApplyResult(dgvApplyResult);
- grd.DatagridviewColumnWidthAdaptation(dgvApplyResult);
- dpt_ST_Trauma.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
- dpt_ET_Trauma.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
- dpt_AdmDateTime_Trauma.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
- dpt_DateTime_Trauma.Text = DateTime.Now.ToString("yyyy-MM-01 00:00:00");
- rbg_Status.SelectedIndex = 2;
- }
- private void GetPatientInfo(string PatientInfo)
- {
- JObject joPatient = JObject.Parse(PatientInfo);
- JObject joBaseInfo = JObject.Parse(JsonHelper.getDestValue(joPatient, "output.baseinfo"));
- this.tbName.Text = joBaseInfo["psn_name"].ToString();
- this.tbPsnNO.Text = joBaseInfo["psn_no"].ToString();
- this.tbGend.Text = joBaseInfo["gend"].ToString();
- this.tbBirthDay.Text = joBaseInfo["brdy"].ToString();
- this.tbNaty.Text = joBaseInfo["naty"].ToString();
- this.tbCertType.Text = joBaseInfo["psn_cert_type"].ToString();
- this.tbCertNO.Text = joBaseInfo["certno"] + "";
- this.tbAge.Text = joBaseInfo["age"] + "";
- JObject joSelectedInsuInfo = JObject.Parse(JsonHelper.getDestValue(joPatient, "selectedInsuInfo"));
- insuType = JsonHelper.getDestValue(joSelectedInsuInfo, "insutype").ToString();
- tb_InsuplcAdmdvs.Text = InsuplcAdmdvs = JsonHelper.getDestValue(joSelectedInsuInfo, "insuplc_admdvs").ToString();
- //险种类型
- DataTable dtInsuType = (DataTable)dblkcbxInsuranceType.DataSource;
- for (int i = 0; i < dtInsuType.Rows.Count; i++)
- {
- if (dtInsuType.Rows[i]["Code"].ToString() == insuType)
- {
- dblkcbxInsuranceType.Text = dtInsuType.Rows[i]["Name"].ToString();
- }
- }
- }
- private void btn_ReadCard_Click(object sender, EventArgs e)
- {
- string outParam;
- //打开读卡窗口,操作员选择读卡类型后进行读卡器读卡,再进行1101获取参保信息
- PatientService patientService = new PatientService();
- int ret = patientService.readPatientInfo(out outParam);
- if (ret != 0)
- {
- MessageBox.Show("获取参保人员基本信息失败:" + outParam);
- return;
- }
- GetPatientInfo(outParam);
- }
- private void btn_Exit_Click(object sender, EventArgs e)
- {
- mainForm.Close();
- }
- private void btn_Reg_Click(object sender, EventArgs e)
- {
- string outParam = string.Empty, errorMsg = string.Empty;
- JObject joData = new JObject();
- joData.Add("psn_no", Global.pat.psn_no);
- joData.Add("insutype", insuType);
- joData.Add("begndate", dpt_ST_Trauma.Text);
- joData.Add("enddate", dpt_ET_Trauma.Text);
- joData.Add("psn_cert_type", "01"); //01身份证
- joData.Add("certno", Global.pat.certNO);
- joData.Add("tel", "");
- joData.Add("addr", "");
- joData.Add("insu_admdvs", Global.pat.insuplc_admdvs);
- joData.Add("emp_no", "");
- joData.Add("emp_name", "");
- joData.Add("mdtrt_id", "");
- joData.Add("setl_id", "");
- joData.Add("trum_part", "");
- joData.Add("trum_time", dpt_DateTime_Trauma.Text);
- joData.Add("trum_site", "");
- joData.Add("trum_rea", "");
- joData.Add("adm_mtd", "");
- joData.Add("adm_time", dpt_AdmDateTime_Trauma.Text);
- joData.Add("adm_diag_dscr", "");
- joData.Add("agnter_name", "");
- joData.Add("agnter_cert_type", "");
- joData.Add("agnter_certno", "");
- joData.Add("agnter_tel", "");
- joData.Add("agnter_addr", "");
- joData.Add("agnter_rlts", "");
- joData.Add("biz_used_flag", "1"); //0-否,1-是
- joData.Add("memo", "");
- joData.Add("ttp_pay_prop", "");
- JObject joInput = new JObject();
- joInput.Add("data", joData);
- JObject joRtn = invoker.invokeCenterService(TradeEnum.TraumaRecord, joInput);
- if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
- {
- MessageBox.Show("【2560】外伤备案登记失败:" + errorMsg);
- return;
- }
- else
- {
- //存到后台
- //TraumaRecordInput TraumaIn = JsonConvert.DeserializeObject<TraumaRecordInput>(joRtn.ToString());
- //JObject joDbIn = TraumaIn.ConvertToDBJson();
- string declareNo = JsonHelper.getDestValue(joRtn, "output.trtDclaDetlSn");
- JObject joDbIn = new JObject();
- joDbIn.Add("PersonnelNO", Global.pat.psn_no);
- joDbIn.Add("Insutype", insuType);
- joDbIn.Add("InsuranceAreaCode", Global.pat.insuplc_admdvs);
- joDbIn.Add("BusinHospCode", Global.inf.hospitalNO);
- joDbIn.Add("BusinHospDesc", Global.inf.hospitalName);
- joDbIn.Add("BusinStartDate", dpt_ST_Trauma.Text);
- joDbIn.Add("BusinEndDate", dpt_ET_Trauma.Text);
- joDbIn.Add("BusinDate", DateTime.Now.ToString("yyyy-MM-dd"));
- joDbIn.Add("AreaCode", Global.pat.mdtrtarea_admvs);
- joDbIn.Add("AdmDateTime", dpt_AdmDateTime_Trauma.Text);
- joDbIn.Add("TraumaDateTime", dpt_DateTime_Trauma.Text);
- joDbIn.Add("AgnterCertType", "01"); //证件类型 01身份证
- joDbIn.Add("AgnterCertNo", Global.pat.certNO); //证件号码
- joDbIn.Add("DeclareNo", declareNo);
- joDbIn.Add("RecordType", "Tr"); //
- 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 errorMsg) != 0)
- {
- MessageBox.Show("插入失败");
- return;
- }
- MessageBox.Show("外伤备案登记成功");
- }
- }
- private DataTable QueryRecord(string sqlStr, string desc)
- {
- JObject joRtn = mis.DynamicQuery(sqlStr, desc);
- string err;
- if (JsonHelper.parseIrisRtnValue(joRtn, out err) != 0)
- {
- MessageBox.Show("查询失败");
- return null;
- }
- return (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
- }
- private void QueryData()
- {
- string sqlStr = " select Top 100 * from BS_InsuPersonnelRecord "
- + " Where Hospital_Dr= " + Global.inf.hospitalDr
- + " AND Interface_Dr= " + Global.inf.interfaceDr;
- if (rbg_Status.SelectedIndex == 0)
- sqlStr = sqlStr + " And RecordStatus=1";
- else
- if (rbg_Status.SelectedIndex == 1)
- sqlStr = sqlStr + " And RecordStatus=-1";
- if (!string.IsNullOrEmpty(tb_CertNo.Text))
- sqlStr = sqlStr + " And AgnterCertNo= '" + tb_CertNo.Text + "'";
- sqlStr = sqlStr + " Order By ID DESC ";
- dgvApplyResult.DataSource = QueryRecord(sqlStr, "查询外伤备案登记记录");
- }
- private void btn_Query_Click(object sender, EventArgs e)
- {
- QueryData();
- }
- private void btn_Cancel_Click(object sender, EventArgs e)
- {
- string err;
- if (dgvApplyResult.RowCount == 0)
- {
- MessageBox.Show("请先查询外伤备案登记信息!");
- return;
- }
- if ((rtb_CancelReason.Text == "请输入撤销原因") || (string.IsNullOrEmpty(rtb_CancelReason.Text)))
- {
- MessageBox.Show("请输入撤销原因");
- if (rtb_CancelReason.CanSelect) { rtb_CancelReason.SelectAll(); }
- return;
- }
- int i = dgvApplyResult.SelectedIndex;
- if (dgvApplyResult.Rows[i].Cells["RecordStatus"].Value.ToString() != "1")
- {
- MessageBox.Show("当前外伤备案记录已撤销,请检查!");
- return;
- }
- string PersonnelNO = dgvApplyResult.Rows[i].Cells["PersonnelNO"].Value.ToString();
- string PatientName = dgvApplyResult.Rows[i].Cells["PatientName"].Value.ToString();
- string DeclareNo = dgvApplyResult.Rows[i].Cells["DeclareNo"].Value.ToString();
- JObject joInput = new JObject();
- joInput.Add("psn_no", PersonnelNO);
- joInput.Add("trt_dcla_detl_sn", DeclareNo);
- joInput.Add("memo", rtb_CancelReason.Text);
- JObject joData = new JObject();
- joData.Add("data", joInput);
- JObject joRtn = invoker.invokeCenterService(TradeEnum.TraumaCancelRecord, joData);
- if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
- {
- MessageBox.Show(err);
- return;
- }
- else
- {
- //更新后台
- JObject joDbIn = new JObject();
- joDbIn.Add("PersonnelNO", PersonnelNO);
- joDbIn.Add("PatientName", PatientName);
- joDbIn.Add("DeclareNo", DeclareNo);
- joDbIn.Add("RecordType", "Tr"); //
- joDbIn.Add("RecordStatus", "-1");
- joDbIn.Add("CreateUser", Global.user.ID);
- joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09030001", joDbIn).ToString(), "插入/更新备案登记信息表");
- if (JsonHelper.parseIrisRtnValue(joRtn, out err) != 0)
- {
- MessageBox.Show("中心撤销成功但HIS医保平台撤销更新失败,请联系管理员手工处理");
- return;
- }
- else
- {
- MessageBox.Show("外伤备案登记撤销成功");
- QueryData();
- }
- }
- }
- }
- }
|