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.

280 lines
9.2 KiB

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