PatientService.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using Newtonsoft.Json.Linq;
  2. using PTMedicalInsurance.Common;
  3. using PTMedicalInsurance.Entity;
  4. using PTMedicalInsurance.Entity.Local;
  5. using PTMedicalInsurance.Forms;
  6. using PTMedicalInsurance.Helper;
  7. using PTMedicalInsurance.Variables;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Diagnostics;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading;
  14. using System.Threading.Tasks;
  15. using System.Windows.Forms;
  16. namespace PTMedicalInsurance.Business
  17. {
  18. class PatientService
  19. {
  20. protected HisMainBusiness hBus = new HisMainBusiness();
  21. protected InvokeHelper invoker = new InvokeHelper();
  22. /// <summary>
  23. /// 读卡
  24. /// </summary>
  25. /// <returns></returns>
  26. public int readCard(out string outParam)
  27. {
  28. Global.writeLog_debug($"Current Thread ID: {Thread.CurrentThread.ManagedThreadId}");
  29. Global.writeLog_debug($"Current Process ID: {Process.GetCurrentProcess().Id}");
  30. CallResult ret = new ReadCardProcess().Process(null);
  31. outParam = ret.PureData?.ToString();
  32. return ret.Code;
  33. }
  34. /// <summary>
  35. /// 读卡并展示病人信息
  36. /// </summary>
  37. /// <param name="outParam"></param>
  38. /// <returns></returns>
  39. public int readPatientInfo(out string outParam)
  40. {
  41. string patInfo = "";
  42. //打开读卡窗口,操作员选择读卡类型后进行读卡器读卡,再进行1101获取参保信息
  43. if (readCard(out outParam) != 0)
  44. {
  45. return -1;
  46. }
  47. else
  48. {
  49. patInfo = outParam;
  50. hBus.convertPatientInfo(patInfo, out outParam);
  51. }
  52. #region 展示患者信息
  53. //患者信息赋值给全局变量
  54. string errMsg = "";
  55. if (hBus.setGlobalPatAfaterShowPatInfo(outParam, out errMsg) != 0)
  56. {
  57. outParam = JsonHelper.setExceptionJson(-1, "setGlobalPatAfaterShowPatInfo", errMsg).ToString();
  58. return -1;
  59. }
  60. //在这里判断,建档的时候会直接拦截
  61. //校验HIS姓名与医保姓名是否一致
  62. if (!string.IsNullOrEmpty(Global.pat.admID))
  63. {
  64. if (hBus.checkName(Global.pat.name, out errMsg) != 0)
  65. {
  66. outParam = JsonHelper.setExceptionJson(-1, "校验HIS与医保姓名是否一致", errMsg).ToString();
  67. return -1;
  68. }
  69. }
  70. #endregion
  71. return 0;
  72. }
  73. }
  74. }