| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547 |
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using PTMedicalInsurance.Business;
- using PTMedicalInsurance.Helper;
- using PTMedicalInsurance.Variables;
- 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;
- using PTMedicalInsurance.FormSetter;
- 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();
- private JObject joDirInfoOfCenterRtn; //中心返回的目录信息
- public BasicData()
- {
- InitializeComponent();
- this.dgvInsuDirInfo.DataError += delegate (object sender, DataGridViewDataErrorEventArgs e) { };//屏蔽单元格错误
- rbgDirecType.SelectedIndex = 0;
- rbgDirecType_C.SelectedIndex = 0;
- rbgDownType_3.SelectedIndex = 5;
- 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;
- GridViewSetter gvs = new GridViewSetter();
- gvs.SetHeaderTextOfLimitPrice(dgvLimitPriceInfo);
- gvs.SetHeaderTextOfSelfPay(dgvSelfPayRiotInfo);
- gvs.SetHeaderTextOfInsuDir(dgvInsuDirInfo);
- }
- #region 函数封装
- private void queryInsuDirectory(int currentPage, int pageSize, int directoryType,int interfaceDr,string code)
- {
- try
- {
- string dirCode = "";
- string dirName = "";
- string approvalNO = "";
- Sunny.UI.UIDataGridView dgv;
- Sunny.UI.UIPagination pg;
- if (tbBasicData.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;
- }
- JObject joInput = new JObject {
- { "currentPage" , currentPage },
- { "pageSize" , pageSize },
- { "serviceCode" , code },
- { "directoryType" , directoryType },
- { "directoryCode" , dirCode },
- { "directoryName" , dirName },
- { "approvalNO" , approvalNO },
- { "directoryDr" , interfaceDr }
- };
- if ((rbgDirecType.SelectedIndex == 8) && (tbDicType.Text != ""))
- {
- joInput.Add("type",tbDicType.Text);
- }
- 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;
- }
- }
- }
- private void queryHISInsuDirectory(int directoryType, int pageIndex, int count, Sunny.UI.UIDataGridView dgv, int interfaceDr)
- {
- string code = "09010042";
- if (tbBasicData.SelectedIndex == 0)
- {
- if (rbgDirecType.SelectedIndex == 8)
- { code = "09010043"; }
- }
- queryInsuDirectory(pageIndex, count, directoryType + 1, interfaceDr, code);
- setHeaderTxt(directoryType, dgv);
- }
- private int queryHISDirectory(int currentPage, int pageSize,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 = 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;
- }
- joRtn = mIS.ConvertHISDir(joHISRtn);
- if (JsonHelper.parseIrisRtnValue(joRtn,out errMsg) != 0)
- {
- return -1;
- }
- }
- //已对照是先调云医保,然后再匹配HIS
- if (rbMaped.Checked) {
- dgvHISDirectory.DataSource = null;
- 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"];
- JArray jaMIRtn = JArray.Parse(JsonHelper.getDestValue(joMIRtn, "result.Data"));
- if (jaMIRtn.Count == 0)
- {
- errMsg = "未查询到已对照数据!";
- return -1;
- }
- 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;
- }
- else
- {
- JArray jaData = JArray.Parse(JsonHelper.getDestValue(joRtn,"result.Data"));
- for (int i = 0; i < jaData.Count; i++)
- {
- jaData[i]["flag"] = new JObject();
- jaData[i]["flag"] = "已对照";
- }
- joRtn["result"]["Data"] = jaData;
- Global.writeLog(joRtn.ToString());
- }
- }
- if (rbNoMaped.Checked) { flag = "NoMaped"; }
- DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
- int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
- pgHISDirect.TotalCount = totalCount;
- pgHISDirect.PageSize = 50;
- dgvHISDirectory.DataSource = dt;
- dgvHISDirectory.Columns[0].ReadOnly = true;
- return 0;
- }
- private void 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;
- }
- 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;
- }
- 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(); ;
-
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- if (dtHis.Rows[iHis]["MapID"].ToString() == "0")
- {
- jsonTemp.ID = "";
- }
- else
- {
- 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");
- 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.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 = "未对照";
- dtHis.Rows[iHis]["MapID"] = 0;
- }
- else
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
- }
- }
- /// <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 = "1365";
- break;
- }
- case 2://材料
- {
- funNo = "1364";
- 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;
- }
- }
- try
- {
- JObject joRtn = hBus.DownloadDirectory(funNo, ver);
- if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
- {
- txtPath = joRtn["filePath"].ToString();
- DataImoport bus = new DataImoport();
- JObject joImportRtn = bus.importDataToIrisByTxt(txtPath, 50, directoryType + 1, uiProcessBar);
- if (JsonHelper.parseCenterRtnValue(joImportRtn, out errorMessage) == 0)
- {
- iResult = 0;
- }
- else
- {
- 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
- #region 按钮
- private void Form1_Load(object sender, EventArgs e)
- {
- //rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(rbgDirecType_ValueChanged);
- this.WindowState = FormWindowState.Maximized;
- }
- private void btnDownload_Click(object sender, EventArgs e)
- {
- string errorMessage = string.Empty;
- if (rbgDirecType.SelectedIndex == 8)
- {
- dynamic joData = new JObject();
- joData.type = tbDicType.Text;
- joData.parentValue = "";
- joData.admdvs = "";
- joData.date = tbDicDate.Text;
- joData.vali_flag = "";
- if (downloadDicionary(joData, uiProcessBar1,out errorMessage) != 0)
- {
- MessageBox.Show(errorMessage);
- return;
- }
- }
- else
- {
- 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)
- {
- queryHISInsuDirectory(rbgDirecType.SelectedIndex, 1, 20, dgvDirectoy,Global.inf.interfaceDr);
- }
- private void btnQueryHISDirectory_Click(object sender, EventArgs e)
- {
- string errMsg;
- if (queryHISDirectory(1, 50, out errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- return;
- }
- GridViewSetter gridSetter = new GridViewSetter();
- gridSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
- }
- private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
- {
- queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, Global.inf.interfaceDr);
- }
- 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 (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)
- {
- btnQuery_Click(null, new EventArgs());
- }
- private void toolStripMenuItem2_Click(object sender, EventArgs e)
- {
- CancleMapping();
- }
- private void tsmiMapping_Click(object sender, EventArgs e)
- {
- Mapping();
- }
- 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_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)
- {
- if (rbAll.Checked)
- {
- btnQueryHISDirectory_Click(null, new EventArgs());
- }
- }
- 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 tsmUpdateDir_Click(object sender, EventArgs e)
- {
- JObject joData = new JObject();
- string outPar = "";
- try
- {
- int dirIndex = dgvDirectoy.CurrentRow.Index;
- int type = -1;
- switch (rbgDirecType.SelectedIndex)
- {
- case 0:
- type = 0;
- break;
- case 1:
- type = 5;
- break;
- case 2:
- type = 4;
- break;
- }
- if (type == -1)
- {
- MessageBox.Show("仅支持西药,诊疗,材料的更新查询!");
- return;
- }
- joData.Add("type",type);
- joData.Add("med_list_codg",dgvDirectoy.Rows[dirIndex].Cells["Code"].Value.ToString());
- joData.Add("fee_ocur_time", DateTime.Now.ToString("yyyy-MM-dd"));
- if (QueryAndShowInsuDirInfo(joData, out outPar) != 0)
- {
- MessageBox.Show(outPar);
- }
-
- }
- catch (Exception ex)
- {
- MessageBox.Show("目录查询异常:" + ex.Message);
- }
- }
- private void rbgDownType_3_ValueChanged(object sender, int index, string text)
- {
- DataGridView dgs = new DataGridView();
- GridViewSetter gvs = new GridViewSetter();
- //gvs.SetHeaderTextOfMoreInfo()
- }
- private void btQueryDir_2_Click(object sender, EventArgs e)
- {
- JObject joData = new JObject();
- string outPar = "";
- try
- {
- joData.Add("type", rbgDownType_3.SelectedIndex);
- joData.Add("med_list_codg", tbInsuCode_2.Text);
- joData.Add("fee_ocur_time", tbOccurDate_2.Text);
- if (QueryAndShowInsuDirInfo(joData, out outPar) != 0)
- {
- MessageBox.Show(outPar);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("目录更新异常:" + ex.Message);
- }
- }
- private void dgvLimitPriceInfo_DataError(object sender, DataGridViewDataErrorEventArgs anError)
- {
- // MessageBox.Show("Error happened " + anError.Context.ToString());
- // string msg = String.Format("Finished Editing Cell at ({0}, {1})",
- //anError.ColumnIndex, anError.RowIndex);
- // MessageBox.Show(msg);
- // if (anError.Context == DataGridViewDataErrorContexts.Commit)
- // {
- // MessageBox.Show("Commit error");
- // }
- // if (anError.Context == DataGridViewDataErrorContexts.CurrentCellChange)
- // {
- // MessageBox.Show("Cell change");
- // }
- // if (anError.Context == DataGridViewDataErrorContexts.Parsing)
- // {
- // MessageBox.Show("parsing error");
- // }
- // if (anError.Context == DataGridViewDataErrorContexts.LeaveControl)
- // {
- // MessageBox.Show("leave control error");
- // }
- // if (anError.Context == DataGridViewDataErrorContexts.Formatting)
- // {
- // MessageBox.Show("Formatting control error");
- // }
- // if (anError.Context == DataGridViewDataErrorContexts.Display)
- // {
- // MessageBox.Show("Display control error");
- // }
- // if ((anError.Exception) is ConstraintException)
- // {
- // DataGridView view = (DataGridView)sender;
- // view.Rows[anError.RowIndex].ErrorText = "an error";
- // view.Rows[anError.RowIndex].Cells[anError.ColumnIndex].ErrorText = "an error";
- // anError.ThrowException = false;
- // }
- }
- #endregion
- #region 目录更新 ,限价更新,自付比例更新
- /// <summary>
- /// 通过1312等更新医保目录
- /// </summary>
- /// <param name="errMsg"></param>
- /// <returns></returns>
- private int UpdateDirBy1312(JObject jo, out string errMsg)
- {
- errMsg = "";
- try
- {
- JObject joParam = new JObject();
- joParam.Add("Code", JsonHelper.getDestValue(jo, "hilist_code"));
- joParam.Add("Name", JsonHelper.getDestValue(jo, "hilist_name"));
- //joParam.Add("HisType", direcType + 1);
- //joParam.Add("HisTypeName", hisTypeName);
- //joParam.Add("LocateCode", tbLocateCode.Text);
- //joParam.Add("LocateName", tbLocateName.Text);
- //joParam.Add("DrugSafetyStandardCode", tbSafetyCode.Text);
- //joParam.Add("DosageFormCode", tbDosageCode.Text);
- //joParam.Add("DosageFormName", tbDosageName.Text);
- joParam.Add("CategoryCode", JsonHelper.getDestValue(jo, "list_type"));
- //joParam.Add("CategoryName", "");
- //joParam.Add("Specification", tbSpecification.Text);
- //joParam.Add("SpecificationCode", "");
- //joParam.Add("UnitOfPackag", tbUnitOfPackag.Text);
- //joParam.Add("UnitOfValuation", tbUnitOfValuation.Text);
- joParam.Add("StartDate", JsonHelper.getDestValue(jo, "begndate"));
- joParam.Add("EndDate", JsonHelper.getDestValue(jo, "enddate"));
- //joParam.Add("PinyinSearchCode", pym);
- //joParam.Add("Instructions", rtbInstructions.Text);
- //joParam.Add("ExceptContent", rtbExceptContent.Text);
- //joParam.Add("Connotation", rtbConnotation.Text);
- //joParam.Add("Note", tbNote.Text);
- joParam.Add("ValidFlag", JsonHelper.getDestValue(jo, "vali_flag"));
- //joParam.Add("ApprovalNO", tbApprovalNO.Text);
- //joParam.Add("VersionNO", tbVersionNO.Text);
- //joParam.Add("VersionName", tbVersionName.Text);
- //joParam.Add("UseFlag", Convert.ToInt32(cbUseFlag.Checked));
- //joParam.Add("SpecialFlag", Convert.ToInt32(cbSpecialFlag.Checked));
- joParam.Add("LimitFlag", JsonHelper.getDestValue(jo, "lmt_used_flag"));
- //joParam.Add("LimitRange", rtbLimitRange.Text);
- //joParam.Add("UniqueRecordNO", JsonHelper.getDestValue(jo, ""));
- //joParam.Add("NationalCode", tbNationalCode.Text);
- //joParam.Add("NationalName", tbNationalName.Text);
- //joParam.Add("Manufacturers", tbManufacturers.Text);
- joParam.Add("UpdateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- joParam.Add("ChargeItemLevel", JsonHelper.getDestValue(jo, "chrgitm_lv"));
- //joParam.Add("Company", tbCompany.Text);
- joParam.Add("ChargeItemType", JsonHelper.getDestValue(jo, "med_chrgitm_type"));
- JObject joRtn = mIS.UpdateDirectoryBySelf(joParam);
- string error = "";
- if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
- {
- errMsg = "更新失败:" + error;
- return -1;
- }
- else
- {
- errMsg ="更新成功";
- return 0;
- }
- }
- catch (Exception ex)
- {
- errMsg = "UpdateDir:" + ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 更新限价信息
- /// </summary>
- /// <param name="errMsg"></param>
- /// <returns></returns>
- private int UpdateLimitPrice(JArray ja, out string errMsg)
- {
- errMsg = "更新成功";
- bool bSuccess = true;
- try
- {
- Global.writeLog(ja.ToString());
- //遍历
- foreach (JObject jo in ja)
- {
- Global.writeLog(jo.ToString());
- //转换为IRIS字段
- JObject joTmp = new JObject();
- joTmp.Add("Code", JsonHelper.getDestValue(jo, "hilist_code"));
- joTmp.Add("Name", "");
- joTmp.Add("LimitType", JsonHelper.getDestValue(jo, "hilist_lmtpric_type"));
- joTmp.Add("DisposeWay", JsonHelper.getDestValue(jo, "overlmt_dspo_way"));
- joTmp.Add("BeginDate", JsonHelper.getDestValue(jo, "begndate"));
- joTmp.Add("EndDate", JsonHelper.getDestValue(jo, "enddate"));
- joTmp.Add("UpLimitAmount", JsonHelper.getDestValue(jo, "hilist_pric_uplmt_amt"));
- joTmp.Add("InsuranceAreaCode", JsonHelper.getDestValue(jo, "insu_admdvs"));
- joTmp.Add("PoolAreaNO", JsonHelper.getDestValue(jo, "poolarea_no"));
- joTmp.Add("ValidFlag", JsonHelper.getDestValue(jo, "vali_flag"));
- joTmp.Add("RequiredID", JsonHelper.getDestValue(jo, "rid"));
- joTmp.Add("UpdateTime", JsonHelper.getDestValue(jo, "updt_time"));
- JObject joRtn = mIS.UpdateDirectoryLimitPrice(joTmp);
- string error = "";
- if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
- {
- bSuccess = false;
- errMsg = errMsg + "更新失败:" + error;
- }
- }
- if (bSuccess == true)
- {
- return 0;
- }
- else
- {
- return -1;
- }
- }
- catch (Exception ex)
- {
- errMsg = "UpdateLimitPrice:" + ex.Message;
- return -1;
- }
- }
- private int UpdateSelfPayProportion(JArray ja, out string errMsg)
- {
- errMsg = "更新成功";
- bool bSuccess = true;
- try
- {
- //遍历
- foreach (JObject jo in ja)
- {
- //转换为IRIS字段
- JObject joTmp = new JObject();
- joTmp.Add("Code", JsonHelper.getDestValue(jo, "hilist_code"));
- joTmp.Add("Name", "");
- joTmp.Add("PersonnelType", JsonHelper.getDestValue(jo, "selfpay_prop_psn_type"));
- joTmp.Add("ProportionType", JsonHelper.getDestValue(jo, "selfpay_prop_type"));
- joTmp.Add("BeginDate", JsonHelper.getDestValue(jo, "begndate"));
- joTmp.Add("EndDate", JsonHelper.getDestValue(jo, "enddate"));
- joTmp.Add("Proportion", JsonHelper.getDestValue(jo, "selfpay_prop"));
- joTmp.Add("InsuranceAreaCode", JsonHelper.getDestValue(jo, "insu_admdvs"));
- joTmp.Add("PoolAreaNO", "");
- joTmp.Add("ValidFlag", JsonHelper.getDestValue(jo, "vali_flag"));
- joTmp.Add("RequiredID", "");
- joTmp.Add("UpdateTime", "");
- JObject joRtn = mIS.UpdateDirectorySelfpayProportion(joTmp);
- string error = "";
- if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
- {
- bSuccess = false;
- errMsg = errMsg + "更新失败:" + error;
- }
- }
- if (bSuccess == true)
- {
- return 0;
- }
- else
- {
- return -1;
- }
- }
- catch (Exception ex)
- {
- errMsg = "UpdateSelfPayProportion:" + ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 查询并展示医保目录信息(目录信息,限价信息,比例信息更新)
- /// </summary>
- /// <param name="joData"></param>
- /// <param name="errMsg"></param>
- /// <returns></returns>
- private int QueryAndShowInsuDirInfo(JObject joData, out string errMsg)
- {
- errMsg = "";
- try
- {
- int type = int.Parse(JsonHelper.getDestValue(joData, "type"));
- if (cBus.UpdateDirectory_HEB(joData, out errMsg) != 0)
- {
- return -1;
- }
- else
- {
- joDirInfoOfCenterRtn = JObject.Parse(errMsg);
- return ShowInsuDirInfo(type, joDirInfoOfCenterRtn, out errMsg);
- }
-
- }
- catch (Exception ex)
- {
- errMsg = ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 查询然后更新目录信息
- /// </summary>
- /// <param name="joData"></param>
- /// <param name="errMsg"></param>
- /// <returns></returns>
- private int QueryAndUpdateInsuDirInfo(JObject joData, out string errMsg)
- {
- errMsg = "";
- try
- {
- if (cBus.UpdateDirectory_HEB(joData, out errMsg) != 0)
- {
- return -1;
- }
- else
- {
- joDirInfoOfCenterRtn = JObject.Parse(errMsg);
- return UpdateInsuDirInfo(joDirInfoOfCenterRtn, out errMsg);
- }
- }
- catch (Exception ex)
- {
- errMsg = ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 1312,限价,自付比例信息更新到后台
- /// </summary>
- /// <param name="joDirInfo"></param>
- /// <param name="errMsg"></param>
- /// <returns></returns>
- private int UpdateInsuDirInfo(JObject joDirInfo, out string errMsg)
- {
- errMsg = "";
- try
- {
- JArray jaLimitPirceInfo = JArray.Parse(JsonHelper.getDestValue(joDirInfo, "output.lmtpric"));
- JArray jaSelfPayRiotInfo = JArray.Parse(JsonHelper.getDestValue(joDirInfo, "output.selfpay_array"));
- JObject joInsuDirInfo = JObject.Parse(JsonHelper.getDestValue(joDirInfo, "output.hilist"));
- if (UpdateDirBy1312(joInsuDirInfo, out errMsg) != 0)
- {
- return -1;
- }
- if (UpdateLimitPrice(jaLimitPirceInfo, out errMsg) != 0)
- {
- return -1;
- }
- if (UpdateSelfPayProportion(jaSelfPayRiotInfo, out errMsg) != 0)
- {
- return -1;
- }
- return 0;
- }
- catch (Exception ex)
- {
- errMsg = ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 展示1312,限价,自付比例等目录查询后的信息
- /// </summary>
- /// <param name="type"></param>
- /// <param name="joDirInfo"></param>
- /// <param name="errMsg"></param>
- /// <returns></returns>
- private int ShowInsuDirInfo(int type,JObject joDirInfo, out string errMsg)
- {
- errMsg = "";
- try
- {
- if (JsonHelper.parseCenterRtnValue(joDirInfo, out errMsg) != 0)
- {
- return -1;
- }
- else
- {
- JArray jaLimitPirceInfo = JArray.Parse(JsonHelper.getDestValue(joDirInfo, "output.lmtpric"));
- JArray jaSelfPayRiotInfo = JArray.Parse(JsonHelper.getDestValue(joDirInfo, "output.selfpay_array"));
- JObject joInsuDirInfo = JObject.Parse(JsonHelper.getDestValue(joDirInfo, "output.hilist"));
- JArray jaInsuDirInfo = new JArray();
- jaInsuDirInfo.Add(joInsuDirInfo);
- DataTable dtLimitPriceInfo = (DataTable)jaLimitPirceInfo.ToObject(typeof(DataTable));
- DataTable dtSelfPayRiotInfo = (DataTable)jaSelfPayRiotInfo.ToObject(typeof(DataTable));
- DataTable dtInsuDirInfo = (DataTable)jaInsuDirInfo.ToObject(typeof(DataTable));
- dgvLimitPriceInfo.DataSource = dtLimitPriceInfo;
- dgvSelfPayRiotInfo.DataSource = dtSelfPayRiotInfo;
- dgvInsuDirInfo.DataSource = dtInsuDirInfo;
- GridViewSetter gvs = new GridViewSetter();
- gvs.SetHeaderTextOfLimitPrice(dgvLimitPriceInfo);
- if (type == 0)//西药
- {
- gvs.SetHeaderTextOfMoreInfo(0, dgvMoreInfo);
- JObject joMoreInfo = JObject.Parse(JsonHelper.getDestValue(joDirInfo, "output.tcmpat"));
- JArray jaMoreInfo = new JArray();
- jaMoreInfo.Add(joMoreInfo);
- DataTable dtMoreInfo = (DataTable)jaMoreInfo.ToObject(typeof(DataTable));
- dgvMoreInfo.DataSource = dtMoreInfo;
- }
- if (type == 5)
- {
- gvs.SetHeaderTextOfMoreInfo(5, dgvMoreInfo);
- JObject joMoreInfo = JObject.Parse(JsonHelper.getDestValue(joDirInfo, "output.trtserv"));
- JArray jaMoreInfo = new JArray();
- jaMoreInfo.Add(joMoreInfo);
- DataTable dtMoreInfo = (DataTable)jaMoreInfo.ToObject(typeof(DataTable));
- dgvMoreInfo.DataSource = dtMoreInfo;
- }
- if (type == 4)
- {
- gvs.SetHeaderTextOfMoreInfo(4, dgvMoreInfo);
- JObject joMoreInfo = JObject.Parse(JsonHelper.getDestValue(joDirInfo, "output.mcsinfo"));
- JArray jaMoreInfo = new JArray();
- jaMoreInfo.Add(joMoreInfo);
- DataTable dtMoreInfo = (DataTable)jaMoreInfo.ToObject(typeof(DataTable));
- dgvMoreInfo.DataSource = dtMoreInfo;
- }
- //更新后台
- tbBasicData.SelectedIndex = 2;
- return 0;
- }
- }
- catch (Exception ex)
- {
- errMsg = "" + ex.Message;
- return -1;
- }
- }
- #endregion
- private void btSave_2_Click(object sender, EventArgs e)
- {
- string errMsg;
- if (joDirInfoOfCenterRtn == null) { return; }
- if (JsonHelper.parseIrisRtnValue(joDirInfoOfCenterRtn, out errMsg) != 0) return;
- if (UpdateInsuDirInfo(joDirInfoOfCenterRtn, out errMsg) != 0) MessageBox.Show(errMsg);
- }
- private void tsmUpdateDir_Click_1(object sender, EventArgs e)
- {
- JObject joData = new JObject();
- string outPar = "";
- try
- {
- int dirIndex = dgvDirectoy.CurrentRow.Index;
- int type = -1;
- switch (rbgDirecType.SelectedIndex)
- {
- case 0:
- type = 0;
- break;
- case 1:
- type = 5;
- break;
- case 2:
- type = 4;
- break;
- }
- if (type == -1)
- {
- MessageBox.Show("仅支持西药,诊疗,材料的更新!");
- return;
- }
- joData.Add("type", type);
- joData.Add("med_list_codg", dgvDirectoy.Rows[dirIndex].Cells["Code"].Value.ToString());
- joData.Add("fee_ocur_time", DateTime.Now.ToString("yyyy-MM-dd"));
- if (QueryAndUpdateInsuDirInfo(joData, out outPar) != 0)
- {
- MessageBox.Show(outPar);
- }
- queryHISInsuDirectory(rbgDirecType.SelectedIndex, 1, 20, dgvDirectoy, Global.inf.interfaceDr);
- }
- catch (Exception ex)
- {
- MessageBox.Show("目录更新异常:" + ex.Message);
- }
- }
- private void toolStripMenuItem5_Click(object sender, EventArgs e)
- {
- if (!rbMaped.Checked)
- {
- MessageBox.Show("请选择已对照进行更新");
- return;
- }
- DataTable dt = (DataTable)dgvHISDirectory.DataSource; //获取当前页的数据,注意在已对照页面更新
- if ((dt == null) || (dt.Rows.Count < 1))
- {
- MessageBox.Show("表中无数据,请检查!");
- return;
- }
- string htype = "";
- string cxno = "";
- if (rbgDirecType_C.SelectedIndex == 0)
- {
- htype = "1";
- cxno = "1360";
- }
- else if (rbgDirecType_C.SelectedIndex == 1)
- {
- htype = "2";
- cxno = "1365";
- }
- else if (rbgDirecType_C.SelectedIndex == 2)
- {
- htype = "3";
- cxno = "1364";
- }
- // MessageBox.Show("第1列" + dt.Rows[0][0]);
- // MessageBox.Show("第1行" + dt.Rows[0].ToString());
- dynamic one1312 = new JObject();
- //one1312.Add("query_date", "");//查询时间点 日期型
- //one1312.Add("hilist_code", "");//医保目录编码 字符型 30
- one1312.Add("med_list_codg", "");//医保目录编码 字符型 30
- one1312.Add("fee_ocur_time", "2022-01-01");//医保目录编码 字符型 30
- //one1312.Add("insu_admdvs", "");//参保机构医保区划 字符型 6 Y
- //one1312.Add("begndate", ""); //开始日期 日期型
- //one1312.Add("hilist_name", "");//医保目录名称 字符型 200
- //one1312.Add("wubi", "");//五笔助记码 字符型 30
- //one1312.Add("pinyin", "");//拼音助记码 字符型 30
- //one1312.Add("med_chrgitm_type", "");//医疗收费项目类别 字符型 6 Y
- //one1312.Add("chrgitm_lv", "");//收费项目等级 字符型 3 Y
- //one1312.Add("lmt_used_flag", "");//限制使用标志 字符型 3 Y
- //one1312.Add("list_type", "");//目录类别 字符型 30
- //one1312.Add("med_use_flag", "");//医疗使用标志 字符型 3 Y
- //one1312.Add("matn_used_flag", "");//生育使用标志 字符型 3 Y
- //one1312.Add("hilist_use_type", "");//医保目录使用类别 字符型 3 Y
- //one1312.Add("lmt_cpnd_type", ""); //限复方使用类型 字符型 3 Y
- //one1312.Add("vali_flag", "");//有效标志 字符型 3 Y
- //one1312.Add("updt_time", "2021-01-01");//更新时间 日期型
- //one1312.Add("page_num", 1);//当前页数 数值型 4
- //one1312.Add("page_size", 50);//本页数据量 数值型 4
- dynamic data1312 = new JObject();
- dynamic joPamam = new JObject();//更新HIS医保目录入参
- //joPamam.Add("Code", "");
- //joPamam.Add("Name", "");
- joPamam.Add("HisType", htype);
- //joPamam.Add("ChargeItemLevel", "");
- //joPamam.Add("ListType", "");
- int i;
- string sfdl = "";
- for (i = 0; i < dt.Rows.Count; i++)
- {
- one1312.med_list_codg = dt.Rows[i][12].ToString();//每行的第13列是医保编码
- //if (htype == "3")
- //{
- // one1312.hilist_code = dt.Rows[i][12].ToString();//每行的第13列是医保编码,长春截取15位,医保目录只有15位,武汉是20位
- //}
- data1312.data = one1312;
- JObject jo1312Rtn = invoker.invokeCenterService(cxno, data1312.ToString());
- if (JsonHelper.parseCenterReturnJson(jo1312Rtn, out string errorMsg) == 0)
- {
- joPamam.CeilingPrice = "999999";
- joPamam.Code = dt.Rows[i][12].ToString();//哈尔滨医保查询医保编码字母都是小写
- if (!string.IsNullOrEmpty(JsonHelper.getDestValue(jo1312Rtn, "output.hilist.vali_flag")))//判断返回结束时间为空的
- //if (Convert.ToString(dt_result.Rows[n]["vali_flag"])=="1"&& Convert.ToString(dt_result.Rows[n]["poolarea_no"]) == "230100")
- {
- //医保返参取值
- //joPamam.Code = dt_result.Rows[n][3].ToString();//长春第四位医保编码
- //joPamam.Code = dt_result.Rows[i]["hilist_code"].ToString();
-
- joPamam.Name = jo1312Rtn["output"]["hilist"]["hilist_name"];
- joPamam.ChargeItemLevel = jo1312Rtn["output"]["hilist"]["chrgitm_lv"];//长春第28位收费项目等级
-
- if (joPamam.ChargeItemLevel == "01")
- {
- joPamam.ChargeItemLevelName = "甲类";
- }
- else if (joPamam.ChargeItemLevel == "02")
- {
- joPamam.ChargeItemLevelName = "乙类";
- }
- else if (joPamam.ChargeItemLevel == "03")
- {
- joPamam.ChargeItemLevelName = "丙类";
- }
- joPamam.ListType = jo1312Rtn["output"]["hilist"]["list_type"];//取医保目录类别 101 201 301
- joPamam.ChargeItemType = jo1312Rtn["output"]["hilist"]["med_chrgitm_type"];//取医疗收费类别 01.02.03....
- }
- //取医保目录价格,哈尔滨三级医院
- DataTable dt_result = (DataTable)jo1312Rtn["output"]["lmtpric"].ToObject(typeof(DataTable));
- if (dt_result.Rows.Count>0) {
- for (int n = 0; n < dt_result.Rows.Count; n++)
- {
- if (dt_result.Rows[n]["hilist_lmtpric_type"].ToString() == "3")//取医院等级为三的限价
- {
- joPamam.CeilingPrice = dt_result.Rows[n]["hilist_pric_uplmt_amt"].ToString();
- }
- }
- }
-
-
- JObject joRtn = mIS.UpdateDirectoryBySelf(joPamam);
- }
- }
- MessageBox.Show("更新完成!");
- }
- }
- }
|