MedInsuQuery.cs 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553
  1. using Newtonsoft.Json.Linq;
  2. using System;
  3. using System.IO;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. using PTMedicalInsurance.Common;
  13. using PTMedicalInsurance.Helper;
  14. using PTMedicalInsurance.FormSetter;
  15. using PTMedicalInsurance.Business;
  16. using PTMedicalInsurance.Variables;
  17. namespace PTMedicalInsurance.Forms
  18. {
  19. public partial class MedInsuQuery : Form
  20. {
  21. DataTable dtExport;
  22. JObject joRtn10001 = new JObject();
  23. JObject joInput20002 = new JObject();
  24. public string patInfo = "", ReadCardOutParam = "", CertNo = "";
  25. public string presAdmLoc = "", presAdmDoc = "", presAdmID = "", presNo = "", hiRxno = "";
  26. public string DrCode = "", DrName = "", DrInsuCode = "", DrCertNo = "";
  27. //1.声明自适应类实例
  28. AutoResizeForm asc = new AutoResizeForm();
  29. private InvokeHelper invoker = new InvokeHelper();
  30. private HisIrisServices hIS = new HisIrisServices();
  31. private MIIrisServices mIS = new MIIrisServices();
  32. HisMainBusiness hBus = new HisMainBusiness();
  33. public MedInsuQuery()
  34. {
  35. InitializeComponent();
  36. asc.controllInitializeSize(this);
  37. asc.controlAutoSize(this);
  38. }
  39. public MedInsuQuery( int iPage)
  40. {
  41. InitializeComponent();
  42. asc.controllInitializeSize(this);
  43. asc.controlAutoSize(this);
  44. tbcMain.SelectedIndex = iPage;
  45. }
  46. private void btnClose_Click(object sender, EventArgs e)
  47. {
  48. this.Close();
  49. }
  50. private void MedInsuQuery_Load(object sender, EventArgs e)
  51. {
  52. //this.WindowState = FormWindowState.Maximized;
  53. tbcMain.SelectedIndex = 1;
  54. dpST.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
  55. dpED.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
  56. dt_ST.Text = DateTime.Now.ToString("yyyy-MM-01 00:00:00");
  57. dt_ET.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
  58. date_st.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
  59. date_et.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
  60. dtp_st.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
  61. dtp_et.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
  62. dpt_ST.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
  63. dpt_ET.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
  64. DT_ST1.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
  65. DT_ET1.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
  66. dptST.Text = DateTime.Now.ToString("yyyy-MM-01 00:00:00");
  67. dptET.Text = DateTime.Now.ToString("yyyy-MM-31 23:59:59");
  68. dtTHSJ.Text = DateTime.Now.ToString();
  69. // dgvSettlRecord.AutoGenerateColumns = false;
  70. cbbLevel.SelectedIndex = 0;
  71. cbbOverPrice.SelectedIndex = 0;
  72. GridViewSetter grdSetter = new GridViewSetter();
  73. grdSetter.SetHeaderTextOfMedInsuHosPerInfo(dgvSettlRecord);
  74. grdSetter.SetHeaderTextOfSettltMentFeelDetailInfo(dgvInsuFeeUpload);
  75. grdSetter.DatagridviewColumnWidthAdaptation(dgvInsuFeeUpload);
  76. grdSetter.SetHeaderTextOfMIPatCurrentInsuInfo(dgv_4001);
  77. grdSetter.SetHeaderTextOfSettlList(dgvSettleData);
  78. grdSetter.SetHeaderTextOfSettltMentFeelDetailInfo(dgvFeeInfo);
  79. grdSetter.SetHeaderTextOfHISRegister(dgv_HISRegInfo);
  80. grdSetter.SetHeaderTextOfHISPrescFee(dgv_PrescriptionInfo);
  81. grdSetter.SetHeaderTextOfBillInfo(dgv_BillInfo);
  82. grdSetter.SetHeaderTextOfBillDetailInfo(dgv_BillDetailInfo);
  83. grdSetter.SetHeaderTextOf5205DrugDetailInfo(dgv5205);
  84. grdSetter.DatagridviewColumnWidthAdaptation(dgv_HISRegInfo);
  85. grdSetter.DatagridviewColumnWidthAdaptation(dgv_PrescriptionInfo);
  86. grdSetter.DatagridviewColumnWidthAdaptation(dgv_BillInfo);
  87. grdSetter.DatagridviewColumnWidthAdaptation(dgv_BillDetailInfo);
  88. grdSetter.DatagridviewColumnWidthAdaptation(dgv5205);
  89. rbg_Type.SelectedIndex = 0;
  90. tbJGBM.Text = Global.inf.hospitalNO;
  91. dtTHSJ.Text= DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  92. }
  93. private void btnQuery_Click(object sender, EventArgs e)
  94. {
  95. btnPrint.Enabled = false;
  96. string sCZYXM = Global.user.name;
  97. string SqlHeard = " Adm_Dr,MdtrtID,Name as PatientName,Age,PsnCertNO,Gend,PsnType,EmpName,AdmInDepName,insuplcAdmdvs,sZYZT AS sZTSM, "
  98. + " AdmBed,RegDate,MainDiagName,AttendDoctorNO,ChiefPhyDocName,'"+ sCZYXM+ "' as OpertName,'' as InHospNo,''Address ";
  99. string SqlStrMain = " SELECT a.*,b.*,a.PatientName AS Name,a.PsnType AS PsnTypeCode,'在院' sZYZT FROM BS_MIPatCurrentInsuInfo a LEFT JOIN BS_MedInsuRegisterInfo b "
  100. + " ON a.MdtrtID=b.InsuRegID AND a.Interface_Dr=b.Interface_Dr AND a.Hospital_Dr=b.Hospital_Dr "
  101. + " WHERE b.Type=1 AND b.ValidFlag=1 AND b.Hospital_Dr= " + Global.inf.hospitalDr + " AND b.Interface_Dr= " + Global.inf.interfaceDr
  102. + " AND b.InsuRegID NOT IN (SELECT MdtrtID FROM BS_MedInsuSettlement WHERE MdtrtID=b.InsuRegID AND BillType=1 AND ValidFlag=1 AND AdmType=2) "
  103. + " AND b.RegDate<='" + dpED.Text + "' AND b.RegDate>'" + dpST.Text + "' " //
  104. + " UNION ALL "
  105. + " SELECT a.*,b.*,a.PatientName AS Name,a.PsnType AS PsnTypeCode,'已结算' AS sZYZT "
  106. + " FROM BS_MIPatCurrentInsuInfo a LEFT JOIN BS_MedInsuRegisterInfo b "
  107. + " ON a.MdtrtID=b.InsuRegID AND a.Interface_Dr=b.Interface_Dr AND a.Hospital_Dr=b.Hospital_Dr "
  108. + " LEFT JOIN BS_MedInsuSettlement c ON a.MdtrtID=b.InsuRegID AND b.InsuRegID=c.MdtrtID AND a.Interface_Dr=b.Interface_Dr AND b.Interface_Dr=c.Interface_Dr "
  109. + " WHERE b.Type=1 AND b.ValidFlag=1 AND c.BillType=1 AND b.Hospital_Dr= " + Global.inf.hospitalDr + " AND b.Interface_Dr= " + Global.inf.interfaceDr
  110. + " AND c.AdmType=2 AND c.SettlementDateTime<='" + dpED.Text + "' AND c.SettlementDateTime>'" + dpST.Text + "' "; //
  111. string sqlStr = " SELECT "+ SqlHeard + " FROM ("+ SqlStrMain +") M ";
  112. //MessageBox.Show(sqlStr);
  113. JObject joSqlstr = new JObject();
  114. joSqlstr.Add("sqlStr", sqlStr);
  115. joSqlstr.Add("Type", "MedInsuHosPInfo");
  116. joSqlstr.Add("hospID", Global.inf.hisHospitalDr);
  117. JArray jaParam = new JArray();
  118. jaParam.Add(joSqlstr);
  119. JObject joSettlQuery = new JObject();
  120. joSettlQuery.Add("params", jaParam);
  121. joSettlQuery.Add("code", "09010059");
  122. InvokeHelper invoker = new InvokeHelper();
  123. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  124. //MessageBox.Show(joRtn.ToString());
  125. if (joRtn["result"]["data"].ToString() == "[]")
  126. {
  127. MessageBox.Show("查询结果为空!");
  128. return;
  129. }
  130. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  131. dgvSettlRecord.DataSource = dt;
  132. if (dt.Rows.Count != 0)
  133. {
  134. btnPrint.Enabled = true;
  135. dtExport = dt;
  136. //从HIS获取患者的床号(分床前医保登记的病人床号没有写入医保平台登记表)
  137. for (int i = 0; i < dt.Rows.Count; i++)
  138. {
  139. string BedNo, BedDocName, InHospNo, Address;
  140. JObject joTmp = new JObject();
  141. joTmp.Add("admID", dt.Rows[i]["Adm_Dr"].ToString());
  142. JObject joRtn2 = invoker.invokeHISService(JsonHelper.setIrisInpar("05110014", joTmp).ToString(), "获取患者就诊信息");
  143. if (JsonHelper.parseIrisRtnValue(joRtn2, out string errMsg) == 0)
  144. {
  145. BedNo = JsonHelper.getDestValue(JObject.Parse(joRtn2.ToString()), "mdtrtinfo.adm_bed");
  146. BedDocName = JsonHelper.getDestValue(JObject.Parse(joRtn2.ToString()), "mdtrtinfo.chfpdr_name");
  147. InHospNo = JsonHelper.getDestValue(JObject.Parse(joRtn2.ToString()), "mdtrtinfo.medrcdno");
  148. Address = JsonHelper.getDestValue(JObject.Parse(joRtn2.ToString()), "mdtrtinfo.Address");
  149. dt.Rows[i]["AdmBed"] = BedNo;
  150. dt.Rows[i]["AttendDoctorNO"] = BedDocName;
  151. dt.Rows[i]["InHospNo"] = InHospNo;
  152. dt.Rows[i]["Address"] = Address;
  153. }
  154. else
  155. {
  156. if (errMsg.IndexOf("请重新登录") > 0)
  157. {
  158. MessageBox.Show("获取患者信息失败,请重新登录系统!");
  159. break;
  160. }
  161. }
  162. }
  163. }
  164. }
  165. private void btnPrint_Click(object sender, EventArgs e)
  166. {
  167. string LSH = DateTime.Now.ToString("yyyy-MM-dd"); //DateTime.Now.ToString("MMddHHmmssffff");
  168. string sFliePathName = @"C:\Users\Administrator\Desktop\" + LSH + "医保在院患者登记或结算信息.xls";
  169. string ReturnFileName = ExportToExcel.DataTabletoExcel(dtExport, sFliePathName);
  170. if (ReturnFileName != "")
  171. {
  172. MessageBox.Show("导出成功,文件保存路径:【" + ReturnFileName + "】");
  173. System.Diagnostics.Process.Start(ReturnFileName); //打开excel文件
  174. }
  175. else
  176. {
  177. MessageBox.Show("导出失败!");
  178. }
  179. }
  180. private void btnOK_Click(object sender, EventArgs e)
  181. {
  182. string sqlStr;
  183. sqlStr = " SELECT a.Adm_Dr,c.Name, b.HISCode, b.MedInsuNO, b.Price,b.Sumamt,b.ChargeItemLevel,c.ChargeItemLevelName,b.SelfPayProp, ";
  184. sqlStr = sqlStr + " b.UpLimitAmount,b.OverLimitAmount,b.InScopeAmount,b.FullOwnPayAmount,b.PreSelfPayAmount,b.LimitUsedFlag ";
  185. sqlStr = sqlStr + " FROM BS_MedInsuSettlement a LEFT JOIN BS_MedInsuFeeUploadRecord b ";
  186. sqlStr = sqlStr + " ON a.Hospital_Dr=b.Hospital_Dr AND a.MdtrtID=b.MdtrtID AND a.PersonnelNO=b.PersonnelNO ";
  187. sqlStr = sqlStr + " LEFT JOIN HB_MedInsuDirectory c ON b.MedInsuNO=c.Code AND a.Interface_Dr=c.Interface_Dr AND a.Hospital_Dr=c.Hospital_Dr ";
  188. sqlStr = sqlStr + " WHERE b.MedInsuNO<>'' and a.ValidFlag=1 AND a.BillType=1 AND a.AdmType=2 ";
  189. sqlStr = sqlStr + " AND a.Interface_Dr=" + Global.inf.interfaceDr;
  190. sqlStr = sqlStr + " AND a.Hospital_Dr= " + Global.inf.hospitalDr;
  191. sqlStr = sqlStr + " AND a.OccurTime>'" + dt_ST.Text + "'";
  192. sqlStr = sqlStr + " AND a.OccurTime<'" + dt_ET.Text + "'";
  193. if (tb_InHospNo.Text != "")
  194. {
  195. sqlStr = sqlStr + " and a.BillID='" + tb_InHospNo.Text + "'";
  196. }
  197. if (tb_SettleID.Text != "")
  198. {
  199. sqlStr = sqlStr + " and a.SettlementID='" + tb_SettleID.Text + "'";
  200. }
  201. if (cbbOverPrice.Text == "是")
  202. {
  203. sqlStr = sqlStr + " AND b.OverLimitAmount>0 ";
  204. }
  205. else if (cbbOverPrice.Text == "否")
  206. {
  207. sqlStr = sqlStr + " AND b.OverLimitAmount<=0 ";
  208. }
  209. if (cbbLevel.Text == "甲类")
  210. {
  211. sqlStr = sqlStr + " AND b.ChargeItemLevel='01' ";
  212. }
  213. else if (cbbLevel.Text == "乙类")
  214. {
  215. sqlStr = sqlStr + " AND b.ChargeItemLevel='02' ";
  216. }
  217. else if (cbbLevel.Text == "丙类")
  218. {
  219. sqlStr = sqlStr + " AND b.ChargeItemLevel='03' ";
  220. }
  221. JObject joSqlstr = new JObject();
  222. joSqlstr.Add("sqlStr", sqlStr);
  223. JArray jaParam = new JArray();
  224. jaParam.Add(joSqlstr);
  225. JObject joSettlQuery = new JObject();
  226. joSettlQuery.Add("params", jaParam);
  227. joSettlQuery.Add("code", "09010118");
  228. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询医保结算费用信息");
  229. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  230. dgvInsuFeeUpload.DataSource = dt;
  231. }
  232. private void uiButton3_Click(object sender, EventArgs e)
  233. {
  234. //string sqlStr = " SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + Global.inf.hospitalDr;
  235. //sqlStr = sqlStr + " and OccurTime>'" + DT_ST1.Text + "'";
  236. //sqlStr = sqlStr + " and OccurTime<'" + DT_ET1.Text + "'";
  237. //sqlStr = sqlStr + " and Interface_Dr=" + Global.inf.interfaceDr + "";
  238. //sqlStr = sqlStr + " and CertificateNO= " + tb_CertNo.Text;
  239. //sqlStr = sqlStr + " and BillType=1 and ValidFlag=1 ";
  240. string sqlstr = " SELECT distinct a.InsuranceAreaCode, b.PersonalNO,b.PsnCertType,b.PsnCertNO,b.PatientName , ";
  241. sqlstr = sqlstr + " b.Gend,b.Naty,b.Brdy,b.Age,b.Balc,b.Insutype,b.PsnType,b.PsnInsuStas,b.PsnInsuDate, ";
  242. sqlstr = sqlstr + " b.PausInsuDate,b.Cvlservflag,b.insuplcAdmdvs,b.EmpName ";
  243. sqlstr = sqlstr + " FROM BS_MedInsuSettlement a ";
  244. sqlstr = sqlstr + " RIGHT JOIN BS_MIPatCurrentInsuInfo b ";
  245. sqlstr = sqlstr + " ON a.PersonnelNO=b.PersonalNO AND a.Interface_Dr=b.Interface_Dr ";
  246. sqlstr = sqlstr + " AND a.PersonType=b.PsnType AND a.InsuranceType=b.Insutype ";
  247. sqlstr = sqlstr + " WHERE a.ValidFlag=1 AND a.BillType=1 ";
  248. sqlstr = sqlstr + " and a.OccurTime>'" + DT_ST1.Text + "'";
  249. sqlstr = sqlstr + " and a.OccurTime<'" + DT_ET1.Text + "'";
  250. sqlstr = sqlstr + " and a.Interface_Dr='" + Global.inf.interfaceDr + "'";
  251. if (tb_CertNo.Text!="")
  252. sqlstr = sqlstr + " and a.CertificateNO='" + tb_CertNo.Text + "'";
  253. JObject joSqlstr = new JObject();
  254. joSqlstr.Add("sqlStr", sqlstr);
  255. joSqlstr.Add("Type", "4001");
  256. JArray jaParam = new JArray();
  257. jaParam.Add(joSqlstr);
  258. JObject joSettlQuery = new JObject();
  259. joSettlQuery.Add("params", jaParam);
  260. joSettlQuery.Add("code", "09010059");
  261. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  262. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  263. dgv_4001.DataSource = dt;
  264. }
  265. private void uiButton4_Click(object sender, EventArgs e)
  266. {
  267. string errorMsg = "";
  268. if (dgv_4001.CurrentRow == null)
  269. {
  270. MessageBox.Show("请查询患者参保信息");
  271. return;
  272. }
  273. int iCenter = dgv_4001.CurrentRow.Index;
  274. string psn_no = dgv_4001.Rows[iCenter].Cells["PersonalNO"].Value.ToString();
  275. string psn_cert_type = dgv_4001.Rows[iCenter].Cells["PsnCertType"].Value.ToString();
  276. string certno = dgv_4001.Rows[iCenter].Cells["PsnCertNO"].Value.ToString();
  277. string psn_name = dgv_4001.Rows[iCenter].Cells["PatientName"].Value.ToString();
  278. string gend = dgv_4001.Rows[iCenter].Cells["Gend"].Value.ToString();
  279. string naty = dgv_4001.Rows[iCenter].Cells["Naty"].Value.ToString();
  280. string brdy = dgv_4001.Rows[iCenter].Cells["Brdy"].Value.ToString();
  281. string age = dgv_4001.Rows[iCenter].Cells["Age"].Value.ToString();
  282. string balc = dgv_4001.Rows[iCenter].Cells["Balc"].Value.ToString();
  283. string insutype = dgv_4001.Rows[iCenter].Cells["Insutype"].Value.ToString();
  284. string psn_type = dgv_4001.Rows[iCenter].Cells["PsnType"].Value.ToString();
  285. string psn_insu_stas = dgv_4001.Rows[iCenter].Cells["PsnInsuStas"].Value.ToString();
  286. string psn_insu_date = dgv_4001.Rows[iCenter].Cells["PsnInsuDate"].Value.ToString();
  287. string paus_insu_date = dgv_4001.Rows[iCenter].Cells["PausInsuDate"].Value.ToString();
  288. string cvlserv_flag = dgv_4001.Rows[iCenter].Cells["Cvlservflag"].Value.ToString();
  289. string insuplc_admdvs = dgv_4001.Rows[iCenter].Cells["insuplcAdmdvs"].Value.ToString();
  290. string emp_name = dgv_4001.Rows[iCenter].Cells["EmpName"].Value.ToString();
  291. JObject joInput = new JObject();
  292. JObject joData = new JObject();
  293. joData.Add("psn_no", psn_no);
  294. joData.Add("psn_cert_type", psn_cert_type);
  295. joData.Add("certno", certno);
  296. joData.Add("psn_name", psn_name);
  297. joData.Add("gend", gend);
  298. joData.Add("naty", naty);
  299. joData.Add("brdy", brdy);
  300. joData.Add("age", age);
  301. joData.Add("balc", balc);
  302. joData.Add("insutype", insutype);
  303. joData.Add("psn_type", psn_type);
  304. joData.Add("psn_insu_stas", psn_insu_stas);
  305. joData.Add("psn_insu_date", psn_insu_date);
  306. joData.Add("paus_insu_date", paus_insu_date);
  307. joData.Add("cvlserv_flag", cvlserv_flag);
  308. joData.Add("insuplc_admdvs", insuplc_admdvs);
  309. joData.Add("emp_name", emp_name);
  310. joInput.Add("data", joData);
  311. JObject joRtn = invoker.invokeCenterServiceF("4001", JsonHelper.setCenterInparF("4001", joInput));
  312. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  313. {
  314. MessageBox.Show("患者信息上传失败:" + errorMsg);
  315. return;
  316. }
  317. MessageBox.Show("患者信息上传成功");
  318. }
  319. private void uiButton7_Click(object sender, EventArgs e)
  320. {
  321. string sqlStr = " SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + Global.inf.hospitalDr;
  322. sqlStr = sqlStr + " and OccurTime>'" + dpt_ST.Text + "'";
  323. sqlStr = sqlStr + " and OccurTime<'" + dpt_ET.Text + "'";
  324. sqlStr = sqlStr + " and Interface_Dr=" + Global.inf.interfaceDr + "";
  325. sqlStr = sqlStr + " and BillType=1 and ValidFlag=1 and ReversalFlag<>1";
  326. if ((rbg_Type.SelectedIndex == 0) || (rbg_Type.SelectedIndex == 3))
  327. sqlStr = sqlStr + "and AdmType=1";
  328. else if ((rbg_Type.SelectedIndex == 1) || (rbg_Type.SelectedIndex == 2))
  329. sqlStr = sqlStr + "and AdmType=2";
  330. if (tb_CertNo2.Text != "")
  331. sqlStr = sqlStr + " and CertificateNO= " + tb_CertNo2.Text;
  332. JObject joSqlstr = new JObject();
  333. joSqlstr.Add("sqlStr", sqlStr);
  334. JArray jaParam = new JArray();
  335. jaParam.Add(joSqlstr);
  336. JObject joSettlQuery = new JObject();
  337. joSettlQuery.Add("params", jaParam);
  338. joSettlQuery.Add("code", "09010059");
  339. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  340. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  341. dgvSettleData.DataSource = dt;
  342. }
  343. private void dgvSettleData_DoubleClick(object sender, EventArgs e)
  344. {
  345. uiButton5_Click(sender, e);
  346. }
  347. /// <summary>
  348. /// 上传费用明细
  349. /// </summary>
  350. /// <param name="sender"></param>
  351. /// <param name="e"></param>
  352. private void uiButton5_Click(object sender, EventArgs e)
  353. {
  354. string outParam = "成功", funNO = "";
  355. if (rbg_Type.SelectedIndex == 0)
  356. funNO = "4303";
  357. else if (rbg_Type.SelectedIndex == 1)
  358. funNO = "4403";
  359. else if (rbg_Type.SelectedIndex == 2)
  360. funNO = "4801";
  361. else if (rbg_Type.SelectedIndex == 3)
  362. funNO = "4802";
  363. if (dgvSettleData.CurrentRow == null)
  364. {
  365. MessageBox.Show("请先查询患者结算信息");
  366. return;
  367. }
  368. int iCenter = dgvSettleData.CurrentRow.Index;
  369. Global.pat.mdtrtID = dgvSettleData.Rows[iCenter].Cells["MdtrtID"].Value.ToString();
  370. Global.pat.medType = dgvSettleData.Rows[iCenter].Cells["MedicalType"].Value.ToString();
  371. Global.pat.psn_no = dgvSettleData.Rows[iCenter].Cells["PersonnelNO"].Value.ToString();
  372. Global.pat.adm_Dr = int.Parse(dgvSettleData.Rows[iCenter].Cells["AdmID"].Value.ToString());
  373. Global.pat.billID = dgvSettleData.Rows[iCenter].Cells["BillID"].Value.ToString();
  374. Global.pat.recordID = dgvSettleData.Rows[iCenter].Cells["RecordID"].Value.ToString();
  375. Global.pat.certNO = dgvSettleData.Rows[iCenter].Cells["CertificateNO"].Value.ToString();
  376. Global.pat.name= dgvSettleData.Rows[iCenter].Cells["PatientName"].Value.ToString();
  377. Global.pat.brdy = dgvSettleData.Rows[iCenter].Cells["BirthDay"].Value.ToString();
  378. Global.pat.gend = dgvSettleData.Rows[iCenter].Cells["Gender"].Value.ToString();
  379. //获取IS费用
  380. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  381. {
  382. MessageBox.Show("获取HIS费用信息失败:" + outParam);
  383. return;
  384. }
  385. //调用医保平台转换HIS费用(转换医保编码等)
  386. JObject joHisFee = JObject.Parse(outParam);
  387. if (mIS.convertHisFeeWithInsuCodeHF(joHisFee, out outParam) != 0)
  388. {
  389. MessageBox.Show("调用医保平台转换HIS费用(转换医保编码等)失败:" + outParam);
  390. return;
  391. }
  392. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  393. //按指定条数分割后上传
  394. if (uploadFeeToCenter(funNO, 300, jaFeeDetail, out outParam) != 0)
  395. {
  396. MessageBox.Show("按指定条数分割后上传失败:" + outParam);
  397. return;
  398. }
  399. else
  400. {
  401. MessageBox.Show("上传成功!" + outParam);
  402. return;
  403. }
  404. }
  405. public int uploadFeeToCenter(string funNO, int singleCount, JArray jaFeeDetail, out string outParam)
  406. {
  407. outParam = "";
  408. string errMsg, type = "feedetail";
  409. try
  410. {
  411. if (rbg_Type.SelectedIndex == 0)
  412. type = "outfeedetail";
  413. else if (rbg_Type.SelectedIndex == 1)
  414. type = "feedetail";
  415. else if (rbg_Type.SelectedIndex == 2)
  416. type = "feedetail";
  417. else if (rbg_Type.SelectedIndex == 3)
  418. type = "outfeedetail";
  419. JArray jaTmp = new JArray();
  420. for (int i = 0; i < jaFeeDetail.Count; i++)
  421. {
  422. jaFeeDetail[i]["chrg_bchno"] = Global.pat.adm_Dr.ToString();
  423. jaFeeDetail[i]["med_type"] = Global.pat.medType;
  424. jaFeeDetail[i]["bilg_dept_codg"] = "A10";
  425. jaFeeDetail[i]["certno"] = Global.pat.certNO;
  426. jaFeeDetail[i]["psn_name"] = Global.pat.name;
  427. jaFeeDetail[i]["gend"] = Global.pat.gend;
  428. jaFeeDetail[i]["brdy"] = Global.pat.brdy;
  429. jaFeeDetail[i]["mdtrt_sn"] = Global.pat.adm_Dr;
  430. if (jaFeeDetail[i]["validFlag"].ToString() == "N") continue;
  431. jaTmp.Add(jaFeeDetail[i]);
  432. if (((i + 1) % singleCount == 0) || ((i + 1) == jaFeeDetail.Count))
  433. {
  434. JObject joFeeDetail = new JObject();
  435. joFeeDetail.Add(type, jaTmp);
  436. JObject joRtn = invoker.invokeCenterServiceF(funNO, JsonHelper.setCenterInparF(funNO, joFeeDetail));
  437. //if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
  438. //{
  439. // outParam = errMsg;
  440. // return -1;
  441. //}
  442. jaTmp = new JArray();
  443. }
  444. }
  445. return 0;
  446. }
  447. catch (Exception ex)
  448. {
  449. outParam = "uploadFee 异常:" + ex.Message;
  450. return -1;
  451. }
  452. }
  453. private void uiButton16_Click(object sender, EventArgs e)
  454. {
  455. string errorMsg;
  456. try
  457. {
  458. if (dgv_HISRegInfo.DataSource == null)
  459. return;
  460. if (dgv_HISRegInfo.Rows[dgv_HISRegInfo.CurrentRow.Index].Cells["ID"].Value.ToString() == "")
  461. return;
  462. presNo = dgv_HISRegInfo.Rows[dgv_HISRegInfo.CurrentRow.Index].Cells["prescNo"].Value.ToString();
  463. JObject joTmp = new JObject();
  464. joTmp.Add("startDate", dtp_st.Text);
  465. joTmp.Add("endDate", dtp_et.Text);
  466. joTmp.Add("hospCode", JsonHelper.getDestValue((JObject)Global.curEvt.jaSession[0], "hospCode"));
  467. joTmp.Add("prescNo", presNo); //处方号
  468. JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110038", joTmp).ToString(), "获取门诊处方风险提示参数");
  469. if (JsonHelper.parseIrisRtnValue(joRtn, out errorMsg) != 0)
  470. {
  471. MessageBox.Show("获取门诊处方风险提示参数失败,请联系管理员!" + errorMsg);
  472. return;
  473. }
  474. else
  475. {
  476. if ((joRtn["result"].ToString() == "[]") || (joRtn["result"].ToString() == ""))
  477. {
  478. MessageBox.Show("调用HIS接口服务05110038获取处方号【"+ presNo + "】门诊处方风险提示参数结果为空!");
  479. return;
  480. }
  481. //调用接口上传至中心
  482. JObject joInput = new JObject();
  483. joInput = JObject.Parse(joRtn["result"][0].ToString());
  484. //joInput["treatmentRecord"]["patientinfo"]["psn_no"] = Global.pat.mdtrtID;
  485. joInput["treatmentRecord"]["patientinfo"]["brdy"] = joInput["treatmentRecord"]["patientinfo"]["brdy"] + " 00:00:00";
  486. JObject joRtn10001 = invoker.invokeCenterServiceF("10001", JsonHelper.setCenterInparF("10001", joInput));
  487. if (JsonHelper.parseCenterRtnValue(joRtn10001, out errorMsg) != 0)
  488. {
  489. MessageBox.Show("门诊处方风险提示上传失败:" + errorMsg);
  490. return;
  491. }
  492. MessageBox.Show("门诊处方风险提示上传成功");
  493. }
  494. }
  495. catch (Exception ex)
  496. {
  497. MessageBox.Show("异常:" + ex.Message);
  498. return;
  499. }
  500. }
  501. /// <summary>
  502. /// 新华网人员类别与医保人员类别对照关系
  503. /// </summary>
  504. /// <param name="param"></param>
  505. /// <returns></returns>
  506. public string GetPsnType(string param)
  507. {
  508. if ((param == "11") || (param == "11021") || (param == "11031") ||
  509. (param == "1101") || (param == "1102") || (param == "1103") ||
  510. (param == "1111") || (param == "1113") || (param == "116006") ||
  511. (param == "116011") || (param == "116012") || (param == "116013") ||
  512. (param == "116014") || (param == "116015") || (param == "116017") ||
  513. (param == "136046") || (param == "136048") || (param == "136050") ||
  514. (param == "116018") || (param == "116019") || (param == "116020") ||
  515. (param == "116021") || (param == "136042") || (param == "136044") ||
  516. (param == "5005") || (param == "5007") || (param == "5010") ||
  517. (param == "5011") || (param == "5015") || (param == "5019") ||
  518. (param == "5022") || (param == "5028") || (param == "5029") ||
  519. (param == "5032") || (param == "5035") || (param == "5038") ||
  520. (param == "5041") || (param == "5044") || (param == "5048") ||
  521. (param == "5050") || (param == "1117") || (param == "1118") ||
  522. (param == "116041") || (param == "116042") || (param == "116043") ||
  523. (param == "116044") || (param == "116045") || (param == "116046") ||
  524. (param == "11032") || (param == "11033") || (param == "11034") ||
  525. (param == "116047") || (param == "116048") || (param == "116022") ||
  526. (param == "116031") || (param == "116032") || (param == "116033") ||
  527. (param == "5053") || (param == "5054") || (param == "5055") ||
  528. (param == "5059") || (param == "116090") || (param == "116050") ||
  529. (param == "116051") || (param == "995330"))
  530. return "1025100"; //在职
  531. else if ((param == "1105") || (param == "3601") || (param == "3602"))
  532. return "1025200"; //农民工
  533. else if ((param == "12") || (param == "1112") || (param == "1201") ||
  534. (param == "1202") || (param == "1114") || (param == "1203") ||
  535. (param == "12031") || (param == "136047") || (param == "1205") ||
  536. (param == "995311") || (param == "136049") || (param == "126001") ||
  537. (param == "136051") || (param == "126002") || (param == "136052") ||
  538. (param == "126003") || (param == "126004") || (param == "126009") ||
  539. (param == "995319") || (param == "126010") || (param == "995307") ||
  540. (param == "126013") || (param == "126015") || (param == "126016") ||
  541. (param == "126017") || (param == "126018") || (param == "126019") ||
  542. (param == "126022") || (param == "136055") || (param == "126023") ||
  543. (param == "126024") || (param == "126025") || (param == "126026") ||
  544. (param == "126027") || (param == "136035") || (param == "136039") ||
  545. (param == "136040") || (param == "136041") || (param == "136043") ||
  546. (param == "136045") || (param == "126031") || (param == "126032") ||
  547. (param == "126033") || (param == "5006") || (param == "5008") ||
  548. (param == "5012") || (param == "5013") || (param == "5016") ||
  549. (param == "5017") || (param == "5020") || (param == "5023") ||
  550. (param == "5030") || (param == "5033") || (param == "5036") ||
  551. (param == "5039") || (param == "5042") || (param == "5045") ||
  552. (param == "5049") || (param == "5051") || (param == "120701") ||
  553. (param == "120703") || (param == "120707") || (param == "120708") ||
  554. (param == "120711") || (param == "120712") || (param == "120715") ||
  555. (param == "120716") || (param == "120719") || (param == "120720") ||
  556. (param == "120723") || (param == "120724") || (param == "120727") ||
  557. (param == "120728") || (param == "120731") || (param == "120733") ||
  558. (param == "120735") || (param == "120737") || (param == "126041") ||
  559. (param == "126042") || (param == "126043") || (param == "126044") ||
  560. (param == "126045") || (param == "126046") || (param == "12032") ||
  561. (param == "12033") || (param == "12034") || (param == "12035") ||
  562. (param == "126047") || (param == "126048") || (param == "116088") ||
  563. (param == "126064") || (param == "126065") || (param == "126117") ||
  564. (param == "126216") || (param == "126037") || (param == "126067") ||
  565. (param == "126066") || (param == "126034") || (param == "5056") ||
  566. (param == "5057") || (param == "5058") || (param == "126316") ||
  567. (param == "126317") || (param == "5060") || (param == "126090") ||
  568. (param == "995331"))
  569. return "1025300"; //退休人员
  570. else
  571. if ((param == "13") || (param == "1300") || (param == "1300") ||
  572. (param == "995309") || (param == "136053") || (param == "136001") ||
  573. (param == "136002") || (param == "136004") || (param == "136005") ||
  574. (param == "136006") || (param == "136007") || (param == "136008") ||
  575. (param == "136009") || (param == "136010") || (param == "136011") ||
  576. (param == "136012") || (param == "136014") || (param == "136015") ||
  577. (param == "136016") || (param == "136017") || (param == "136018") ||
  578. (param == "136019") || (param == "136020") || (param == "136021") ||
  579. (param == "136022") || (param == "136023") || (param == "136024") ||
  580. (param == "136090") || (param == "13031") || (param == "136026") ||
  581. (param == "136029") || (param == "136030") || (param == "136031") ||
  582. (param == "5001") || (param == "5002") || (param == "5003") ||
  583. (param == "5004") || (param == "5009") || (param == "5018") ||
  584. (param == "5021") || (param == "5024") || (param == "5031") ||
  585. (param == "5034") || (param == "5037") || (param == "5040") ||
  586. (param == "5043") || (param == "5046") || (param == "5047") ||
  587. (param == "5052") || (param == "137001") || (param == "137002") ||
  588. (param == "137003") || (param == "136054") || (param == "130102") ||
  589. (param == "5088"))
  590. return "1025400"; //离休
  591. else
  592. if ((param == "14") || (param == "1405") || (param == "156006") || (param == "156007"))
  593. return "1025500"; //居民(未成年)
  594. else
  595. if ((param == "1401") || (param == "140101"))
  596. return "1025600"; //新生儿
  597. else
  598. if ((param == "1402"))
  599. return "1025700"; //学龄前儿童
  600. else
  601. if (param == "1403")
  602. return "1025800"; //中小学生
  603. else
  604. if ((param == "1404") || (param == "140890") || (param == "140891") ||
  605. (param == "156008") || (param == "140401") || (param == "140402") ||
  606. (param == "140403"))
  607. return "1025900"; //大学生
  608. else
  609. if ((param == "995301") || (param == "1405"))
  610. return "1025110"; //未成年(未入学)
  611. else
  612. if (param == "15")
  613. return "1025111"; //居民(成年)
  614. else
  615. if (param == "1501")
  616. return "1025112"; //普通居民(成年)
  617. else
  618. if ((param == "16") || (param == "160104") || (param == "140805") ||
  619. (param == "160100") || (param == "160101") || (param == "160102") ||
  620. (param == "160103"))
  621. return "1025113"; //居民(老年)
  622. else
  623. return "1025111"; //居民(成年)
  624. }
  625. /// <summary>
  626. /// 根据HIS就诊ID查询患者参保信息
  627. /// </summary>
  628. /// <param name="admID"></param>
  629. /// <param name="errorMsg"></param>
  630. /// <returns></returns>
  631. public int GetInsuPersonInfo(string admID, out JObject joRtn, out string errorMsg)
  632. {
  633. joRtn = null;
  634. string sqlstr = " SELECT TOP 1 * FROM BS_MIPatCurrentInsuInfo WHERE AdmID='" + admID + "'";
  635. sqlstr = sqlstr + " and Interface_Dr='" + Global.inf.interfaceDr + "' ORDER BY ID DESC";
  636. JObject joSqlstr = new JObject();
  637. joSqlstr.Add("sqlStr", sqlstr);
  638. JArray jaParam = new JArray();
  639. jaParam.Add(joSqlstr);
  640. JObject joQuery = new JObject();
  641. joQuery.Add("params", jaParam);
  642. joQuery.Add("code", "09010082");
  643. JObject joQueryRtn = invoker.invokeInsuService(joQuery.ToString(), "查询人员参保信息");
  644. if (JsonHelper.parseIrisRtnValue(joQueryRtn, out errorMsg) != 0)
  645. {
  646. MessageBox.Show("查询人员参保信息失败,请联系管理员!" + errorMsg);
  647. return -1;
  648. }
  649. joRtn = joQueryRtn;
  650. return 0;
  651. }
  652. public string GetInsuFeeInfo(string admID, string InsuCode)
  653. {
  654. string sqlStr;
  655. sqlStr = " SELECT admID as Adm_Dr,'' as Name,''as HISCode,MedInsuNO,Price,Sumamt, ";
  656. sqlStr = sqlStr + " ChargeItemLevel,SelfPayProp,UpLimitAmount,OverLimitAmount,InScopeAmount,";
  657. sqlStr = sqlStr + " FullOwnPayAmount,PreSelfPayAmount,LimitUsedFlag From BS_MedInsuFeeUploadRecord ";
  658. sqlStr = sqlStr + " WHERE Hospital_Dr= " + Global.inf.hospitalDr;
  659. sqlStr = sqlStr + " AND admID='" + admID + "'";
  660. sqlStr = sqlStr + " AND MedInsuNO='" + InsuCode + "'";
  661. JObject joSqlstr = new JObject();
  662. joSqlstr.Add("sqlStr", sqlStr);
  663. JArray jaParam = new JArray();
  664. jaParam.Add(joSqlstr);
  665. JObject joSettlQuery = new JObject();
  666. joSettlQuery.Add("params", jaParam);
  667. joSettlQuery.Add("code", "09010118");
  668. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询医保结算费用信息");
  669. decimal SelfPayProp = decimal.Parse(JsonHelper.getDestValue(joRtn, "result.data[0].SelfPayProp"));
  670. //1007100-医保个人,1007200-医保统筹,1007300-现金
  671. if (SelfPayProp == 0)
  672. return "1007200";
  673. else
  674. return "1007300";
  675. }
  676. private void uiButton13_Click(object sender, EventArgs e)
  677. {
  678. string errorMsg;
  679. string participateType = "1024200", personnelType;
  680. if ((dgv_BillInfo.DataSource == null) || (dgv_BillInfo.Rows[dgv_BillInfo.CurrentRow.Index].Cells["billCode"].Value.ToString() == ""))
  681. {
  682. MessageBox.Show("请先查询单据信息!");
  683. return;
  684. }
  685. if ((dgv_BillDetailInfo.DataSource == null) || (dgv_BillDetailInfo.Rows[dgv_BillDetailInfo.CurrentRow.Index].Cells["billID"].Value.ToString() == ""))
  686. {
  687. MessageBox.Show("请先查询明细信息!");
  688. return;
  689. }
  690. try
  691. {
  692. string entId = dgv_BillInfo.Rows[dgv_BillInfo.CurrentRow.Index].Cells["entId"].Value.ToString();
  693. string billCode = dgv_BillInfo.Rows[dgv_BillInfo.CurrentRow.Index].Cells["billCode"].Value.ToString();
  694. string billTime = dgv_BillInfo.Rows[dgv_BillInfo.CurrentRow.Index].Cells["billTime"].Value.ToString();
  695. string InsuredType = dgv_BillInfo.Rows[dgv_BillInfo.CurrentRow.Index].Cells["participateType"].Value.ToString(); //险种类型
  696. string admID = dgv_BillInfo.Rows[dgv_BillInfo.CurrentRow.Index].Cells["admID"].Value.ToString();
  697. if (InsuredType.Substring(0, 2) == "31")
  698. {
  699. participateType = "1024100"; //职工
  700. }
  701. else if (InsuredType.Substring(0, 2) == "39")
  702. {
  703. participateType = "1024200"; //居民
  704. }
  705. //人员类别
  706. if (GetInsuPersonInfo(admID, out JObject joQueryRtn, out errorMsg) != 0)
  707. {
  708. MessageBox.Show("查询参保人员信息失败!" + errorMsg);
  709. return;
  710. }
  711. personnelType = GetPsnType(JsonHelper.getDestValue(joQueryRtn, "result.rows[0].psnType").ToString());
  712. JObject joData = JObject.Parse(JsonHelper.getDestValue(joInput20002, "result[0]").ToString());
  713. joData["participateType"] = participateType;
  714. joData["personnelType"] = personnelType;
  715. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(joInput20002, "result[0].detail"));
  716. //for (int i = 0; i < jaFeeDetail.Count; i++)
  717. //{
  718. // string InsuCode = jaFeeDetail[i]["medicalDrugId"].ToString();
  719. // if (InsuCode != "未对照")
  720. // {
  721. // string toPay = GetInsuFeeInfo(admID, InsuCode);
  722. // }
  723. //}
  724. JObject joInput = new JObject();
  725. joInput.Add("data", joData);
  726. JObject joRtn = invoker.invokeCenterServiceF("20002", JsonHelper.setCenterInparF("20002", joInput));
  727. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  728. {
  729. MessageBox.Show("事后单据鉴核信息提报失败,中心返回:" + errorMsg);
  730. return;
  731. }
  732. MessageBox.Show("事后单据鉴核信息提报成功!" + errorMsg);
  733. }
  734. catch (Exception ex)
  735. {
  736. MessageBox.Show("事后单据鉴核信息提报异常:" + ex.Message);
  737. return;
  738. }
  739. }
  740. private void dgv_BillInfo_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  741. {
  742. }
  743. private void uiButton19_Click(object sender, EventArgs e)
  744. {
  745. string errorMsg = "";
  746. if (dgv_4001.CurrentRow == null)
  747. {
  748. MessageBox.Show("请查询患者参保信息");
  749. return;
  750. }
  751. for (int i = 0; i < dgv_4001.Rows.Count; i++)
  752. {
  753. //int iCenter = dgv_4001.CurrentRow.Index;
  754. string psn_no = dgv_4001.Rows[i].Cells["PersonalNO"].Value.ToString();
  755. string psn_cert_type = dgv_4001.Rows[i].Cells["PsnCertType"].Value.ToString();
  756. string certno = dgv_4001.Rows[i].Cells["PsnCertNO"].Value.ToString();
  757. string psn_name = dgv_4001.Rows[i].Cells["PatientName"].Value.ToString();
  758. string gend = dgv_4001.Rows[i].Cells["Gend"].Value.ToString();
  759. string naty = dgv_4001.Rows[i].Cells["Naty"].Value.ToString();
  760. string brdy = dgv_4001.Rows[i].Cells["Brdy"].Value.ToString();
  761. string age = dgv_4001.Rows[i].Cells["Age"].Value.ToString();
  762. string balc = dgv_4001.Rows[i].Cells["Balc"].Value.ToString();
  763. string insutype = dgv_4001.Rows[i].Cells["Insutype"].Value.ToString();
  764. string psn_type = dgv_4001.Rows[i].Cells["PsnType"].Value.ToString();
  765. string psn_insu_stas = dgv_4001.Rows[i].Cells["PsnInsuStas"].Value.ToString();
  766. string psn_insu_date = dgv_4001.Rows[i].Cells["PsnInsuDate"].Value.ToString();
  767. string paus_insu_date = dgv_4001.Rows[i].Cells["PausInsuDate"].Value.ToString();
  768. string cvlserv_flag = dgv_4001.Rows[i].Cells["Cvlservflag"].Value.ToString();
  769. string insuplc_admdvs = dgv_4001.Rows[i].Cells["insuplcAdmdvs"].Value.ToString();
  770. string emp_name = dgv_4001.Rows[i].Cells["EmpName"].Value.ToString();
  771. JObject joInput = new JObject();
  772. JObject joData = new JObject();
  773. joData.Add("psn_no", psn_no);
  774. joData.Add("psn_cert_type", psn_cert_type);
  775. joData.Add("certno", certno);
  776. joData.Add("psn_name", psn_name);
  777. joData.Add("gend", gend);
  778. joData.Add("naty", naty);
  779. joData.Add("brdy", brdy);
  780. joData.Add("age", age);
  781. joData.Add("balc", balc);
  782. joData.Add("insutype", insutype);
  783. joData.Add("psn_type", psn_type);
  784. joData.Add("psn_insu_stas", psn_insu_stas);
  785. joData.Add("psn_insu_date", psn_insu_date);
  786. joData.Add("paus_insu_date", paus_insu_date);
  787. joData.Add("cvlserv_flag", cvlserv_flag);
  788. joData.Add("insuplc_admdvs", insuplc_admdvs);
  789. joData.Add("emp_name", emp_name);
  790. joInput.Add("data", joData);
  791. JObject joRtn = invoker.invokeCenterServiceF("4001", JsonHelper.setCenterInparF("4001", joInput));
  792. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  793. {
  794. MessageBox.Show("患者信息上传失败:" + errorMsg);
  795. return;
  796. }
  797. }
  798. MessageBox.Show("患者信息上传成功");
  799. }
  800. private void dgvSettleData_CellClick(object sender, DataGridViewCellEventArgs e)
  801. {
  802. if (dgvSettleData.CurrentRow == null)
  803. {
  804. MessageBox.Show("请先查询医保结算信息");
  805. return;
  806. }
  807. int iCenter = dgvSettleData.CurrentRow.Index;
  808. string PersonnelNO = dgvSettleData.Rows[iCenter].Cells["PersonnelNO"].Value.ToString(); //MdtrtID
  809. string SettlementID = dgvSettleData.Rows[iCenter].Cells["SettlementID"].Value.ToString();
  810. string MdtrtID = dgvSettleData.Rows[iCenter].Cells["MdtrtID"].Value.ToString();
  811. string sqlStr;
  812. sqlStr = " SELECT a.Adm_Dr,c.Name, b.HISCode, b.MedInsuNO, b.Price,b.Sumamt,b.ChargeItemLevel,c.ChargeItemLevelName,b.SelfPayProp, ";
  813. sqlStr = sqlStr + " b.UpLimitAmount,b.OverLimitAmount,b.InScopeAmount,b.FullOwnPayAmount,b.PreSelfPayAmount,b.LimitUsedFlag ";
  814. sqlStr = sqlStr + " FROM BS_MedInsuSettlement a LEFT JOIN BS_MedInsuFeeUploadRecord b ";
  815. sqlStr = sqlStr + " ON a.Hospital_Dr=b.Hospital_Dr AND a.MdtrtID=b.MdtrtID AND a.PersonnelNO=b.PersonnelNO ";
  816. sqlStr = sqlStr + " LEFT JOIN HB_MedInsuDirectory c ON b.MedInsuNO=c.Code AND a.Interface_Dr=c.Interface_Dr AND a.Hospital_Dr=c.Hospital_Dr ";
  817. sqlStr = sqlStr + " WHERE b.MedInsuNO<>'' and a.ValidFlag=1 AND a.BillType=1 "; //AND a.AdmType=2
  818. sqlStr = sqlStr + " AND a.Interface_Dr=" + Global.inf.interfaceDr;
  819. sqlStr = sqlStr + " AND a.Hospital_Dr= " + Global.inf.hospitalDr;
  820. sqlStr = sqlStr + " AND a.OccurTime>'" + dpt_ST.Text + "'";
  821. sqlStr = sqlStr + " AND a.OccurTime<'" + dpt_ET.Text + "'";
  822. sqlStr = sqlStr + " AND a.PersonnelNO='" + PersonnelNO + "'";
  823. sqlStr = sqlStr + " AND a.SettlementID='" + SettlementID + "'";
  824. sqlStr = sqlStr + " AND a.MdtrtID='" + MdtrtID + "'";
  825. if (tb_CertNo2.Text != "")
  826. sqlStr = sqlStr + " And a.CertificateNO='" + tb_CertNo2.Text + "' ";
  827. JObject joSqlstr = new JObject();
  828. joSqlstr.Add("sqlStr", sqlStr);
  829. JArray jaParam = new JArray();
  830. jaParam.Add(joSqlstr);
  831. JObject joSettlQuery = new JObject();
  832. joSettlQuery.Add("params", jaParam);
  833. joSettlQuery.Add("code", "09010118");
  834. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询医保结算费用信息");
  835. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  836. dgvFeeInfo.DataSource = dt;
  837. }
  838. private void uiButton20_Click(object sender, EventArgs e)
  839. {
  840. string outParam = "成功", funNO = "";
  841. if (rbg_Type.SelectedIndex == 0)
  842. funNO = "4303";
  843. else if (rbg_Type.SelectedIndex == 1)
  844. funNO = "4403";
  845. else if (rbg_Type.SelectedIndex == 2)
  846. funNO = "4801";
  847. else if (rbg_Type.SelectedIndex == 3)
  848. funNO = "4802";
  849. if (dgvSettleData.CurrentRow == null)
  850. {
  851. MessageBox.Show("请先查询患者结算信息");
  852. return;
  853. }
  854. for (int i = 0; i < dgvSettleData.Rows.Count; i++)
  855. {
  856. int iCenter = dgvSettleData.CurrentRow.Index;
  857. Global.pat.mdtrtID = dgvSettleData.Rows[i].Cells["MdtrtID"].Value.ToString();
  858. Global.pat.medType = dgvSettleData.Rows[i].Cells["MedicalType"].Value.ToString();
  859. Global.pat.psn_no = dgvSettleData.Rows[i].Cells["PersonnelNO"].Value.ToString();
  860. Global.pat.adm_Dr = int.Parse(dgvSettleData.Rows[i].Cells["AdmID"].Value.ToString());
  861. Global.pat.billID = dgvSettleData.Rows[i].Cells["BillID"].Value.ToString();
  862. Global.pat.recordID = dgvSettleData.Rows[i].Cells["RecordID"].Value.ToString();
  863. Global.pat.certNO = dgvSettleData.Rows[i].Cells["CertificateNO"].Value.ToString();
  864. Global.pat.name = dgvSettleData.Rows[i].Cells["PatientName"].Value.ToString();
  865. Global.pat.brdy = dgvSettleData.Rows[i].Cells["BirthDay"].Value.ToString();
  866. Global.pat.gend = dgvSettleData.Rows[i].Cells["Gender"].Value.ToString();
  867. //获取IS费用
  868. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  869. {
  870. MessageBox.Show("获取HIS费用信息失败:" + outParam);
  871. return;
  872. }
  873. //调用医保平台转换HIS费用(转换医保编码等)
  874. JObject joHisFee = JObject.Parse(outParam);
  875. if (mIS.convertHisFeeWithInsuCodeHF(joHisFee, out outParam) != 0)
  876. {
  877. MessageBox.Show("调用医保平台转换HIS费用(转换医保编码等)失败:" + outParam);
  878. return;
  879. }
  880. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  881. //按指定条数分割后上传
  882. if (uploadFeeToCenter(funNO, 300, jaFeeDetail, out outParam) != 0)
  883. {
  884. //MessageBox.Show("按指定条数分割后上传失败:" + outParam);
  885. //return;
  886. }
  887. else
  888. continue;
  889. }
  890. MessageBox.Show("上传成功!" + outParam);
  891. }
  892. private void rbg_Type_ValueChanged(object sender, int index, string text)
  893. {
  894. dgvSettleData.DataSource = null;
  895. dgvFeeInfo.DataSource = null;
  896. }
  897. private void uiButton21_Click(object sender, EventArgs e)
  898. {
  899. string errorMsg;
  900. if (dgv_HISRegInfo.DataSource == null)
  901. return;
  902. if (dgv_HISRegInfo.Rows[dgv_HISRegInfo.CurrentRow.Index].Cells["ID"].Value.ToString() == "")
  903. return;
  904. for (int i = 0; i < dgv_HISRegInfo.Rows.Count; i++)
  905. {
  906. presNo = dgv_HISRegInfo.Rows[dgv_HISRegInfo.CurrentRow.Index].Cells["prescNo"].Value.ToString();
  907. JObject joTmp = new JObject();
  908. joTmp.Add("startDate", dtp_st.Text);
  909. joTmp.Add("endDate", dtp_et.Text);
  910. joTmp.Add("hospCode", JsonHelper.getDestValue((JObject)Global.curEvt.jaSession[0], "hospCode"));
  911. joTmp.Add("prescNo", presNo); //处方号
  912. JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110038", joTmp).ToString(), "获取门诊处方风险提示参数");
  913. if (JsonHelper.parseIrisRtnValue(joRtn, out errorMsg) != 0)
  914. {
  915. MessageBox.Show("获取门诊处方风险提示参数失败,请联系管理员!" + errorMsg);
  916. return;
  917. }
  918. else
  919. {
  920. if ((joRtn["result"].ToString() == "[]") || (joRtn["result"].ToString() == ""))
  921. {
  922. MessageBox.Show("调用HIS接口服务05110038获取处方号【" + presNo + "】门诊处方风险提示参数结果为空!!");
  923. return;
  924. }
  925. //调用接口上传至中心
  926. JObject joInput = new JObject();
  927. joInput = JObject.Parse(joRtn["result"][0].ToString());
  928. //joInput["treatmentRecord"]["patientinfo"]["psn_no"] = Global.pat.mdtrtID;
  929. joInput["treatmentRecord"]["patientinfo"]["brdy"] = joInput["treatmentRecord"]["patientinfo"]["brdy"] + " 00:00:00";
  930. JObject joRtn10001 = invoker.invokeCenterServiceF("10001", JsonHelper.setCenterInparF("10001", joInput));
  931. if (JsonHelper.parseCenterRtnValue(joRtn10001, out errorMsg) != 0)
  932. {
  933. MessageBox.Show("门诊处方风险提示上传失败:" + errorMsg);
  934. return;
  935. }
  936. }
  937. }
  938. MessageBox.Show("门诊处方风险提示上传成功");
  939. }
  940. private void dgv_HISRegInfo_CellClick(object sender, DataGridViewCellEventArgs e)
  941. {
  942. if (dgv_HISRegInfo.DataSource == null)
  943. return;
  944. if (dgv_HISRegInfo.Rows[dgv_HISRegInfo.CurrentRow.Index].Cells["ID"].Value.ToString() == "")
  945. return;
  946. string outParam = "";
  947. DataTable dt = null;
  948. presAdmDoc = dgv_HISRegInfo.Rows[dgv_HISRegInfo.CurrentRow.Index].Cells["doc"].Value.ToString();
  949. presAdmLoc = dgv_HISRegInfo.Rows[dgv_HISRegInfo.CurrentRow.Index].Cells["loc"].Value.ToString();
  950. presNo = dgv_HISRegInfo.Rows[dgv_HISRegInfo.CurrentRow.Index].Cells["prescNo"].Value.ToString();
  951. presAdmID = dgv_HISRegInfo.Rows[dgv_HISRegInfo.CurrentRow.Index].Cells["admID"].Value.ToString();
  952. Global.pat.adm_Dr = int.Parse(presAdmID);
  953. if (presNo == "") return;
  954. //获取HIS处方明细信息
  955. if (GetHISPrescFeeInfo(presNo, ref outParam, ref dt) != 0)
  956. {
  957. MessageBox.Show(outParam);
  958. return;
  959. }
  960. dgv_PrescriptionInfo.DataSource = dt;
  961. }
  962. private void dgv_BillInfo_CellClick(object sender, DataGridViewCellEventArgs e)
  963. {
  964. string outParam = "";
  965. DataTable dt = null;
  966. string errMsg;
  967. if (dgv_BillInfo.DataSource == null)
  968. return;
  969. if (dgv_BillInfo.Rows[dgv_BillInfo.CurrentRow.Index].Cells["billCode"].Value.ToString() == "")
  970. return;
  971. string billID = dgv_BillInfo.Rows[dgv_BillInfo.CurrentRow.Index].Cells["billCode"].Value.ToString();
  972. try
  973. {
  974. JObject joTmp = new JObject();
  975. joTmp.Add("startDate", date_st.Text.Substring(0, 10));
  976. joTmp.Add("endDate", date_et.Text.Substring(0, 10));
  977. joTmp.Add("hospCode", JsonHelper.getDestValue((JObject)Global.curEvt.jaSession[0], "hospCode"));
  978. joTmp.Add("billID", billID);
  979. JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110039", joTmp).ToString(), "组织事后单据鉴核信息填报参数");
  980. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  981. {
  982. MessageBox.Show("组织事后单据鉴核信息填报参数失败,请联系管理员!" + errMsg);
  983. return;
  984. }
  985. else
  986. {
  987. joInput20002 = joRtn;
  988. JObject detail = new JObject();
  989. string result = JsonHelper.getDestValue(joRtn, "result[0]").ToString();
  990. detail = JObject.Parse(result);
  991. dt = (DataTable)detail["detail"].ToObject(typeof(DataTable));
  992. dgv_BillDetailInfo.DataSource = dt;
  993. }
  994. }
  995. catch (Exception ex)
  996. {
  997. MessageBox.Show("组织事后单据鉴核信息填报参数异常:" + ex.Message);
  998. return;
  999. }
  1000. }
  1001. private void btnReadCard_Click(object sender, EventArgs e)
  1002. {
  1003. string outParam = "", errMsg = "";
  1004. if (hBus.readCard(out outParam) != 0)
  1005. {
  1006. MessageBox.Show("读卡失败!" + outParam);
  1007. return;
  1008. }
  1009. else
  1010. {
  1011. string patInfo = outParam;
  1012. //展示患者信息界面
  1013. if (hBus.showPatInfo(patInfo, out outParam) != 0)
  1014. {
  1015. MessageBox.Show("参保信息展示异常!" + outParam);
  1016. return;
  1017. }
  1018. else
  1019. {
  1020. if (hBus.setGlobalPatAfaterShowPatInfo(outParam, out errMsg) != 0)
  1021. {
  1022. MessageBox.Show("setGlobalPatAfaterShowPatInfo全局变量赋值异常!" + errMsg);
  1023. return;
  1024. }
  1025. }
  1026. }
  1027. }
  1028. private void btn5205_Click(object sender, EventArgs e)
  1029. {
  1030. string outParam = "", errMsg = "";
  1031. if (string.IsNullOrEmpty(Global.pat.psn_no))
  1032. {
  1033. MessageBox.Show("未获取到该患者的医保个人编号,请重新读卡!");
  1034. return;
  1035. }
  1036. JObject joInput = new JObject();
  1037. JObject joData = new JObject();
  1038. joData.Add("psn_no", Global.pat.psn_no);
  1039. joData.Add("begntime", dptST.Text);
  1040. joData.Add("endtime", dptET.Text);
  1041. joInput.Add("data", joData);
  1042. JObject joRtn = invoker.invokeCenterService("5205", JsonHelper.setCenterInparF("5205", joInput));
  1043. if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
  1044. {
  1045. MessageBox.Show("人员慢特病用药记录查询失败:" + errMsg);
  1046. return;
  1047. }
  1048. else
  1049. {
  1050. dgv5205.DataSource = (DataTable)joRtn["output"]["feedetail"].ToObject(typeof(DataTable));
  1051. }
  1052. }
  1053. public int queryHISDirectory(out string errMsg)
  1054. {
  1055. errMsg = "";
  1056. string pageSize = "500";
  1057. string flag = "Maped";
  1058. JObject joHISRtn = new JObject();
  1059. JObject joRtn = new JObject();
  1060. JArray jaPagination = new JArray();
  1061. JArray jaParams = new JArray();
  1062. dynamic joParam = new JObject();
  1063. joParam.alias = "";
  1064. joParam.HospitalDr = Global.inf.hospitalDr;
  1065. joParam.InterfaceDr = Global.inf.interfaceDr;
  1066. joParam.hisType = "drugs";
  1067. jaParams.Add(joParam);
  1068. dynamic joPagination = new JObject();
  1069. joPagination.pageSize = pageSize;
  1070. joPagination.currentPage = "1";
  1071. joPagination.sortColumn = "HisCode";
  1072. joPagination.sortOrder = "asc";
  1073. jaPagination.Add(joPagination);
  1074. JObject joMIRtn = mIS.GetMappedHISDir(jaPagination, jaParams);
  1075. if (JsonHelper.parseIrisRtnValue(joMIRtn, out errMsg) != 0)
  1076. {
  1077. return -1;
  1078. }
  1079. //传给HIS,进行匹配
  1080. joParam = new JObject();
  1081. joParam.TotalCount = joMIRtn["result"]["TotalCount"];
  1082. joParam.type = "drugs";
  1083. joParam.flag = flag;
  1084. joParam.hospID = Global.inf.hisHospitalDr;
  1085. joParam.interfaceDr = Global.inf.interfaceDr;
  1086. joParam.alias = "";
  1087. joParam.include = "Hosp";
  1088. joParam.groupID = "324";
  1089. joParam.specInput = "";//增加规格过滤
  1090. joParam.compareArr = joMIRtn["result"]["Data"];
  1091. jaParams = new JArray();
  1092. jaParams.Add(joParam);
  1093. if (hIS.getHISDir(jaPagination, jaParams, out joRtn, out errMsg) != 0)
  1094. {
  1095. return -1;
  1096. }
  1097. DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  1098. dtExport = dt;
  1099. int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
  1100. //pgHISDirect.TotalCount = totalCount;
  1101. //pgHISDirect.PageSize = pageSize;
  1102. dgvMedInsuMapRelation.DataSource = null;
  1103. dgvMedInsuMapRelation.DataSource = dt;
  1104. dgvMedInsuMapRelation.Columns[0].ReadOnly = true;
  1105. GridViewSetter gridSetter = new GridViewSetter();
  1106. gridSetter.SetHeaderTextOfMapping_HisDirectory(dgvMedInsuMapRelation);
  1107. gridSetter.DatagridviewColumnWidthAdaptation(dgvMedInsuMapRelation);
  1108. return 0;
  1109. }
  1110. private void uiButton9_Click(object sender, EventArgs e)
  1111. {
  1112. if (queryHISDirectory(out string errMsg) != 0)
  1113. {
  1114. MessageBox.Show(errMsg);
  1115. return;
  1116. }
  1117. }
  1118. private void uiButton10_Click(object sender, EventArgs e)
  1119. {
  1120. string errorMsg;
  1121. if (dgvMedInsuMapRelation.CurrentRow == null)
  1122. {
  1123. MessageBox.Show("请先查询医保药品对照信息");
  1124. return;
  1125. }
  1126. int iCenter = dgvMedInsuMapRelation.CurrentRow.Index;
  1127. string insuCode = dgvMedInsuMapRelation.Rows[iCenter].Cells["insuCode"].Value.ToString(); //中心编码
  1128. string insuName = dgvMedInsuMapRelation.Rows[iCenter].Cells["insuName"].Value.ToString(); //中心编码
  1129. string itemCode = dgvMedInsuMapRelation.Rows[iCenter].Cells["itemCode"].Value.ToString(); //医院编码
  1130. string itemDesc = dgvMedInsuMapRelation.Rows[iCenter].Cells["itemDesc"].Value.ToString(); //医院名称
  1131. SaleBillInfo sbi = new SaleBillInfo(insuCode, insuName);
  1132. try
  1133. {
  1134. if (sbi.ShowDialog() == DialogResult.OK)
  1135. {
  1136. JObject joInput = new JObject();
  1137. JObject joData = new JObject();
  1138. joData.Add("entId", sbi.entId);
  1139. joData.Add("code", sbi.code);
  1140. joData.Add("medicalDrugId", sbi.medicalDrugId);
  1141. joData.Add("queryTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  1142. joData.Add("salePkg", sbi.salePkg);
  1143. joData.Add("unpackCount", sbi.unpackCount);
  1144. joData.Add("drugSalePrice", sbi.drugSalePrice);
  1145. joData.Add("batchNo", sbi.batchNo);
  1146. joInput.Add("data", joData);
  1147. JObject joRtn = invoker.invokeCenterServiceF("20001", JsonHelper.setCenterInparFT("20001", joInput));
  1148. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1149. {
  1150. MessageBox.Show("医保药品鉴核数据采集事前鉴核服务上传失败:" + errorMsg);
  1151. return;
  1152. }
  1153. else
  1154. {
  1155. DataTable dtData = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
  1156. DataTable dtVerifyResult = (DataTable)joRtn["output"]["verifyResult"].ToObject(typeof(DataTable));
  1157. DataTable dtTraceCodeVo = (DataTable)joRtn["output"]["traceCodeVo"].ToObject(typeof(DataTable));
  1158. DataTable dtMedDrugInfo = (DataTable)joRtn["output"]["medDrugInfo"].ToObject(typeof(DataTable));
  1159. dgvData.DataSource = dtData;
  1160. dgvVerifyResult.DataSource = dtVerifyResult;
  1161. dgvTraceCodeVo.DataSource = dtTraceCodeVo;
  1162. dgvMedDrugInfo.DataSource = dtMedDrugInfo;
  1163. MessageBox.Show("医保药品鉴核数据采集事前鉴核服务上传成功");
  1164. }
  1165. }
  1166. else
  1167. {
  1168. MessageBox.Show("操作员已取消!");
  1169. return;
  1170. }
  1171. }
  1172. catch (Exception ex)
  1173. {
  1174. MessageBox.Show("异常:" + ex.Message);
  1175. return;
  1176. }
  1177. }
  1178. private void uiButton11_Click(object sender, EventArgs e)
  1179. {
  1180. string errorMsg;
  1181. JObject joInput = new JObject();
  1182. JObject joData = new JObject();
  1183. joData.Add("ent_id", tbJGBM.Text);
  1184. joData.Add("bill_code", tbDJBH.Text);
  1185. joData.Add("bill_time", dtTHSJ.Text);
  1186. joInput.Add("data", joData);
  1187. JObject joRtn = invoker.invokeCenterServiceF("20003", JsonHelper.setCenterInparF("20003", joInput));
  1188. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1189. {
  1190. MessageBox.Show("医保销售单据退货上传失败:" + errorMsg);
  1191. return;
  1192. }
  1193. else
  1194. {
  1195. MessageBox.Show("医保销售单据退货上传成功!" + errorMsg);
  1196. }
  1197. }
  1198. private void uiButton15_Click(object sender, EventArgs e)
  1199. {
  1200. string errMsg;
  1201. dgv_BillInfo.DataSource = null;
  1202. dgv_BillDetailInfo.DataSource = null;
  1203. try
  1204. {
  1205. JObject joTmp = new JObject();
  1206. joTmp.Add("startDate",date_st.Text.Substring(0,10));
  1207. joTmp.Add("endDate", date_et.Text.Substring(0, 10));
  1208. joTmp.Add("hospCode", JsonHelper.getDestValue((JObject)Global.curEvt.jaSession[0], "hospCode"));
  1209. joTmp.Add("billID", "");
  1210. JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110039", joTmp).ToString(), "组织事后单据鉴核信息填报参数");
  1211. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1212. {
  1213. MessageBox.Show("组织事后单据鉴核信息填报参数失败,请联系管理员!" + errMsg);
  1214. return;
  1215. }
  1216. else
  1217. {
  1218. DataTable dt = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
  1219. dgv_BillInfo.DataSource = dt;
  1220. }
  1221. }
  1222. catch (Exception ex)
  1223. {
  1224. MessageBox.Show("组织事后单据鉴核信息填报参数异常:" + ex.Message);
  1225. return;
  1226. }
  1227. }
  1228. /// <summary>
  1229. /// 获取HIS就诊信息
  1230. /// </summary>
  1231. /// <param name="dtST"></param>
  1232. /// <param name="dtED"></param>
  1233. /// <param name="PatInfo"></param>
  1234. /// <param name="errMsg"></param>
  1235. /// <param name="DT"></param>
  1236. /// <returns></returns>
  1237. private int GetHISRegInfo(string dtST, string dtED, string PatInfo, ref string errMsg, ref DataTable DT)
  1238. {
  1239. dynamic joTmp = new JObject();
  1240. joTmp.Add("stDate", dtST);
  1241. joTmp.Add("endDate", dtED);
  1242. joTmp.Add("patInfo", PatInfo);
  1243. JObject joRtnHISRegInfo = hIS.GetHISRegInfo(joTmp);
  1244. if (JsonHelper.parseIrisRtnValue(joRtnHISRegInfo, out errMsg) != 0)
  1245. {
  1246. errMsg = "获取HIS患者就诊信息失败,请联系管理员!" + errMsg;
  1247. return -1;
  1248. }
  1249. else
  1250. {
  1251. if ((joRtnHISRegInfo["result"]["rows"].ToString() == "[]"))
  1252. {
  1253. errMsg = "查询HIS就诊信息结果为空!";
  1254. return -1;
  1255. }
  1256. else
  1257. {
  1258. DT = (DataTable)joRtnHISRegInfo["result"]["rows"].ToObject(typeof(DataTable));
  1259. return 0;
  1260. }
  1261. }
  1262. }
  1263. private void uiButton18_Click(object sender, EventArgs e)
  1264. {
  1265. string errMsg;
  1266. //if (tb_SFZH.Text == "")
  1267. //{
  1268. // MessageBox.Show("请先输入患者身份证号进行查找患者未结算处方信息!");
  1269. // return;
  1270. //}
  1271. //else
  1272. //{
  1273. // dgv_HISRegInfo.DataSource = null;
  1274. // dgv_PrescriptionInfo.DataSource = null;
  1275. // CertNo = tb_SFZH.Text;
  1276. // Global.pat.certNO = tb_SFZH.Text;
  1277. //}
  1278. dgv_HISRegInfo.DataSource = null;
  1279. dgv_PrescriptionInfo.DataSource = null;
  1280. CertNo = tb_SFZH.Text;
  1281. Global.pat.certNO = tb_SFZH.Text;
  1282. #region【查询HIS就诊信息-用身份证号查询患者当日的就诊记录】
  1283. string outParam = "";
  1284. DataTable dt1 = null;
  1285. if (GetHISRegInfo(dtp_st.Text, dtp_et.Text, Global.pat.certNO, ref outParam, ref dt1) != 0)
  1286. {
  1287. MessageBox.Show(outParam);
  1288. return;
  1289. }
  1290. dgv_HISRegInfo.DataSource = dt1;
  1291. #endregion
  1292. #region【根据处方号查询处方明细信息】
  1293. presAdmDoc = dgv_HISRegInfo.Rows[0].Cells["doc"].Value.ToString();
  1294. presAdmLoc = dgv_HISRegInfo.Rows[0].Cells["loc"].Value.ToString();
  1295. presNo = dgv_HISRegInfo.Rows[0].Cells["prescNo"].Value.ToString();
  1296. presAdmID = dgv_HISRegInfo.Rows[0].Cells["admID"].Value.ToString();
  1297. Global.pat.adm_Dr = int.Parse(presAdmID);
  1298. if (presNo == "") return;
  1299. DataTable dt2 = null;
  1300. //获取HIS处方明细信息
  1301. if (GetHISPrescFeeInfo(presNo, ref outParam, ref dt2) != 0)
  1302. {
  1303. MessageBox.Show(outParam);
  1304. return;
  1305. }
  1306. dgv_PrescriptionInfo.DataSource = dt2;
  1307. #endregion
  1308. }
  1309. /// <summary>
  1310. /// 获取HIS费用明细信息
  1311. /// </summary>
  1312. /// <param name="PrescNo"></param>
  1313. /// <param name="errMsg"></param>
  1314. /// <param name="DT"></param>
  1315. /// <returns></returns>
  1316. private int GetHISPrescFeeInfo(string PrescNo, ref string errMsg, ref DataTable DT)
  1317. {
  1318. dynamic joTmp = new JObject();
  1319. joTmp.Add("prescNo", PrescNo);
  1320. JObject joRtnHISPrescFeeInfo = hIS.GetHISPrescFeeInfo(joTmp);
  1321. if (JsonHelper.parseIrisRtnValue(joRtnHISPrescFeeInfo, out errMsg) != 0)
  1322. {
  1323. errMsg = "获取HIS患者处方信息失败,请联系管理员!" + errMsg;
  1324. return -1;
  1325. }
  1326. else
  1327. {
  1328. if ((joRtnHISPrescFeeInfo["result"]["rows"].ToString() == "[]"))
  1329. {
  1330. errMsg = "查询HIS处方信息结果为空!";
  1331. return -1;
  1332. }
  1333. else
  1334. {
  1335. DT = (DataTable)joRtnHISPrescFeeInfo["result"]["rows"].ToObject(typeof(DataTable));
  1336. return 0;
  1337. }
  1338. }
  1339. }
  1340. private void dgv_HISRegInfo_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  1341. {
  1342. uiButton16_Click(sender, e);
  1343. }
  1344. }
  1345. }