MedInsuQuery.cs 75 KB

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