HisMainBusiness.cs 160 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143
  1. /******************************************************************************
  2. * 文件名称: HisMainBusiness.cs
  3. * 文件说明: HIS主体交易的封装
  4. * 当前版本: V1.0
  5. * 创建日期: 2022-06-20
  6. *
  7. * * 2020-06-20: 增加 HisMainBusiness 类
  8. * ***** 2020-06-20: 增加 CardReader 方法,获取URL地址,USER信息,地方版SSCard.dll使用
  9. * ***** 2020-06-20: 增加 CardReader 方法重载,国家版电子凭证使用
  10. * ***** 2020-06-20: 增加 Init 方法,SSCard环境初始化
  11. * ***** 2020-06-20: 增加 ReadCardBas 方法,读社保卡
  12. * ***** 2020-06-20: 增加 VerifyPIN 方法,验证密码
  13. * ***** 2020-06-20: 增加 ChangePIN 方法,修改密码
  14. * ***** 2020-06-20: 增加 ReadSFZ 方法,读身份证
  15. * ***** 2020-06-20: 增加 GetQRBase 方法,读二维码
  16. * ***** 2020-06-20: 增加 NationEcTrans 方法,读电子凭证(国家版)
  17. ******************************************************************************/
  18. using Newtonsoft.Json;
  19. using Newtonsoft.Json.Linq;
  20. using Org.BouncyCastle.Utilities.Encoders;
  21. using PTMedicalInsurance.Common;
  22. using PTMedicalInsurance.Entity.Settlement.PortalPay;
  23. using PTMedicalInsurance.Forms;
  24. using PTMedicalInsurance.Helper;
  25. using PTMedicalInsurance.Variables;
  26. using System;
  27. using System.Collections.Generic;
  28. using System.Data;
  29. using System.IO;
  30. using System.IO.Compression;
  31. using System.Linq;
  32. using System.Reflection;
  33. using System.Text;
  34. using System.Threading.Tasks;
  35. using System.Windows.Forms;
  36. namespace PTMedicalInsurance.Business
  37. {
  38. class HisMainBusiness
  39. {
  40. private InvokeHelper invoker = new InvokeHelper();
  41. private HisIrisServices hIS = new HisIrisServices();
  42. private MIIrisServices mIS = new MIIrisServices();
  43. private CenterBusiness cBus = new CenterBusiness();
  44. /// <summary>
  45. /// 获取HIS的IRIS配置信息
  46. /// </summary>
  47. /// <param name="con"></param>
  48. public void getHisConfingue(out IrisConfigue con)
  49. {
  50. IniFile ini = new IniFile(Global.curEvt.path + @"\INSUConfigure.ini");
  51. con.ip = ini.ReadValue("HIS", "ip");
  52. con.url = ini.ReadValue("HIS", "url");
  53. con.authorization = ini.ReadValue("HIS", "authorization");
  54. }
  55. /// <summary>
  56. /// 获取医保平台的iris配置信息
  57. /// </summary>
  58. /// <param name="con"></param>
  59. public void getInsuConfingue(out IrisConfigue con)
  60. {
  61. IniFile ini = new IniFile(Global.curEvt.path + @"\INSUConfigure.ini");
  62. con.ip = ini.ReadValue("INSU", "ip");
  63. con.url = ini.ReadValue("INSU", "url");
  64. con.authorization = ini.ReadValue("INSU", "authorization");
  65. }
  66. /// <summary>
  67. /// 获取Session信息(目前只获取操作员信息)
  68. /// </summary>
  69. /// <param name="joSession"></param>
  70. public void getSessionInfo(JObject joSession)
  71. {
  72. Global.user.ID = JsonHelper.getDestValue(joSession, "userCode");
  73. Global.user.name = JsonHelper.getDestValue(joSession, "userName");
  74. Global.user.type = "3";
  75. }
  76. /// <summary>
  77. /// 根据壳程序传入的入参设置全局接口变量
  78. /// </summary>
  79. /// <param name="joInpar"></param>
  80. /// <param name="inf"></param>
  81. public void setGlobalInterface(JObject joInpar,out InterfaceInfo inf)
  82. {
  83. inf = new InterfaceInfo();
  84. inf.hospitalDr = int.Parse(JsonHelper.getDestValue(joInpar, "HospitalDr"));
  85. inf.hisHospitalDr = int.Parse(JsonHelper.getDestValue(joInpar, "hisHospitalDr"));
  86. inf.hospitalName = JsonHelper.getDestValue(joInpar, "HospitalName");
  87. inf.interfaceDr = int.Parse(JsonHelper.getDestValue(joInpar, "ID"));
  88. inf.interfaceID = JsonHelper.getDestValue(joInpar, "InterfaceID");
  89. //inf.oper = "3";
  90. inf.centerURL = JsonHelper.getDestValue(joInpar, "CenterURL");
  91. inf.areaCode = JsonHelper.getDestValue(joInpar, "AreaCode");
  92. inf.dllName = JsonHelper.getDestValue(joInpar, "DLLName");
  93. inf.hospitalNO = JsonHelper.getDestValue(joInpar, "HospitalNO");
  94. inf.version = "V1.0";
  95. inf.signatureType = "SM2";
  96. inf.recivedSystem = "YBXT";
  97. inf.AK = "BObOUSG1z1FXOGn3SkJ0FchX+8ftm9+RYqfVWLqdyVL2srAevCusk7ZZTSR3BQRcYe4bMq85MYmYGzz90UATaC8=";
  98. inf.SK = "AKPGR6SIzhJUe8kdIgHmAgIAKjQQl3s4TqoSTbJ7Sc9H";
  99. inf.dev_safe_info = "";
  100. inf.dev_no = Global.curEvt.mac;
  101. inf.cardURL = inf.centerURL;
  102. //inf.ecURL = JsonHelper.getDestValue(joInpar, "CenterURL2");
  103. inf.BusinessID = "41a8514ba8ed429eb4dde381eda02fe0"; //商务ID码
  104. inf.CreditID = "91530112MA6Q3GGC1E"; //服务商统一社会信用代码
  105. inf.centerURL2 = JsonHelper.getDestValue(joInpar, "CenterURL2");
  106. byte[] b = Base64.Decode(inf.centerURL2);
  107. string centerURL2 = System.Text.Encoding.UTF8.GetString(b);
  108. JObject joCenterURL2 = JObject.Parse(centerURL2);
  109. inf.ecURL = JsonHelper.getDestValue(joCenterURL2, "core.ecURL");
  110. inf.downURL = JsonHelper.getDestValue(joCenterURL2, "core.downURL");
  111. inf.PortalAmp.url = JsonHelper.getDestValue(joCenterURL2, "portalAmp.url");
  112. inf.PortalAmp.appid = JsonHelper.getDestValue(joCenterURL2, "portalAmp.appid");
  113. inf.PortalAmp.secretKey = JsonHelper.getDestValue(joCenterURL2, "portalAmp.secretKey");
  114. inf.PortalAmp.privateKey = JsonHelper.getDestValue(joCenterURL2, "portalAmp.privateKey");
  115. inf.PortalAmp.publicKey = JsonHelper.getDestValue(joCenterURL2, "portalAmp.publicKey");
  116. inf.PortalOrg.url = JsonHelper.getDestValue(joCenterURL2, "portalOrg.url");
  117. inf.PortalOrg.appid = JsonHelper.getDestValue(joCenterURL2, "portalOrg.appid");
  118. inf.PortalOrg.secretKey = JsonHelper.getDestValue(joCenterURL2, "portalOrg.secretKey");
  119. inf.PortalOrg.privateKey = JsonHelper.getDestValue(joCenterURL2, "portalOrg.privateKey");
  120. inf.PortalOrg.publicKey = JsonHelper.getDestValue(joCenterURL2, "portalOrg.publicKey");
  121. inf.MobilePay.url = JsonHelper.getDestValue(joCenterURL2, "mobilePay.url");
  122. inf.MobilePay.appid = JsonHelper.getDestValue(joCenterURL2, "mobilePay.appid");
  123. inf.MobilePay.secretKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.secretKey");
  124. inf.MobilePay.privateKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.privateKey");
  125. inf.MobilePay.publicKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.publicKey");
  126. inf.PresCir.url = JsonHelper.getDestValue(joCenterURL2, "mobilePay.url");
  127. inf.PresCir.appid = JsonHelper.getDestValue(joCenterURL2, "mobilePay.appid");
  128. inf.PresCir.secretKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.secretKey");
  129. inf.PresCir.privateKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.privateKey");
  130. inf.PresCir.publicKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.publicKey");
  131. inf.cainfo = "";
  132. }
  133. /// <summary>
  134. /// 根据壳程序传入的入参设置全局接口变量
  135. /// </summary>
  136. /// <param name="joInpar"></param>
  137. /// <param name="inf"></param>
  138. public void setGlobalInterface_Plat(JObject joInpar, out InterfaceInfo inf)
  139. {
  140. inf = new InterfaceInfo();
  141. inf.hospitalDr = int.Parse(JsonHelper.getDestValue(joInpar, "hospitalID"));
  142. inf.hisHospitalDr = int.Parse(JsonHelper.getDestValue(joInpar, "hisHospitalDr"));
  143. inf.hospitalName = JsonHelper.getDestValue(joInpar, "hospitalName");
  144. inf.interfaceDr = int.Parse(JsonHelper.getDestValue(joInpar, "medInsuInterfaceID"));
  145. inf.interfaceID = JsonHelper.getDestValue(joInpar, "interfaceNO");
  146. //inf.oper = "3";
  147. inf.centerURL = JsonHelper.getDestValue(joInpar, "centerURL");
  148. inf.areaCode = JsonHelper.getDestValue(joInpar, "areaCode");
  149. inf.dllName = JsonHelper.getDestValue(joInpar, "dLLName");
  150. inf.hospitalNO = JsonHelper.getDestValue(joInpar, "hospitalNO");
  151. inf.version = "V1.0";
  152. inf.signatureType = "SM2";
  153. inf.recivedSystem = "YBXT";
  154. inf.AK = "BObOUSG1z1FXOGn3SkJ0FchX+8ftm9+RYqfVWLqdyVL2srAevCusk7ZZTSR3BQRcYe4bMq85MYmYGzz90UATaC8=";
  155. inf.SK = "AKPGR6SIzhJUe8kdIgHmAgIAKjQQl3s4TqoSTbJ7Sc9H";
  156. inf.dev_safe_info = "";
  157. inf.dev_no = Global.curEvt.mac;
  158. inf.cardURL = inf.centerURL;
  159. //inf.ecURL = JsonHelper.getDestValue(joInpar, "CenterURL2");
  160. inf.BusinessID = "41a8514ba8ed429eb4dde381eda02fe0"; //商务ID码
  161. inf.CreditID = "91530112MA6Q3GGC1E"; //服务商统一社会信用代码
  162. inf.centerURL2 = JsonHelper.getDestValue(joInpar, "centerURL2");
  163. byte[] b = Base64.Decode(inf.centerURL2);
  164. string centerURL2 = System.Text.Encoding.UTF8.GetString(b);
  165. JObject joCenterURL2 = JObject.Parse(centerURL2);
  166. inf.ecURL = JsonHelper.getDestValue(joCenterURL2, "core.ecURL");
  167. inf.downURL = JsonHelper.getDestValue(joCenterURL2, "core.downURL");
  168. inf.PortalAmp.url = JsonHelper.getDestValue(joCenterURL2, "portalAmp.url");
  169. inf.PortalAmp.appid = JsonHelper.getDestValue(joCenterURL2, "portalAmp.appid");
  170. inf.PortalAmp.secretKey = JsonHelper.getDestValue(joCenterURL2, "portalAmp.secretKey");
  171. inf.PortalAmp.privateKey = JsonHelper.getDestValue(joCenterURL2, "portalAmp.privateKey");
  172. inf.PortalAmp.publicKey = JsonHelper.getDestValue(joCenterURL2, "portalAmp.publicKey");
  173. inf.PortalOrg.url = JsonHelper.getDestValue(joCenterURL2, "portalOrg.url");
  174. inf.PortalOrg.appid = JsonHelper.getDestValue(joCenterURL2, "portalOrg.appid");
  175. inf.PortalOrg.secretKey = JsonHelper.getDestValue(joCenterURL2, "portalOrg.secretKey");
  176. inf.PortalOrg.privateKey = JsonHelper.getDestValue(joCenterURL2, "portalOrg.privateKey");
  177. inf.PortalOrg.publicKey = JsonHelper.getDestValue(joCenterURL2, "portalOrg.publicKey");
  178. inf.MobilePay.url = JsonHelper.getDestValue(joCenterURL2, "mobilePay.url");
  179. inf.MobilePay.appid = JsonHelper.getDestValue(joCenterURL2, "mobilePay.appid");
  180. inf.MobilePay.secretKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.secretKey");
  181. inf.MobilePay.privateKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.privateKey");
  182. inf.MobilePay.publicKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.publicKey");
  183. inf.PresCir.url = JsonHelper.getDestValue(joCenterURL2, "mobilePay.url");
  184. inf.PresCir.appid = JsonHelper.getDestValue(joCenterURL2, "mobilePay.appid");
  185. inf.PresCir.secretKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.secretKey");
  186. inf.PresCir.privateKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.privateKey");
  187. inf.PresCir.publicKey = JsonHelper.getDestValue(joCenterURL2, "mobilePay.publicKey");
  188. inf.cainfo = "";
  189. }
  190. /// <summary>
  191. /// 初始化环境
  192. /// </summary>
  193. /// <param name="inParam"></param>
  194. /// <returns></returns>
  195. public int initEnvironment(string inParam,out string error)
  196. {
  197. error = string.Empty;
  198. try
  199. {
  200. //获取HIS和医保平台的IRIS配置信息
  201. getHisConfingue(out Global.hisConfig);
  202. getInsuConfingue(out Global.insuConfig);
  203. JObject joInparam = JObject.Parse(inParam);
  204. JObject JoSession = JObject.Parse(JsonHelper.getDestValue(joInparam, "session[0]"));
  205. string hisHospitalDr = JsonHelper.getDestValue(JoSession, "hospID");
  206. JObject joInterface = JObject.Parse(JsonHelper.getDestValue(joInparam, "interfaceinfo"));
  207. joInterface.Add("hisHospitalDr", hisHospitalDr);
  208. if (joInterface != null)
  209. {
  210. //获取当前接口详细信息
  211. if (Global.businessType == "P1")
  212. {
  213. setGlobalInterface_Plat(joInterface, out Global.inf);
  214. }
  215. else
  216. {
  217. setGlobalInterface(joInterface, out Global.inf);
  218. }
  219. string session = JsonHelper.getDestValue(joInparam, "session[0]");
  220. JObject joSession = (session !="")? JObject.Parse(session):null;
  221. if (joSession != null)
  222. {
  223. //获取当前用户信息
  224. getSessionInfo(joSession);
  225. return 0;
  226. }
  227. else
  228. {
  229. error = "初始化环境失败:session获取失败!";
  230. return -1;
  231. }
  232. }
  233. else
  234. {
  235. error = "初始化环境失败:interfaceinfo获取失败!";
  236. return -1;
  237. }
  238. }
  239. catch (Exception ex)
  240. {
  241. error ="初始化环境失败:" + ex.Message;
  242. return -1;
  243. }
  244. }
  245. /// <summary>
  246. /// 读卡
  247. /// </summary>
  248. /// <returns></returns>
  249. public int readCard(out string outParam)
  250. {
  251. outParam = "";
  252. string errorMsg = "";
  253. string sOutPar;
  254. string pCardinfo = "";
  255. string pBusCardinfo = "";
  256. JObject joCardInfo = new JObject();
  257. ChooseCard cc = new ChooseCard();
  258. CardReader_JIL CardRead = new CardReader_JIL();
  259. try
  260. {
  261. //#region【调用银海COM组件读卡弹框-1401交易】
  262. ////调用银海com组件读卡弹框 1401交易
  263. //InvokeHelper yinhaiCom = new InvokeHelper();
  264. //JObject joInput1401 = new JObject();
  265. //dynamic joData1401 = new JObject();
  266. //joData1401.fixmedinsCode = Global.inf.hospitalNO;
  267. //joData1401.psnNo = "";
  268. ////交易输入报文格式
  269. //joInput1401["transNo"] = "1401";
  270. //joInput1401["transType"] = "passwordCheck";
  271. //joInput1401["timestamp"] = DateTime.Now.ToString("YYYYMMDDHH24MISS");
  272. //joInput1401.Add("data", JObject.FromObject(joData1401));
  273. //string sRtnValue1401 = string.Empty;
  274. //yinhaiCom.Call("1401", joInput1401.ToString(), out sRtnValue1401);
  275. //JObject joRtn1401 = new JObject();
  276. //joRtn1401 = JObject.Parse(sRtnValue1401);
  277. //if (JsonHelper.parseCenterRtnValue(joRtn1401, out errorMsg) != 0)
  278. //{
  279. // outParam = "调用银海控件失败:" + errorMsg;
  280. // return -1;
  281. //}
  282. //else
  283. //{
  284. // outParam = joRtn1401.ToString();
  285. // Global.pat.certNO = JsonHelper.getDestValue(JObject.Parse(outParam), "output.certno"); //证件号码
  286. // Global.pat.name = JsonHelper.getDestValue(JObject.Parse(outParam), "output.psn_name"); //姓名
  287. // Global.pat.card.NO = JsonHelper.getDestValue(JObject.Parse(outParam), "output.card_no"); //社会保障卡号
  288. // Global.pat.insuplc_admdvs = JsonHelper.getDestValue(JObject.Parse(outParam), "output.insuplc_admdvs"); //参保地
  289. // Global.pat.card.SN = JsonHelper.getDestValue(JObject.Parse(outParam), "output.card_sn"); //卡识别码
  290. // Global.pat.certType = JsonHelper.getDestValue(JObject.Parse(outParam), "output.psn_cert_type"); //证件类别
  291. // Global.pat.mdtrtcertNO = JsonHelper.getDestValue(JObject.Parse(outParam), "output.mdtrt_cert_no"); //就诊凭证编号
  292. // Global.pat.mdtrtcertType = JsonHelper.getDestValue(JObject.Parse(outParam), "output.mdtrt_cert_type"); //就诊凭证类型
  293. // Global.pat.IDNO = Global.pat.certNO;
  294. //}
  295. //#endregion
  296. #region【调用自定义读卡窗口读卡】
  297. if (cc.ShowDialog() == DialogResult.OK)
  298. {
  299. #region【电子凭证】
  300. if (cc.sP_CertType == "01")
  301. {
  302. Global.pat.mdtrtcertType = "01";
  303. Global.pat.certType = "01";
  304. Random rd = new Random();
  305. int iNum = rd.Next();
  306. string sLSH = DateTime.Now.ToString("yyyyMMddHHmmss") + Global.inf.hospitalNO + iNum.ToString().Substring(0, 5);
  307. joCardInfo.Add("operatorId", Global.user.ID);
  308. joCardInfo.Add("operatorName", Global.user.name);
  309. joCardInfo.Add("officeId", Global.user.officeID);
  310. joCardInfo.Add("officeName", Global.user.officeName);
  311. joCardInfo.Add("orgId", Global.inf.hospitalNO);
  312. joCardInfo.Add("businessType", cc.sL_CertCodeType);
  313. //认证方式
  314. //二维码
  315. if (cc.EcCertDecodeType == "0")
  316. {
  317. joCardInfo.Add("deviceType", cc.sL_CertCodeType);
  318. }
  319. //电子凭证
  320. else if (cc.EcCertDecodeType == "1")
  321. {
  322. joCardInfo.Add("outBizNo", sLSH);
  323. joCardInfo.Add("extData", "");
  324. }
  325. //刷脸、先授权后解码
  326. else if (cc.EcCertDecodeType == "2") //刷脸
  327. {
  328. joCardInfo.Add("outBizNo", sLSH);
  329. joCardInfo.Add("extData", "");
  330. JObject JoInputAuth = new JObject();
  331. JoInputAuth.Add("orgId", Global.inf.hospitalNO);
  332. JoInputAuth.Add("transType", "cn.nhsa.ec.auth");
  333. JoInputAuth.Add("data", joCardInfo);
  334. JoInputAuth.Add("extra", "");
  335. //调用刷脸认证接口cn.nhsa.ec.auth返回授权信息authNo
  336. CardRead.InsuQRCodeQuery(Global.inf.ecURL, JoInputAuth.ToString(), out sOutPar);
  337. if (JsonHelper.getDestValue(JObject.Parse(sOutPar), "code") != "0")
  338. {
  339. outParam = "调用刷脸认证接口cn.nhsa.ec.auth失败:" + sOutPar;
  340. return -1;
  341. }
  342. //成功返回授权信息
  343. string auth = sOutPar;
  344. JObject JoAuthOut = new JObject();
  345. JoAuthOut.Add("outBizNo", DateTime.Now.ToString("yyyyMMddHHmmss") + Global.inf.hospitalNO + iNum.ToString().Substring(0, 5));
  346. JoAuthOut.Add("authNo", auth);
  347. JoAuthOut.Add("extData", "");
  348. joCardInfo = (JObject)JoAuthOut.DeepClone();
  349. }
  350. //调用电子凭证动态库NationECCode.dll获取身份信息
  351. JObject JoInput = new JObject();
  352. JoInput.Add("orgId", Global.inf.hospitalNO);
  353. JoInput.Add("transType", cc.sL_EcCertDecodeTradeNO);
  354. JoInput.Add("data", joCardInfo);
  355. JoInput.Add("extra", "");
  356. //MessageBox.Show("电子凭证解码地址:" + Global.inf.ecURL + ",入参:" + JoInput.ToString());
  357. CardRead.InsuQRCodeQuery(Global.inf.ecURL, JoInput.ToString(), out sOutPar);
  358. if (JsonHelper.getDestValue(JObject.Parse(sOutPar), "code") != "0")
  359. {
  360. outParam = "调用电子凭证失败:" + sOutPar;
  361. return -1;
  362. }
  363. Global.pat.ecToken = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.ecToken");
  364. Global.pat.name = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.userName");
  365. Global.pat.IDType = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.idType");
  366. Global.pat.IDNO = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.idNo");
  367. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(JObject.Parse(sOutPar), "data.insuOrg");
  368. Global.pat.mdtrtcertNO = Global.pat.ecToken;
  369. Global.pat.certType = Global.pat.IDType;
  370. Global.pat.certNO = Global.pat.IDNO;
  371. }
  372. #endregion
  373. #region【身份证】
  374. if (cc.sP_CertType == "02")
  375. {
  376. //Global.pat.mdtrtcertType = "02";
  377. //Global.pat.mdtrtcertNO = cc.sP_CertNO;
  378. //Global.pat.certType = "01";
  379. //Global.pat.certNO = cc.sP_IDNO;
  380. //Global.pat.name = cc.PatName;
  381. //Global.pat.card.SN = "";
  382. //长春身份证调用动态库读卡
  383. if (CardRead.readSFZ(out pCardinfo, out pBusCardinfo) != 0)
  384. {
  385. outParam = "社保卡读卡异常ReadCardBas:" + pCardinfo;
  386. return -1;
  387. }
  388. //}
  389. Global.writeLog("医保读卡" + "(" + Global.curEvt.URL + ")", pCardinfo, pBusCardinfo);//医保读卡日志输出
  390. //【社保卡读卡成功返回】
  391. Global.pat.mdtrtcertType = "02";
  392. Global.pat.mdtrtcertNO = pBusCardinfo.Replace('\u0000', ' ').Trim();
  393. //Global.pat.mdtrtcertNO = tools.getDestPosStrBySpliter(pCardinfo, 1);//获取身份证号
  394. Global.pat.certType = "01";
  395. Global.pat.certNO = tools.getDestPosStrBySpliter(pCardinfo, 1);//获取身份证号
  396. Global.pat.name = tools.getDestPosStrBySpliter(pCardinfo, 2);//姓名
  397. Global.pat.card.SN = "";
  398. Global.pat.insuplc_admdvs = tools.getDestPosStrBySpliter(pCardinfo, 1).ToString().Substring(0,6);
  399. //Global.pat.insuplc_admdvs = "220581";
  400. }
  401. #endregion
  402. #region【社保卡】
  403. if (cc.sP_CertType == "03")
  404. {
  405. //【社保卡-异地】
  406. //if (cc.bOtherProvLocal)
  407. //{
  408. // Global.pat.bOtherProvLocal = true;
  409. // Global.pat.insuplc_admdvs = Global.pat.card.SearchAdmCode;
  410. // if (CardRead.ReadCardBas_HSM_Step1(cc.sL_CardType, Global.inf.hospitalNO, out sOutPar) != 0)
  411. // {
  412. // outParam = "社保卡读卡异常ReadCardBas_HSM_Step1:" + sOutPar;
  413. // return -1;
  414. // }
  415. // else
  416. // {
  417. // //【9201卡内部认证】
  418. // JObject joData9201 = new JObject();
  419. // joData9201.Add("mac", sOutPar);
  420. // //Global.pat.insuplc_admdvs = tools.getDestPosStrBySpliter(sOutPar, 1); //参保地
  421. // InvokeHelper invoker9201 = new InvokeHelper();
  422. // JObject joRtn9201 = invoker9201.invokeCenterService("9201", JsonHelper.setCenterInpar("9201", joData9201));
  423. // if (JsonHelper.parseCenterRtnValue(joRtn9201, out errorMsg) != 0)
  424. // {
  425. // outParam = "卡内部认证9201交易失败:" + errorMsg;
  426. // return -1;
  427. // }
  428. // else
  429. // {
  430. // outParam = joRtn9201.ToString();
  431. // Global.pat.card.pKey = JsonHelper.getDestValue(JObject.Parse(outParam), "output.crtf_ide_data"); //认证鉴别数据
  432. // }
  433. // if (CardRead.ReadCardBas_HSM_Step2(Global.pat.card.pKey, out sOutPar) != 0)
  434. // {
  435. // outParam = "社保卡读卡异常ReadCardBas_HSM_Step2:" + errorMsg;
  436. // return -1;
  437. // }
  438. // }
  439. //}
  440. //else //【社保卡-本地】
  441. //{
  442. if (CardRead.readCard( out pCardinfo, out pBusCardinfo) != 0)
  443. {
  444. outParam = "社保卡读卡异常ReadCardBas:" + pCardinfo;
  445. return -1;
  446. }
  447. //}
  448. Global.writeLog("医保读卡" + "(" + Global.curEvt.URL + ")", pCardinfo, pBusCardinfo);//医保读卡日志输出
  449. //【社保卡读卡成功返回】
  450. Global.pat.insuplc_admdvs = tools.getDestPosStrBySpliter(pCardinfo, 1); //参保地
  451. Global.pat.card.NO = tools.getDestPosStrBySpliter(pCardinfo, 2); //社会保障号码
  452. Global.pat.certNO = tools.getDestPosStrBySpliter(pCardinfo, 3); //卡号
  453. Global.pat.card.SN = tools.getDestPosStrBySpliter(pCardinfo, 4); //卡识别码
  454. Global.pat.name = tools.getDestPosStrBySpliter(pCardinfo, 5); //姓名
  455. //Global.pat.certType = "90";
  456. Global.pat.certType = "01";
  457. Global.pat.mdtrtcertType = "03";
  458. //Global.pat.mdtrtcertNO = Global.pat.certNO;
  459. Global.pat.mdtrtcertNO = pBusCardinfo.Replace('\u0000',' ').Trim();//长春医保卡卡凭证所有涉及凭证,传参需传医保读卡第二个返参
  460. Global.pat.certNO = Global.pat.card.NO;
  461. }
  462. #endregion
  463. }
  464. else
  465. {
  466. outParam = "收款员取消读卡!";
  467. return -1;
  468. }
  469. #endregion
  470. #region【1101获取身份信息】
  471. JObject joData1101 = new JObject();
  472. joData1101.Add("mdtrt_cert_type", Global.pat.mdtrtcertType); //就诊凭证类型
  473. joData1101.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO); //就诊凭证编码
  474. joData1101.Add("card_sn", Global.pat.card.SN); //卡识别码
  475. joData1101.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd"));
  476. joData1101.Add("psn_cert_type", Global.pat.certType); //证件类别
  477. joData1101.Add("certno", Global.pat.certNO); //证件号码
  478. joData1101.Add("psn_name", Global.pat.name); //姓名
  479. JObject joExpContent= new JObject();
  480. joExpContent.Add("credit_flag", Global.pat.creditFlag);
  481. joData1101.Add("exp_content", joExpContent);
  482. JObject joInput1101 = new JObject();
  483. joInput1101.Add("data", joData1101);
  484. InvokeHelper invoker = new InvokeHelper();
  485. JObject joRtn1101 = invoker.invokeCenterService("1101", JsonHelper.setCenterInpar("1101", joInput1101));
  486. if (JsonHelper.parseCenterRtnValue(joRtn1101, out errorMsg) != 0)
  487. {
  488. outParam = "读卡失败:" + errorMsg;
  489. return -1;
  490. }
  491. else
  492. {
  493. outParam = joRtn1101.ToString();
  494. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(JObject.Parse(outParam), "output.insuinfo.insuplc_admdvs"); //参保地
  495. Global.pat.psn_no = JsonHelper.getDestValue(JObject.Parse(outParam), "output.insuinfo.psn_no"); //参保地
  496. return 0;
  497. }
  498. #endregion
  499. }
  500. catch (Exception ex)
  501. {
  502. outParam = "异常:" + ex.Message;
  503. return -1;
  504. }
  505. }
  506. /// <summary>
  507. /// 展示患者信息界面,转换相关编码为中文,并获取操作员选中的信息
  508. /// </summary>
  509. /// <param name="patInfo"></param>
  510. /// <param name="outparam"></param>
  511. /// <returns></returns>
  512. public int showPatInfo(String patInfo,out string outparam )
  513. {
  514. outparam = "";
  515. //展示信息界面
  516. JObject joOutparam = JObject.Parse(patInfo);
  517. JObject joOutput = JObject.Parse(JsonHelper.getDestValue(joOutparam, "output"));
  518. //编码转换
  519. JArray jaConvertCode = new JArray();
  520. JObject joConvertCodeParam = new JObject();
  521. joConvertCodeParam.Add("hospitalDr", Global.inf.hospitalDr);
  522. joConvertCodeParam.Add("interfaceDr", Global.inf.interfaceDr);
  523. joConvertCodeParam.Add("output", joOutput);
  524. jaConvertCode.Add(joConvertCodeParam);
  525. JObject joConvertCode = new JObject();
  526. joConvertCode.Add("code", "09010054");
  527. joConvertCode.Add("params", jaConvertCode);
  528. InvokeHelper invoker = new InvokeHelper();
  529. JObject joConvertCodeRtn = invoker.invokeInsuService(joConvertCode.ToString(), "患者信息编码转换");
  530. PatientInsuInfo frmPatientInfo = new PatientInsuInfo(joConvertCodeRtn);
  531. //相关信息转换到登记面板
  532. try
  533. {
  534. if (frmPatientInfo.ShowDialog() == DialogResult.OK)
  535. {
  536. //原来用的是转换后的
  537. //frmPatientInfo.joSelectedInsuInfo.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
  538. //frmPatientInfo.joSelectedInsuInfo.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
  539. //joOutparam.Property("output").AddBeforeSelf(new JProperty("selectedInsuInfo", frmPatientInfo.joSelectedInsuInfo));
  540. //现在用转换之前的
  541. JArray jaInsuInfo = JArray.Parse(JsonHelper.getDestValue(joOutput, "insuinfo"));
  542. JArray jaIdInfo = JArray.Parse(JsonHelper.getDestValue(joOutput, "idetinfo"));
  543. JObject joSelectedInsuInfo = (JObject)jaInsuInfo[frmPatientInfo.insuInfoIndex];
  544. JObject joSelectedIdInfo;
  545. if (jaIdInfo.Count != 0)
  546. {
  547. joSelectedIdInfo = (JObject)jaIdInfo[frmPatientInfo.idInfoIndex];
  548. }
  549. else
  550. {
  551. joSelectedIdInfo = new JObject();
  552. }
  553. joSelectedInsuInfo.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
  554. joSelectedInsuInfo.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
  555. joOutparam.Property("output").AddBeforeSelf(new JProperty("selectedInsuInfo", joSelectedInsuInfo));
  556. joOutparam.Property("output").AddBeforeSelf(new JProperty("selectedIdInfo", joSelectedInsuInfo));
  557. outparam = joOutparam.ToString();
  558. return 0;
  559. }
  560. else
  561. {
  562. outparam = JsonHelper.setExceptionJson(-1, "门诊读卡", "收款员取消读卡").ToString();
  563. return -1;
  564. }
  565. }
  566. catch (Exception e)
  567. {
  568. outparam = JsonHelper.setExceptionJson(-1, "患者参保信息展示", e.Message).ToString();
  569. return -1;
  570. }
  571. }
  572. /// <summary>
  573. /// 患者读卡并获取中心信息(1101)后设置PAT结构体
  574. /// </summary>
  575. /// <param name="patInfo"></param>
  576. /// <param name="errMsg"></param>
  577. /// <returns></returns>
  578. public int setGlobalPatAfaterShowPatInfo(string patInfo,out string errMsg)
  579. {
  580. JObject joPatInfo;
  581. errMsg = "";
  582. try
  583. {
  584. joPatInfo = JObject.Parse(patInfo);
  585. //基本信息
  586. Global.pat.certNO = JsonHelper.getDestValue(joPatInfo, "output.baseinfo.certno");
  587. Global.pat.psn_no = JsonHelper.getDestValue(joPatInfo, "output.baseinfo.psn_no");
  588. Global.pat.gend = JsonHelper.getDestValue(joPatInfo, "output.baseinfo.gend");
  589. Global.pat.brdy = JsonHelper.getDestValue(joPatInfo, "output.baseinfo.brdy");
  590. Global.pat.naty = JsonHelper.getDestValue(joPatInfo, "output.baseinfo.naty");
  591. Global.pat.age = JsonHelper.getDestValue(joPatInfo, "output.baseinfo.age");
  592. Global.pat.certType = JsonHelper.getDestValue(joPatInfo, "output.baseinfo.psn_cert_type");
  593. //if (Global.pat.name != JsonHelper.getDestValue(joPatInfo, "output.baseinfo.psn_name"))
  594. //{
  595. // errMsg = "患者姓名(" + Global.pat.name + ")与参保人姓名(" + JsonHelper.getDestValue(joPatInfo, "output.baseinfo.psn_name") + ")不一致,请检查!";
  596. // return -1;
  597. //}
  598. Global.pat.name = JsonHelper.getDestValue(joPatInfo, "output.baseinfo.psn_name");
  599. //选中的参保信息
  600. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.insuplc_admdvs");
  601. Global.pat.psn_insu_date = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.psn_insu_date");
  602. Global.pat.cvlserv_flag = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.cvlserv_flag");
  603. Global.pat.balc = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.balc");
  604. Global.pat.emp_name = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.emp_name");
  605. Global.pat.psn_type = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.psn_type");
  606. Global.pat.psn_insu_stas = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.psn_insu_stas");
  607. Global.pat.insuType = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.insutype");
  608. Global.pat.paus_insu_date = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.paus_insu_date");
  609. //卡片信息
  610. //Global.pat.cardSN = JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo.paus_insu_date");
  611. //选中的身份信息
  612. return 0;
  613. }
  614. catch (Exception ex)
  615. {
  616. errMsg = "获取患者信息发生异常:" + ex.Message;
  617. return -1;
  618. }
  619. }
  620. /// <summary>
  621. /// 显示住院患者登记面板,返回登记入参
  622. /// </summary>
  623. /// <param name="regInfo"></param>
  624. /// <returns></returns>
  625. public int showInPatRegisterForm(out string regInfo)
  626. {
  627. //调用服务获取门诊诊断信息
  628. string diagnoses;
  629. if (hIS.getPatDiagnoses(Global.pat, out diagnoses) != 0)
  630. {
  631. regInfo = JsonHelper.setExceptionJson(-1, "getPatDiagnoses", diagnoses).ToString();
  632. return -1;
  633. }
  634. JObject joHisRtnInfo = JObject.Parse(diagnoses);
  635. //组织登记入参
  636. JObject joReg = new JObject();
  637. try
  638. {
  639. JArray jaDiagnoses = JArray.Parse(JsonHelper.getDestValue(joHisRtnInfo, "diseinfo"));
  640. string dscg_maindiag_code = "",dscg_maindiag_name = "";
  641. // 对诊断数组进行转换 转换下主要诊断
  642. JArray jaConvertedDiagnoses = new JArray();
  643. JArray jaInPatDiagnoses = new JArray();
  644. JArray jaOutPatDiagnoses = new JArray();
  645. for (int i = 0; i < jaDiagnoses.Count; i++)
  646. {
  647. string diag_type = JsonHelper.getDestValue((JObject)jaDiagnoses[i], "diag_type");
  648. switch (diag_type)
  649. {
  650. case "1":
  651. {
  652. jaDiagnoses[i]["diag_type_name"] = new JObject();
  653. jaDiagnoses[i]["diag_type_name"] = "西医主要诊断";
  654. break;
  655. }
  656. case "2":
  657. {
  658. jaDiagnoses[i]["diag_type_name"] = new JObject();
  659. jaDiagnoses[i]["diag_type_name"] = "西医其他诊断";
  660. break;
  661. }
  662. case "3":
  663. {
  664. jaDiagnoses[i]["diag_type_name"] = new JObject();
  665. jaDiagnoses[i]["diag_type_name"] = "中医主病诊断";
  666. break;
  667. }
  668. case "4":
  669. {
  670. jaDiagnoses[i]["diag_type_name"] = new JObject();
  671. jaDiagnoses[i]["diag_type_name"] = "中医主证诊断";
  672. break;
  673. }
  674. }
  675. //if (jaDiagnoses[i]["diaTypeCode"].ToString() == "ADD") //ADD 入院 OPD 门诊
  676. //{
  677. // jaConvertedDiagnoses.Add(jaDiagnoses[i]);
  678. //}
  679. if (jaDiagnoses[i]["diaTypeCode"].ToString() == "ADD") //ADD 入院 OPD 门诊
  680. {
  681. jaInPatDiagnoses.Add(jaDiagnoses[i]);
  682. }
  683. if (jaDiagnoses[i]["diaTypeCode"].ToString() == "OPD") //ADD 入院 OPD 门诊
  684. {
  685. jaOutPatDiagnoses.Add(jaDiagnoses[i]);
  686. }
  687. }
  688. if (jaInPatDiagnoses.Count > 0)
  689. {
  690. jaConvertedDiagnoses = (JArray)jaInPatDiagnoses.DeepClone();
  691. }
  692. else
  693. {
  694. jaConvertedDiagnoses = (JArray)jaOutPatDiagnoses.DeepClone();
  695. }
  696. for (int i = 0; i < jaConvertedDiagnoses.Count; i++)
  697. {
  698. jaConvertedDiagnoses[i]["diag_srt_no"] = i + 1;
  699. if (jaConvertedDiagnoses[i]["maindiag_flag"].ToString() == "1")
  700. {
  701. dscg_maindiag_code = jaConvertedDiagnoses[i]["diag_code"].ToString();
  702. dscg_maindiag_name = jaConvertedDiagnoses[i]["diag_name"].ToString();
  703. }
  704. }
  705. //登记面板实例
  706. OutpatientRegistration frmReg = new OutpatientRegistration();
  707. frmReg.dblkcbxSettelmentWay.Enabled = false;
  708. DataTable dt = (DataTable)frmReg.dblkcbxInsuranceType.DataSource;
  709. int selectedIndex = 0;
  710. for (int i = 0; i < dt.Rows.Count; i++)
  711. {
  712. if (dt.Rows[i]["Code"].ToString() == Global.pat.insuType)
  713. {
  714. selectedIndex = i;
  715. frmReg.dblkcbxInsuranceType.Text = dt.Rows[i]["Name"].ToString();
  716. frmReg.insuType = dt.Rows[i]["Code"].ToString();
  717. }
  718. }
  719. DataTable dtMedType = (DataTable)frmReg.dblkcbxMedicalType.DataSource;
  720. for (int i = 0; i < dtMedType.Rows.Count; i++)
  721. {
  722. if (dtMedType.Rows[i]["Code"].ToString() == "21")
  723. {
  724. frmReg.dblkcbxMedicalType.Text = dtMedType.Rows[i]["Name"].ToString();
  725. frmReg.med_type = dtMedType.Rows[i]["Code"].ToString();
  726. }
  727. }
  728. frmReg.DtDiagnose = (DataTable)jaConvertedDiagnoses.ToObject(typeof(DataTable));
  729. //展示登记面板
  730. if (frmReg.ShowDialog() == DialogResult.OK)
  731. {
  732. string diseCodg ="",diseName = "";
  733. diseCodg = frmReg.diseCodg;
  734. diseName = frmReg.diseName;
  735. //哈尔滨要求必须传病种。普通疾病传主诊断
  736. //if (string.IsNullOrEmpty(frmReg.diseCodg))
  737. //{
  738. // diseCodg = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_code");
  739. //};
  740. //if (string.IsNullOrEmpty(frmReg.diseName))
  741. //{
  742. // diseName = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_name");
  743. //}
  744. JObject joMdtrtinfo = new JObject();
  745. joMdtrtinfo.Add("psn_no", Global.pat.psn_no); //人员编号
  746. joMdtrtinfo.Add("insutype", Global.pat.insuType); //险种类型
  747. joMdtrtinfo.Add("coner_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.coner_name")); //联系人姓名
  748. joMdtrtinfo.Add("tel", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.tel")); //联系电话
  749. joMdtrtinfo.Add("begntime", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime")); //开始时间 "2023-02-28 14:26:29"
  750. joMdtrtinfo.Add("mdtrt_cert_type", Global.pat.mdtrtcertType); //就诊凭证类型
  751. joMdtrtinfo.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO); //就诊凭证编号
  752. joMdtrtinfo.Add("med_type", frmReg.med_type); //医疗类别
  753. joMdtrtinfo.Add("ipt_no", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.ipt_no")); //住院号
  754. joMdtrtinfo.Add("medrcdno", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.medrcdno")); //病历号
  755. joMdtrtinfo.Add("atddr_no", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.atddr_no")); //主治医生编码
  756. joMdtrtinfo.Add("chfpdr_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.chfpdr_name")); //主诊医师姓名
  757. joMdtrtinfo.Add("adm_diag_dscr", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_diag_dscr")); //入院诊断描述
  758. joMdtrtinfo.Add("adm_dept_codg", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_stand_code")); //入院科室编码
  759. joMdtrtinfo.Add("adm_dept_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_name")); //入院科室名称
  760. joMdtrtinfo.Add("adm_bed", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_bed")); //入院床位
  761. joMdtrtinfo.Add("dscg_maindiag_code", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_code")); //住院主诊断代码
  762. joMdtrtinfo.Add("dscg_maindiag_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_name")); //住院主诊断名称
  763. //joMdtrtinfo.Add("dscg_maindiag_code", dscg_maindiag_code); //住院主诊断代码
  764. //joMdtrtinfo.Add("dscg_maindiag_name", dscg_maindiag_name); //住院主诊断名称
  765. joMdtrtinfo.Add("main_cond_dscr", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.main_cond_dscr")); //主要病情描述
  766. joMdtrtinfo.Add("dise_codg", diseCodg); //病种编码
  767. joMdtrtinfo.Add("dise_name", diseName); //病种名称
  768. joMdtrtinfo.Add("oprn_oprt_code", frmReg.oprn_oprt_code); //手术操作代码
  769. joMdtrtinfo.Add("oprn_oprt_name", frmReg.oprn_oprt_name); //手术操作名称
  770. joMdtrtinfo.Add("fpsc_no", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.fpsc_no")); //计划生育服务证号
  771. joMdtrtinfo.Add("matn_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.matn_type")); //生育类别
  772. joMdtrtinfo.Add("birctrl_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_type")); //计划生育手术类别
  773. joMdtrtinfo.Add("latechb_flag", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.latechb_flag")); //晚育标志
  774. joMdtrtinfo.Add("geso_val", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.geso_val")); //孕周数
  775. joMdtrtinfo.Add("fetts", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.fetts")); //胎次
  776. joMdtrtinfo.Add("fetus_cnt", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.fetus_cnt")); //胎儿数
  777. joMdtrtinfo.Add("pret_flag", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.pret_flag")); //早产标志
  778. joMdtrtinfo.Add("birctrl_matn_date", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_matn_date")); //计划生育手术或生育日期
  779. joMdtrtinfo.Add("dise_type_code", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dise_type_code")); //病种类型
  780. JObject joTrum = new JObject();
  781. JObject joDataExp = new JObject(); //外伤节点 trum_content
  782. //joDataExp.Add("acct_payamt", "0.00");
  783. //joDataExp.Add("cla_trt_flag", "");
  784. joDataExp.Add("trum_flag", frmReg.traumaFlag);//外伤标志 0 否 1是
  785. joDataExp.Add("rel_ttp_flag", frmReg.relTtpFlag);//涉及第三方标志 0 否 1是
  786. //JObject joMdtPep = new JObject();//就诊人群类型 mdtrt_grp_content
  787. //joMdtPep.Add("mdtrt_grp_type", "");//1新冠肺炎确诊患者 2其他国家突发公共事件 3新冠肺炎疑似患者 4无症状感染者
  788. joTrum.Add("trum_content", joDataExp);//外伤节点 trum_content
  789. //joTrum.Add("mdtrt_grp_content", joMdtPep);//就诊人群类型 trum_content
  790. joMdtrtinfo.Add("exp_content", joTrum); //字段扩展
  791. joMdtrtinfo.Add("insuplc_admdvs", Global.pat.insuplc_admdvs); //参保地医保区划
  792. joMdtrtinfo.Add("mdtrtarea_admvs", Global.inf.areaCode); //就医地医保区划
  793. joReg.Add("mdtrtinfo", joMdtrtinfo);
  794. joReg.Add("diseinfo", jaConvertedDiagnoses);
  795. Global.pat.disCode = diseCodg;
  796. Global.pat.disName = diseName;
  797. Global.pat.medType = frmReg.med_type;
  798. regInfo = joReg.ToString();
  799. return 0;
  800. }
  801. else
  802. {
  803. regInfo = "收费员取消操作!";
  804. return -1;
  805. }
  806. }
  807. catch (Exception ex)
  808. {
  809. regInfo = "登记界面显示异常:" + ex.Message;
  810. return -1;
  811. }
  812. }
  813. /// <summary>
  814. /// 显示出院登记界面,返回出院登记和结算的入参
  815. /// </summary>
  816. /// <param name="joSumFee"></param>
  817. /// <param name="outParam"></param>
  818. /// <returns></returns>
  819. public int showDischargeRegisterForm(string funNO, JObject joSumFee, JObject joHisRtnInfo, out string outParam)
  820. {
  821. outParam = "";
  822. string errMsg;
  823. try
  824. {
  825. JArray jaDiagnoses = JArray.Parse(JsonHelper.getDestValue(joHisRtnInfo, "diseinfo"));
  826. //选择结算方式等
  827. OutpatientRegistration frmReg = new OutpatientRegistration();
  828. frmReg.dblkcbxInsuranceType.Enabled = true;
  829. DataTable dt = (DataTable)frmReg.dblkcbxInsuranceType.DataSource;
  830. int selectedIndex = 0;
  831. for (int i = 0; i < dt.Rows.Count; i++)
  832. {
  833. if (dt.Rows[i]["Code"].ToString() == Global.pat.insuType)
  834. {
  835. selectedIndex = i;
  836. frmReg.dblkcbxInsuranceType.Text = dt.Rows[i]["Name"].ToString();
  837. frmReg.insuType = dt.Rows[i]["Code"].ToString();
  838. }
  839. }
  840. dt = (DataTable)frmReg.dblkcbxMedicalType.DataSource;
  841. for (int i = 0; i < dt.Rows.Count; i++)
  842. {
  843. if (dt.Rows[i]["Code"].ToString() == Global.pat.medType)
  844. {
  845. frmReg.dblkcbxMedicalType.Text = dt.Rows[i]["Name"].ToString();
  846. frmReg.med_type = dt.Rows[i]["Code"].ToString();
  847. }
  848. }
  849. if (Global.pat.RYorCY == "1")
  850. {
  851. DataTable dtMedType = (DataTable)frmReg.dblkcbxMedicalType.DataSource;
  852. for (int i = 0; i < dtMedType.Rows.Count; i++)
  853. {
  854. if (dtMedType.Rows[i]["Code"].ToString() == "21")
  855. {
  856. frmReg.dblkcbxMedicalType.Text = dtMedType.Rows[i]["Name"].ToString();
  857. frmReg.med_type = dtMedType.Rows[i]["Code"].ToString();
  858. }
  859. }
  860. }
  861. DataTable dtSettlWay = (DataTable)frmReg.dblkcbxSettelmentWay.DataSource;
  862. for (int i = 0; i < dtSettlWay.Rows.Count; i++)
  863. {
  864. if (dtSettlWay.Rows[i]["Code"].ToString() == "01")
  865. {
  866. frmReg.dblkcbxSettelmentWay.Text = dtSettlWay.Rows[i]["Name"].ToString();
  867. frmReg.psn_setlway = dtSettlWay.Rows[i]["Code"].ToString();
  868. }
  869. }
  870. DataTable DTdiseCodg = (DataTable)frmReg.dblkcbxDisease.DataSource;
  871. for (int i = 0; i < DTdiseCodg.Rows.Count; i++)
  872. {
  873. if (DTdiseCodg.Rows[i]["Code"].ToString() == Global.pat.DiseasecCode)
  874. {
  875. frmReg.dblkcbxDisease.Text = DTdiseCodg.Rows[i]["Name"].ToString();
  876. frmReg.diseCodg = DTdiseCodg.Rows[i]["Code"].ToString();
  877. }
  878. }
  879. if (frmReg.dblkcbxInsuranceType.Text != "")
  880. frmReg.dblkcbxInsuranceType.Enabled = false;
  881. if (frmReg.dblkcbxMedicalType.Text != "")
  882. frmReg.dblkcbxMedicalType.Enabled = false;
  883. if (frmReg.dblkcbxDisease.Text != "")
  884. frmReg.dblkcbxDisease.Enabled = false;
  885. // 对诊断数组进行转换 转换下主要诊断
  886. JArray jaConvertedDiagnoses = new JArray();
  887. string dscg_maindiag_code = "", dscg_maindiag_name = "";
  888. for (int i = 0; i < jaDiagnoses.Count; i++)
  889. {
  890. string diag_type = JsonHelper.getDestValue((JObject)jaDiagnoses[i], "diag_type");
  891. switch (diag_type)
  892. {
  893. case "1":
  894. {
  895. jaDiagnoses[i]["diag_type_name"] = new JObject();
  896. jaDiagnoses[i]["diag_type_name"] = "西医主要诊断";
  897. break;
  898. }
  899. case "2":
  900. {
  901. jaDiagnoses[i]["diag_type_name"] = new JObject();
  902. jaDiagnoses[i]["diag_type_name"] = "西医其他诊断";
  903. break;
  904. }
  905. case "3":
  906. {
  907. jaDiagnoses[i]["diag_type_name"] = new JObject();
  908. jaDiagnoses[i]["diag_type_name"] = "中医主病诊断";
  909. break;
  910. }
  911. case "4":
  912. {
  913. jaDiagnoses[i]["diag_type_name"] = new JObject();
  914. jaDiagnoses[i]["diag_type_name"] = "中医主证诊断";
  915. break;
  916. }
  917. }
  918. if (jaDiagnoses[i]["diaTypeCode"].ToString() == "DIS") //ADD 入院 OPD 门诊 DIS出院诊断
  919. {
  920. jaConvertedDiagnoses.Add(jaDiagnoses[i]);
  921. }
  922. }
  923. for (int i = 0; i < jaConvertedDiagnoses.Count; i++)
  924. {
  925. jaConvertedDiagnoses[i]["diag_srt_no"] = i + 1;
  926. if (jaConvertedDiagnoses[i]["maindiag_flag"].ToString() == "1")
  927. {
  928. dscg_maindiag_code = jaConvertedDiagnoses[i]["diag_code"].ToString();
  929. dscg_maindiag_name = jaConvertedDiagnoses[i]["diag_name"].ToString();
  930. }
  931. //增加就诊ID
  932. jaConvertedDiagnoses[i]["mdtrt_id"] = new JObject();
  933. jaConvertedDiagnoses[i]["mdtrt_id"] = Global.pat.mdtrtID;
  934. }
  935. frmReg.DtDiagnose = (DataTable)jaConvertedDiagnoses.ToObject(typeof(DataTable));
  936. if (frmReg.ShowDialog() == DialogResult.OK)
  937. {
  938. string diseCodg = "", diseName = "";
  939. //哈尔滨要求必须传病种。普通疾病传主诊断
  940. if (string.IsNullOrEmpty(frmReg.diseCodg))
  941. {
  942. diseCodg = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_code");
  943. };
  944. if (string.IsNullOrEmpty(frmReg.diseName))
  945. {
  946. diseName = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_name");
  947. };
  948. //出院登记入参
  949. //单病种出院登记 病种信息取入院登记入参
  950. if (Global.pat.RYorCY == "2")
  951. {
  952. if (Global.pat.medType == "26")
  953. {
  954. diseCodg = Global.pat.DiseasecCode;
  955. diseName = Global.pat.DiseasecName;
  956. }
  957. else
  958. {
  959. frmReg.insuType = Global.pat.insuType;
  960. }
  961. }
  962. JObject joDscgInfo = new JObject();
  963. joDscgInfo.Add("mdtrt_id", Global.pat.mdtrtID);
  964. joDscgInfo.Add("psn_no", Global.pat.psn_no); //人员编号
  965. joDscgInfo.Add("insutype", frmReg.insuType); //险种类型
  966. //joDscgInfo.Add("coner_name", JsonHelper.getJsonValue(joHisPatInfo, "coner_name")); //联系人姓名
  967. //joDscgInfo.Add("tel", JsonHelper.getJsonValue(joHisPatInfo, "tel")); //联系电话
  968. joDscgInfo.Add("endtime", Global.pat.hisDischargeTime); //结束时间DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  969. joDscgInfo.Add("dise_codg", diseCodg); //病种编码
  970. joDscgInfo.Add("dise_name", diseName); //病种名称
  971. joDscgInfo.Add("oprn_oprt_code", frmReg.oprn_oprt_code); //手术操作代码
  972. joDscgInfo.Add("oprn_oprt_name", frmReg.oprn_oprt_name); //手术操作名称
  973. joDscgInfo.Add("fpsc_no", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.fpsc_no")); //计划生育服务证号
  974. joDscgInfo.Add("matn_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.matn_type")); //生育类别
  975. joDscgInfo.Add("birctrl_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_type")); //计划生育手术类别
  976. joDscgInfo.Add("latechb_flag", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.latechb_flag")); //晚育标志
  977. joDscgInfo.Add("geso_val", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.geso_val")); //孕周数
  978. joDscgInfo.Add("fetts", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.fetts")); //胎次
  979. joDscgInfo.Add("fetus_cnt", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.fetus_cnt")); //胎儿数
  980. joDscgInfo.Add("pret_flag", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.pret_flag")); //早产标志
  981. joDscgInfo.Add("birctrl_matn_date", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_matn_date")); //计划生育手术或生育日期
  982. joDscgInfo.Add("cop_flag", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dise_type_code")); //伴有并发症标志
  983. joDscgInfo.Add("dscg_dept_codg", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_codg")); //出院科室编码
  984. joDscgInfo.Add("dscg_dept_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_name")); //出院科室名称
  985. joDscgInfo.Add("dscg_bed", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_bed")); //出院床位
  986. joDscgInfo.Add("dscg_way", "1"); //离院方式
  987. joDscgInfo.Add("die_date", ""); //死亡日期
  988. joDscgInfo.Add("exp_content", ""); //字段扩展
  989. joDscgInfo.Add("insuplc_admdvs", Global.pat.insuplc_admdvs); //参保地医保区划
  990. joDscgInfo.Add("mdtrtarea_admvs", Global.inf.areaCode); //就医地医保区划
  991. JObject joRegInpar = new JObject();
  992. joRegInpar.Add("dscginfo", joDscgInfo);
  993. joRegInpar.Add("diseinfo", jaConvertedDiagnoses);
  994. //结算入参
  995. JObject joSetlInpar = new JObject();
  996. joSetlInpar.Add("psn_no", Global.pat.psn_no);
  997. joSetlInpar.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
  998. joSetlInpar.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
  999. joSetlInpar.Add("medfee_sumamt", JsonHelper.getDestValue(joSumFee, "data.Sumamt"));
  1000. joSetlInpar.Add("psn_setlway", frmReg.psn_setlway); //结算方式
  1001. joSetlInpar.Add("mdtrt_id", Global.pat.mdtrtID);
  1002. joSetlInpar.Add("acct_used_flag", frmReg.personAccountUsedFlag);//个人账户使用标志
  1003. joSetlInpar.Add("insutype", frmReg.insuType);//险种类型
  1004. joSetlInpar.Add("insuplc_admdvs", Global.pat.insuplc_admdvs); //参保地
  1005. joSetlInpar.Add("mdtrtarea_admvs", Global.inf.areaCode); //就医地
  1006. joSetlInpar.Add("mid_setl_flag", "0");
  1007. joSetlInpar.Add("fulamt_ownpay_amt", JsonHelper.getDestValue(joSumFee, "data.FullOwnPayAmount")); //全自费金额
  1008. joSetlInpar.Add("overlmt_selfpay", JsonHelper.getDestValue(joSumFee, "data.OverLimitAmount"));
  1009. joSetlInpar.Add("preselfpay_amt", JsonHelper.getDestValue(joSumFee, "data.PreSelfPayAmount"));
  1010. //joSetlInpar.Add("dscgTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  1011. joSetlInpar.Add("dscgTime", Global.pat.hisDischargeTime);
  1012. //joSetlInpar.Add("chrg_bchno", Global.pat.adm_Dr.ToString());
  1013. joSetlInpar.Add("med_type", Global.pat.medType);
  1014. joSetlInpar.Add("exp_content", ""); //
  1015. joSetlInpar.Add("minpacunt_drug_trac_cnt", Global.Set.minpacunt_drug_trac_cnt);
  1016. joSetlInpar.Add("mcs_trac_cnt", Global.Set.mcs_trac_cnt);
  1017. //joSetlInpar.Add("invono", "");
  1018. //JObject joDataExp = new JObject();
  1019. //joDataExp.Add("acct_payamt", "0.00");
  1020. //joDataExp.Add("cla_trt_flag", "");
  1021. //joSetlInpar.Add("exp_content", joDataExp); //11111
  1022. AmpHos001 ampHos001 = new AmpHos001();
  1023. // 院内证件类型,和 ORG_001 的his_cust_list 内的his_cust_type 是同样的意思
  1024. ampHos001.hisCustType = Global.pat.mdtrtcertType; // 院内证件类型
  1025. // 院内证件号,和 ORG_001 的his_cust_list 内的his_cust_id 是同样的意思
  1026. ampHos001.hisCustId = Global.pat.certNO; // 院内证件号
  1027. // 应用类型
  1028. ampHos001.appType = "02"; // 应用类型应用类型 01 门诊02 住院03 挂号04 线上
  1029. // 医疗机构订单号
  1030. ampHos001.medOrgOrd = Global.inf.hospitalNO + Global.pat.settlID; // 医疗机构订单号 ,必填,通过这个单号来回查推送的详情数据\norgCode+subOrgCode+medOrgOrd 不超过47位。\nmedOrgOrd 和 ORG_002 返回的org_trace_no 需要一致
  1031. // 分院编号
  1032. ampHos001.subOrgCode = ""; // 分院编号
  1033. // 订单状态
  1034. ampHos001.orderStatus = ""; // 订单状态 "pushType 类型为 HOSPITAL_PAYMENT 时必填\nMERCHANT_WAIT_PAY 待支付\nMERCHANT_PAID 已支付\nMERCHANT_PART_REFUNDED 已部分退款\nMERCHANT_REFUNDED 已全额退款\nMERCHANT_CLOSED 已取消")
  1035. // 机构代码
  1036. ampHos001.orgCode = Global.inf.hospitalNO; // 机构代码
  1037. // 用户名
  1038. ampHos001.patientName = Global.pat.name; // 用户名
  1039. // 证件类型
  1040. ampHos001.idType = Global.pat.certType; // 证件类型
  1041. // 证件号
  1042. ampHos001.idNo = Global.pat.certNO; // 证件号
  1043. // 推送类型
  1044. ampHos001.pushType = "HOSPITAL_PAYMENT"; // 推送类型HOSPITAL_APPOINTMENT 挂号单 HOSPITAL_PAYMENT 支付单
  1045. // 子订单类型
  1046. ampHos001.subOrderType = ""; // 子订单类型 只有当 pushType 为挂号单时必填 APPOINTMENT_WAIT_PA
  1047. // 是否本人挂号
  1048. ampHos001.isDoneBySelf = ""; // 是否本人挂号 只有当 pushType 为挂号单时必填YES 是NO 否NULL 未知
  1049. // 下一步就医指引
  1050. ampHos001.nextStepTips = ""; // 下一步就医指引 一、当 pushType 为挂号单时必填a)当 subOrderType 为预约成功待⽀付,并且承接⻚⽀持在线医保⽀付的时候,建议传⼊⽂案:“⽀持在线医保⽀付,⽆需取号,直接前往就诊科室”b)当 subOrderType 为其他 类型(非待支付)时,建 议传⼊⽂案“请前往 3 楼302 室内科签到就诊”,或 者自定义⽂案;二、当 pushType 为支付单 时必填a)医保订单待支付提醒中, 请传入支付相关提示,如 “点击在线医保支付,无 需前往窗口/ 自助机排队”b)医保订单支付完成提醒中,请传入取药、检查检验的指引,如“请前往 3 楼⻄药房 5 号窗⼝取药。”
  1051. // 预约时间
  1052. ampHos001.scheduledTime = ""; // 预约时间 当推送类型为“挂号单 ”时 必填。格式:yyyy-MM-dd HH:mm:ss
  1053. // 重定向地址
  1054. ampHos001.redirectUrl = ""; // 重定向地址
  1055. // 科室名称
  1056. ampHos001.deptName = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_name"); // 科室名称
  1057. // 科室编码
  1058. ampHos001.deptCode = "A10"; // 科室编码
  1059. // 科室地址
  1060. ampHos001.deptLoc = ""; // 科室地址
  1061. // 医生姓名
  1062. ampHos001.drName = ""; // 医生姓名
  1063. // 医生职级
  1064. ampHos001.drLvName = ""; // 医生职级
  1065. // 医生编码
  1066. ampHos001.drNo = ""; // 医生编码
  1067. // 订单创建时间
  1068. ampHos001.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // 订单创建时间
  1069. // 订单修改时间
  1070. ampHos001.updateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // 订单修改时间
  1071. // 扩展参数
  1072. ampHos001.extData = null; // 扩展参数
  1073. JObject joOut = new JObject();
  1074. joOut.Add("DischargeRegister", joRegInpar);
  1075. joOut.Add("Settlement", joSetlInpar);
  1076. joOut.Add("ampHos001", ampHos001.ToJson());
  1077. joOut.Add("errorCode", 0);
  1078. outParam = joOut.ToString();
  1079. return 0;
  1080. }
  1081. else
  1082. {
  1083. outParam = "收款员取消结算";
  1084. return -1;
  1085. }
  1086. }
  1087. catch (Exception ex)
  1088. {
  1089. outParam = "showDischargeRegisterForm 异常:" + ex.Message;
  1090. return -1;
  1091. }
  1092. }
  1093. public int showOutPatRegisterForm(out string regInfo)
  1094. {
  1095. //调用服务获取门诊诊断信息
  1096. string diagnoses;
  1097. if (hIS.getPatDiagnoses(Global.pat, out diagnoses) != 0)
  1098. {
  1099. regInfo = JsonHelper.setExceptionJson(-1, "getPatDiagnoses", diagnoses).ToString();
  1100. return -1;
  1101. }
  1102. JObject joHisRtnInfo = JObject.Parse(diagnoses);
  1103. //组织入参
  1104. JObject joReg = new JObject();
  1105. try
  1106. {
  1107. JArray jaDiagnoses = JArray.Parse(JsonHelper.getDestValue(joHisRtnInfo, "diseinfo"));
  1108. //登记面板实例
  1109. OutpatientRegistration frmReg = new OutpatientRegistration();
  1110. //frmReg.dblkcbxSettelmentWay.Enabled = false;
  1111. //险种类型
  1112. DataTable dtInsuType = (DataTable)frmReg.dblkcbxInsuranceType.DataSource;
  1113. for (int i = 0; i < dtInsuType.Rows.Count; i++)
  1114. {
  1115. if (dtInsuType.Rows[i]["Code"].ToString() == Global.pat.insuType)
  1116. {
  1117. frmReg.dblkcbxInsuranceType.Text = dtInsuType.Rows[i]["Name"].ToString();
  1118. frmReg.insuType = dtInsuType.Rows[i]["Code"].ToString();
  1119. }
  1120. }
  1121. //医疗类别
  1122. DataTable dtMedType = (DataTable)frmReg.dblkcbxMedicalType.DataSource;
  1123. for (int i = 0; i < dtMedType.Rows.Count; i++)
  1124. {
  1125. if (dtMedType.Rows[i]["Code"].ToString() == "11")
  1126. {
  1127. frmReg.dblkcbxMedicalType.Text = dtMedType.Rows[i]["Name"].ToString();
  1128. frmReg.med_type = dtMedType.Rows[i]["Code"].ToString();
  1129. }
  1130. }
  1131. //结算方式
  1132. DataTable dtSettlWay = (DataTable)frmReg.dblkcbxSettelmentWay.DataSource;
  1133. for (int i = 0; i < dtSettlWay.Rows.Count; i++)
  1134. {
  1135. if (dtSettlWay.Rows[i]["Code"].ToString() == "01")
  1136. {
  1137. frmReg.dblkcbxSettelmentWay.Text = dtSettlWay.Rows[i]["Name"].ToString();
  1138. frmReg.psn_setlway = dtSettlWay.Rows[i]["Code"].ToString();
  1139. }
  1140. }
  1141. //转换下主要诊断
  1142. for (int i = 0; i < jaDiagnoses.Count; i++)
  1143. {
  1144. jaDiagnoses[i]["diag_dept"] = "A10";
  1145. string diag_type = JsonHelper.getDestValue((JObject)jaDiagnoses[i], "diag_type");
  1146. switch (diag_type)
  1147. {
  1148. case "1":
  1149. {
  1150. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1151. jaDiagnoses[i]["diag_type_name"] = "西医主要诊断";
  1152. break;
  1153. }
  1154. case "2":
  1155. {
  1156. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1157. jaDiagnoses[i]["diag_type_name"] = "西医其他诊断";
  1158. break;
  1159. }
  1160. case "3":
  1161. {
  1162. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1163. jaDiagnoses[i]["diag_type_name"] = "中医主病诊断";
  1164. break;
  1165. }
  1166. case "4":
  1167. {
  1168. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1169. jaDiagnoses[i]["diag_type_name"] = "中医主证诊断";
  1170. break;
  1171. }
  1172. }
  1173. }
  1174. frmReg.DtDiagnose = (DataTable)jaDiagnoses.ToObject(typeof(DataTable));
  1175. //展示登记面板
  1176. if (frmReg.ShowDialog() == DialogResult.OK)
  1177. {
  1178. string diseCodg = "", diseName = "";
  1179. //哈尔滨要求必须传病种。普通疾病传主诊断
  1180. if (string.IsNullOrEmpty(frmReg.diseCodg))
  1181. {
  1182. diseCodg = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_code");
  1183. };
  1184. if (string.IsNullOrEmpty(frmReg.diseName))
  1185. {
  1186. diseName = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_name");
  1187. };
  1188. //组织挂号入参
  1189. JObject joRegInpar = new JObject();
  1190. string occurTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1191. joRegInpar.Add("psn_no", Global.pat.psn_no);
  1192. joRegInpar.Add("insutype", frmReg.insuType);
  1193. joRegInpar.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));//挂号时间
  1194. joRegInpar.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
  1195. joRegInpar.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
  1196. joRegInpar.Add("ipt_otp_no", Global.pat.adm_Dr);
  1197. joRegInpar.Add("atddr_no", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.atddr_no"));
  1198. joRegInpar.Add("dr_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.chfpdr_name"));
  1199. //joRegInpar.Add("dept_code", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_codg"));
  1200. joRegInpar.Add("dept_code", "A10");
  1201. joRegInpar.Add("dept_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_name"));
  1202. joRegInpar.Add("caty", "A10");
  1203. joRegInpar.Add("exp_content", "");
  1204. joReg.Add("data", joRegInpar);
  1205. //组织就诊信息入参
  1206. JObject joMdtrtinfo = new JObject();
  1207. for (int i = 0; i < jaDiagnoses.Count; i++)
  1208. {
  1209. jaDiagnoses[i]["vali_flag"] = new JObject();
  1210. jaDiagnoses[i]["vali_flag"] = "1";
  1211. }
  1212. joMdtrtinfo.Add("mdtrt_id", Global.pat.mdtrtID);
  1213. joMdtrtinfo.Add("psn_no", Global.pat.psn_no); //人员编号
  1214. Global.pat.medType = frmReg.med_type;
  1215. joMdtrtinfo.Add("med_type", frmReg.med_type); //医疗类别
  1216. joMdtrtinfo.Add("begntime", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime")); //开始时间
  1217. joMdtrtinfo.Add("main_cond_dscr", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.main_cond_dscr")); //主要病情描述
  1218. joMdtrtinfo.Add("dise_codg", diseCodg); //病种编码
  1219. joMdtrtinfo.Add("dise_name", diseName); //病种名称
  1220. joMdtrtinfo.Add("birctrl_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_type")); //计划生育手术类别
  1221. joMdtrtinfo.Add("birctrl_matn_date", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_matn_date")); //计划生育手术或生育日期
  1222. joMdtrtinfo.Add("matn_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.matn_type")); //生育类别
  1223. joMdtrtinfo.Add("geso_val", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.geso_val")); //孕周数
  1224. joMdtrtinfo.Add("exp_content", ""); //字段扩展
  1225. //组织结算入参
  1226. JObject joSetlInpar = new JObject();
  1227. joSetlInpar.Add("psn_no", Global.pat.psn_no);
  1228. joSetlInpar.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
  1229. joSetlInpar.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
  1230. joSetlInpar.Add("med_type", Global.pat.medType);
  1231. joSetlInpar.Add("medfee_sumamt", "");
  1232. joSetlInpar.Add("psn_setlway", frmReg.psn_setlway); //结算方式
  1233. joSetlInpar.Add("mdtrt_id", Global.pat.mdtrtID);
  1234. joSetlInpar.Add("chrg_bchno", Global.pat.adm_Dr.ToString());
  1235. joSetlInpar.Add("acct_used_flag", frmReg.personAccountUsedFlag);//个人账户使用标志
  1236. joSetlInpar.Add("insutype", frmReg.insuType);//险种类型
  1237. joSetlInpar.Add("pub_hosp_rfom_flag", "");
  1238. JObject joExpContent = new JObject();
  1239. JObject joTrum = new JObject();
  1240. joTrum.Add("trum_flag", frmReg.traumaFlag);//外伤标志 0 否 1是
  1241. joTrum.Add("rel_ttp_flag", frmReg.relTtpFlag);//涉及第三方标志 0 否 1是
  1242. //JObject joMdtPep = new JObject();//就诊人群类型 mdtrt_grp_content
  1243. //joMdtPep.Add("mdtrt_grp_type", "");//1新冠肺炎确诊患者 2其他国家突发公共事件 3新冠肺炎疑似患者 4无症状感染者
  1244. joExpContent.Add("trum_content", joTrum);//外伤节点 trum_content
  1245. //信用支付
  1246. //dynamic joCredit = new { bank_code = "", pay_fee = 0};
  1247. //joExpContent.Add("credit_info",JObject.FromObject(joCredit));
  1248. //joExpContent.Add("credit_flag", frmReg.creditFlag);
  1249. joSetlInpar.Add("exp_content", joExpContent); //字段扩展
  1250. joSetlInpar.Add("minpacunt_drug_trac_cnt", Global.Set.minpacunt_drug_trac_cnt);
  1251. joSetlInpar.Add("mcs_trac_cnt", Global.Set.mcs_trac_cnt);
  1252. joReg.Add("mdtrtinfo", joMdtrtinfo);
  1253. joReg.Add("diseinfo", jaDiagnoses);
  1254. joReg.Add("settlement", joSetlInpar);
  1255. //
  1256. AmpHos001 ampHos001 = new AmpHos001();
  1257. // 院内证件类型,和 ORG_001 的his_cust_list 内的his_cust_type 是同样的意思
  1258. ampHos001.hisCustType = Global.pat.mdtrtcertType; // 院内证件类型
  1259. // 院内证件号,和 ORG_001 的his_cust_list 内的his_cust_id 是同样的意思
  1260. ampHos001.hisCustId = Global.pat.certNO; // 院内证件号
  1261. // 应用类型
  1262. ampHos001.appType = "01"; // 应用类型应用类型 01 门诊02 住院03 挂号04 线上
  1263. // 医疗机构订单号
  1264. ampHos001.medOrgOrd = Global.inf.hospitalNO + Global.pat.settlID; // 医疗机构订单号 ,必填,通过这个单号来回查推送的详情数据\norgCode+subOrgCode+medOrgOrd 不超过47位。\nmedOrgOrd 和 ORG_002 返回的org_trace_no 需要一致
  1265. // 分院编号
  1266. ampHos001.subOrgCode = ""; // 分院编号
  1267. // 订单状态
  1268. ampHos001.orderStatus = ""; // 订单状态 "pushType 类型为 HOSPITAL_PAYMENT 时必填\nMERCHANT_WAIT_PAY 待支付\nMERCHANT_PAID 已支付\nMERCHANT_PART_REFUNDED 已部分退款\nMERCHANT_REFUNDED 已全额退款\nMERCHANT_CLOSED 已取消")
  1269. // 机构代码
  1270. ampHos001.orgCode =Global.inf.hospitalNO; // 机构代码
  1271. // 用户名
  1272. ampHos001.patientName = Global.pat.name; // 用户名
  1273. // 证件类型
  1274. ampHos001.idType = Global.pat.certType; // 证件类型
  1275. // 证件号
  1276. ampHos001.idNo = Global.pat.certNO; // 证件号
  1277. // 推送类型
  1278. ampHos001.pushType = "HOSPITAL_PAYMENT"; // 推送类型HOSPITAL_APPOINTMENT 挂号单 HOSPITAL_PAYMENT 支付单
  1279. // 子订单类型
  1280. ampHos001.subOrderType = ""; // 子订单类型 只有当 pushType 为挂号单时必填 APPOINTMENT_WAIT_PA
  1281. // 是否本人挂号
  1282. ampHos001.isDoneBySelf = ""; // 是否本人挂号 只有当 pushType 为挂号单时必填YES 是NO 否NULL 未知
  1283. // 下一步就医指引
  1284. ampHos001.nextStepTips = ""; // 下一步就医指引 一、当 pushType 为挂号单时必填a)当 subOrderType 为预约成功待⽀付,并且承接⻚⽀持在线医保⽀付的时候,建议传⼊⽂案:“⽀持在线医保⽀付,⽆需取号,直接前往就诊科室”b)当 subOrderType 为其他 类型(非待支付)时,建 议传⼊⽂案“请前往 3 楼302 室内科签到就诊”,或 者自定义⽂案;二、当 pushType 为支付单 时必填a)医保订单待支付提醒中, 请传入支付相关提示,如 “点击在线医保支付,无 需前往窗口/ 自助机排队”b)医保订单支付完成提醒中,请传入取药、检查检验的指引,如“请前往 3 楼⻄药房 5 号窗⼝取药。”
  1285. // 预约时间
  1286. ampHos001.scheduledTime = ""; // 预约时间 当推送类型为“挂号单 ”时 必填。格式:yyyy-MM-dd HH:mm:ss
  1287. // 重定向地址
  1288. ampHos001.redirectUrl = ""; // 重定向地址
  1289. // 科室名称
  1290. ampHos001.deptName = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_name"); // 科室名称
  1291. // 科室编码
  1292. ampHos001.deptCode = "A10"; // 科室编码
  1293. // 科室地址
  1294. ampHos001.deptLoc = ""; // 科室地址
  1295. // 医生姓名
  1296. ampHos001.drName = ""; // 医生姓名
  1297. // 医生职级
  1298. ampHos001.drLvName = ""; // 医生职级
  1299. // 医生编码
  1300. ampHos001.drNo = ""; // 医生编码
  1301. // 订单创建时间
  1302. ampHos001.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // 订单创建时间
  1303. // 订单修改时间
  1304. ampHos001.updateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // 订单修改时间
  1305. // 扩展参数
  1306. ampHos001.extData = null; // 扩展参数
  1307. joReg.Add("ampHos001", ampHos001.ToJson());
  1308. regInfo = joReg.ToString();
  1309. return 0;
  1310. }
  1311. else
  1312. {
  1313. regInfo = "收费员取消操作!";
  1314. return -1;
  1315. }
  1316. }
  1317. catch (Exception ex)
  1318. {
  1319. regInfo = "登记界面显示异常:" + ex.Message;
  1320. return -1;
  1321. }
  1322. }
  1323. public int showOutPatRegisterForm(string patInfo, out string regInfo)
  1324. {
  1325. //登记面板实例
  1326. OutpatientRegistration frmReg = new OutpatientRegistration();
  1327. //如果是慢性病患者,查询慢病信息
  1328. string chronicDieseaseInfo = "";
  1329. if (Global.pat.medType == "14")
  1330. {
  1331. if (QueryOPChronicDisease(out chronicDieseaseInfo) != 0)
  1332. {
  1333. regInfo = "检测到患者为慢病患者,但查询中心的慢病信息出错!";
  1334. return -1;
  1335. }
  1336. DataTable dtChronicDiesease = JsonConvert.DeserializeObject<DataTable>(chronicDieseaseInfo);
  1337. // 获取当前日期
  1338. DateTime today = DateTime.Today;
  1339. // 先筛选出符合条件的 DataRow(不投影)
  1340. IEnumerable<DataRow> filteredRows = dtChronicDiesease.AsEnumerable()
  1341. .Where(row =>
  1342. {
  1343. var endDateObj = row["enddate"];
  1344. if (endDateObj == null || endDateObj == DBNull.Value)
  1345. return false;
  1346. if (endDateObj is DateTime endDate)
  1347. return endDate.Date < today;
  1348. if (endDateObj is string endDateStr && DateTime.TryParse(endDateStr, out var endDate2))
  1349. return endDate2.Date < today;
  1350. return false;
  1351. });
  1352. // 如果结果为空,避免 CopyToDataTable 抛异常
  1353. DataTable resultTable;
  1354. if (filteredRows.Any())
  1355. {
  1356. // 复制成一个新的 DataTable(包含原表所有列)
  1357. DataTable filteredTable = filteredRows.CopyToDataTable();
  1358. // 创建目标 DataTable
  1359. resultTable = new DataTable("");
  1360. resultTable.Columns.Add("Code", typeof(string));
  1361. resultTable.Columns.Add("Name", typeof(string));
  1362. resultTable.Columns.Add("SearchCode", typeof(string));
  1363. // 投影每一行数据到新结构
  1364. foreach (DataRow sourceRow in filteredTable.Rows)
  1365. {
  1366. resultTable.Rows.Add(
  1367. sourceRow["opsp_dise_code"],
  1368. sourceRow["opsp_dise_name"],
  1369. sourceRow["opsp_dise_name"]
  1370. );
  1371. }
  1372. // 现在 resultTable 就是你需要的 DataTable
  1373. }
  1374. else
  1375. {
  1376. // 处理空集合情况
  1377. resultTable = new DataTable("");
  1378. resultTable.Columns.Add("Code", typeof(string));
  1379. resultTable.Columns.Add("Name", typeof(string));
  1380. resultTable.Columns.Add("SearchCode", typeof(string));
  1381. // 返回空表
  1382. }
  1383. }
  1384. //调用服务获取门诊诊断信息
  1385. string diagnoses;
  1386. if (hIS.getPatDiagnoses(Global.pat, out diagnoses) != 0)
  1387. {
  1388. regInfo = JsonHelper.setExceptionJson(-1, "getPatDiagnoses", diagnoses).ToString();
  1389. return -1;
  1390. }
  1391. JObject joHisRtnInfo = JObject.Parse(diagnoses);
  1392. //组织入参
  1393. JObject joReg = new JObject();
  1394. try
  1395. {
  1396. JArray jaDiagnoses = JArray.Parse(JsonHelper.getDestValue(joHisRtnInfo, "diseinfo"));
  1397. //frmReg.initBaseInfo(JObject.Parse(patInfo));
  1398. //frmReg.dblkcbxSettelmentWay.Enabled = false;
  1399. //险种类型
  1400. DataTable dtInsuType = (DataTable)frmReg.dblkcbxInsuranceType.DataSource;
  1401. for (int i = 0; i < dtInsuType.Rows.Count; i++)
  1402. {
  1403. if (dtInsuType.Rows[i]["Code"].ToString() == Global.pat.insuType)
  1404. {
  1405. frmReg.dblkcbxInsuranceType.Text = dtInsuType.Rows[i]["Name"].ToString();
  1406. frmReg.insuType = dtInsuType.Rows[i]["Code"].ToString();
  1407. }
  1408. }
  1409. //医疗类别
  1410. DataTable dtMedType = (DataTable)frmReg.dblkcbxMedicalType.DataSource;
  1411. string defaultMedType = string.IsNullOrEmpty(Global.pat.medType) ? "9901" : Global.pat.medType;
  1412. for (int i = 0; i < dtMedType.Rows.Count; i++)
  1413. {
  1414. if (dtMedType.Rows[i]["Code"].ToString() == defaultMedType)
  1415. {
  1416. frmReg.dblkcbxMedicalType.Text = dtMedType.Rows[i]["Name"].ToString();
  1417. frmReg.med_type = dtMedType.Rows[i]["Code"].ToString();
  1418. }
  1419. }
  1420. //结算方式
  1421. DataTable dtSettlWay = (DataTable)frmReg.dblkcbxSettelmentWay.DataSource;
  1422. for (int i = 0; i < dtSettlWay.Rows.Count; i++)
  1423. {
  1424. if (dtSettlWay.Rows[i]["Code"].ToString() == "01")
  1425. {
  1426. frmReg.dblkcbxSettelmentWay.Text = dtSettlWay.Rows[i]["Name"].ToString();
  1427. frmReg.psn_setlway = dtSettlWay.Rows[i]["Code"].ToString();
  1428. }
  1429. }
  1430. //转换下主要诊断
  1431. for (int i = 0; i < jaDiagnoses.Count; i++)
  1432. {
  1433. string diag_type = JsonHelper.getDestValue((JObject)jaDiagnoses[i], "diag_type");
  1434. switch (diag_type)
  1435. {
  1436. case "1":
  1437. {
  1438. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1439. jaDiagnoses[i]["diag_type_name"] = "西医主要诊断";
  1440. break;
  1441. }
  1442. case "2":
  1443. {
  1444. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1445. jaDiagnoses[i]["diag_type_name"] = "西医其他诊断";
  1446. break;
  1447. }
  1448. case "3":
  1449. {
  1450. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1451. jaDiagnoses[i]["diag_type_name"] = "中医主病诊断";
  1452. break;
  1453. }
  1454. case "4":
  1455. {
  1456. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1457. jaDiagnoses[i]["diag_type_name"] = "中医主证诊断";
  1458. break;
  1459. }
  1460. }
  1461. }
  1462. frmReg.DtDiagnose = (DataTable)jaDiagnoses.ToObject(typeof(DataTable));
  1463. //展示登记面板
  1464. if (tools.ShowAppDiaglog(frmReg) == DialogResult.OK)
  1465. {
  1466. string diseCodg = frmReg.diseCodg, diseName = frmReg.diseName;
  1467. #region 组织挂号入参
  1468. JObject joRegInpar = new JObject();
  1469. string occurTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1470. joRegInpar.Add("psn_no", Global.pat.psn_no);
  1471. joRegInpar.Add("insutype", frmReg.insuType);
  1472. Global.pat.insuType = frmReg.insuType;
  1473. joRegInpar.Add("begntime", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime"));//挂号时间 occurTime
  1474. joRegInpar.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
  1475. joRegInpar.Add("mdtrt_cert_no", Global.pat.certNO);
  1476. string admDr = Utils.convertAdmDr(Global.pat.adm_Dr.ToString());
  1477. joRegInpar.Add("ipt_otp_no", admDr);
  1478. joRegInpar.Add("atddr_no", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.atddr_no"));
  1479. joRegInpar.Add("dr_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.chfpdr_name"));
  1480. joRegInpar.Add("dept_code", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_codg"));
  1481. joRegInpar.Add("dept_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_name"));
  1482. joRegInpar.Add("exp_content", "");
  1483. joRegInpar.Add("caty", "A10");
  1484. string dscg_maindiag_code = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_code");
  1485. string dscg_maindiag_name = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_name");
  1486. List<string> lstDiag = new List<string> { "H52.300x002", "H52.701", "Z46.000", "Z97.300", "Z97.300x002" };
  1487. if (lstDiag.Contains(dscg_maindiag_code))
  1488. {
  1489. regInfo = $"请检查主诊断【{dscg_maindiag_name}】!该诊断不允许进行医保结算!";
  1490. return -1;
  1491. }
  1492. #endregion
  1493. #region 组织就诊信息入参
  1494. JObject joMdtrtinfo = new JObject();
  1495. for (int i = 0; i < jaDiagnoses.Count; i++)
  1496. {
  1497. jaDiagnoses[i]["vali_flag"] = new JObject();
  1498. jaDiagnoses[i]["vali_flag"] = "1";
  1499. }
  1500. joMdtrtinfo.Add("mdtrt_id", Global.pat.mdtrtID);
  1501. joMdtrtinfo.Add("psn_no", Global.pat.psn_no); //人员编号
  1502. Global.pat.medType = frmReg.med_type;
  1503. joMdtrtinfo.Add("med_type", frmReg.med_type); //医疗类别
  1504. joMdtrtinfo.Add("begntime", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime")); //开始时间
  1505. joMdtrtinfo.Add("main_cond_dscr", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.main_cond_dscr")); //主要病情描述
  1506. joMdtrtinfo.Add("dise_codg", diseCodg); //病种编码
  1507. joMdtrtinfo.Add("dise_name", diseName); //病种名称
  1508. joMdtrtinfo.Add("birctrl_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_type")); //计划生育手术类别
  1509. //joMdtrtinfo.Add("birctrl_matn_date", ""); //计划生育手术或生育日期 JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_matn_date") 20230228医保中心校验传正确时间或空
  1510. joMdtrtinfo.Add("matn_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.matn_type")); //生育类别
  1511. //joMdtrtinfo.Add("geso_val", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.geso_val")); //孕周数
  1512. // 特殊2203A需要exp_content字段
  1513. JObject ExportObj = new JObject();
  1514. ExportObj.Add("dise_reim_mon", "");
  1515. ExportObj.Add("deve_flag", "");
  1516. ExportObj.Add("otp_reim_flag", "");
  1517. ExportObj.Add("local_dise", ""); //单病种编码
  1518. ExportObj.Add("ifen_flag", ""); //传染性标志
  1519. //ExportObj.Add("cla_trt_flag", frmReg.claTrtFlag); //分级诊疗标志
  1520. ExportObj.Add("trum_flag", frmReg.traumaFlag); //外伤标志
  1521. //ExportObj.Add("ipt_type", frmReg.iptTypeCode); //住院类型(离院)
  1522. ExportObj.Add("rel_ttp_flag", frmReg.relTtpFlag); //涉及第三方标志
  1523. ExportObj.Add("mdtrt_grp_type", ""); //就诊人群类型
  1524. ExportObj.Add("elec_bill_code", ""); //电子票据代码
  1525. ExportObj.Add("elec billno_code", ""); //电子票据号码
  1526. ExportObj.Add("otp_er_refl_flag", ""); //门诊转急诊
  1527. joMdtrtinfo.Add("exp_content", ExportObj); //字段扩展
  1528. #endregion
  1529. #region 组织结算入参
  1530. JObject joSetlInpar = new JObject();
  1531. joSetlInpar.Add("psn_no", Global.pat.psn_no);
  1532. joSetlInpar.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
  1533. joSetlInpar.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
  1534. joSetlInpar.Add("med_type", Global.pat.medType);
  1535. joSetlInpar.Add("medfee_sumamt", "");
  1536. joSetlInpar.Add("psn_setlway", frmReg.psn_setlway); //结算方式
  1537. joSetlInpar.Add("mdtrt_id", Global.pat.mdtrtID);
  1538. joSetlInpar.Add("chrg_bchno", Global.pat.adm_Dr.ToString());
  1539. joSetlInpar.Add("acct_used_flag", frmReg.personAccountUsedFlag);//个人账户使用标志
  1540. joSetlInpar.Add("insutype", frmReg.insuType);//险种类型
  1541. joSetlInpar.Add("pub_hosp_rfom_flag", "");
  1542. joSetlInpar.Add("exp_content", "");
  1543. joSetlInpar.Add("mdtrt_mode", "0");
  1544. joSetlInpar.Add("minpacunt_drug_trac_cnt", Global.Set.minpacunt_drug_trac_cnt);
  1545. joSetlInpar.Add("mcs_trac_cnt", Global.Set.mcs_trac_cnt);
  1546. #endregion
  1547. joReg.Add("data", joRegInpar);
  1548. joReg.Add("mdtrtinfo", joMdtrtinfo);
  1549. joReg.Add("diseinfo", jaDiagnoses);
  1550. joReg.Add("settlement", joSetlInpar);
  1551. regInfo = joReg.ToString();
  1552. return 0;
  1553. }
  1554. else
  1555. {
  1556. regInfo = "收费员取消操作!";
  1557. return -1;
  1558. }
  1559. }
  1560. catch (Exception ex)
  1561. {
  1562. regInfo = "登记界面显示异常:" + ex.Message;
  1563. return -1;
  1564. }
  1565. }
  1566. public int QueryOPChronicDisease(out string chronicDiseaseInfo)
  1567. {
  1568. TradeEnum trade;
  1569. if (Global.pat.insuplc_admdvs.Substring(0, 4) != Global.inf.areaCode.Substring(0, 4))
  1570. {
  1571. trade = TradeEnum.QueryChronicDiseaseRecord;
  1572. }
  1573. else
  1574. {
  1575. trade = TradeEnum.QueryChronicDiseaseRecordLocal;
  1576. }
  1577. JObject joTmp = new JObject();
  1578. joTmp.Add("psn_no", Global.pat.psn_no);
  1579. JObject joData = new JObject();
  1580. joData.Add("data", joTmp);
  1581. //5301 也可以
  1582. JObject joRtn = invoker.invokeCenterService(trade.GetCode(), joData);
  1583. string err;
  1584. if (JsonHelper.parseCenterRtnValue(joRtn, out chronicDiseaseInfo) != 0)
  1585. {
  1586. return -1;
  1587. }
  1588. else
  1589. {
  1590. if (trade == TradeEnum.QueryChronicDiseaseRecord)
  1591. {
  1592. chronicDiseaseInfo = JsonHelper.getDestValue(joRtn, "output.feedetail");
  1593. }
  1594. else
  1595. {
  1596. chronicDiseaseInfo = JsonHelper.getDestValue(joRtn, "output.result");
  1597. }
  1598. return 0;
  1599. }
  1600. }
  1601. /// <summary>
  1602. /// 获取门诊患者的各入参
  1603. /// </summary>
  1604. /// <param name="regInfo"></param>
  1605. /// <returns></returns>
  1606. public int getOutPatientInparamForPayAfterTreatment(out string regInfo)
  1607. {
  1608. //调用服务获取门诊诊断信息
  1609. string diagnoses;
  1610. if (hIS.getPatDiagnoses(Global.pat, out diagnoses) != 0)
  1611. {
  1612. regInfo = JsonHelper.setExceptionJson(-1, "getPatDiagnoses", diagnoses).ToString();
  1613. return -1;
  1614. }
  1615. JObject joHisRtnInfo = JObject.Parse(diagnoses);
  1616. //组织入参
  1617. JObject joReg = new JObject();
  1618. try
  1619. {
  1620. JArray jaDiagnoses = JArray.Parse(JsonHelper.getDestValue(joHisRtnInfo, "diseinfo"));
  1621. //转换下主要诊断
  1622. for (int i = 0; i < jaDiagnoses.Count; i++)
  1623. {
  1624. jaDiagnoses[i]["diag_dept"] = "A10";
  1625. string diag_type = JsonHelper.getDestValue((JObject)jaDiagnoses[i], "diag_type");
  1626. switch (diag_type)
  1627. {
  1628. case "1":
  1629. {
  1630. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1631. jaDiagnoses[i]["diag_type_name"] = "西医主要诊断";
  1632. break;
  1633. }
  1634. case "2":
  1635. {
  1636. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1637. jaDiagnoses[i]["diag_type_name"] = "西医其他诊断";
  1638. break;
  1639. }
  1640. case "3":
  1641. {
  1642. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1643. jaDiagnoses[i]["diag_type_name"] = "中医主病诊断";
  1644. break;
  1645. }
  1646. case "4":
  1647. {
  1648. jaDiagnoses[i]["diag_type_name"] = new JObject();
  1649. jaDiagnoses[i]["diag_type_name"] = "中医主证诊断";
  1650. break;
  1651. }
  1652. }
  1653. }
  1654. string diseCodg = "", diseName = "";
  1655. diseCodg = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_code");
  1656. diseName = JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.dscg_maindiag_name");
  1657. //组织挂号入参
  1658. JObject joRegInpar = new JObject();
  1659. string occurTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1660. joRegInpar.Add("psn_no", Global.pat.psn_no);
  1661. joRegInpar.Add("insutype", Global.pat.insuType);
  1662. joRegInpar.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));//挂号时间
  1663. joRegInpar.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
  1664. joRegInpar.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
  1665. joRegInpar.Add("ipt_otp_no", Global.pat.adm_Dr);
  1666. joRegInpar.Add("atddr_no", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.atddr_no"));
  1667. joRegInpar.Add("dr_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.chfpdr_name"));
  1668. //joRegInpar.Add("dept_code", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_codg"));
  1669. joRegInpar.Add("dept_code", "A10");
  1670. joRegInpar.Add("dept_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_name"));
  1671. joRegInpar.Add("caty", "A10");
  1672. joRegInpar.Add("exp_content", "");
  1673. joReg.Add("data", joRegInpar);
  1674. //组织就诊信息入参
  1675. JObject joMdtrtinfo = new JObject();
  1676. for (int i = 0; i < jaDiagnoses.Count; i++)
  1677. {
  1678. jaDiagnoses[i]["vali_flag"] = new JObject();
  1679. jaDiagnoses[i]["vali_flag"] = "1";
  1680. }
  1681. joMdtrtinfo.Add("mdtrt_id", Global.pat.mdtrtID);
  1682. joMdtrtinfo.Add("psn_no", Global.pat.psn_no); //人员编号
  1683. joMdtrtinfo.Add("med_type", Global.pat.medType); //医疗类别
  1684. joMdtrtinfo.Add("begntime", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime")); //开始时间
  1685. joMdtrtinfo.Add("main_cond_dscr", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.main_cond_dscr")); //主要病情描述
  1686. joMdtrtinfo.Add("dise_codg", diseCodg); //病种编码
  1687. joMdtrtinfo.Add("dise_name", diseName); //病种名称
  1688. joMdtrtinfo.Add("birctrl_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_type")); //计划生育手术类别
  1689. joMdtrtinfo.Add("birctrl_matn_date", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.birctrl_matn_date")); //计划生育手术或生育日期
  1690. joMdtrtinfo.Add("matn_type", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.matn_type")); //生育类别
  1691. joMdtrtinfo.Add("geso_val", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.geso_val")); //孕周数
  1692. joMdtrtinfo.Add("exp_content", ""); //字段扩展
  1693. //组织结算入参
  1694. JObject joSetlInpar = new JObject();
  1695. joSetlInpar.Add("psn_no", Global.pat.psn_no);
  1696. joSetlInpar.Add("mdtrt_cert_type", Global.pat.mdtrtcertType);
  1697. joSetlInpar.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO);
  1698. joSetlInpar.Add("med_type", Global.pat.medType);
  1699. joSetlInpar.Add("medfee_sumamt", "");
  1700. joSetlInpar.Add("psn_setlway", "01"); //结算方式 写死
  1701. joSetlInpar.Add("mdtrt_id", Global.pat.mdtrtID);
  1702. joSetlInpar.Add("chrg_bchno", Global.pat.adm_Dr.ToString());
  1703. joSetlInpar.Add("acct_used_flag", Global.Set.acctUsedFlag);//个人账户使用标志
  1704. joSetlInpar.Add("insutype", Global.pat.insuType);//险种类型
  1705. joSetlInpar.Add("pub_hosp_rfom_flag", "");
  1706. JObject joExpContent = new JObject();
  1707. JObject joTrum = new JObject();
  1708. joTrum.Add("trum_flag", "");//外伤标志 0 否 1是
  1709. joTrum.Add("rel_ttp_flag", "");//涉及第三方标志 0 否 1是
  1710. //JObject joMdtPep = new JObject();//就诊人群类型 mdtrt_grp_content
  1711. //joMdtPep.Add("mdtrt_grp_type", "");//1新冠肺炎确诊患者 2其他国家突发公共事件 3新冠肺炎疑似患者 4无症状感染者
  1712. joExpContent.Add("trum_content", joTrum);//外伤节点 trum_content
  1713. //信用支付
  1714. //dynamic joCredit = new { bank_code = "", pay_fee = 0};
  1715. //joExpContent.Add("credit_info",JObject.FromObject(joCredit));
  1716. //joExpContent.Add("credit_flag", frmReg.creditFlag);
  1717. joSetlInpar.Add("exp_content", joExpContent); //字段扩展
  1718. joReg.Add("mdtrtinfo", joMdtrtinfo);
  1719. joReg.Add("diseinfo", jaDiagnoses);
  1720. joReg.Add("settlement", joSetlInpar);
  1721. regInfo = joReg.ToString();
  1722. return 0;
  1723. }
  1724. catch (Exception ex)
  1725. {
  1726. regInfo = "登记界面显示异常:" + ex.Message;
  1727. return -1;
  1728. }
  1729. }
  1730. /// <summary>
  1731. /// 上传费用到中心
  1732. /// </summary>
  1733. /// <returns></returns>
  1734. ///
  1735. public int uploadFee(string funNO,int singleCount,out string outParam)
  1736. {
  1737. outParam = "";
  1738. //获取IS费用
  1739. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  1740. {
  1741. return -1;
  1742. }
  1743. //调用医保平台转换HIS费用(转换医保编码等)
  1744. JObject joHisFee = JObject.Parse(outParam);
  1745. if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  1746. {
  1747. return -2;
  1748. }
  1749. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  1750. //按指定条数分割后上传,保存,更新
  1751. if (uploadFeeToCenter(funNO, singleCount, jaFeeDetail, out outParam) != 0)
  1752. {
  1753. return -3;
  1754. }
  1755. else
  1756. {
  1757. outParam = "成功";
  1758. return 0;
  1759. }
  1760. }
  1761. public int uploadFeeToCenter(string funNO,int singleCount,JArray jaFeeDetail, out string outParam)
  1762. {
  1763. outParam = "";
  1764. string errMsg;
  1765. try
  1766. {
  1767. JArray jaTmp = new JArray();
  1768. for (int i = 0; i < jaFeeDetail.Count; i++)
  1769. {
  1770. jaFeeDetail[i]["rxno"] = ""; //临时改,后面处理
  1771. jaFeeDetail[i]["chrg_bchno"] = Global.pat.adm_Dr.ToString();
  1772. jaFeeDetail[i]["med_type"] = Global.pat.medType;
  1773. jaFeeDetail[i]["bilg_dept_codg"] = "A10";
  1774. jaFeeDetail[i]["acord_dept_codg"] = "A10";
  1775. if (jaFeeDetail[i]["med_list_codg"].ToString().Substring(0, 1) == "C")
  1776. {
  1777. jaFeeDetail[i]["medins_list_codg"] = jaFeeDetail[i]["med_list_codg"].ToString();//耗材院内医疗机构编码传医保目录27位
  1778. jaFeeDetail[i]["med_list_codg"] = jaFeeDetail[i]["med_list_codg"].ToString().Substring(0, 15);//耗材医保目录传15位
  1779. }
  1780. if (jaFeeDetail[i]["validFlag"].ToString() == "N") continue;
  1781. jaTmp.Add(jaFeeDetail[i]);
  1782. if (((i + 1) % singleCount == 0) || ((i + 1) == jaFeeDetail.Count))
  1783. {
  1784. JObject joFeeDetail = new JObject();
  1785. joFeeDetail.Add("feedetail", jaTmp);
  1786. JObject joRtn = invoker.invokeCenterService(funNO, JsonHelper.setCenterInpar(funNO, joFeeDetail.ToString()));
  1787. if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
  1788. {
  1789. outParam = errMsg;
  1790. return -1;
  1791. }
  1792. else
  1793. {
  1794. //成功后插入医保平台
  1795. if (mIS.insertFee(jaTmp, out errMsg) != 0)
  1796. {
  1797. outParam = outParam + errMsg;
  1798. return -1;
  1799. }
  1800. //更新2301返回的数据
  1801. if (mIS.updateFee(JArray.Parse(JsonHelper.getDestValue(joRtn, "output.result")), out errMsg) != 0)
  1802. {
  1803. outParam = outParam + errMsg;
  1804. return -1;
  1805. }
  1806. }
  1807. jaTmp = new JArray();
  1808. }
  1809. }
  1810. return 0;
  1811. }
  1812. catch (Exception ex)
  1813. {
  1814. outParam = "uploadFee 异常:" + ex.Message;
  1815. return -1;
  1816. }
  1817. }
  1818. /// <summary>
  1819. /// 获取登记时候传入的信息,并赋值给patients结构体
  1820. /// </summary>
  1821. /// <param name="businessType"></param>
  1822. /// <param name="inparam"></param>
  1823. /// <param name="pat"></param>
  1824. public void GetRegPatInfo(string businessType, JObject joInparam,out Patients pat)
  1825. {
  1826. pat = new Patients();
  1827. try
  1828. {
  1829. switch (businessType)
  1830. {
  1831. case "M2"://门诊登记
  1832. {
  1833. break;
  1834. }
  1835. case "M2C"://门诊登记撤销
  1836. {
  1837. break;
  1838. }
  1839. case "Z0"://住院修改
  1840. {
  1841. break;
  1842. }
  1843. case "Z2"://入院登记
  1844. {
  1845. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  1846. pat.psn_no = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.output.baseinfo.psn_no");
  1847. pat.insuType = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.selectedInsuInfo.insutype");
  1848. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.selectedInsuInfo.insuplc_admdvs");
  1849. pat.mdtrtcertType = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.selectedInsuInfo.mdtrt_cert_type");
  1850. pat.mdtrtcertNO = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.selectedInsuInfo.mdtrt_cert_no");
  1851. pat.name = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.output.baseinfo.psn_name");
  1852. pat.psn_type = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.selectedInsuInfo.psn_type");
  1853. pat.certType = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.output.baseinfo.psn_cert_type");
  1854. pat.certNO = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.output.baseinfo.certno");
  1855. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  1856. pat.card.SN = JsonHelper.getDestValue(joInparam, "params[0].patientInfo.cardinfo.card_sn");
  1857. break;
  1858. }
  1859. case "Z2C"://入院登记取消
  1860. {
  1861. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  1862. pat.psn_no = JsonHelper.getDestValue(joInparam, "params[0].psn_no");
  1863. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "params[0].mdtrt_id");
  1864. //pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "params[0].insuplc_admdvs");
  1865. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  1866. break;
  1867. }
  1868. case "Z6"://出院登记
  1869. {
  1870. pat.hisDischargeTime = Convert.ToDateTime(JsonHelper.getDestValue(joInparam, "insuAdmObj.disDateTime")).ToString("yyyy-MM-dd HH:mm:ss");
  1871. break;
  1872. }
  1873. case "Z6C"://出院登记取消
  1874. {
  1875. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  1876. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  1877. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  1878. break;
  1879. }
  1880. default:
  1881. {
  1882. break;
  1883. }
  1884. }
  1885. //如果患者异地的则就医地需要该为369900
  1886. if (Global.pat.insuplc_admdvs != "")
  1887. {
  1888. if (Global.pat.insuplc_admdvs.Substring(0, 4) != Global.inf.areaCode.Substring(0, 4))
  1889. {
  1890. Global.inf.areaCode = "229900";
  1891. }
  1892. }
  1893. }
  1894. catch (Exception ex)
  1895. {
  1896. Global.writeLog("GetRegPatInfo(" + businessType + ")", JsonHelper.Compress(joInparam),"PAT结构体设置异常:" + ex.Message);
  1897. }
  1898. }
  1899. /// <summary>
  1900. /// 获取就诊费用明细
  1901. /// </summary>
  1902. /// <param name="outParam"></param>
  1903. /// <returns></returns>
  1904. public CallResult getFeeDetail()
  1905. {
  1906. string outParam = "";
  1907. //获取IS费用
  1908. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  1909. {
  1910. return new CallResult(-1, "获取His费用失败!", outParam);
  1911. }
  1912. //调用医保平台转换HIS费用(转换医保编码等)
  1913. JObject joHisFee = JObject.Parse(outParam);
  1914. if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  1915. {
  1916. return new CallResult(-2, "转换社保费用失败", outParam);
  1917. }
  1918. return new CallResult(0, "成功", JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  1919. }
  1920. /// <summary>
  1921. /// 获取费用上传时前端传入的信息,并赋值给patients结构体
  1922. /// </summary>
  1923. /// <param name="businessType"></param>
  1924. /// <param name="joInparam"></param>
  1925. /// <param name="pat"></param>
  1926. public void GetFeeHisInfo(string businessType, JObject joInparam, out Patients pat)
  1927. {
  1928. pat = new Patients();
  1929. try
  1930. {
  1931. switch (businessType)
  1932. {
  1933. case "M3"://门诊费用上传
  1934. {
  1935. break;
  1936. }
  1937. case "M3C"://门诊费用撤销
  1938. {
  1939. break;
  1940. }
  1941. case "Z3"://入院费用上传
  1942. {
  1943. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "insuAdmObj.admID"));
  1944. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  1945. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  1946. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  1947. pat.name = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_name");
  1948. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  1949. pat.recordID = "";
  1950. break;
  1951. }
  1952. case "Z3C"://住院费用上传取消
  1953. {
  1954. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "insuAdmObj.admID"));
  1955. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  1956. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  1957. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  1958. break;
  1959. }
  1960. default:
  1961. {
  1962. break;
  1963. }
  1964. }
  1965. //如果患者异地的则就医地需要该为369900
  1966. if (Global.pat.insuplc_admdvs != "")
  1967. {
  1968. if (Global.pat.insuplc_admdvs.Substring(0, 4) != Global.inf.areaCode.Substring(0, 4))
  1969. {
  1970. Global.inf.areaCode = "229900";
  1971. }
  1972. }
  1973. }
  1974. catch (Exception ex)
  1975. {
  1976. Global.writeLog("GetFeeHisInfo(" + businessType + ")", JsonHelper.Compress(joInparam), "PAT结构体设置异常:" + ex.Message);
  1977. }
  1978. }
  1979. /// <summary>
  1980. /// 获取结算时前端传入的信息,并赋值给patients结构体
  1981. /// </summary>
  1982. /// <param name="businessType"></param>
  1983. /// <param name="joInparam"></param>
  1984. /// <param name="pat"></param>
  1985. public void GetSettlementHisInfo(string businessType, JObject joInparam, out Patients pat)
  1986. {
  1987. pat = new Patients();
  1988. switch (businessType)
  1989. {
  1990. case "M4"://门诊预结算
  1991. {
  1992. break;
  1993. }
  1994. case "M4C"://门诊预结算撤销
  1995. {
  1996. break;
  1997. }
  1998. case "M5"://门诊结算
  1999. {
  2000. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  2001. pat.recordID = JsonHelper.getDestValue(joInparam, "params[0].recordID");
  2002. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2003. Global.pat.insuplc_admdvs = "";
  2004. Global.Set.minpacunt_drug_trac_cnt = JsonHelper.getDestValue(joInparam, "insuAdmObj.minpacunt_drug_trac_cnt");
  2005. Global.Set.mcs_trac_cnt = JsonHelper.getDestValue(joInparam, "insuAdmObj.mcs_trac_cnt");
  2006. break;
  2007. }
  2008. case "M5C"://门诊结算撤销
  2009. {
  2010. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  2011. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  2012. pat.settlID = JsonHelper.getDestValue(joInparam, "insuAdmObj.setl_id");
  2013. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  2014. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  2015. pat.recordID = JsonHelper.getDestValue(joInparam, "params[0].recordID");
  2016. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2017. break;
  2018. }
  2019. case "M6C"://移动支付门诊结算撤销,长春移动支付退费走线下模式,从核心接口退费
  2020. {
  2021. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  2022. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  2023. pat.settlID = JsonHelper.getDestValue(joInparam, "insuAdmObj.setl_id");
  2024. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  2025. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  2026. pat.recordID = JsonHelper.getDestValue(joInparam, "params[0].recordID");
  2027. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2028. break;
  2029. }
  2030. case "Z4"://住院预结算
  2031. {
  2032. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "insuAdmObj.admID"));
  2033. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  2034. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  2035. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  2036. pat.name = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_name");
  2037. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2038. break;
  2039. }
  2040. case "Z4C"://住院预结算撤销
  2041. {
  2042. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  2043. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  2044. pat.settlID = JsonHelper.getDestValue(joInparam, "insuAdmObj.setl_id");
  2045. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  2046. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  2047. pat.recordID = JsonHelper.getDestValue(joInparam, "params[0].recordID");
  2048. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2049. break;
  2050. }
  2051. case "Z5"://住院结算
  2052. {
  2053. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "insuAdmObj.admID"));
  2054. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  2055. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  2056. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  2057. pat.name = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_name");
  2058. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2059. pat.hisDischargeTime = Convert.ToDateTime(JsonHelper.getDestValue(joInparam, "insuAdmObj.disDateTime")).ToString("yyyy-MM-dd HH:mm:ss");
  2060. Global.Set.minpacunt_drug_trac_cnt = JsonHelper.getDestValue(joInparam, "insuAdmObj.minpacunt_drug_trac_cnt");
  2061. Global.Set.mcs_trac_cnt = JsonHelper.getDestValue(joInparam, "insuAdmObj.mcs_trac_cnt");
  2062. break;
  2063. }
  2064. case "Z5C"://住院结算撤销
  2065. {
  2066. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "insuAdmObj.admID"));
  2067. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  2068. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  2069. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  2070. pat.name = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_name");
  2071. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2072. pat.settlID = JsonHelper.getDestValue(joInparam, "insuAdmObj.setl_id");
  2073. pat.SettID_HISJSB = pat.settlID; //这里是通过09010059交易获取到的结算ID
  2074. break;
  2075. }
  2076. case "M7":
  2077. case "M8":// 长春先医后付挂号
  2078. {
  2079. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "insuAdmObj.admID"));
  2080. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  2081. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  2082. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  2083. Global.Set.acctUsedFlag = JsonHelper.getDestValue(joInparam, "insuAdmObj.acct_used_flag");
  2084. pat.name = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_name");
  2085. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2086. pat.settlID = JsonHelper.getDestValue(joInparam, "insuAdmObj.setl_id");
  2087. pat.medType = JsonHelper.getDestValue(joInparam, "insuAdmObj.med_type");
  2088. pat.SettID_HISJSB = pat.settlID; //这里是通过09010059交易获取到的结算ID
  2089. break;
  2090. }
  2091. default:
  2092. {
  2093. break;
  2094. }
  2095. }
  2096. //如果患者异地的则就医地需要该为369900
  2097. //if (Global.pat.insuplc_admdvs != "")
  2098. //{
  2099. // if (Global.pat.insuplc_admdvs.Substring(0, 4) != Global.inf.areaCode.Substring(0, 4))
  2100. // {
  2101. // Global.inf.areaCode = "369900";
  2102. // }
  2103. //}
  2104. }
  2105. /// <summary>
  2106. /// 获取自助机调用时前端传入的信息,并赋值给patients结构体
  2107. /// </summary>
  2108. /// <param name="businessType"></param>
  2109. /// <param name="joInparam"></param>
  2110. /// <param name="pat"></param>
  2111. public void GetSelfServiceMachineInfo(string businessType, JObject joInparam, out Patients pat)
  2112. {
  2113. pat = new Patients();
  2114. switch (businessType)
  2115. {
  2116. case "GetPatientInfo"://读取患者信息
  2117. {
  2118. Global.ssmp.cardType = JsonHelper.getDestValue(joInparam, "params[0].cardType");
  2119. //Global.operationType = JsonHelper.getDestValue(joInparam, "operationType") + "-" + businessType;
  2120. Global.Set.operationType = (OperationType)Enum.Parse(typeof(OperationType), JsonHelper.getDestValue(joInparam, "operationType"));
  2121. break;
  2122. }
  2123. case "OPReg"://门诊挂号
  2124. {
  2125. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  2126. pat.recordID = JsonHelper.getDestValue(joInparam, "params[0].recordID");
  2127. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2128. Global.ssmp.cardType = JsonHelper.getDestValue(joInparam, "params[0].cardType");
  2129. Global.pat.insuplc_admdvs = "";
  2130. Global.Set.operationType = (OperationType)Enum.Parse(typeof(OperationType), JsonHelper.getDestValue(joInparam, "operationType"));
  2131. Global.pat.IDNO = JsonHelper.getDestValue(joInparam, "params[0].idNo"); //身份证号
  2132. Global.pat.name = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_name"); //姓名
  2133. Global.Set.minpacunt_drug_trac_cnt = JsonHelper.getDestValue(joInparam, "insuAdmObj.minpacunt_drug_trac_cnt");
  2134. Global.Set.mcs_trac_cnt = JsonHelper.getDestValue(joInparam, "insuAdmObj.mcs_trac_cnt");
  2135. break;
  2136. }
  2137. case "OPSettl"://门诊结算
  2138. {
  2139. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  2140. pat.recordID = JsonHelper.getDestValue(joInparam, "params[0].recordID");
  2141. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2142. pat.insuplc_admdvs = "";
  2143. Global.ssmp.cardType = JsonHelper.getDestValue(joInparam, "params[0].cardType");
  2144. Global.Set.operationType = (OperationType)Enum.Parse(typeof(OperationType), JsonHelper.getDestValue(joInparam, "operationType"));
  2145. Global.pat.IDNO = JsonHelper.getDestValue(joInparam, "params[0].idNo"); //身份证号
  2146. Global.pat.name = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_name"); //姓名
  2147. Global.Set.minpacunt_drug_trac_cnt = JsonHelper.getDestValue(joInparam, "insuAdmObj.minpacunt_drug_trac_cnt");
  2148. Global.Set.mcs_trac_cnt = JsonHelper.getDestValue(joInparam, "insuAdmObj.mcs_trac_cnt");
  2149. break;
  2150. }
  2151. case "IPInReg"://入院登记
  2152. {
  2153. Global.ssmp.cardType = JsonHelper.getDestValue(joInparam, "params[0].cardType");
  2154. //Global.operationType = JsonHelper.getDestValue(joInparam, "operationType") + "-" + businessType;
  2155. Global.Set.operationType = (OperationType)Enum.Parse(typeof(OperationType), JsonHelper.getDestValue(joInparam, "operationType"));
  2156. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  2157. break;
  2158. }
  2159. case "IPSettl"://住院结算
  2160. {
  2161. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  2162. pat.psn_no = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_no");
  2163. pat.mdtrtID = JsonHelper.getDestValue(joInparam, "insuAdmObj.mdtrt_id");
  2164. pat.name = JsonHelper.getDestValue(joInparam, "insuAdmObj.psn_name");
  2165. pat.recordID = JsonHelper.getDestValue(joInparam, "params[0].recordID");
  2166. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2167. pat.recordID = JsonHelper.getDestValue(joInparam, "params[0].recordID");
  2168. pat.insuplc_admdvs = JsonHelper.getDestValue(joInparam, "insuAdmObj.insuplc_admdvs");
  2169. Global.ssmp.cardType = JsonHelper.getDestValue(joInparam, "params[0].cardType");
  2170. if (string.IsNullOrEmpty(JsonHelper.getDestValue(joInparam, "insuAdmObj.inDays")))
  2171. {
  2172. Global.Set.hospitalizationsDays = 0;
  2173. }
  2174. else
  2175. {
  2176. Global.Set.hospitalizationsDays = int.Parse(JsonHelper.getDestValue(joInparam, "insuAdmObj.inDays"));
  2177. }
  2178. if (string.IsNullOrEmpty(JsonHelper.getDestValue(joInparam, "insuAdmObj.inTimes")))
  2179. {
  2180. Global.Set.hospitalizationsTimes = 0;
  2181. }
  2182. else
  2183. {
  2184. Global.Set.hospitalizationsTimes = int.Parse(JsonHelper.getDestValue(joInparam, "insuAdmObj.inTimes"));
  2185. }
  2186. if (string.IsNullOrEmpty(JsonHelper.getDestValue(joInparam, "insuAdmObj.admDateTime")))
  2187. {
  2188. Global.Set.hisAdmTime = "";
  2189. }
  2190. else
  2191. {
  2192. Global.Set.hisAdmTime = Convert.ToDateTime(JsonHelper.getDestValue(joInparam, "insuAdmObj.admDateTime")).ToString("yyyy-MM-dd HH:mm:ss");
  2193. }
  2194. if (string.IsNullOrEmpty(JsonHelper.getDestValue(joInparam, "insuAdmObj.disDateTime")))
  2195. {
  2196. Global.Set.hisDischargeTime = "";
  2197. }
  2198. else
  2199. {
  2200. Global.Set.hisDischargeTime = Convert.ToDateTime(JsonHelper.getDestValue(joInparam, "insuAdmObj.disDateTime")).ToString("yyyy-MM-dd HH:mm:ss");
  2201. }
  2202. break;
  2203. }
  2204. case "DischargeAudit"://出院核查
  2205. {
  2206. pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInparam, "params[0].admID"));
  2207. pat.billID = JsonHelper.getDestValue(joInparam, "params[0].billID");
  2208. break;
  2209. }
  2210. default:
  2211. {
  2212. break;
  2213. }
  2214. }
  2215. }
  2216. ///对目录下载业务的封装
  2217. ///
  2218. public JObject DownloadDirectory(string funNO,string inParam)
  2219. {
  2220. string errorMessage = "", sRtn = "";
  2221. JObject joRtn = new JObject();
  2222. try
  2223. {
  2224. JObject joCenterRtn = cBus.DownDirecotry(funNO,inParam);
  2225. if (JsonHelper.parseCenterRtnValue(joCenterRtn,out errorMessage) != 0)
  2226. {
  2227. joRtn = JsonHelper.setExceptionJson(-100, "下载异常", errorMessage);
  2228. return joRtn;
  2229. }
  2230. string filename = JsonHelper.getDestValue(joCenterRtn, "output.filename");
  2231. //MessageBox.Show("1306查询目录文件号返回:"+ joCenterRtn.ToString());
  2232. JObject jo9102Rtn = cBus.SaveFile(joCenterRtn);
  2233. if (JsonHelper.parseIrisRtnValue(jo9102Rtn,out errorMessage) != 0)
  2234. {
  2235. joRtn = JsonHelper.setExceptionJson(-100, "保存文件异常", errorMessage);
  2236. return joRtn;
  2237. }
  2238. //解压缩
  2239. string zipFilePath = jo9102Rtn["filePath"].ToString();
  2240. string txtFileDir = System.Environment.CurrentDirectory + "\\Download";
  2241. string txtFilePath = txtFileDir + "\\" + filename.Substring(0, filename.Length - 4);
  2242. //string txtFilePath = Global.curEvt.path + "\\Download\\" + filename;
  2243. //MessageBox.Show("解压缩的txtFilePath:"+ zipFilePath+"|解压到目标路径:"+ txtFileDir+"|文件解析路径:"+ txtFilePath);
  2244. //昆明下载下来的文件是解压后的TXT
  2245. if (tools.ExtractFile(zipFilePath, txtFileDir, out errorMessage) != 0)
  2246. {
  2247. joRtn = JsonHelper.setExceptionJson(-100, "提取文件", errorMessage);
  2248. return joRtn;
  2249. }
  2250. joRtn = (JObject)jo9102Rtn.DeepClone();
  2251. joRtn["filePath"] = txtFilePath;
  2252. return joRtn;
  2253. }
  2254. catch (Exception ex)
  2255. {
  2256. joRtn = JsonHelper.setExceptionJson(-100, "下载中心目录", errorMessage);
  2257. return joRtn;
  2258. }
  2259. finally
  2260. {
  2261. Global.writeLog("HisMainBusiness.DownloadDirectory", inParam, joRtn.ToString());
  2262. }
  2263. }
  2264. public JObject DownloadDirectory(TradeEnum trade, string inParam)
  2265. {
  2266. string errorMessage = "", sRtn = "";
  2267. JObject joRtn = new JObject();
  2268. try
  2269. {
  2270. JObject joCenterRtn = cBus.DownDirecotry(trade, inParam);
  2271. if (JsonHelper.parseCenterRtnValue(joCenterRtn, out errorMessage) != 0)
  2272. {
  2273. joRtn = JsonHelper.setExceptionJson(-100, "下载异常", errorMessage);
  2274. return joRtn;
  2275. }
  2276. string filename = JsonHelper.getDestValue(joCenterRtn, "output.filename");
  2277. //MessageBox.Show("1306查询目录文件号返回:"+ joCenterRtn.ToString());
  2278. JObject jo9102Rtn = cBus.SaveFile(joCenterRtn, inParam);
  2279. if (JsonHelper.parseIrisRtnValue(jo9102Rtn, out errorMessage) != 0)
  2280. {
  2281. joRtn = JsonHelper.setExceptionJson(-100, "保存文件异常", errorMessage);
  2282. return joRtn;
  2283. }
  2284. //解压缩
  2285. string zipFilePath = jo9102Rtn["filePath"].ToString();
  2286. string txtFileDir = System.Environment.CurrentDirectory + "\\YBDLOAD";
  2287. string txtFilePath = txtFileDir + "\\" + filename.Substring(0, filename.Length - 4);
  2288. //MessageBox.Show("解压缩的txtFilePath:"+ zipFilePath+"|解压到目标路径:"+ txtFileDir+"|文件解析路径:"+ txtFilePath);
  2289. if (File.Exists(txtFilePath))
  2290. {
  2291. //询问收款员是否继续进行HIS退费
  2292. if (DialogResult.Yes == MessageBox.Show("下载的文件已存在,是否覆盖? ", "提示", MessageBoxButtons.YesNo))
  2293. {
  2294. File.Delete(txtFilePath);
  2295. }
  2296. else
  2297. {
  2298. joRtn = (JObject)jo9102Rtn.DeepClone();
  2299. joRtn["filePath"] = txtFilePath;
  2300. return joRtn;
  2301. }
  2302. }
  2303. //昆明下载下来的文件是解压后的TXT
  2304. if (tools.ExtractFile(zipFilePath, txtFileDir, out errorMessage) != 0)
  2305. {
  2306. joRtn = JsonHelper.setExceptionJson(-100, "提取文件", errorMessage);
  2307. return joRtn;
  2308. }
  2309. joRtn = (JObject)jo9102Rtn.DeepClone();
  2310. joRtn["filePath"] = txtFilePath;
  2311. return joRtn;
  2312. }
  2313. catch (Exception ex)
  2314. {
  2315. joRtn = JsonHelper.setExceptionJson(-100, "下载中心目录", errorMessage);
  2316. return joRtn;
  2317. }
  2318. finally
  2319. {
  2320. Global.writeLog("HisMainBusiness.DownloadDirectory", inParam, joRtn.ToString());
  2321. }
  2322. }
  2323. /// <summary>
  2324. /// 字典下载
  2325. /// </summary>
  2326. /// <param name="inParam"></param>
  2327. /// <returns></returns>
  2328. public string downDictionary(string inParam)
  2329. {
  2330. JObject joCenterRtn = invoker.invokeCenterService("1901", inParam);
  2331. return joCenterRtn.ToString();
  2332. }
  2333. /// <summary>
  2334. /// 展示结算信息界面
  2335. /// </summary>
  2336. /// <param name="joSettlement"></param>
  2337. /// <param name="outParam"></param>
  2338. /// <returns></returns>
  2339. public int showSettlementForm(JObject joSettlement, out string outParam)
  2340. {
  2341. outParam = "";
  2342. string errMsg;
  2343. try
  2344. {
  2345. SettlementInfo frmSettlment = new SettlementInfo(joSettlement);
  2346. //信用支付
  2347. if (Global.pat.creditArray != null)
  2348. {
  2349. frmSettlment.dtCreditInfo = (DataTable)Global.pat.creditArray.ToObject(typeof(DataTable));
  2350. }
  2351. //相关信息转换到结算信息面板
  2352. if (frmSettlment.ShowDialog() == DialogResult.OK)
  2353. {
  2354. //信用支付
  2355. dynamic joCredit = new { bank_code = frmSettlment.bankCode, pay_fee = frmSettlment.payFee };
  2356. JObject joExpContent = new JObject();
  2357. joExpContent.Add("credit_info", JObject.FromObject(joCredit));
  2358. joExpContent.Add("credit_flag", frmSettlment.creditFlag);
  2359. Global.writeLog("joExpContent" + joExpContent.ToString());
  2360. outParam = joExpContent.ToString();
  2361. return 0;
  2362. }
  2363. else
  2364. {
  2365. outParam = "收款员取消";
  2366. return -1;
  2367. }
  2368. }
  2369. catch (Exception ex)
  2370. {
  2371. outParam = "showSettlementForm 异常:" + ex.Message;
  2372. return -1;
  2373. }
  2374. }
  2375. /// <summary>
  2376. /// 门诊预结算封装,返回正式结算的入参
  2377. /// </summary>
  2378. /// <param name="joSettlement"></param>
  2379. /// <param name="outParam"></param>
  2380. /// <returns></returns>
  2381. public int preSettlement_OutPat( JObject joSettlement, out string outParam)
  2382. {
  2383. outParam = "";
  2384. //预结算
  2385. JObject jo2206Data = new JObject();
  2386. jo2206Data.Add("data", joSettlement);
  2387. JObject jo2206Rtn = invoker.invokeCenterService("2206", JsonHelper.setCenterInpar("2206", jo2206Data));
  2388. if (JsonHelper.parseCenterRtnValue(jo2206Rtn, out outParam) != 0)
  2389. {
  2390. outParam = JsonHelper.setExceptionJson(-1, "出院预结算", outParam).ToString();
  2391. return -1;
  2392. }
  2393. //返回给HIS进行预结算判断
  2394. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo"));
  2395. if (hIS.preSettlement(joSettlement, joSetlinfo, out outParam) != 0)
  2396. {
  2397. outParam = JsonHelper.setExceptionJson(-1, "返回结算信息给HIS", outParam).ToString();
  2398. return -1;
  2399. }
  2400. //编码转换
  2401. if (mIS.convertSettlementWithInsuCode(jo2206Rtn, out outParam) != 0)
  2402. {
  2403. outParam = JsonHelper.setExceptionJson(-1, "结算信息转换", outParam).ToString();
  2404. return -1;
  2405. }
  2406. JObject joSumFee = new JObject();
  2407. string errMsg = "";
  2408. //判断勾稽关系是否平
  2409. if (hIS.sumInsuRtnSettlInfo(JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo")), out joSumFee, out errMsg) != 0)
  2410. {
  2411. outParam = "勾稽关系不符合标准,请联系管理员!" + errMsg;
  2412. return -1;
  2413. }
  2414. //展示结算信息
  2415. JObject joConverted = JObject.Parse(outParam);
  2416. if (showSettlementForm(joConverted, out outParam) != 0)
  2417. {
  2418. outParam = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  2419. return -1;
  2420. }
  2421. else
  2422. {
  2423. return 0;
  2424. }
  2425. }
  2426. /// <summary>
  2427. /// 门诊预结算封装,返回正式结算的入参
  2428. /// </summary>
  2429. /// <param name="joSettlement"></param>
  2430. /// <param name="outParam"></param>
  2431. /// <returns></returns>
  2432. public int preSettlementForPayAfterTreatment(JObject joSettlement, out string outParam)
  2433. {
  2434. outParam = "";
  2435. //预结算
  2436. JObject jo2206Data = new JObject();
  2437. jo2206Data.Add("data", joSettlement);
  2438. JObject jo2206Rtn = invoker.invokeCenterService("2206", JsonHelper.setCenterInpar("2206", jo2206Data));
  2439. if (JsonHelper.parseCenterRtnValue(jo2206Rtn, out outParam) != 0)
  2440. {
  2441. outParam = JsonHelper.setExceptionJson(-1, "出院预结算", outParam).ToString();
  2442. return -1;
  2443. }
  2444. //返回给HIS进行预结算判断
  2445. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo"));
  2446. if (hIS.preSettlement(joSettlement, joSetlinfo, out outParam) != 0)
  2447. {
  2448. outParam = JsonHelper.setExceptionJson(-1, "返回结算信息给HIS", outParam).ToString();
  2449. return -1;
  2450. }
  2451. JObject joSumFee = new JObject();
  2452. string errMsg = "";
  2453. //判断勾稽关系是否平
  2454. if (hIS.sumInsuRtnSettlInfo(JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo")), out joSumFee, out errMsg) != 0)
  2455. {
  2456. outParam = "勾稽关系不符合标准,请联系管理员!" + errMsg;
  2457. return -1;
  2458. }
  2459. return 0;
  2460. }
  2461. /// <summary>
  2462. /// 预结算封装,返回正式结算的入参
  2463. /// </summary>
  2464. /// <param name="joSettlement"></param>
  2465. /// <param name="outParam"></param>
  2466. /// <returns></returns>
  2467. public int preSettlement(string funNO,out JObject joSettlement, out string outParam)
  2468. {
  2469. joSettlement = new JObject();
  2470. outParam = "";
  2471. string outPar = "";
  2472. //调用IRIS获取医保各项金额
  2473. if (mIS.getSumFee(out outPar) != 0)
  2474. {
  2475. outParam = JsonHelper.setExceptionJson(-1, "获取医保费用各项汇总金额", outPar).ToString();
  2476. return -1;
  2477. }
  2478. JObject joSumFee = JObject.Parse(outPar);
  2479. //从云医保平台获取患者详细的医保登记信息
  2480. int type;
  2481. if (funNO == "2206")
  2482. {
  2483. type = 3; //门诊预结算
  2484. }
  2485. else
  2486. {
  2487. type = 1; //住院预结算
  2488. }
  2489. if (mIS.queryRegisterInfo(type, out outParam) != 0)
  2490. {
  2491. outParam = JsonHelper.setExceptionJson(-1, "查询患者云平台登记信息", outParam).ToString();
  2492. return -1;
  2493. }
  2494. JObject joReg = JObject.Parse(outParam);
  2495. Global.pat.medType = JsonHelper.getDestValue(joReg, "data.MedicalType");
  2496. Global.pat.insuType = JsonHelper.getDestValue(joReg, "data.InsuType");
  2497. Global.pat.mdtrtcertType = JsonHelper.getDestValue(joReg, "data.CertificateType");
  2498. //Global.pat.mdtrtcertNO = JsonHelper.getDestValue(joReg, "data.CertificateNO");获取全局变量重新获取卡串
  2499. Global.pat.certType = JsonHelper.getDestValue(joReg, "data.CertificateType");
  2500. Global.pat.certNO = JsonHelper.getDestValue(joReg, "data.CertificateNO");
  2501. //Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joReg, "data.InsuranceAreaCode");
  2502. Global.pat.psn_type = Global.pat.insuType; //后面再改
  2503. if ((Global.pat.RYorCY == "2") && (Global.pat.medType == "26"))
  2504. {
  2505. Global.pat.DiseasecCode = JsonHelper.getDestValue(joReg, "data.DiseasecCode");
  2506. Global.pat.DiseasecName = JsonHelper.getDestValue(joReg, "data.DiseasecName");
  2507. }
  2508. //昆明结算前读卡核验身份
  2509. //string patInfo = "";
  2510. //if (readCard(out patInfo) != 0)
  2511. //{
  2512. // outParam = JsonHelper.setExceptionJson(-1, "readCard", patInfo).ToString();
  2513. // return -1;
  2514. //}
  2515. //调用服务获取门诊诊断信息
  2516. string diagnoses;
  2517. if (hIS.getPatDiagnoses(Global.pat, out diagnoses) != 0)
  2518. {
  2519. outParam = JsonHelper.setExceptionJson(-1, "getPatDiagnoses", diagnoses).ToString();
  2520. return -1;
  2521. }
  2522. JObject joDiagnoses = JObject.Parse(diagnoses);
  2523. //展示出院登记界面,选择结算方式等
  2524. if (showDischargeRegisterForm(funNO, joSumFee, joDiagnoses, out outParam) != 0)
  2525. {
  2526. outParam = JsonHelper.setExceptionJson(-1, "展示出院预结算界面", outParam).ToString();
  2527. return -1;
  2528. }
  2529. JObject joRtn = JObject.Parse(outParam);
  2530. JObject jo2303Inpar = JObject.Parse(JsonHelper.getDestValue(joRtn, "Settlement"));
  2531. JObject jo2402Inpar = JObject.Parse(JsonHelper.getDestValue(joRtn, "DischargeRegister"));
  2532. // MessageBox.Show("读卡获取参保地1:" + Global.pat.insuplc_admdvs);
  2533. //出院登记放再预结算之前
  2534. JObject jo2402Rtn = invoker.invokeCenterService("2402", JsonHelper.setCenterInpar("2402", jo2402Inpar));
  2535. string errMsg;
  2536. if (JsonHelper.parseCenterRtnValue(jo2402Rtn, out errMsg) != 0)
  2537. {
  2538. outParam = JsonHelper.setExceptionJson(-1, "预结算失败:出院登记失败", errMsg).ToString();
  2539. return -1;
  2540. }
  2541. //预结算
  2542. JObject jo2303Data = new JObject();
  2543. jo2303Data.Add("data", jo2303Inpar);
  2544. JObject jo2303Rtn = invoker.invokeCenterService(funNO, JsonHelper.setCenterInpar(funNO, jo2303Data));
  2545. if (JsonHelper.parseCenterRtnValue(jo2303Rtn, out outParam) != 0)
  2546. {
  2547. outParam = JsonHelper.setExceptionJson(-1, "出院预结算", outParam).ToString();
  2548. return -1;
  2549. }
  2550. //预结算结果传给HIS进行HIS判断
  2551. if (funNO == "2303")
  2552. {
  2553. //返回给HIS
  2554. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2303Rtn, "output.setlinfo"));
  2555. JObject joParam = new JObject();
  2556. joParam.Add("admID", Global.pat.adm_Dr);
  2557. joParam.Add("recordID", Global.pat.recordID);
  2558. joParam.Add("billID", Global.pat.billID);
  2559. if (hIS.preSettlementInfo(joParam, joSetlinfo, out outParam) != 0)
  2560. {
  2561. outParam = JsonHelper.setExceptionJson(-1, "出院预结算", outParam).ToString();
  2562. return -1;
  2563. }
  2564. }
  2565. //编码转换
  2566. if (mIS.convertSettlementWithInsuCode(jo2303Rtn, out outParam) != 0)
  2567. {
  2568. outParam = JsonHelper.setExceptionJson(-1, "结算信息转换", outParam).ToString();
  2569. return -1;
  2570. }
  2571. //展示结算信息
  2572. JObject joConverted = JObject.Parse(outParam);
  2573. if (showSettlementForm(joConverted, out outParam) != 0)
  2574. {
  2575. outParam = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  2576. return -1;
  2577. }
  2578. else
  2579. {
  2580. joSettlement = (JObject)joRtn.DeepClone();
  2581. if (Global.Set.creditFlag == "1")
  2582. {
  2583. Global.writeLog($"OUT:{outParam}");
  2584. JObject joTmp = JObject.Parse(outParam);
  2585. Global.writeLog($"joTmp:{joTmp}");
  2586. Global.writeLog("joSettlement" + joSettlement.ToString());
  2587. //信用支付
  2588. JObject joExpContent = new JObject();
  2589. if (JsonHelper.getDestValue(joSettlement, "Settlement.exp_content") != "")
  2590. {
  2591. joExpContent = JObject.Parse(JsonHelper.getDestValue(joSettlement, "exp_content"));
  2592. }
  2593. else
  2594. {
  2595. joSettlement["Settlement"]["exp_content"] = new JObject();
  2596. }
  2597. joExpContent.Add("credit_info", JObject.Parse(JsonHelper.getDestValue(joTmp, "credit_info")));
  2598. joExpContent.Add("credit_flag", JsonHelper.getDestValue(joTmp, "credit_flag"));
  2599. joSettlement["Settlement"]["exp_content"] = joExpContent;
  2600. }
  2601. return 0;
  2602. }
  2603. }
  2604. public int returnToFrontEndAfterSettlement(JObject joCenterRtn,JObject joHisServieRtn, out string outParam)
  2605. {
  2606. outParam = "";
  2607. try
  2608. {
  2609. JObject johisInsuInfo = JObject.Parse(JsonHelper.getDestValue(joHisServieRtn, "result"));
  2610. johisInsuInfo.Add("setl_id", JsonHelper.getDestValue(joCenterRtn, "output.setlinfo.setl_id"));
  2611. JObject joTmp = (JObject)joCenterRtn.DeepClone();
  2612. joTmp.Add("hisInsuInfo", johisInsuInfo);
  2613. outParam = joTmp.ToString();
  2614. return 0;
  2615. }
  2616. catch (Exception ex)
  2617. {
  2618. outParam = "returnToFrontEndAfterSettlement:" + ex.Message;
  2619. return -1;
  2620. }
  2621. }
  2622. /// <summary>
  2623. /// 插入患者该次就诊参保信息
  2624. /// </summary>
  2625. /// <param name="mdtrtID"></param>
  2626. /// <param name="patInfo"></param>
  2627. /// <param name="outparam"></param>
  2628. /// <returns></returns>
  2629. public int insertPatCurInsuInfo(String patInfo, out string outparam)
  2630. {
  2631. Global.writeLog(" " + patInfo);
  2632. outparam = "";
  2633. try
  2634. {
  2635. JObject joPatInfo = JObject.Parse(patInfo);
  2636. JObject joBaseInfo = JObject.Parse(JsonHelper.getDestValue(joPatInfo, "output.baseinfo"));
  2637. JObject joInsuInfo = JObject.Parse(JsonHelper.getDestValue(joPatInfo, "selectedInsuInfo"));
  2638. JObject joIdetInfo = JObject.Parse(JsonHelper.getDestValue(joPatInfo, "selectedIdInfo"));
  2639. JObject joExpContent = new JObject();
  2640. if (JsonHelper.getDestValue(joPatInfo, "output.exp_content") != "")
  2641. {
  2642. joExpContent = JObject.Parse(JsonHelper.getDestValue(joPatInfo, "output.exp_content"));
  2643. }
  2644. else
  2645. {
  2646. joExpContent = null;
  2647. }
  2648. if (mIS.insertPatCurInsuInfo(joBaseInfo, joInsuInfo, joIdetInfo,joExpContent, out outparam) != 0)
  2649. {
  2650. return -1;
  2651. }
  2652. else
  2653. {
  2654. return 0;
  2655. }
  2656. }
  2657. catch (Exception e)
  2658. {
  2659. outparam = "插入患者该次就诊参保信息失败:" + e.Message;
  2660. return -1;
  2661. }
  2662. }
  2663. /// <summary>
  2664. /// 校验HIS信息与医保参保信息姓名是否一致
  2665. /// </summary>
  2666. /// <param name="insuName"></param>
  2667. /// <param name="errMsg"></param>
  2668. /// <returns></returns>
  2669. public int checkName(string insuName, out string errMsg)
  2670. {
  2671. try
  2672. {
  2673. errMsg = "";
  2674. string hisPatBaseInfo = "";
  2675. if (hIS.GetHisPatBaseInfo(out hisPatBaseInfo) != 0)
  2676. {
  2677. errMsg = hisPatBaseInfo;
  2678. return -1;
  2679. }
  2680. string hisPatName = JsonHelper.getDestValue(JObject.Parse(hisPatBaseInfo), "result.patName");
  2681. if (hisPatName != insuName)
  2682. {
  2683. errMsg = "患者姓名(" + hisPatName + ")与参保人姓名(" + insuName + ")不一致,请检查!";
  2684. return -1;
  2685. }
  2686. else
  2687. {
  2688. return 0;
  2689. }
  2690. }
  2691. catch (Exception ex)
  2692. {
  2693. errMsg = "核对HIS与医保平台姓名一致性发生异常:" + ex.Message;
  2694. return -1;
  2695. }
  2696. }
  2697. #region【事前事中服务】
  2698. /// <summary>
  2699. /// 事前分析
  2700. /// </summary>
  2701. /// <param name="outparam"></param>
  2702. /// <returns></returns>
  2703. public int PreAnalysis(string trig_scen, string inparam, out string outparam)
  2704. {
  2705. outparam = "";
  2706. try
  2707. {
  2708. ////先签到
  2709. //JObject jo9001Rtn = new JObject();
  2710. //cBus.signIn(out jo9001Rtn);
  2711. if (trig_scen == "5")
  2712. {
  2713. outparam = inparam;
  2714. }
  2715. else
  2716. {
  2717. //获取HIS返回的内容
  2718. if (hIS.PreAnalysis(out outparam) != 0)
  2719. {
  2720. return -1;
  2721. }
  2722. }
  2723. PreAndInProcessAnalysis preAnalysis = new PreAndInProcessAnalysis(outparam);
  2724. if (preAnalysis.setPatientByHisBaseInfo(out outparam) != 0)
  2725. {
  2726. return -1;
  2727. }
  2728. outparam = preAnalysis.Get3101Inpar(trig_scen, Global.pat).ToString();
  2729. JObject joRtn = invoker.invokeCenterService("3101", JsonHelper.setCenterInpar("3101", outparam));
  2730. if (JsonHelper.parseCenterRtnValue(joRtn, out outparam) != 0)
  2731. {
  2732. return -1;
  2733. }
  2734. else
  2735. {
  2736. JArray jaResult = JArray.Parse(JsonHelper.getDestValue(joRtn, "output.result"));
  2737. string HasValues = JsonHelper.getDestValue(joRtn, "output.result[0].HasValues").ToString();
  2738. if (jaResult.HasValues)
  2739. {
  2740. PreAndInProcessAnalysisForm paipaForm = new PreAndInProcessAnalysisForm(joRtn);
  2741. if (paipaForm.ShowDialog() == DialogResult.OK)
  2742. {
  2743. //【3103】事前事中服务反馈服务
  2744. if (PreAnalysisFeedBack("3101", paipaForm.JrID, out outparam) != 0)
  2745. {
  2746. outparam = "【3103】事前事中服务反馈服务" + outparam;
  2747. return -1;
  2748. }
  2749. else
  2750. {
  2751. return 0;
  2752. }
  2753. }
  2754. else
  2755. {
  2756. outparam = "事前事中审核不通过,操作员取消!";
  2757. return -1;
  2758. }
  2759. }
  2760. else
  2761. {
  2762. return 0;
  2763. }
  2764. if (HasValues == "")
  2765. {
  2766. outparam = "事前事中审核服务未返回详细说明!";
  2767. return -1;
  2768. }
  2769. }
  2770. }
  2771. catch (Exception ex)
  2772. {
  2773. outparam = ex.Message;
  2774. return -1;
  2775. }
  2776. }
  2777. /// <summary>
  2778. /// 事中分析
  2779. /// </summary>
  2780. /// <param name="outparam"></param>
  2781. /// <returns></returns>
  2782. public int InProcessAnalysis(out string outparam)
  2783. {
  2784. outparam = "";
  2785. try
  2786. {
  2787. //获取HIS返回的内容
  2788. if (hIS.PreAnalysis(out outparam) != 0)
  2789. {
  2790. return -1;
  2791. }
  2792. PreAndInProcessAnalysis preAnalysis = new PreAndInProcessAnalysis(outparam);
  2793. if (preAnalysis.setPatientByHisBaseInfo(out outparam) != 0)
  2794. {
  2795. return -1;
  2796. }
  2797. outparam = preAnalysis.Get3101Inpar("5", Global.pat).ToString();
  2798. JObject joRtn = invoker.invokeCenterService("3102", JsonHelper.setCenterInpar("3102", outparam));
  2799. return JsonHelper.parseCenterRtnValue(joRtn, out outparam);
  2800. }
  2801. catch (Exception ex)
  2802. {
  2803. outparam = ex.Message;
  2804. return -1;
  2805. }
  2806. finally
  2807. {
  2808. Global.writeLog("InProcessAnalysis", "", outparam);
  2809. }
  2810. }
  2811. public int PreAnalysisFeedBack(string funNo, string jrId, out string outparam)
  2812. {
  2813. outparam = "";
  2814. try
  2815. {
  2816. outparam = "";
  2817. string WarnType = "";
  2818. //【3103】事前事中服务反馈服务
  2819. if (funNo == "3101")
  2820. WarnType = "1";
  2821. else
  2822. if (funNo == "3102")
  2823. WarnType = "2";
  2824. JObject joInput3103Warns = new JObject();
  2825. joInput3103Warns.Add("warn_rslt_id", jrId);
  2826. joInput3103Warns.Add("dspo_way", Global.Set.dspoWay);
  2827. joInput3103Warns.Add("dspo_way_rea", Global.Set.dspoWayRea);
  2828. JArray ja3103Warns = new JArray();
  2829. ja3103Warns.Add(joInput3103Warns);
  2830. JObject joInput3103 = new JObject();
  2831. joInput3103.Add("warn_type", WarnType); //反馈类型 1.事前 2.事中
  2832. joInput3103.Add("warns", ja3103Warns);
  2833. JObject joInput = new JObject();
  2834. joInput.Add("data", joInput3103);
  2835. JObject jo3103Rtn = invoker.invokeCenterService("3103", JsonHelper.setCenterInpar("3103", joInput.ToString()));
  2836. if (JsonHelper.parseCenterRtnValue(jo3103Rtn, out string errMsg) != 0)
  2837. {
  2838. outparam = JsonHelper.setExceptionJson(-1, "【3103】事前事中服务反馈服务调用失败:", errMsg).ToString();
  2839. return -1;
  2840. }
  2841. return 0;
  2842. }
  2843. catch (Exception ex)
  2844. {
  2845. outparam = ex.Message;
  2846. return -1;
  2847. }
  2848. finally
  2849. {
  2850. Global.writeLog("PreAnalysisFeedBack", "", outparam);
  2851. }
  2852. }
  2853. #endregion
  2854. }
  2855. }