1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626 |
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using PTMedicalInsurance.Business;
- using PTMedicalInsurance.Helper;
- using PTMedicalInsurance.Variables;
- using PTMedicalInsurance.FormSetter;
- using PTMedicalInsurance.Common;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace PTMedicalInsurance.Forms
- {
- public partial class BasicData : Form
- {
- //设置实例
- CenterBusiness cBus = new CenterBusiness();
- HisMainBusiness hBus = new HisMainBusiness();
- HisIrisServices hIS = new HisIrisServices();
- MIIrisServices mIS = new MIIrisServices();
- InvokeHelper invoker = new InvokeHelper();
- InsuServices Iis = new InsuServices();
- FileHandle comp = new FileHandle();
- DataImoport bus = new DataImoport();
- //1.声明自适应类实例
- AutoResizeForm asc = new AutoResizeForm();
- public JObject joSelectedInsuInfo;
- public int insuInfoIndex = 0;
- public int idInfoIndex = 0;
- DataTable dtExport;
- DataTable dtImport;
- public string Type = "", MedInsuType = "";
- public int HisType;
- public int iRecordCount = 0;
- public BasicData()
- {
- InitializeComponent();
- rbgDirecType.SelectedIndex = 0;
- rbgDirecType_C.SelectedIndex = 0;
- rbSingleDown.Checked = true;
- this.rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(this.rbgDirecType_ValueChanged);
- this.pgDownload.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.pgDownload_PageChanged);
- this.pgCenterDirect.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.pgCenterDirect_PageChanged);
- Font rowFont = new Font("UTF-8", 8);
- Font columnFont = new Font("UTF-8", 9);
- rbgDirecType.SelectedIndex = 8;
- rbAll.Checked = true;
- //tabControl1.SelectedIndex = 1;
- //this.StartPosition = FormStartPosition.CenterParent;
- asc.controllInitializeSize(this);
- asc.controlAutoSize(this);
- }
- #region 函数封装
- private void queryInsuDirectory(int currentPage, int pageSize, int directoryType, int interfaceDr, string code)
- {
- try
- {
- string dirCode = "";
- string dirName = "";
- string approvalNO = "";
- string manufacturer = "";
- Sunny.UI.UIDataGridView dgv;
- Sunny.UI.UIPagination pg;
- if (tabControl1.SelectedIndex == 0)
- {
- dirCode = tbDirectoryCode.Text;
- dirName = tbDircetoryName.Text;
- approvalNO = "";
- dgv = dgvDirectoy;
- pg = pgDownload;
- }
- else
- {
- dirName = tbCenterDirectoryFilter.Text;
- dirCode = tbInsuCode.Text;
- dgv = dgvCenterDirectory;
- approvalNO = tbApprovalNO.Text;
- pg = pgCenterDirect;
- manufacturer = tbManufacturer.Text;
- }
- JObject joInput = new JObject {
- { "currentPage" , currentPage },
- { "pageSize" , pageSize },
- { "serviceCode" , code },
- { "directoryType" , directoryType },
- { "directoryCode" , dirCode },
- { "directoryName" , dirName },
- { "approvalNO" , approvalNO },
- { "manufacturer" , manufacturer },
- { "directoryDr" , interfaceDr }
- };
- JObject joRtn = mIS.getMIDirectoryByPagination(joInput);
- if (joRtn["errorCode"].ToString() != "0")
- {
- MessageBox.Show("IRIS数据返回错误:" + joRtn["errorMessage"].ToString());
- return;
- }
- if (joRtn["result"]["rows"] == null)
- {
- MessageBox.Show("该节点不存在");
- return;
- }
- if (joRtn["result"]["total"].ToString() == "0")
- {
- MessageBox.Show("未查询到数据");
- dgv.DataSource = null;
- return;
- }
- DataTable dt = (DataTable)joRtn["result"]["rows"].ToObject(typeof(DataTable));
- int totalCount = int.Parse(joRtn["result"]["total"].ToString());
- pg.TotalCount = totalCount;
- pg.PageSize = pageSize;
- dgv.DataSource = dt;
- dgv.Columns[0].ReadOnly = true;
- }
- catch (Exception ex)
- {
- MessageBox.Show("查询异常:" + ex.Message);
- }
- }
- private void setHeaderTxt(int directoryType, Sunny.UI.UIDataGridView dgv)
- {
- GridViewSetter gvdSetter = new GridViewSetter();
- switch (directoryType)
- {
- case 0://药品
- {
- gvdSetter.SetHeaderTextOfDrug(dgv);
- break;
- }
- case 1://诊疗
- {
- gvdSetter.SetHeaderTextOfMedicalService(dgv);
- break;
- }
- case 2://材料
- {
- gvdSetter.SetHeaderTextOfMaterials(dgv);
- break;
- }
- case 3://疾病诊断
- {
- gvdSetter.SetHeaderTextOfDiagnose(dgv);
- break;
- }
- case 4://手术
- {
- gvdSetter.SetHeaderTextOfDiagnose(dgv);
- break;
- }
- case 5://慢性病
- {
- gvdSetter.SetHeaderTextOfDiagnose(dgv);
- break;
- }
- case 6://DRGs
- {
- gvdSetter.SetHeaderTextOfDiagnose(dgv);
- break; ;
- }
- case 7://日间手术
- {
- gvdSetter.SetHeaderTextOfDiagnose(dgv);
- break; ;
- }
- case 8://字典表
- {
- gvdSetter.SetHeaderTextOfDictionary(dgv);
- break;
- }
- case 9://中药饮片下载
- {
- gvdSetter.SetHeaderTextOfChineseMedicine(dgv);
- break;
- }
- case 10://医药机构制剂目录下载
- {
- gvdSetter.SetHeaderTextOfPreparation(dgv);
- break;
- }
- case 11://肿瘤形态学下载
- {
- gvdSetter.SetHeaderTextOfTumorMorphology(dgv);
- break;
- }
- case 12://中医疾病下载
- {
- gvdSetter.GetChineseDiagnoseJsonByTxt(dgv);
- break;
- }
- case 13://中医证候下载
- {
- gvdSetter.GetTCMSyndromeJsonByTxt(dgv);
- break;
- }
- case 14://民族药品
- {
- gvdSetter.GetEthnicMedicineJsonByTxt(dgv);
- break;
- }
- case 15://目录信息查询
- {
- gvdSetter.GetMedInsuCatalogJsonByTxt(dgv);
- break;
- }
- case 16://医疗与医保目录匹配关系查询
- {
- gvdSetter.GetMedInsuCorrespondencJsonByTxt(dgv);
- break;
- }
- case 17://医药机构目录匹配查询
- {
- gvdSetter.GetMedInstCorrespondencJsonByTxt(dgv);
- break;
- }
- case 18://医保目录限价查询
- {
- gvdSetter.GetMedInsuFixedPriceJsonByTxt(dgv);
- break;
- }
- case 19://医保目录先自付比例下载
- {
- gvdSetter.GetMedInsuFirstPayProportionJsonByTxt(dgv);
- break;
- }
- case 20://医药机构信息
- {
- gvdSetter.GetMedicalInstitutionJsonByTxt(dgv);
- break;
- }
- }
- }
- private void queryHISInsuDirectory(int directoryType, int pageIndex, int count, Sunny.UI.UIDataGridView dgv, int interfaceDr)
- {
- string code = "09010042";
- if (tabControl1.SelectedIndex == 0)
- {
- if (rbgDirecType.SelectedIndex == 20)
- {
- code = "090100XX";
- }
- else if (rbgDirecType.SelectedIndex == 8)
- {
- code = "09010043";
- }
- else
- {
- code = "09010042";
- }
- if (rbgDirecType.SelectedIndex <= 13)
- {
- queryInsuDirectory(pageIndex, count, directoryType + 1, interfaceDr, code);
- setHeaderTxt(directoryType, dgv);
- }
- else //几个医保查询该部分数据不存数据库只是临时查询(除医疗机构信息查询外)
- {
- //生成DataView列
- //setHeaderTxt(directoryType, dgv);
- string pages, recordCounts, errorMessage;
- dynamic joData = GetInput(rbgDirecType.SelectedIndex, out string funNo);
- JObject joRtn = cBus.InvokeMedicalInsuranceInquiry(funNo, joData);
- if (joRtn["infcode"].ToString() == "0")
- {
- try
- {
- Sunny.UI.UIPagination pg;
- dgv = dgvDirectoy;
- pg = pgDownload;
- DataTable dt;
- if (rbgDirecType.SelectedIndex == 20)
- {
- dt = (DataTable)joRtn["output"]["medinsinfo"].ToObject(typeof(DataTable));
- if (joRtn["output"]["medinsinfo"].ToString() == "")
- {
- MessageBox.Show("查询成功,但返回结果集为空!");
- //return;
- }
- pg.TotalCount = 50;
- pg.PageSize = 50;
- }
- else
- {
- pages = joRtn["output"]["pages"].ToString(); //页数
- recordCounts = joRtn["output"]["recordCounts"].ToString(); //总记录条数
- dt = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
- if (recordCounts == "0")
- {
- MessageBox.Show("查询成功,但返回结果集为空!");
- //return;
- }
- pg.TotalCount = int.Parse(recordCounts);
- pg.PageSize = int.Parse(TexBYSJL.Text); //int.Parse(pages);
- }
- dgv.DataSource = dt;
- dgv.Columns[0].ReadOnly = true;
- }
- catch (Exception ex)
- {
- MessageBox.Show("查询异常:" + ex.Message);
- }
- }
- else
- {
- errorMessage = "调用交易" + funNo + "出现错误,请查看日志!"; //joImportRtn["errorMessage"].ToString();
- MessageBox.Show(errorMessage);
- return;
- }
- }
- }
- else
- {
- queryInsuDirectory(pageIndex, count, directoryType + 1, interfaceDr, code);
- setHeaderTxt(directoryType, dgv);
- }
- }
- private int queryHISDirectory(int currentPage, int pageSize, out string errMsg)
- {
- errMsg = ""; string flag = "";
- JObject joHISRtn = new JObject();
- JObject joRtn = new JObject();
- string directoryType = string.Empty;
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- {
- directoryType = "drugs";
- break;
- }
- case 1:
- {
- directoryType = "diagnosi";
- break;
- }
- case 2:
- {
- directoryType = "consumables";
- break;
- }
- }
-
- //全部是先调HIS,然后再匹配医保平台的对照关系
- if (rbAll.Checked)
- {
- JArray jaPagination = new JArray();
- JArray jaParams = new JArray();
- flag = "All";
- dynamic joParam = new JObject();
- joParam.code = "";
- joParam.descripts = "";
- joParam.FindType = new JArray();
- joParam.TypeID = "";
- joParam.alias = tbHISDirectoryFilter.Text;
- joParam.include = "Hosp";
- joParam.groupID = "324";
- joParam.hospID = Global.inf.hisHospitalDr;
- joParam.interfaceDr = Global.inf.interfaceDr;
- joParam.type = directoryType;
- joParam.flag = flag;
- joParam.specInput = "";
- jaParams.Add(joParam);
- dynamic joPagination = new JObject();
- joPagination.pageSize = pageSize;
- //joPagination.pageSize = 2;
- joPagination.currentPage = currentPage;
- joPagination.sortColumn = "Code";
- joPagination.sortOrder = "asc";
- jaPagination.Add(joPagination);
- //该服务需要改写,需要跟(CloudMedicalInsurancePlatform.Tables.MapRelation)进行关联
- //joInParams.code = "09010038";
- if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
- {
- return -1;
- }
-
- //int.TryParse(JsonHelper.getDestValue(joHISRtn, "result.TotalCount"), out iRecordCount);
- joRtn = mIS.ConvertHISDir(joHISRtn);
- if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
- {
- return -1;
- }
- }
- //已对照是先调云医保,然后再匹配HIS
- if (rbMaped.Checked)
- {
- JArray jaPagination = new JArray();
- JArray jaParams = new JArray();
- flag = "Maped";
- dynamic joParam = new JObject();
- joParam.alias = tbHISDirectoryFilter.Text;
- joParam.HospitalDr = Global.inf.hospitalDr;
- joParam.InterfaceDr = Global.inf.interfaceDr;
- joParam.hisType = directoryType;
- jaParams.Add(joParam);
- dynamic joPagination = new JObject();
- joPagination.pageSize = pageSize;
- joPagination.currentPage = currentPage;
- joPagination.sortColumn = "HisCode";
- joPagination.sortOrder = "asc";
- jaPagination.Add(joPagination);
- JObject joMIRtn = mIS.GetMappedHISDir(jaPagination, jaParams);
- if (JsonHelper.parseIrisRtnValue(joMIRtn, out errMsg) != 0)
- {
- return -1;
- }
- //传给HIS,进行匹配
- joParam = new JObject();
- joParam.TotalCount = joMIRtn["result"]["TotalCount"];
- joParam.type = directoryType;
- joParam.flag = flag;
- joParam.hospID = Global.inf.hisHospitalDr;
- joParam.interfaceDr = Global.inf.interfaceDr;
- joParam.alias = tbHISDirectoryFilter.Text;
- joParam.include = "Hosp";
- joParam.groupID = "324";
- joParam.compareArr = joMIRtn["result"]["Data"];
- jaParams = new JArray();
- jaParams.Add(joParam);
- if (hIS.getHISDir(jaPagination, jaParams, out joRtn, out errMsg) != 0)
- {
- return -1;
- }
- }
- if (rbNoMaped.Checked)
- {
- JArray jaPagination = new JArray();
- JArray jaParams = new JArray();
- flag = "All";
- dynamic joParam = new JObject();
- joParam.code = "";
- joParam.descripts = "";
- joParam.FindType = new JArray();
- joParam.TypeID = "";
- joParam.alias = tbHISDirectoryFilter.Text;
- joParam.include = "Hosp";
- joParam.groupID = "324";
- joParam.hospID = Global.inf.hisHospitalDr;
- joParam.interfaceDr = Global.inf.interfaceDr;
- joParam.type = directoryType;
- joParam.flag = flag;
- joParam.specInput = "";
- jaParams.Add(joParam);
- dynamic joPagination = new JObject();
- joPagination.pageSize = pageSize;
- //joPagination.pageSize = 2;
- joPagination.currentPage = currentPage;
- joPagination.sortColumn = "Code";
- joPagination.sortOrder = "asc";
- jaPagination.Add(joPagination);
- //1.获取全部HIS目录
- if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
- {
- return -1;
- }
- //JArray ja = JArray.Parse(joHISRtn["result"]["Data"].ToString());
- //if (ja.Count > 1000)
- //{
- // //如果太大只能在C#代码处理
- // joRtn = mIS.GetNoMappHISDirTooLarge(joHISRtn);
- //}
- //else
- //{
- // joRtn = mIS.GetNoMappHISDir(joHISRtn);
- //}
- joRtn = mIS.GetNoMappHISDirTooLarge(joHISRtn);
- if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
- {
- return -1;
- }
- }
- DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
- int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
- if (rbNoMaped.Checked)
- {
- //pgHISDirect.PageSize = pageSize;
- //pgHISDirect.TotalCount = totalCount;
- }
- else
- {
- pgHISDirect.PageSize = 50;
- pgHISDirect.TotalCount = totalCount;
- }
-
- dgvHISDirectory.DataSource = null;
- dgvHISDirectory.DataSource = dt;
- dgvHISDirectory.Columns[0].ReadOnly = true;
- dtImport = dtExport = dt;
- return 0;
- }
- private int queryHISDirectoryOfExport(out string errMsg)
- {
- errMsg = "";
- string directoryType = string.Empty;
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- {
- directoryType = "drugs";
- break;
- }
- case 1:
- {
- directoryType = "diagnosi";
- break;
- }
- case 2:
- {
- directoryType = "consumables";
- break;
- }
- }
- JObject joHISRtn = new JObject();
- JObject joRtn = new JObject();
- InvokeHelper invoker = new InvokeHelper();
- string flag = "";
- //全部是先调HIS,然后再匹配医保平台的对照关系
- if (rbAll.Checked)
- {
- JArray jaPagination = new JArray();
- JArray jaParams = new JArray();
- flag = "All";
- dynamic joParam = new JObject();
- joParam.code = "";
- joParam.descripts = "";
- joParam.FindType = new JArray();
- joParam.TypeID = "";
- joParam.alias = tbHISDirectoryFilter.Text;
- joParam.include = "Hosp";
- joParam.groupID = "324";
- joParam.hospID = Global.inf.hisHospitalDr;
- joParam.interfaceDr = Global.inf.interfaceDr;
- joParam.type = directoryType;
- joParam.flag = flag;
- joParam.specInput = "";
- jaParams.Add(joParam);
- dynamic joPagination = new JObject();
- joPagination.pageSize = 5000;
- joPagination.currentPage = 1;
- joPagination.sortColumn = "Code";
- joPagination.sortOrder = "asc";
- jaPagination.Add(joPagination);
- //该服务需要改写,需要跟(CloudMedicalInsurancePlatform.Tables.MapRelation)进行关联
- //joInParams.code = "09010038";
- if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
- {
- return -1;
- }
- joRtn = mIS.ConvertHISDir(joHISRtn);
- //导出不包含医保目录编码和名称 数据源来自HIS服务
- //dtExport = (DataTable)joHISRtn["result"]["Data"].ToObject(typeof(DataTable));
- //导出包含医保目录编码和名称 数据源来自医保平台服务
- dtExport = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
- if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
- {
- return -1;
- }
- }
- //已对照是先调云医保,然后再匹配HIS
- if (rbMaped.Checked)
- {
- JArray jaPagination = new JArray();
- JArray jaParams = new JArray();
- flag = "Maped";
- dynamic joParam = new JObject();
- joParam.alias = tbHISDirectoryFilter.Text;
- joParam.HospitalDr = Global.inf.hospitalDr;
- joParam.InterfaceDr = Global.inf.interfaceDr;
- joParam.hisType = directoryType;
- jaParams.Add(joParam);
- dynamic joPagination = new JObject();
- joPagination.pageSize = 5000;
- joPagination.currentPage = 1;
- joPagination.sortColumn = "HisCode";
- joPagination.sortOrder = "asc";
- jaPagination.Add(joPagination);
- JObject joMIRtn = mIS.GetMappedHISDir(jaPagination, jaParams);
- if (JsonHelper.parseIrisRtnValue(joMIRtn, out errMsg) != 0)
- {
- return -1;
- }
- //传给HIS,进行匹配
- joParam = new JObject();
- joParam.TotalCount = joMIRtn["result"]["TotalCount"];
- joParam.type = directoryType;
- joParam.flag = flag;
- joParam.hospID = Global.inf.hisHospitalDr;
- joParam.interfaceDr = Global.inf.interfaceDr;
- joParam.alias = tbHISDirectoryFilter.Text;
- joParam.include = "Hosp";
- joParam.groupID = "324";
- joParam.compareArr = joMIRtn["result"]["Data"];
- jaParams = new JArray();
- jaParams.Add(joParam);
- if (hIS.getHISDir(jaPagination, jaParams, out joRtn, out errMsg) != 0)
- {
- return -1;
- }
- dtExport = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
- }
- if (rbNoMaped.Checked)
- {
- JArray jaPagination = new JArray();
- JArray jaParams = new JArray();
- flag = "All";
- dynamic joParam = new JObject();
- joParam.code = "";
- joParam.descripts = "";
- joParam.FindType = new JArray();
- joParam.TypeID = "";
- joParam.alias = tbHISDirectoryFilter.Text;
- joParam.include = "Hosp";
- joParam.groupID = "324";
- joParam.hospID = Global.inf.hisHospitalDr;
- joParam.interfaceDr = Global.inf.interfaceDr;
- joParam.type = directoryType;
- joParam.flag = flag;
- joParam.specInput = "";
- jaParams.Add(joParam);
- dynamic joPagination = new JObject();
- joPagination.pageSize = 10000;
- //joPagination.pageSize = 2;
- joPagination.currentPage = 1;
- joPagination.sortColumn = "Code";
- joPagination.sortOrder = "asc";
- jaPagination.Add(joPagination);
- //1.获取全部HIS目录
- if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
- {
- return -1;
- }
- joRtn = mIS.GetNoMappHISDir(joHISRtn);
- if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
- {
- return -1;
- }
- dtExport = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
- }
- return 0;
- }
- private int queryCenterDirectory_09010012(int currentPage, int pageSize)
- {
- string directoryType = string.Empty;
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- {
- directoryType = "drugs";
- break;
- }
- case 1:
- {
- directoryType = "diagnosi";
- break;
- }
- case 2:
- {
- directoryType = "consumables";
- break;
- }
- }
- dynamic joInParams = new JObject();
- joInParams.pagination = new JArray() as dynamic;
- joInParams.session = new JArray() as dynamic;
- JArray jaParams = new JArray();
- dynamic joParams = new JObject();
- joParams.code = "";
- joParams.descripts = "";
- joParams.FindType = new JArray();
- joParams.TypeID = "";
- joParams.alias = "";
- joParams.include = "Hosp";
- joParams.groupID = "324";
- joParams.hospID = "25";
- joParams.type = directoryType;
- joParams.specInput = "";
- jaParams.Add(joParams);
- joInParams.Add("params", JArray.FromObject(jaParams));
- dynamic joSession = new JObject();
- joSession.userID = "";
- joSession.locID = "";
- joSession.groupID = "";
- joSession.hospID = "";
- joSession.sessionID = "";
- joSession.hospCode = "";
- joSession.language = "";
- joSession.hostName = "";
- joSession.ipv4 = "";
- joSession.ipv6 = "";
- joSession.mac = "";
- joInParams.session.Add(joSession);
- dynamic joPagination = new JObject();
- joPagination.pageSize = pageSize;
- joPagination.currentPage = currentPage;
- joPagination.sortColumn = "Code";
- joPagination.sortOrder = "asc";
- joInParams.pagination.Add(joPagination);
- joInParams.code = "09010012";
- string sInput = joInParams.ToString();
- string sRtn = invoker.invokeInsuService(joInParams, "");
- JObject jsonRtn = JObject.Parse(sRtn);
- if (jsonRtn["result"]["Data"] == null)
- {
- MessageBox.Show("该节点不存在");
- return -1;
- }
- JObject joRtn = JObject.Parse(sRtn);
- DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
- int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
- pgCenterDirect.TotalCount = totalCount;
- pgCenterDirect.PageSize = 50;
- dgvCenterDirectory.DataSource = dt;
- return 0;
- }
- private void Mapping()
- {
- int iHis = dgvHISDirectory.CurrentRow.Index;
- if (dgvCenterDirectory.CurrentRow == null)
- {
- MessageBox.Show("请查询中心目录");
- return;
- }
- int iCenter = dgvCenterDirectory.CurrentRow.Index;
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- DataTable dtCenter = (DataTable)dgvCenterDirectory.DataSource;
- dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Code"].Value.ToString();
- dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Name"].Value.ToString();
- int hisType = rbgDirecType_C.SelectedIndex + 1;
- string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
- string Code = "";
- string standardCode = dgvHISDirectory.Rows[iHis].Cells["standardCode"].ToString();
- string NationCode = dgvHISDirectory.Rows[iHis].Cells["NationCode"].ToString();
-
- if ((string.IsNullOrEmpty(NationCode)) && (string.IsNullOrEmpty(standardCode) == false))
- Code = standardCode;
- else
- if ((string.IsNullOrEmpty(NationCode) == false) && (string.IsNullOrEmpty(standardCode)))
- Code = NationCode;
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
- jsonTemp.HospitalDr = Global.inf.hospitalDr;
- jsonTemp.updateUserID = Global.user.ID;
- jsonTemp.InterfaceDr = Global.inf.interfaceDr;
- jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
- jsonTemp.HISName = dgvHISDirectory.Rows[iHis].Cells["itemDesc"].Value;
- jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["ID"];
- jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["medInsuDirectoryID"];
- //1.已对照 2.已对照但未上传 3 已对照且已上传
- jsonTemp.State = 1;
- jsonTemp.HisType = hisType;
- jsonTemp.HisTypeName = hisTypeName;
- jsonTemp.InsuCode = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Code"].Value;
- jsonTemp.InsuName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Name"].Value;
- jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- jsonTemp.NationCode = Code;
- jsonTemp.NationName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Name"].Value;
- jaParams.Add(jsonTemp);
- JObject joIn = new JObject();
- joIn.Add(new JProperty("params", jaParams));
- joIn.Add("code", "09010040");
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入对照信息");
- //JObject joRtn = JObject.Parse(irisRtn);
- if ((int)joRtn["errorCode"] == 0)
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "已对照";
- }
- else
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
- }
- }
- private void CancleMapping()
- {
- int iHis = dgvHISDirectory.CurrentRow.Index;
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
- jsonTemp.HospitalDr = Global.inf.hospitalDr;
- jsonTemp.updateUserID = Global.user.ID;
- jsonTemp.InterfaceDr = Global.inf.interfaceDr;
- jsonTemp.State = 0;
- jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
- jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- jaParams.Add(jsonTemp);
- JObject joIn = new JObject();
- joIn.Add(new JProperty("params", jaParams));
- joIn.Add("code", "09010041");
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消对照");
- if ((int)joRtn["errorCode"] == 0)
- {
- dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = "";
- dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = "";
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "未对照";
- }
- else
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
- }
- }
- private void UpdateNationCodeInfo()
- {
- int iHis = dgvHISDirectory.CurrentRow.Index;
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- string ID = dtHis.Rows[iHis]["MapID"].ToString();
- string HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].ToString();
- string InsuCode = dgvHISDirectory.Rows[iHis].Cells["insuCode"].ToString();
- string Code = "";
- string NationCode = dgvHISDirectory.Rows[iHis].Cells["NationCode"].ToString();
- string standardCode= dgvHISDirectory.Rows[iHis].Cells["standardCode"].ToString();
- if ((string.IsNullOrEmpty(NationCode)) && (string.IsNullOrEmpty(standardCode) == false))
- Code = standardCode;
- else
- if ((string.IsNullOrEmpty(NationCode) == false) && (string.IsNullOrEmpty(standardCode)))
- Code = NationCode;
- if ((string.IsNullOrEmpty(InsuCode)) || (string.IsNullOrEmpty(ID)))
- {
- MessageBox.Show("当前HIS目录未对照医保目录!");
- return;
- }
- NationCodeInfo NCI = new NationCodeInfo(Code);
- try
- {
- if (NCI.ShowDialog() == DialogResult.OK)
- {
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- jsonTemp.ID = ID;
- jsonTemp.HospitalDr = Global.inf.hospitalDr;
- jsonTemp.updateUserID = Global.user.ID;
- jsonTemp.InterfaceDr = Global.inf.interfaceDr;
- jsonTemp.HISCode = HISCode;
- jsonTemp.NationCode = NCI.NationCode;
- jsonTemp.NationName = NCI.NationName;
- jaParams.Add(jsonTemp);
- JObject joIn = new JObject();
- joIn.Add(new JProperty("params", jaParams));
- joIn.Add("code", "09010040");
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "更新对照表贯标目录信息");
- }
- else
- {
- MessageBox.Show("您已取消贯标目录信息!");
- return;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("异常:" + ex.Message);
- return;
- }
- }
- /// <summary>
- /// 医保目录单个版本号的下载
- /// </summary>
- /// <param name="ver"></param>
- /// <param name="directoryType"></param>
- /// <param name="uiProcessBar"></param>
- /// <param name="errorMessage"></param>
- /// <returns></returns>
- public int SingleDownload(string ver, int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
- {
- string txtPath = string.Empty;
- errorMessage = "";
- int iResult = -1;
- string funNo = "";
- switch (directoryType)
- {
- case 0://药品
- {
- funNo = "1301"; //"1301";
- break;
- }
- case 1://诊疗
- {
- funNo = "1305";
- break;
- }
- case 2://材料
- {
- funNo = "1306";
- break;
- }
- case 3://疾病诊断
- {
- funNo = "1307";
- break;
- }
- case 4://手术
- {
- funNo = "1308";
- break;
- }
- case 5://慢性病
- {
- funNo = "1309";
- break;
- }
- case 6://DRGs
- {
- funNo = "1310";
- break; ;
- }
- case 7://日间手术
- {
- funNo = "1311";
- break;
- }
- case 8://字典表
- {
- break;
- }
- case 9://中药饮片
- {
- funNo = "1302";
- break;
- }
- case 10://医药机构制剂
- {
- funNo = "1303";
- break;
- }
- }
- try
- {
- JObject joRtn = hBus.DownloadDirectory(funNo, ver);
- //MessageBox.Show("往IRIS插入数据准备:" + joRtn.ToString());
- //if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
- if (JsonHelper.parseIrisRtnValue(joRtn, out errorMessage) == 0)
- {
- txtPath = joRtn["filePath"].ToString();
- //MessageBox.Show("获取txt数据往IRIS插入文件路径:"+ txtPath);
- DataImoport bus = new DataImoport();
- JObject joImportRtn = bus.importDataToIrisByTxt(txtPath, 50, directoryType + 1, uiProcessBar);
- //MessageBox.Show("往IRIS插入数据:" + joImportRtn.ToString());
- //if (JsonHelper.parseCenterRtnValue(joImportRtn, out errorMessage) == 0)
- if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
- {
- iResult = 0;
- }
- else
- {
- Global.writeLog(joImportRtn.ToString());
- errorMessage = "导入数据出现错误,请查看日志!";//joImportRtn["errorMessage"].ToString();
- }
- }
- return iResult;
- }
- catch (Exception ex)
- {
- errorMessage = "SingleDownload提示:" + ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 医保目录单个版本号的下载
- /// </summary>
- /// <param name="ver"></param>
- /// <param name="directoryType"></param>
- /// <param name="uiProcessBar"></param>
- /// <param name="errorMessage"></param>
- /// <returns></returns>
- public int downloadDicionary(JObject joData, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
- {
- errorMessage = "";
- int iResult = -1;
- try
- {
- JObject joRtn = cBus.DownDictionay(joData);
- if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
- {
- DataImoport DI = new DataImoport();
- JArray jaList = JArray.Parse(JsonHelper.getDestValue(joRtn, "output.list"));
- JObject joImportRtn = DI.importDictionary(uiProcessBar, jaList, tbDicType.Text);
- if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
- {
- iResult = 0;
- }
- else
- {
- errorMessage = "导入数据出现错误,请查看日志!" + errorMessage;
- }
- }
- return iResult;
- }
- catch (Exception ex)
- {
- errorMessage = "downloadDicionary提示:" + ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 自动下载医保目录,直到最新版本(返回报错)
- /// </summary>
- /// <param name="directoryType"></param>
- /// <param name="uiProcessBar"></param>
- /// <param name="errorMessage"></param>
- /// <returns></returns>
- public int AutoDownload(int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
- {
- int iResult = 0;
- errorMessage = "";
- try
- {
- while (iResult == 0)
- {
- JObject joMaxVerNO = mIS.getDirectoryMaxVersionNO(directoryType);
- string ver = joMaxVerNO["result"]["MaxVersionNO"].ToString();
- iResult = JsonHelper.parseIrisRtnValue(joMaxVerNO, out errorMessage);
- iResult = SingleDownload(ver, directoryType, uiProcessBar, out errorMessage);
- }
- return iResult;
- }
- catch (Exception ex)
- {
- errorMessage = ex.Message;
- return -1;
- }
- }
- #endregion
- private void btnDownload_Click(object sender, EventArgs e)
- {
- string errorMessage = string.Empty;
- //医保字典数据下载
- if (rbgDirecType.SelectedIndex == 8)
- {
- if (tbDicDate.Text == "")
- {
- MessageBox.Show("请输入查询日期!");
- return;
- }
- dynamic joData = new JObject();
- joData.type = tbDicType.Text; //字典类型
- joData.parentValue = ""; //父字典键值
- joData.admdvs = Global.inf.areaCode; //行政区划 就医地
- joData.date = tbDicDate.Text; //查询日期
- joData.vali_flag = "1"; //有效标志
- if (downloadDicionary(joData, uiProcessBar1, out errorMessage) != 0)
- {
- MessageBox.Show("医保字典下载失败:" + errorMessage);
- return;
- }
- }
- else if (rbgDirecType.SelectedIndex <=10)
- {
- if (rbSingleDown.Checked)
- {
- string ver = tbVer.Text;
- if (tbVer.Text != "")
- {
- ver = tbVer.Text;
- }
- if (SingleDownload(ver, rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
- {
- MessageBox.Show("医保目录下载失败:" + errorMessage);
- return;
- }
- }
- if (rbAutoDown.Checked)
- {
- if (AutoDownload(rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
- {
- MessageBox.Show("医保目录下载失败:" + errorMessage);
- return;
- }
- }
- }
- btnQuery_Click(sender, e);
- }
- private void btnQuery_Click(object sender, EventArgs e)
- {
- #region 校验查询条件
- if ((rbgDirecType.SelectedIndex < 0) || (rbgDirecType.SelectedIndex > 20))
- {
- MessageBox.Show("请先选择查询类型!");
- return;
- }
- if (rbgDirecType.SelectedIndex > 13)
- {
- if (rbgDirecType.SelectedIndex != 20)
- {
- if ((TexDate.Text == "") || (TexDate.Text == "输入日期 2021-01-01"))
- {
- MessageBox.Show("查询条件-请输入查询日期!");
- return;
- }
- if ((TexDQYS.Text == "") || (TexDQYS.Text == "当前页数"))
- {
- MessageBox.Show("查询条件-请输入当前页数!");
- return;
- }
- if ((TexBYSJL.Text == "") || (TexBYSJL.Text == "本页数据量"))
- {
- MessageBox.Show("查询条件-请输入本页数据量!");
- return;
- }
- }
- else
- {
- if ((TexYYMC.Text == "") || (TexYYMC.Text == "输入医院名称模糊查找"))
- {
- MessageBox.Show("查询条件-请输入医院名称模糊查找!");
- return;
- }
- }
- }
- #endregion
- queryHISInsuDirectory(rbgDirecType.SelectedIndex, 1, 20, dgvDirectoy, Global.inf.interfaceDr);
- }
- private void btnQueryHISDirectory_Click(object sender, EventArgs e)
- {
- string errMsg;
- int iCount = 50;
- if (rbNoMaped.Checked) iCount = 10000;
-
- if (queryHISDirectory(1, iCount, out errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- return;
- }
- //GridViewSetter gridSetter = new GridViewSetter();
- //gridSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
- }
- private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
- {
- if ((tbCenterDirectoryFilter.Text == "") && (tbInsuCode.Text == "") && (tbApprovalNO.Text == "") && (tbManufacturer.Text == ""))
- {
- return;
- }
- //查询区域通用目录
- JObject joRtn = mIS.getInterface_TY(Global.inf.interfaceDr.ToString(),"");
- string InsuCurrencyCataLogue = JsonHelper.getDestValue(joRtn, "InsuCurrencyCataLogue"); //通用目录编码 6
- string InterfaceName_TY = JsonHelper.getDestValue(joRtn, "InterfaceName_TY"); //通用目录名称
- string HospName = JsonHelper.getDestValue(joRtn, "HospitalName"); //目录名称
- if (InsuCurrencyCataLogue != "")
- {
- queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, int.Parse(InsuCurrencyCataLogue));
- LabExplain.Visible = true;
- LabExplain.Text = "当前接口已设置区域通用目录,数据源:" + InterfaceName_TY+" ,如果确认没有所查目录请联系数据源医院新增维护!";
- }
- else
- {
- queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, Global.inf.interfaceDr);
- LabExplain.Visible = true;
- LabExplain.Text = "当前接口未设置区域通用目录,数据源:" + HospName;
- }
- }
- private void BasicData_Load(object sender, EventArgs e)
- {
- this.WindowState = FormWindowState.Maximized;
- rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(rbgDirecType_ValueChanged);
- LabExplain.Visible = false;
- tabControl1.SelectedIndex = 1;
-
- GridViewSetter gridSetter = new GridViewSetter();
- gridSetter.SetHeaderTextOfRelationShipDr(dgv_RelationShipDr);
- gridSetter.SetHeaderTextOfMedInsuDr(dgv_InsuDr);
- //gridSetter.DatagridviewColumnWidthAdaptation(dgv_HISDr);
- //gridSetter.DatagridviewColumnWidthAdaptation(dgv_InsuDr);
- gridSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
- rbg_MedDrType.SelectedIndex = 0;
- }
- private void pgDownload_PageChanged(object sender, object pagingSource, int pageIndex, int count)
- {
- queryHISInsuDirectory(rbgDirecType.SelectedIndex, pageIndex, count, dgvDirectoy, Global.inf.interfaceDr);
- }
- private void pgHISDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
- {
- string errMsg;
- if (rbNoMaped.Checked == false)
- {
- if (queryHISDirectory(pageIndex, 50, out errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- return;
- }
- }
- }
- private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
- {
- queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, pageIndex, count, dgvCenterDirectory, Global.inf.interfaceDr);
- }
- private void rbgDirecType_ValueChanged(object sender, int index, string text)
- {
- //选定项不同调用的接口也不相同,Index值大于
- if (rbgDirecType.SelectedIndex > 13)
- {
- uiGroupBox1.Visible = false;
- uiGroupBox5.Visible = false;
- uiGroupBox2.Visible = true;
- //uiGroupBox3.Visible = true;
- uiProcessBar1.Visible = false;
- uiGroupBox2.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
- uiGroupBox3.Left = uiGroupBox2.Width+rbgDirecType.Width + rbgDirecType.Left + 10;
- dgvDirectoy.DataSource = null;
- }
- else
- {
- uiGroupBox1.Visible = true;
- uiGroupBox5.Visible = true;
- uiGroupBox2.Visible = true;
- //uiGroupBox3.Visible = false;
- uiProcessBar1.Visible = true;
- uiGroupBox1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
- uiGroupBox5.Left = uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 10;
- uiGroupBox2.Left = uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 15;
- uiGroupBox3.Left = uiGroupBox2.Width + uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 20;
- uiProcessBar1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
- uiProcessBar1.Width = uiGroupBox1.Width + uiGroupBox5.Width + uiGroupBox2.Width + 10;
- }
- setHeaderTxt(rbgDirecType.SelectedIndex, dgvDirectoy);
- }
- private void toolStripMenuItem2_Click(object sender, EventArgs e)
- {
- CancleMapping();
- }
- private void tsmiMapping_Click(object sender, EventArgs e)
- {
- Mapping();
- }
- private void dgvHISDirectory_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- tbInsuCode.Text = dgvHISDirectory.Rows[dgvHISDirectory.CurrentRow.Index].Cells["InsuCode"].Value.ToString();
- }
- private void dgvHISDirectory_DoubleClick(object sender, EventArgs e)
- {
- //int currentPage = pgHISDirect.ActivePage;
- //string flag = dgvHISDirectory.Rows[dgvHISDirectory.CurrentRow.Index].Cells["flag"].Value.ToString();
- //if (flag == "未对照")
- //{
- // Mapping();
- //}
- //else if (flag == "已对照")
- //{
- // CancleMapping();
- //}
- //if (rbAll.Checked)
- //{
- // string errMsg;
- // if (queryHISDirectory(1, 50, out errMsg) != 0)
- // {
- // MessageBox.Show(errMsg);
- // return;
- // }
- //}
- }
- private void dgvDirectoy_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- }
- private void dgvDirectoy_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- }
- private void uiRadioButton1_CheckedChanged(object sender, EventArgs e)
- {
- }
- private void dgvDirectoy_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
- {
- //自动编号,与数据无关
- Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
- e.RowBounds.Location.Y,
- dgvDirectoy.RowHeadersWidth - 4,
- e.RowBounds.Height);
- TextRenderer.DrawText(e.Graphics,
- (e.RowIndex + 1).ToString(),
- dgvDirectoy.RowHeadersDefaultCellStyle.Font,
- rectangle,
- dgvDirectoy.RowHeadersDefaultCellStyle.ForeColor,
- TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
- }
- private void rbAll_ValueChanged(object sender, bool value)
- {
- }
- private void rbMaped_CheckedChanged(object sender, EventArgs e)
- {
- //if (rbMaped.Checked)
- //{
- // string errMsg;
- // if (queryHISDirectory(1, 50, out errMsg) != 0)
- // {
- // MessageBox.Show(errMsg);
- // return;
- // }
- //}
- }
- private void btAddDir_Click(object sender, EventArgs e)
- {
- AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex);
- if (addDirectory.ShowDialog() == DialogResult.OK)
- {
- JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
- string error = "";
- if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
- {
- MessageBox.Show("新增失败:" + error);
- }
- else
- {
- MessageBox.Show("新增成功");
- }
- }
- }
- private void btEditDir_Click(object sender, EventArgs e)
- {
- DataTable dt = (DataTable)dgvDirectoy.DataSource;
- if ((dt == null) || (dt.Rows.Count < 1))
- {
- MessageBox.Show("表中无数据,请检查!");
- return;
- }
- DataRow dr = dt.Rows[dgvDirectoy.CurrentRow.Index];
- AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex, dr);
- if (addDirectory.ShowDialog() == DialogResult.OK)
- {
- JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
- string error = "";
- if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
- {
- MessageBox.Show("修改失败:" + error);
- }
- else
- {
- MessageBox.Show("修改成功");
- }
- }
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- Close();
- }
- /// <summary>
- /// 几个医保查询的交易组织入参
- /// </summary>
- /// <param name="Index"></param>
- /// <param name="funNo"></param>
- /// <returns></returns>
- private JObject GetInput(int Index, out string funNo)
- {
- funNo = "";
- dynamic joData = new JObject();
- switch (Index)
- {
- case 14://民族药品目
- {
- funNo = "1304";
- joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
- joData.genname_codg = ""; //通用名编号
- joData.drug_genname = ""; //药品通用名
- joData.drug_prodname = tbDircetoryName.Text; //药品商品名
- joData.reg_name = ""; //注册名称
- joData.tcmherb_name = ""; //中草药名称
- joData.mlms_name = ""; //药材名称
- joData.vali_flag = ""; //有效标志
- joData.rid = ""; //唯一记录号
- joData.ver = ""; //版本号
- joData.ver_name = ""; //版本名称
- joData.opt_begn_time = ""; //经办开始时间
- joData.opt_end_time = ""; //经办结束时间
- joData.updt_time = TexDate.Text; //更新时间
- joData.page_num = TexDQYS.Text; //当前页数
- joData.page_size = TexBYSJL.Text; //本页数据量
- break;
- }
- case 15://目录信息查询
- {
- funNo = "1312";
- joData.query_date = ""; //查询时间点
- joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
- joData.insu_admdvs = ""; //参保机构医保区划
- joData.begndate = ""; //开始日期
- joData.hilist_name = tbDircetoryName.Text; //医保目录名称
- joData.wubi = ""; //五笔助记码
- joData.pinyin = ""; //拼音助记码
- joData.med_chrgitm_type = ""; //医疗收费项目类别
- joData.chrgitm_lv = ""; //收费项目等级
- joData.lmt_used_flag = ""; //限制使用标志
- joData.list_type = ""; //目录类别
- joData.med_use_flag = ""; //医疗使用标志
- joData.matn_used_flag = ""; //生育使用标志
- joData.hilist_use_type = ""; //医保目录使用类别
- joData.lmt_cpnd_type = ""; //限复方使用类型
- joData.vali_flag = ""; //有效标志
- joData.updt_time = TexDate.Text; //更新时间
- joData.page_num = TexDQYS.Text; //当前页数
- joData.page_size = TexBYSJL.Text; //本页数据量
- break;
- }
- case 16://医疗与医保目录匹配
- {
- funNo = "1316";
- joData.query_date = ""; //查询时间点
- joData.medins_list_codg = ""; //定点医药机构目录编号
- joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
- joData.list_type = ""; //目录类别
- joData.insu_admdvs = ""; //参保机构医保区划
- joData.begndate = ""; //开始日期
- joData.vali_flag = ""; //有效标志
- joData.updt_time = TexDate.Text; //更新时间
- joData.page_num = TexDQYS.Text; //当前页数
- joData.page_size = TexBYSJL.Text; //本页数据量
- break;
- }
- case 17://医药机构目录匹配
- {
- funNo = "1317";
- joData.query_date = ""; //查询时间点
- joData.fixmedins_code = ""; //定点医药机构编号
- joData.medins_list_codg = ""; //定点医药机构目录编号
- joData.medins_list_name = ""; //定点医药机构目录名称
- joData.insu_admdvs = ""; //参保机构医保区划
- joData.list_type = ""; //目录类别
- joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
- joData.begndate = ""; //开始日期
- joData.vali_flag = ""; //有效标志
- joData.updt_time = TexDate.Text; //更新时间
- joData.page_num = TexDQYS.Text; //当前页数
- joData.page_size = TexBYSJL.Text; //本页数据量
- break;
- }
- case 18://医保目录限价
- {
- funNo = "1318";
- joData.query_date = ""; //查询时间点
- joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
- joData.hilist_lmtpric_type = ""; //医保目录限价类型
- joData.overlmt_dspo_way = ""; //医保目录超限处理方式
- joData.insu_admdvs = ""; //参保机构医保区划
- joData.begndate = ""; //开始日期
- joData.enddate = ""; //结束日期
- joData.vali_flag = ""; //有效标志
- joData.rid = ""; //唯一记录号
- joData.tabname = ""; //表名
- joData.poolarea_no = ""; //统筹区
- joData.updt_time = TexDate.Text; //更新时间
- joData.page_num = TexDQYS.Text; //当前页数
- joData.page_size = TexBYSJL.Text; //本页数据量
- break;
- }
- case 19://医保目录先自付比例
- {
- funNo = "1319";
- joData.query_date = ""; //查询时间点
- joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
- joData.selfpay_prop_psn_type = "";//医保目录自付比例人员类别
- joData.selfpay_prop_type = ""; //目录自付比例类别
- joData.insu_admdvs = ""; //参保机构医保区划
- joData.begndate = ""; //开始日期
- joData.enddate = ""; //结束日期
- joData.vali_flag = ""; //有效标志
- joData.rid = ""; //唯一记录号
- joData.tabname = ""; //表名
- joData.poolarea_no = ""; //统筹区
- joData.updt_time = TexDate.Text; //更新时间
- joData.page_num = TexDQYS.Text; //当前页数
- joData.page_size = TexBYSJL.Text; //本页数据量
- break;
- }
- case 20://医药机构信息
- {
- funNo = "1201";
- joData.fixmedins_type = "1"; //定点医疗服务机构类型 1定点医疗机构,2定点零售药店,3工伤定点康复机构,4辅助器具配置机构,5计划生育服务机构
- joData.fixmedins_name = TexYYMC.Text; //定点医药机构名称
- joData.fixmedins_code = ""; //定点医药机构编号
- break;
- }
- }
- return joData;
- }
- private void chek_UporCancel_CheckedChanged(object sender, EventArgs e)
- {
-
- }
- private void uiButton1_Click(object sender, EventArgs e)
- {
- Close();
- }
- /// <summary>
- /// 单条上传目录对照关系
- /// </summary>
- private void SingleUpload()
- {
- if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
- {
- MessageBox.Show("请查询HIS目录对照关系");
- return;
- }
- string errorMsg = "", sMLLX = "";
- //单条目录对照关系上传
- int iHis = dgvHISDirectory.CurrentRow.Index;
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
- //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
- if (hisType == 1)
- {
- sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
- }
- else if (hisType == 2)
- {
- sMLLX = "201";
- }
- else if (hisType == 3)
- {
- sMLLX = "301";
- }
- string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
- string InsuName = dtHis.Rows[iHis]["InsuName"].ToString();
- string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
- string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
- string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
- //调用3301目录对照上传
- JObject joData = new JObject();
- joData.Add("fixmedins_hilist_id", HisCode);
- joData.Add("fixmedins_hilist_name", HisName);
- joData.Add("list_type", sMLLX); //目录类别
- joData.Add("med_list_codg", InsuCode); //医疗目录编码
- joData.Add("begndate", "2022-10-01"); //开始日期
- joData.Add("enddate", UpdateDate); //结束日期
- joData.Add("aprvno", "");
- joData.Add("dosform", "");
- joData.Add("exct_cont", "");
- joData.Add("item_cont", "");
- joData.Add("prcunt", "");
- joData.Add("spec", "");
- joData.Add("pacspec", "");
- joData.Add("memo", "");
- JObject joInput = new JObject();
- joInput.Add("data", joData);
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeCenterService("3301", JsonHelper.setCenterInpar("3301", joInput));
- if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
- {
- MessageBox.Show("目录对照关系上传失败:" + errorMsg);
- }
- else
- {
- MessageBox.Show("目录对照关系上传成功!");
- }
- }
- /// <summary>
- /// 单条撤销目录对照关系上传
- /// </summary>
- private void SingleCancelUpload()
- {
- if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
- {
- MessageBox.Show("请查询HIS目录对照关系");
- return;
- }
- string errorMsg = "", sMLLX = "";
- //撤销目录对照关系
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- int iHis = dgvHISDirectory.CurrentRow.Index;
- string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
- string HisCode = dtHis.Rows[iHis]["HisCode"].ToString();
- int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
- //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
- if (hisType == 1)
- {
- sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
- }
- else if (hisType == 2)
- {
- sMLLX = "201";
- }
- else if (hisType == 3)
- {
- sMLLX = "301";
- }
- //调用3302目录对照撤销
- JObject joData = new JObject();
- joData.Add("fixmedins_code", Global.inf.hospitalNO);
- joData.Add("fixmedins_hilist_id", HisCode);
- joData.Add("list_type", sMLLX); //目录类别
- joData.Add("med_list_codg", InsuCode); //医疗目录编码
- JObject joInput = new JObject();
- joInput.Add("data", joData);
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeCenterService("3302", JsonHelper.setCenterInpar("3302", joInput));
- if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
- {
- MessageBox.Show("目录对照撤销失败:" + errorMsg);
- }
- else
- {
- MessageBox.Show("目录对照撤销成功!");
- }
- }
- /// <summary>
- /// 全部上传目录对照关系
- /// </summary>
- private void AllUpLoad()
- {
- if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
- {
- MessageBox.Show("请查询HIS目录对照关系");
- return;
- }
- string sMLLX = "", errorMsg = "", Msg = "";
- Boolean bOk = true;
- JObject InputjoRtn = new JObject();
- string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
- int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
- if (hisType == 1)
- {
- sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
- }
- else if (hisType == 2)
- {
- sMLLX = "201";
- }
- else if (hisType == 3)
- {
- sMLLX = "301";
- }
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- for (int i = 0; i < dtHis.Rows.Count; i++)
- {
- string InsuCode = dtHis.Rows[i]["InsuCode"].ToString(); //医保目录编码
- string InsuName = dtHis.Rows[i]["InsuName"].ToString(); //医保目录名称
- string HisCode = dtHis.Rows[i]["itemCode"].ToString(); //HIS目录编码
- string HisName = dtHis.Rows[i]["itemDesc"].ToString(); //HIS目录名称
- //调用3301目录对照上传
- JObject joData = new JObject();
- joData.Add("fixmedins_hilist_id", HisCode);
- joData.Add("fixmedins_hilist_name", HisName);
- joData.Add("list_type", sMLLX); //目录类别
- joData.Add("med_list_codg", InsuCode); //医疗目录编码
- joData.Add("begndate", "2022-10-01"); //开始日期
- joData.Add("enddate", UpdateDate); //结束日期
- joData.Add("aprvno", "");
- joData.Add("dosform", "");
- joData.Add("exct_cont", "");
- joData.Add("item_cont", "");
- joData.Add("prcunt", "");
- joData.Add("spec", "");
- joData.Add("pacspec", "");
- joData.Add("memo", "");
- JObject joInput = new JObject();
- joInput.Add("data", joData);
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeCenterService("3301", JsonHelper.setCenterInpar("3301", joInput));
- if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
- {
- bOk = false;
- Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
- }
- }
- if (bOk == false)
- {
- MessageBox.Show("全部目录对照关系上传成功,部分上传异常:" + Msg);
- }
- else
- {
- MessageBox.Show("全部目录对照关系上传成功!");
- }
- }
- /// <summary>
- /// 全部撤销目录对照关系上传
- /// </summary>
- private void AllCancelUpload()
- {
- if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
- {
- MessageBox.Show("请查询HIS目录对照关系");
- return;
- }
- string sMLLX = "", errorMsg = "", Msg = "";
- Boolean bOk = true;
- string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
- int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
- if (hisType == 1)
- {
- sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
- }
- else if (hisType == 2)
- {
- sMLLX = "201";
- }
- else if (hisType == 3)
- {
- sMLLX = "301";
- }
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- for (int i = 0; i < dtHis.Rows.Count; i++)
- {
- string InsuCode = dtHis.Rows[i]["InsuCode"].ToString();
- string HisCode = dtHis.Rows[i]["HisCode"].ToString();
- //调用3302目录对照撤销
- JObject joData = new JObject();
- joData.Add("fixmedins_code", Global.inf.hospitalNO);
- joData.Add("fixmedins_hilist_id", HisCode);
- joData.Add("list_type", sMLLX); //目录类别
- joData.Add("med_list_codg", InsuCode); //医疗目录编码
- JObject joInput = new JObject();
- joInput.Add("data", joData);
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeCenterService("3302", JsonHelper.setCenterInpar("3302", joInput));
- if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
- {
- bOk = false;
- Msg = Msg + "<" + joInput.ToString()+":" + errorMsg + ">";
- }
- }
- if (bOk == false)
- {
- MessageBox.Show("全部撤销目录对照关系上传成功,部分撤销异常:" + Msg);
- }
- else
- {
- MessageBox.Show("全部撤销目录对照关系上传成功!");
- }
- }
- private void ToolStripMenuItem_Upload_Click(object sender, EventArgs e)
- {
- SingleUpload();
- }
- private void ToolStripMenuItem_CancelUpload_Click(object sender, EventArgs e)
- {
- SingleCancelUpload();
- }
- private void rbgDirecType_C_ValueChanged(object sender, int index, string text)
- {
- tbHISDirectoryFilter.Text = "";
- uiTextBox1.Text = "";
- rbMaped.Checked = false;
- rbNoMaped.Checked = false;
- rbAll.Checked = true;
- tbCenterDirectoryFilter.Text = "";
- tbInsuCode.Text = "";
- tbApprovalNO.Text = "";
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- {
- btnExport.Text = "导出药品yp.in文件";
- btnImport.Text = "导入药品yp.out文件";
- break;
- }
- case 1:
- {
- btnExport.Text = "导出诊疗sfxm.in文件";
- btnImport.Text = "导入诊疗sfxm.out文件";
- break;
- }
- case 2:
- {
- btnExport.Text = "导出材料hc.in文件";
- btnImport.Text = "导入材料hc.out文件";
- break;
- }
- }
- if (queryHISDirectory(1, 50, out string errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- return;
- }
- //btnQueryHISDirectory_Click(null, new EventArgs());
- }
- private void btnExport_Click(object sender, EventArgs e)
- {
- //if (rbMaped.Checked)
- //{
- // MessageBox.Show("请先切换‘全部’查询HIS目录!");
- // return;
- //}
- //当前数据表行数
- //MessageBox.Show(iRecordCount.ToString());
- ExportToFile();
- }
- private void ExportToFile()
- {
- //if (queryHISDirectory(1, 10000, out string errMsg) != 0)
- //{
- // MessageBox.Show(errMsg);
- // return;
- //}
- //if (queryHISDirectoryOfExport(out string errorMessage) != 0)
- //{
- // MessageBox.Show("查询医保目录信息出现错误,请查看日志!" + errorMessage);
- // return;
- //}
- if (dtExport.Rows.Count > 0)
- {
- string Maped = "";
- if (rbAll.Checked) Maped = "全部";
- if (rbMaped.Checked) Maped = "已对照";
- if (rbNoMaped.Checked) Maped = "未对照";
- string directoryType = string.Empty;
- string directoryName = string.Empty;
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- {
- directoryType = "yp";
- directoryName = "药品";
- break;
- }
- case 1:
- {
- directoryType = "sfxm";
- directoryName = "诊疗";
- break;
- }
- case 2:
- {
- directoryType = "hc";
- directoryName = "耗材";
- break;
- }
- }
- string Msg = "【" + directoryName + "】医保目录【" + Maped + "】信息";
- if (WriteInParam(dtExport, directoryType) == 0)
- {
- MessageBox.Show(Msg + "导出成功");
- }
- else
- {
- MessageBox.Show("导出失败!");
- }
- }
- else
- {
- MessageBox.Show("请先查询HIS目录信息!");
- return;
- }
- }
- /// <summary>
- /// 循环DataTable写入in文件
- /// </summary>
- /// <param name="Dt"></param>
- /// <param name="Type">yp;sfxm;hc</param>
- private int WriteInParam(DataTable Dt, string Type)
- {
- if (Dt.Rows.Count == 0)
- return -1;
- ProcessBar.Maximum = Dt.Rows.Count;
- try
- {
- //已存在的文件先删除
- //string logDir = Global.curEvt.path + "\\MLDR";
- string logDir = @"D:\MLDR";
- string logName = Type.Trim() + ".in";
- Log log = new Log(logDir, logName.Trim());
- log.DeleteFile(logDir + "\\" + logName);
- for (int i = 0; i < Dt.Rows.Count; i++)
- {
- ProcessBar.Value = i + 1;
- Application.DoEvents();
- String sText = string.Empty;
- string HISCode = string.Empty, HISName = string.Empty, InsuCode = string.Empty, NationCode = string.Empty;
- string spec = string.Empty, Unit = string.Empty, Price = string.Empty, standardCode = string.Empty;
-
- HISCode = Dt.Rows[i]["itemCode"].ToString(); //HIS药品编码
- HISName = Dt.Rows[i]["itemDesc"].ToString(); //HIS药品名称
- if (chk_Import.Checked)
- {
- InsuCode = Dt.Rows[i]["insuCode"].ToString(); //对照的药品编码
- //InsuName = Dt.Rows[i]["insuName"].ToString(); //对照的药品名称
- }
- spec = Dt.Rows[i]["spec"].ToString(); //规格
- Unit = Dt.Rows[i]["itemUnitDesc"].ToString(); //计量单位
- Price = Dt.Rows[i]["itemPrice"].ToString(); //单价
- if (Price == "")
- Price = "0.00";
- string Code = "";
- standardCode= Dt.Rows[i]["standardCode"].ToString(); //贯标码
- NationCode = Dt.Rows[i]["NationCode"].ToString(); //贯标码
- if ((string.IsNullOrEmpty(NationCode)) && (string.IsNullOrEmpty(standardCode) == false))
- Code = standardCode;
- else
- if ((string.IsNullOrEmpty(NationCode) == false) && (string.IsNullOrEmpty(standardCode)))
- Code = NationCode;
- if (Type == "yp")
- {
- //药品导入文件格式:HIS药品编码|HIS药品名称|对照的药品编码|规格|计量单位|单价|
- sText = comp.SetParamsAHS(HISCode, 1) +
- comp.SetParamsAHS(HISName, 1) +
- comp.SetParamsAHS(InsuCode, 1) +
- comp.SetParamsAHS(spec, 1) +
- comp.SetParamsAHS(Unit, 1) +
- decimal.Parse(Price).ToString("0.00");
- }
- else if (Type == "sfxm")
- {
- //收费项目导入文件格式:HIS药品编码|HIS药品名称|对照的项目编码|计量单位|单价|
- sText = comp.SetParamsAHS(HISCode, 1) +
- comp.SetParamsAHS(HISName, 1) +
- comp.SetParamsAHS(InsuCode, 1) +
- comp.SetParamsAHS(Unit, 1) +
- decimal.Parse(Price).ToString("0.00");
- }
- else if (Type == "hc")
- {
- //耗材导入文件格式:HIS药品编码|HIS药品名称|对照的国家医保编码|计量单位|单价|规格|
- sText = comp.SetParamsAHS(HISCode, 1) +
- comp.SetParamsAHS(HISName, 1) +
- comp.SetParamsAHS(Code, 1) + //贯标编码
- comp.SetParamsAHS(Unit, 1) +
- comp.SetParamsAHS(decimal.Parse(Price).ToString("0.00"), 1) +
- spec;
- }
- //写入文件内容
- Global.writeInFileOfExport(Type, sText);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("循环DataTable写入in文件发生异常:" + ex.Message);
- return -1;
- }
-
- return 0;
- }
- private void btnImport_Click(object sender, EventArgs e)
- {
- string errorMessage;
- string filePath = string.Empty;
- string hisTypeName = rbgDirecType_C.Items[rbgDirecType_C.SelectedIndex].ToString();
- if (rbMaped.Checked)
- {
- MessageBox.Show("请先切换‘全部’查询HIS目录!");
- return;
- }
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- {
- filePath = Global.curEvt.path + @"\MLDR\yp.out";
- filePath = @"D:\MLDR\yp.out";
- break;
- }
- case 1:
- {
- filePath = Global.curEvt.path + @"\MLDR\sfxm.out";
- filePath = @"D:\MLDR\sfxm.out";
- break;
- }
- case 2:
- {
- filePath = Global.curEvt.path + @"\MLDR\hc.out";
- filePath = @"D:\MLDR\hc.out";
- break;
- }
- }
- if (File.Exists(filePath) != true)
- {
- MessageBox.Show("路径【" + filePath + "】文件不存在!");
- return;
- }
-
- #region【1.取out文件内容插入医保目录表】
- JObject joImportRtn = bus.ImportToDirectory(filePath, rbgDirecType_C.SelectedIndex, 50, ProcessBar);
- //MessageBox.Show("往IRIS插入数据:" + joImportRtn.ToString());
- if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) != 0)
- {
- Global.writeLog(joImportRtn.ToString());
- MessageBox.Show("插入医保目录表ImportToDirectory出现错误,请查看日志!" + errorMessage);
- return;
- }
- //2.插入目录表成功后一定要执行查询HIS目录信息
- if (queryHISDirectory(1, 3000, out errorMessage) != 0)
- {
- MessageBox.Show("查询插入的医保目录信息出现错误,请查看日志!" + errorMessage);
- return;
- }
- #endregion
- #region【3.取out文件内容插入医保对照表】
- DataTable dtHis = dtImport; //(DataTable)dgvHISDirectory.DataSource;
- if (dtHis.Rows.Count <= 0)
- return;
- JObject joImportMapRalation = bus.ImportToMapRelationFromTxt(filePath, rbgDirecType_C.SelectedIndex, dtHis, ProcessBar);
- if (JsonHelper.parseIrisRtnValue(joImportMapRalation, out errorMessage) != 0)
- {
- Global.writeLog(joImportMapRalation.ToString());
- MessageBox.Show("插入医保对照表ImportToMapRelation出现错误,请查看日志!" + errorMessage);
- }
- //4.插入目录表成功后一定要执行查询HIS目录信息
- btnQueryHISDirectory_Click(sender, e);
- #endregion
- MessageBox.Show("导入【" + hisTypeName + "】" + filePath + "文件成功!");
- }
- private void btnImportDC_Click(object sender, EventArgs e)
- {
- string errorMessage;
- string filePath = string.Empty;
- filePath = Global.curEvt.path + @"\MLDR\zddc.out";
- filePath = @"D:\MLDR\zddc.out";
- if (File.Exists(filePath) != true)
- {
- MessageBox.Show("路径【" + filePath + "】,文件不存在!");
- return;
- }
- JObject joImportRtn = bus.ImportToDictionaryDataDetail(filePath, ProcessBar);
- //MessageBox.Show("往IRIS插入数据:" + joImportRtn.ToString());
- if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) != 0)
- {
- Global.writeLog(joImportRtn.ToString());
- MessageBox.Show("插入医保字典明细表ImportToDictionaryDataDetail出现错误,请查看日志!" + errorMessage);
- return;
- }
- else
- {
- MessageBox.Show("导入医保字典out文件成功!");
- }
- }
- private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (tabControl1.SelectedIndex == 0)
- {
- MessageBox.Show("北京首信医保不提供医保目录和医保字典下载功能,该菜单作废!");
- tabControl1.SelectedIndex = 1;
- return;
- }
- }
- private void btnUpdate_Click(object sender, EventArgs e)
- {
- if (tbInsuCode.Text == "")
- {
- MessageBox.Show("请先输入准确医保编码,再执行更新医保目录信息!");
- return;
- }
- btnQueryCenterDirectory_Click(sender, e);
- DataTable dt = (DataTable)dgvCenterDirectory.DataSource;
- if ((dt == null) || (dt.Rows.Count < 1))
- {
- MessageBox.Show("未检索到医保目录数据,请检查!");
- return;
- }
- DataRow dr = dt.Rows[dgvCenterDirectory.CurrentRow.Index];
- AddMedInsuDirectory addDirectory = new AddMedInsuDirectory(rbgDirecType_C.SelectedIndex, dr);
- if (addDirectory.ShowDialog() == DialogResult.OK)
- {
- JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
- string error = "";
- if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
- {
- MessageBox.Show("修改失败:" + error);
- }
- else
- {
- MessageBox.Show("修改成功");
- }
- }
- }
- private void btnAdd_Click(object sender, EventArgs e)
- {
- AddMedInsuDirectory addDirectory = new AddMedInsuDirectory(rbgDirecType_C.SelectedIndex);
- if (addDirectory.ShowDialog() == DialogResult.OK)
- {
- JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
- string error = "";
- if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
- {
- MessageBox.Show("新增失败:" + error);
- }
- else
- {
- MessageBox.Show("新增成功");
- }
- }
- }
- public int queryHISDr(out string outparam)
- {
- outparam = "";
- string OutMsg = "";
- if (hIS.GetHISDir(out OutMsg) != 0)
- {
- outparam = OutMsg;
- return -1;
- }
- outparam = OutMsg;
- return 0;
- }
- public int queryMedInsuDr(string type, string searchstr, out string outparam)
- {
- outparam = "";
- string OutMsg = "";
- if (hIS.GetMedInsuDir(type, searchstr, out OutMsg) != 0)
- {
- outparam = OutMsg;
- return -1;
- }
- outparam = OutMsg;
- return 0;
- }
- public int queryRelationShipDr(int type, string searchstr, out string outparam)
- {
- outparam = "";
- string OutMsg = "";
- if (hIS.GetRelationShipDir(type, searchstr, "", out OutMsg) != 0)
- {
- outparam = OutMsg;
- return -1;
- }
- outparam = OutMsg;
- return 0;
- }
- /// <summary>
- /// 插入未对照字典数据
- /// </summary>
- /// <param name="type">HIS字典类型:tarSubData收费类型,dosageFormData剂型,frequenceData用法</param>
- /// <param name="HisType">HIS医保对照类型:63收费类型 70剂型 229用法</param>
- /// <param name="ProcessBar">进度条</param>
- /// <param name="outparam"></param>
- /// <returns></returns>
- public int InsertRelationShip(string type, int HisType, Sunny.UI.UIProcessBar ProcessBar, out string outparam)
- {
- outparam = "";
- if (queryHISDr(out outparam) != 0)
- {
- outparam = "查询HIS字典数据失败" + outparam;
- return -1;
- }
-
- JObject joRtn = new JObject(JObject.Parse(outparam));
- DataTable dt = (DataTable)joRtn["result"][type].ToObject(typeof(DataTable));
- JObject joImportMapRalation = bus.ImportToMapRelationFromDT(HisType, dt, dgv_RelationShipDr, ProcessBar);
- if (JsonHelper.parseIrisRtnValue(joImportMapRalation, out outparam) != 0)
- {
- outparam = "插入医保对照表ImportToMapRelationFromDT出现错误,请查看日志!" + outparam;
- return -1;
- }
- return 0;
- }
- private void MappingDr(int type)
- {
- if ((dgv_RelationShipDr.CurrentRow == null) || (dgv_InsuDr.CurrentRow == null))
- {
- MessageBox.Show("请先查询HIS对照信息和医保字典信息");
- return;
- }
- int iHis = dgv_RelationShipDr.CurrentRow.Index;
- int iCenter = dgv_InsuDr.CurrentRow.Index;
-
- DataTable dtHis = (DataTable)dgv_RelationShipDr.DataSource;
- DataTable dtCenter = (DataTable)dgv_InsuDr.DataSource;
- //dgv_RelationShipDr.Rows[iHis].Cells["InsuCode"].Value = dgv_InsuDr.Rows[iCenter].Cells["Code"].Value.ToString();
- //dgv_RelationShipDr.Rows[iHis].Cells["InsuName"].Value = dgv_InsuDr.Rows[iCenter].Cells["Name"].Value.ToString();
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- jsonTemp.ID = dtHis.Rows[iHis]["ID"];
- jsonTemp.HospitalDr = Global.inf.hospitalDr;
- jsonTemp.updateUserID = Global.user.ID;
- jsonTemp.InterfaceDr = Global.inf.interfaceDr;
- jsonTemp.HISCode = dtHis.Rows[iHis]["HISCode"];
- jsonTemp.HISName = dtHis.Rows[iHis]["HISName"];
- //jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["ID"];
- //jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["medInsuDirectoryID"];
- jsonTemp.State = 1; //1.已对照 2.已对照但未上传 3 已对照且已上传
- jsonTemp.HisType = type;
- jsonTemp.InsuCode = dtCenter.Rows[iCenter]["Code"];
- jsonTemp.InsuName = dtCenter.Rows[iCenter]["Name"];
- jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- jaParams.Add(jsonTemp);
- JObject joIn = new JObject();
- joIn.Add(new JProperty("params", jaParams));
- joIn.Add("code", "09010040");
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入医保字典对照信息");
- if ((int)joRtn["errorCode"] == 0)
- {
- dgv_RelationShipDr.Rows[iHis].Cells["Flag"].Value = "已对照";
- dgv_RelationShipDr.Rows[iHis].Cells["State"].Value = "1";
- dgv_RelationShipDr.Rows[iHis].Cells["InsuCode"].Value = dgv_InsuDr.Rows[iCenter].Cells["Code"].Value.ToString();
- dgv_RelationShipDr.Rows[iHis].Cells["InsuName"].Value = dgv_InsuDr.Rows[iCenter].Cells["Name"].Value.ToString();
- }
- else
- {
- dgv_RelationShipDr.Rows[iHis].Cells["Flag"].Value = "对照失败";
- }
- }
- private void CancleMapDr(int type)
- {
- if (dgv_RelationShipDr.CurrentRow == null)
- {
- MessageBox.Show("请先查询HIS医保字典对照信息");
- return;
- }
- int iHis = dgv_RelationShipDr.CurrentRow.Index;
- DataTable dtHis = (DataTable)dgv_RelationShipDr.DataSource;
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- jsonTemp.ID = dtHis.Rows[iHis]["ID"];
- jsonTemp.HospitalDr = Global.inf.hospitalDr;
- jsonTemp.updateUserID = Global.user.ID;
- jsonTemp.InterfaceDr = Global.inf.interfaceDr;
- jsonTemp.State = 0;
- jsonTemp.HisType = type;
- jsonTemp.HISCode = dtHis.Rows[iHis]["HISCode"];
- jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- jaParams.Add(jsonTemp);
- JObject joIn = new JObject();
- joIn.Add(new JProperty("params", jaParams));
- joIn.Add("code", "09010041");
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消医保字典对照");
- if ((int)joRtn["errorCode"] == 0)
- {
- dgv_RelationShipDr.Rows[iHis].Cells["InsuCode"].Value = "";
- dgv_RelationShipDr.Rows[iHis].Cells["InsuName"].Value = "";
- dgv_RelationShipDr.Rows[iHis].Cells["Flag"].Value = "未对照";
- dgv_RelationShipDr.Rows[iHis].Cells["State"].Value = "0";
- }
- else
- {
- dgv_RelationShipDr.Rows[iHis].Cells["Flag"].Value = "取消失败";
- }
- }
- private void rbg_MedDrType_ValueChanged(object sender, int index, string text)
- {
- if (index == 0)
- {
- Type = "tarSubData";
- MedInsuType = "AKA063";
- HisType = 63;
- }
- else if (index == 1)
- {
- Type = "dosageFormData";
- MedInsuType = "AKA070";
- HisType = 70;
- }
- else if (index == 2)
- {
- Type = "frequenceData";
- MedInsuType = "BKC229";
- HisType = 229;
- }
- btnRelationShipDr_Click(sender, null);
- }
- private void btn_InsertDr_Click(object sender, EventArgs e)
- {
- if (InsertRelationShip(Type, HisType, ProcessBarDr, out string outParam) != 0)
- {
- MessageBox.Show("插入医保字典对照数据失败" + outParam);
- return;
- }
- btnRelationShipDr_Click(sender, e);
- //MessageBox.Show("插入完成!");
- }
- private void btnRelationShipDr_Click(object sender, EventArgs e)
- {
- if (queryRelationShipDr(HisType, tbYYMC.Text, out string outParam) != 0)
- {
- dgv_RelationShipDr.DataSource = "";
- MessageBox.Show("查询医保字典对照关系" + outParam);
- return;
- }
- JObject joRtn = new JObject(JObject.Parse(outParam));
- dgv_RelationShipDr.DataSource = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
- }
- private void btnMap_Click(object sender, EventArgs e)
- {
- if (dgv_RelationShipDr.CurrentRow == null)
- {
- //MessageBox.Show("请先查询患者结算信息");
- return;
- }
- //string flag = dgv_RelationShipDr.Rows[dgv_RelationShipDr.CurrentRow.Index].Cells["Flag"].Value.ToString();
- //if (flag == "未对照")
- //{
- // MappingDr(HisType);
- //}
- MappingDr(HisType);
- }
- private void btnCancelMap_Click(object sender, EventArgs e)
- {
- if (dgv_RelationShipDr.CurrentRow == null)
- {
- //MessageBox.Show("请先查询患者结算信息");
- return;
- }
- string flag = dgv_RelationShipDr.Rows[dgv_RelationShipDr.CurrentRow.Index].Cells["Flag"].Value.ToString();
- if (flag == "已对照")
- {
- CancleMapDr(HisType);
- }
- }
- private void dgv_RelationShipDr_DoubleClick(object sender, EventArgs e)
- {
- string flag = dgv_RelationShipDr.Rows[dgv_RelationShipDr.CurrentRow.Index].Cells["Flag"].Value.ToString();
- if (flag == "未对照")
- {
- MappingDr(HisType);
- }
- }
- private void rbAll_CheckedChanged(object sender, EventArgs e)
- {
- //if (rbAll.Checked)
- //{
- // btnQueryHISDirectory_Click(null, new EventArgs());
- //}
- }
- private void rbNoMaped_CheckedChanged(object sender, EventArgs e)
- {
- //if (rbNoMaped.Checked)
- //{
- // string errMsg;
- // if (queryHISDirectory(1, 50, out errMsg) != 0)
- // {
- // MessageBox.Show(errMsg);
- // return;
- // }
- //}
- }
- private void tlpmp_NationInfo_Click(object sender, EventArgs e)
- {
- UpdateNationCodeInfo();
- }
- private void btn_UpdateNationInfo_Click(object sender, EventArgs e)
- {
- UpdateNationCodeInfo();
- }
- private void btnMedInsuDr_Click(object sender, EventArgs e)
- {
- if (queryMedInsuDr(MedInsuType, tbYBMC.Text, out string outParam) != 0)
- {
- MessageBox.Show("查询医保字典数据失败" + outParam);
- return;
- }
- JObject joRtn = new JObject(JObject.Parse(outParam));
- dgv_InsuDr.DataSource = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
- }
- }
- }
|