You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

277 lines
9.1 KiB

2 years ago
  1. 
  2. using Shentun.Utilities;
  3. using Xunit.Abstractions;
  4. namespace Shentun.Peis.PlugIns.Gem.Test
  5. {
  6. public class HisTest
  7. {
  8. private readonly ITestOutputHelper _output;
  9. public HisTest(ITestOutputHelper testOutputHelper)
  10. {
  11. _output = testOutputHelper;
  12. }
  13. [Fact]
  14. public async Task PatientQuery()
  15. {
  16. var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
  17. var hisPatientQueryInput = new HisPatientQueryInput()
  18. {
  19. Data = new HisPatientQueryDataInput()
  20. {
  21. MsgHeader = new HisMsgHeaderInput()
  22. {
  23. Sender = "PEIS",
  24. MsgType = "SVR_ODS_1101",
  25. MsgVersion = "3.1",
  26. },
  27. Patient = new HisPatientQueryPatientInput()
  28. {
  29. IdCard = "110101202404238836",
  30. IdCardCode = "01",
  31. Name = "体检调试一",
  32. Sex = "1",
  33. BirthDate = "2024-04-23",
  34. PatientPhone = "13700000001",
  35. EthnicGroupCode = "01",
  36. WorkUnit = "测试单位",
  37. Address = "测试地址"
  38. }
  39. }
  40. };
  41. var result = await patientRegisterPluginsGemHis.PatientQuery(hisPatientQueryInput);
  42. if(result.MsgHeader.Status != "true")
  43. {
  44. _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
  45. return;
  46. }
  47. _output.WriteLine(result.Patient.PatientId);
  48. }
  49. [Fact]
  50. public async Task PatientNew()
  51. {
  52. var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
  53. var hisPatientQueryInput = new HisPatientQueryInput()
  54. {
  55. Data = new HisPatientQueryDataInput()
  56. {
  57. MsgHeader = new HisMsgHeaderInput()
  58. {
  59. Sender = "PEIS",
  60. MsgType = "SVR_ODS_1101",
  61. MsgVersion = "3.1",
  62. },
  63. Patient = new HisPatientQueryPatientInput()
  64. {
  65. IdCard = "4306249901019311",
  66. IdCardCode = "01",
  67. Name = "李四",
  68. Sex = "2",
  69. BirthDate = "1999-09-01",
  70. PatientPhone = "18911254911",
  71. EthnicGroupCode = "01",
  72. WorkUnit = "本医院",
  73. Address = "本院家属区"
  74. }
  75. }
  76. };
  77. var result = await patientRegisterPluginsGemHis.PatientQuery(hisPatientQueryInput);
  78. if (result.MsgHeader.Status != "true")
  79. {
  80. _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
  81. }
  82. else
  83. {
  84. _output.WriteLine("病人ID:" + result.Patient.PatientId);
  85. }
  86. }
  87. [Fact]
  88. public async Task MecSave()
  89. {
  90. var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
  91. var hisInput = new HisMecSaveInput()
  92. {
  93. Data = new HisMecSaveDataInput()
  94. {
  95. MsgHeader = new HisMsgHeaderInput()
  96. {
  97. Sender = "PEIS",
  98. MsgType = "SVR_ODS_6101",
  99. MsgVersion = "3.1",
  100. },
  101. Items = new List<HisMecSaveDataItemInput>()
  102. {
  103. new HisMecSaveDataItemInput()
  104. {
  105. ExamRequestNo = "0001",
  106. FeeType = "1",
  107. EmpId = "TJ00000006",
  108. DeptId = "",
  109. DoctId = "",
  110. ExeDeptId = "",
  111. Tjunit = "本院",
  112. Tjfee = "1234567.89",
  113. Ztxm = "13932,13933",
  114. Remark = "备注但是发射点法大师傅撒旦"
  115. }
  116. }
  117. }
  118. };
  119. var result = await patientRegisterPluginsGemHis.MecSave(hisInput);
  120. if (result.MsgHeader.Status != "true")
  121. {
  122. _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
  123. }
  124. else
  125. {
  126. _output.WriteLine("成功:医技序号:" + result.MsgHeader.Yjxh);
  127. }
  128. }
  129. [Fact]
  130. public async Task CancelQrCode()
  131. {
  132. var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
  133. var hisInput = new HisCancelQrCodeInput()
  134. {
  135. Data = new HisCancelQrCodeDataInput()
  136. {
  137. MsgHeader = new HisMsgHeaderInput()
  138. {
  139. Sender = "PEIS",
  140. MsgType = "SVR_ODS_6105",
  141. MsgVersion = "3.1",
  142. },
  143. Item = new HisCancelQrCodeDataItemInput()
  144. {
  145. Yjxh = "900",
  146. ExamRequestNo = "0001"
  147. }
  148. }
  149. };
  150. var result = await patientRegisterPluginsGemHis.CancelQrCode(hisInput);
  151. if (result.MsgHeader.Status != "true")
  152. {
  153. _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
  154. }
  155. else
  156. {
  157. _output.WriteLine("成功");
  158. }
  159. }
  160. [Fact]
  161. public async Task PayStatus()
  162. {
  163. var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
  164. var hisInput = new HisPayStatusInput()
  165. {
  166. Data = new HisPayStatusDataInput()
  167. {
  168. MsgHeader = new HisMsgHeaderInput()
  169. {
  170. Sender = "PEIS",
  171. MsgType = "SVR_ODS_6105",
  172. MsgVersion = "3.1",
  173. },
  174. Item = new HisPayStatusDataItemInput()
  175. {
  176. Yjxh = "899",
  177. ExamRequestNo = "0001"
  178. }
  179. }
  180. };
  181. var result = await patientRegisterPluginsGemHis.PayStatus(hisInput);
  182. if (result.MsgHeader.Status != "true")
  183. {
  184. _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
  185. }
  186. else
  187. {
  188. _output.WriteLine("成功"+ result.MsgHeader.Detail);
  189. }
  190. }
  191. [Fact]
  192. public async Task AgreeRefund()
  193. {
  194. var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
  195. var hisInput = new HisAgreeRefundInput()
  196. {
  197. Data = new HisAgreeRefundDataInput()
  198. {
  199. MsgHeader = new HisMsgHeaderInput()
  200. {
  201. Sender = "PEIS",
  202. MsgType = "SVR_ODS_6105",
  203. MsgVersion = "3.1",
  204. },
  205. Item = new HisAgreeRefundDataItemInput()
  206. {
  207. Yjxh = "900",
  208. ExamRequestNo = "0001"
  209. }
  210. }
  211. };
  212. var result = await patientRegisterPluginsGemHis.AgreeRefund(hisInput);
  213. if (result.MsgHeader.Status != "true")
  214. {
  215. _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
  216. }
  217. else
  218. {
  219. _output.WriteLine("成功" + result.MsgHeader.Detail);
  220. }
  221. }
  222. [Fact]
  223. public void XmlSerializer()
  224. {
  225. var hisPatientQueryInput = new HisPatientQueryInput() {
  226. Data = new HisPatientQueryDataInput()
  227. {
  228. MsgHeader = new HisMsgHeaderInput()
  229. {
  230. Sender = "PEIS",
  231. MsgType = "SVR_ODS_1101",
  232. MsgVersion = "3.1",
  233. },
  234. Patient = new HisPatientQueryPatientInput()
  235. {
  236. IdCard = ""
  237. }
  238. }
  239. };
  240. var xml = XmlHelper.SerializeToXml(hisPatientQueryInput.Data);
  241. _output.WriteLine(xml);
  242. }
  243. private string GetConfigParm()
  244. {
  245. string configParm;
  246. string filePath = DirectoryHelper.GetAppDirectory() + "/appsettings.json";
  247. configParm = File.ReadAllText(filePath);
  248. return configParm;
  249. }
  250. }
  251. }