| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554 | 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 PTMedicalInsurance.Helper;using PTMedicalInsurance.Common;using Newtonsoft.Json.Linq;using PTMedicalInsurance.FormSetter;using PTMedicalInsurance.Variables;using FastReport;using Newtonsoft.Json;using System.Threading;using PTMedicalInsurance.Business;namespace PTMedicalInsurance.Forms{        public partial class SettlementChecklist : Form    {        private int hospitalDr;        private int interfaceDr;        private string hospitalNO;        private string interfaceNO;        private string hospitalName;        private string hospitalAreaCode;        private bool disposed = false;        private InsuServices iris = new InsuServices();        Thread thread_test;        private InvokeHelper invoker = new InvokeHelper();        public SettlementChecklist()        {            InitializeComponent();            hospitalDr = Global.inf.hospitalDr;            hospitalNO = Global.inf.hospitalNO;            hospitalName = Global.inf.hospitalName;            hospitalAreaCode = Global.inf.areaCode;        }        public SettlementChecklist(JObject joParam)        {            InitializeComponent();            hospitalDr = Global.inf.hospitalDr;            hospitalNO = Global.inf.hospitalNO;            hospitalName = Global.inf.hospitalName;            hospitalAreaCode = Global.inf.areaCode;            if (joParam == null) return;            string setl_id = JsonHelper.getDestValue(joParam, "setl_id");            if (setl_id == "")            {                MessageBox.Show("根据传入的结算编号为查询到相关信息,请手动输入查询!");                return;            }            string sqlStr = "SELECT * FROM  BS_MedInsuSettlement WHERE Hospital_Dr=" + Global.inf.hospitalDr;            sqlStr = sqlStr + " and SettlementID='" + setl_id + "'";            JObject joSqlstr = new JObject();            joSqlstr.Add("sqlStr", sqlStr);            JArray jaParam = new JArray();            jaParam.Add(joSqlstr);            JObject joSettlQuery = new JObject();            joSettlQuery.Add("params", jaParam);            joSettlQuery.Add("code", "09010059");            InvokeHelper invoker = new InvokeHelper();            JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");            DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));            dgvSettlRecord.DataSource = dt;        }        public void Dispose()        {            Dispose1(true);            GC.SuppressFinalize(this);        }        protected virtual void Dispose1(bool disposing)        {            if (thread_test == null) return;            if (disposed == false)            {                if (disposing == true)                {                        Thread.Sleep(100);                        Global.writeLog("Main - aborting my thread.");                        thread_test.Abort();//终止线程myThread                        thread_test.Join();//等待线程myThread结束                        Global.writeLog("Main - ending.");                                    }                //                //释放托管资源的代码            }            disposed = true;        }        private void rbgDirecType_ValueChanged(object sender, int index, string text)        {        }        private void btnQuery_Click(object sender, EventArgs e)        {            string sqlStr = "SELECT * FROM  BS_MedInsuSettlement WHERE Hospital_Dr=" + hospitalDr ;            sqlStr = sqlStr + " and OccurTime>'" + dpST.Text + "'";            sqlStr = sqlStr + " and OccurTime<'" + dpED.Text + "'";            if (tbName.Text != "")            {                sqlStr = sqlStr + " and PatientName='" + tbName.Text + "'";            }            if (tbPatSettlID.Text != "")            {                sqlStr = sqlStr + " and SettlementID='" + tbPatSettlID.Text + "'";            }            if (tbHisNO.Text != "")            {                sqlStr = sqlStr + " and Adm_Dr='" + tbHisNO.Text + "'";            }            if (rbgBillType.SelectedIndex == 1)            {                sqlStr = sqlStr + " and BillType=1 and ValidFlag=1 ";            }            if (rbgBillType.SelectedIndex == 2)            {                sqlStr = sqlStr + " and BillType=-1 and ValidFlag=0  ";            }                        JObject joRtn = iris.querySettlementInfo(sqlStr);            DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));            dgvSettlRecord.DataSource = dt;        }        private void SettlementChecklist_Load(object sender, EventArgs e)        {            dpST.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");            dpED.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");            tbName.Text = Global.pat.name;            ComboxSetter cbxSetter = new ComboxSetter();            cbxSetter.setCbxInterfaceDataSource(cbxInterface);            GridViewSetter grdSetter = new GridViewSetter();            grdSetter.SetHeaderTextOfSettlList(dgvSettlRecord);            rbgAdmType.SelectedIndex = 0;            rbgBillType.SelectedIndex = 1;            cbxInterface.SelectedValueChanged += new EventHandler(cbxInterface_SelectedValueChanged);            btnDesign.Visible = false;                    }        private void cbxInterface_SelectedValueChanged(object sender, EventArgs e)        {            DataTable dt = (DataTable)cbxInterface.DataSource;            int i = cbxInterface.SelectedIndex;            //赋值            hospitalNO = dt.Rows[i]["HospitalNO"].ToString();            //MessageBox.Show(dt.Rows[i]["HospitalDr"].ToString());            //MessageBox.Show(dt.Rows[i]["HospitalDr"].ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);            hospitalDr = int.Parse(dt.Rows[i]["HospitalDr"].ToString());            interfaceNO = dt.Rows[i]["InterfaceNO"].ToString();            interfaceDr = int.Parse(dt.Rows[i]["ID"].ToString());            hospitalAreaCode = dt.Rows[i]["AreaCode"].ToString();            //Global.inf.centerURL = dt.Rows[i]["CenterURL"].ToString();            //Global.inf.businessDllName = dt.Rows[i]["DLLName"].ToString();            //Global.inf.patientAreaCode = dt.Rows[i]["AreaCode"].ToString();        }        private string getPatCheckList()        {            try            {                int i = dgvSettlRecord.CurrentRow.Index;                DataTable dt = (DataTable)dgvSettlRecord.DataSource;                JObject joSettel = new JObject();                joSettel.Add("HospitalDr", Global.inf.hospitalDr);                joSettel.Add("interfaceDr", Global.inf.interfaceDr);                joSettel.Add("admID", dt.Rows[i]["AdmID"].ToString());                joSettel.Add("SettlementID", dt.Rows[i]["SettlementID"].ToString());                joSettel.Add("ValidFlag", dt.Rows[i]["ValidFlag"].ToString());                JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");                return joRtn.ToString();            }            catch (Exception ex)            {                MessageBox.Show(ex.Message);                return "";            }        }        private void uiPanel1_Click(object sender, EventArgs e)        {        }        [STAThread]        public void design()        {            try            {                string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";                FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);                int i = dgvSettlRecord.CurrentRow.Index;                DataTable dt = (DataTable)dgvSettlRecord.DataSource;                JObject joSettel = new JObject();                joSettel.Add("HospitalDr", Global.inf.hospitalDr);                joSettel.Add("admID", dt.Rows[i]["AdmID"].ToString());                joSettel.Add("SettlementID", dt.Rows[i]["SettlementID"].ToString());                joSettel.Add("ValidFlag", dt.Rows[i]["ValidFlag"].ToString());                JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");                Root json = JsonConvert.DeserializeObject<Root>(joRtn.ToString());                Report report = new Report();                report.RegisterData(json.result.data.classification, "classification");                report.RegisterData(json.result.data.settlement, "settlement");                report.RegisterData(json.result.data.reginfo, "reginfo");                report.Load(Global.curEvt.path + "\\frx\\Test.frx");                PrintDesign pf = new PrintDesign();                pf.designerControl1.Report = report;                report.Design();                pf.WindowState = FormWindowState.Maximized;                pf.ShowDialog();              }            catch (Exception ex)            {                MessageBox.Show(ex.Message);            }                    }        [STAThread]        private void print()        {            string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";            FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);                        var json = JsonConvert.DeserializeObject<Root>(getPatCheckList());            Report report = new Report();            report.RegisterData(json.result.data.classification, "classification");            report.RegisterData(json.result.data.settlement, "settlement");            report.RegisterData(json.result.data.reginfo, "reginfo");            //report.Design();            report.Load(Global.curEvt.path + "\\frx\\Test.frx");            this.ShowInTaskbar = true;            PrintPreview pf = new PrintPreview();            report.Preview = pf.previewControl1;                     report.Show();            pf.WindowState = FormWindowState.Maximized;            pf.ShowDialog();                    }        [STAThread]        private void preview()        {            var json = JsonConvert.DeserializeObject<Root>(getPatCheckList());            Report report = new Report();            report.RegisterData(json.result.data.classification, "classification");            report.RegisterData(json.result.data.settlement, "settlement");            report.RegisterData(json.result.data.reginfo, "reginfo");            //report.Design();            report.Load(Global.curEvt.path + "\\frx\\Test.frx");            //report.Show();            PrintPreview preview1 = new PrintPreview();            preview1.Show();            report.Preview = preview1.previewControl1;            report.Prepare(); //准备            report.ShowPrepared(); //显示            preview1.Show();        }        private void uiButton2_Click(object sender, EventArgs e)        {            Close();        }        public void btnPrint_Click(object sender, EventArgs e)        {            try            {                                #region【调用银海COM组件打印结算单弹框-P0001交易】                //调用银海com组件读卡弹框 P0001交易                InvokeHelper yinhaiCom = new InvokeHelper();                JObject joInputP0001 = new JObject();                dynamic joDataP0001 = new JObject();                string errorMsg = "";                int iHis = dgvSettlRecord.CurrentRow.Index;                joDataP0001.setlId = dgvSettlRecord.Rows[iHis].Cells["SettlementID"].Value;                joDataP0001.mdtrtId = dgvSettlRecord.Rows[iHis].Cells["MdtrtID"].Value;                joDataP0001.psn_no = dgvSettlRecord.Rows[iHis].Cells["PersonnelNO"].Value;                joDataP0001.medinsSetlId = dgvSettlRecord.Rows[iHis].Cells["MSGID"].Value;                //joDataP0001.msgId = dgvSettlRecord.Rows[iHis].Cells["MSGID"].Value;                dynamic InputP0001 = new JObject();                InputP0001.data = JObject.FromObject(joDataP0001);                //交易输入报文格式                joInputP0001["TOKEN"] = "";                joInputP0001["cainfo"] = "";                joInputP0001["fixmedins_code"] = Global.inf.hospitalNO;                joInputP0001["fixmedins_name"] = Global.inf.hospitalName;                joInputP0001["inf_time"] = DateTime.Now.ToString("yyyy-mm-dd HH:mm:ss");                joInputP0001["infno"] = "P0001";                joInputP0001["infver"] = "V1.0";                joInputP0001.Add("input", JObject.FromObject(InputP0001));                joInputP0001["oinfno"] = "";                joInputP0001["sign_no"] = Global.curEvt.signno;                joInputP0001["msgid"] = Global.inf.hospitalNO + DateTime.Now.ToString("yyyyMMddHHmmssffff");                joInputP0001["opter"] = Global.user.ID;                joInputP0001["opter_name"] = Global.user.name;                joInputP0001["pay_loc"] = "";                joInputP0001["recer_admvs"] = Global.inf.areaCode;                joInputP0001["sender_admdvs"] = Global.inf.areaCode;                joInputP0001["insuplc_admdvs"] = Global.inf.areaCode;                joInputP0001["mdtrtarea_admvs"] = Global.inf.areaCode;                joInputP0001["recer_sys_code"] = "GuangXi";                joInputP0001["opter_type"] = Global.user.type;                //MessageBox.Show(joInputP0001.ToString());                string sRtnValueP0001 = string.Empty;                yinhaiCom.Call("P0001", joInputP0001.ToString(), out sRtnValueP0001);                JObject joRtnP0001 = new JObject();                joRtnP0001 = JObject.Parse(sRtnValueP0001);                if (JsonHelper.parseCenterRtnValue(joRtnP0001, out errorMsg) != 0)                {                    MessageBox.Show("调用银海打印结算单控件失败:" + errorMsg);                    return;                }                #endregion                //Thread thread = new Thread(new ThreadStart(print));                //thread.SetApartmentState(ApartmentState.STA); //重点                //thread.Start();                //thread.Join();            }            catch (Exception ex)            {                Global.writeLog("结算单打印异常:" + ex.Message);                MessageBox.Show("打印异常:" + ex.Message);            }                    }        private void btnDesign_Click(object sender, EventArgs e)        {            thread_test = new Thread(new ThreadStart(design));            thread_test.SetApartmentState(ApartmentState.STA); //重点            thread_test.Start();        }        private void SettlementChecklist_FormClosed(object sender, FormClosedEventArgs e)        {            Dispose();        }    }    // Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);    public class Classification    {        public double cwfSummat { get; set; }        public double cwfInScope { get; set; }        public double cwfPreSelfPay { get; set; }        public double cwfOverLimit { get; set; }        public double cwfFullOwnPay { get; set; }        public double zcfSummat { get; set; }        public double zcfInScope { get; set; }        public double zcfPreSelfPay { get; set; }        public double zcfOverLimit { get; set; }        public double zcfFullOwnPay { get; set; }        public double jcfSummat { get; set; }        public double jcfInScope { get; set; }        public double jcfPreSelfPay { get; set; }        public double jcfOverLimit { get; set; }        public double jcfFullOwnPay { get; set; }        public double hyfSummat { get; set; }        public double hyfInScope { get; set; }        public double hyfPreSelfPay { get; set; }        public double hyfOverLimit { get; set; }        public double hyfFullOwnPay { get; set; }        public double zlfSummat { get; set; }        public double zlfInScope { get; set; }        public double zlfPreSelfPay { get; set; }        public double zlfOverLimit { get; set; }        public double zlfFullOwnPay { get; set; }        public double ssfSummat { get; set; }        public double ssfInScope { get; set; }        public double ssfPreSelfPay { get; set; }        public double ssfOverLimit { get; set; }        public double ssfFullOwnPay { get; set; }        public double hlfSummat { get; set; }        public double hlfInScope { get; set; }        public double hlfPreSelfPay { get; set; }        public double hlfOverLimit { get; set; }        public double hlfFullOwnPay { get; set; }        public double wsclfSummat { get; set; }        public double wsclfInScope { get; set; }        public double wsclfPreSelfPay { get; set; }        public double wsclfOverLimit { get; set; }        public double wsclfFullOwnPay { get; set; }        public double xyfSummat { get; set; }        public double xyfInScope { get; set; }        public double xyfPreSelfPay { get; set; }        public double xyfOverLimit { get; set; }        public double xyfFullOwnPay { get; set; }        public double zyypfSummat { get; set; }        public double zyypfInScope { get; set; }        public double zyypfPreSelfPay { get; set; }        public double zyypfOverLimit { get; set; }        public double zyypfFullOwnPay { get; set; }        public double zcyfSummat { get; set; }        public double zcyfInScope { get; set; }        public double zcyfPreSelfPay { get; set; }        public double zcyfOverLimit { get; set; }        public double zcyfFullOwnPay { get; set; }        public double ybzlfSummat { get; set; }        public double ybzlfInScope { get; set; }        public double ybzlfPreSelfPay { get; set; }        public double ybzlfOverLimit { get; set; }        public double ybzlfFullOwnPay { get; set; }        public double ghfSummat { get; set; }        public double ghfInScope { get; set; }        public double ghfPreSelfPay { get; set; }        public double ghfOverLimit { get; set; }        public double ghfFullOwnPay { get; set; }        public double qtSummat { get; set; }        public double qtInScope { get; set; }        public double qtPreSelfPay { get; set; }        public double qtOverLimit { get; set; }        public double qtFullOwnPay { get; set; }        public double totalSummat { get; set; }        public double totalInScope { get; set; }        public double totalPreSelfPay { get; set; }        public double totalOverLimit { get; set; }        public double totalFullOwnPay { get; set; }    }    public class Data    {        public List<Classification> classification { get; set; }        public List<Settlement> settlement { get; set; }        public List<Reginfo> reginfo { get; set; }    }    public class Result    {        public Data data { get; set; }    }    public class Root    {        public Result result { get; set; }        public int errorCode { get; set; }        public string errorMessage { get; set; }    }    public class Settlement    {        public int AdmID { get; set; }        public string MdtrtID { get; set; }        public string SettlementID { get; set; }        public string PersonnelNO { get; set; }        public string PatientName { get; set; }        public string birth { get; set; }        public string CertificateNO { get; set; }        public string Gender { get; set; }        public string InsuranceType { get; set; }        public string PersonType { get; set; }        public string CivilserviceFlag { get; set; }        public string SettlementTime { get; set; }        public string MedicalType { get; set; }        public string Sumamt { get; set; }        public string OwnPayAmount { get; set; }        public string OverLimitAmount { get; set; }        public string PreSelfPayAmount { get; set; }        public string InPolicyRangeAmount { get; set; }        public int ActualPayDeductible { get; set; }        public string HealthInsurancePay { get; set; }        public string CivilserviceAllowancePay { get; set; }        public string EnterpriseSupplementPay { get; set; }        public string SeriousIllnessPay { get; set; }        public string LargeExpensesSupplementPay { get; set; }        public string MedicalAssistPay { get; set; }        public string HospitalPartAmount { get; set; }        public string OtherPay { get; set; }        public string FundPaySumamt { get; set; }        public string PersonPaySumamt { get; set; }        public string AccountPaySumamt { get; set; }        public string PersonCashPay { get; set; }        public string Balance { get; set; }        public string AccountMutualAidAmount { get; set; }        public string OrganSettlementID { get; set; }        public string ClearingOrgan { get; set; }        public string ClearingWay { get; set; }        public string ClearingType { get; set; }        public int ValidFlag { get; set; }        public string msgid { get; set; }        public int BillType { get; set; }        public int BillID { get; set; }        public int admType { get; set; }        public string RecordID { get; set; }        public string insuplc_admdvs { get; set; }    }    public class Reginfo    {        public string AttendDoctorNO { get; set; }        public string ChiefPhyDocName { get; set; }        public string AdmitDepartmentCode { get; set; }        public string AdmitDepartmentName { get; set; }        public string AdmBed { get; set; }        public string MainDiagCode { get; set; }        public string MainDiagName { get; set; }        public string RegDate { get; set; }        public string ConerName { get; set; }        public string Tel { get; set; }    }}
 |