LimitPriceAndSelfpayPropInfo.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using Newtonsoft.Json.Linq;
  2. using PTMedicalInsurance.Business;
  3. using PTMedicalInsurance.Forms.BasicDatas.GridViewSetters;
  4. using PTMedicalInsurance.Helper;
  5. using PTMedicalInsurance.Variables;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows.Forms;
  15. namespace PTMedicalInsurance.Forms.BasicDatas
  16. {
  17. public partial class LimitPriceAndSelfpayPropInfo : Form
  18. {
  19. private string code;
  20. private string err;
  21. MIIrisServices mIS = new MIIrisServices();
  22. private GridViewSetter grdSetter = new GridViewSetter();
  23. public LimitPriceAndSelfpayPropInfo()
  24. {
  25. InitializeComponent();
  26. }
  27. public LimitPriceAndSelfpayPropInfo(string _code)
  28. {
  29. InitializeComponent();
  30. code = _code;
  31. InitForm();
  32. }
  33. private void InitForm()
  34. {
  35. this.StartPosition = FormStartPosition.CenterScreen;
  36. grdSetter.setLimitPrice(dgvLimitPrice);
  37. grdSetter.setSelfPayProp(dgvSelfPayProp);
  38. }
  39. private int GetAuxInfo(string auxInfoType,out string errMsg)
  40. {
  41. string tableName="", eventName="";
  42. if (auxInfoType == "LimitPrice")
  43. {
  44. tableName = "HB_MedInsuDirectoryLimitPrice";
  45. eventName = "限价信息";
  46. }
  47. if (auxInfoType == "SelfPayProp")
  48. {
  49. tableName = "HB_MedInsuDirectorySelfpayProportion";
  50. eventName = "自付比例信息";
  51. }
  52. JObject joSqlstr = new JObject();
  53. joSqlstr.Add("sqlStr", CreateSql(auxInfoType));
  54. JObject joRtn = mIS.DynamicQuery(joSqlstr, $"查询{eventName}");
  55. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  56. {
  57. return -1;
  58. }
  59. else
  60. {
  61. if (JsonHelper.getDestValue(joRtn, "result.total") == "0")
  62. {
  63. errMsg = $"未查询到{eventName}!";
  64. return -1;
  65. }
  66. errMsg = joRtn.ToString();
  67. return 0;
  68. }
  69. }
  70. private String CreateSql(string auxInfoType)
  71. {
  72. string sqlStr = "";
  73. if (auxInfoType == "LimitPrice")
  74. {
  75. sqlStr += " SELECT A.ID, A.Hospital_Dr, A.Interface_Dr, A.Code, A.Name,B.Descripts LimitType, C.Descripts DisposeWay, A.BeginDate, ";
  76. sqlStr += " A.EndDate, A.UpLimitAmount, A.InsuranceAreaCode, A.PoolAreaNO,A.ValidFlag, A.RequiredID, A.UpdateTime";
  77. sqlStr += " FROM SQLUser.HB_MedInsuDirectoryLimitPrice A LEFT JOIN HB_DictionaryDataDetail B ON A.LimitType = B.Code ";
  78. sqlStr += " AND (B.HBDictionary_Dr = (SELECT ID FROM SQLUser.HB_Dictionary WHERE InsuCode= 'hilistLmtpricType' AND Interface_Dr = 1))";
  79. sqlStr += " LEFT JOIN HB_DictionaryDataDetail C ON A.DisposeWay = C.Code";
  80. sqlStr += " AND (B.HBDictionary_Dr = (SELECT ID FROM SQLUser.HB_Dictionary WHERE InsuCode= 'overlmtDspoWay' AND Interface_Dr = 1))";
  81. sqlStr += $" WHERE A.Interface_Dr = {Global.inf.interfaceDr} AND A.Code ='{code}'";
  82. }
  83. if (auxInfoType == "SelfPayProp")
  84. {
  85. sqlStr += " SELECT A.ID, A.Hospital_Dr, A.Interface_Dr, A.Code, A.Name,B.Descripts PersonnelType, C.Descripts ProportionType, A.BeginDate, ";
  86. sqlStr += " A.EndDate, A.Proportion, A.InsuranceAreaCode, A.PoolAreaNO,A.ValidFlag, A.RequiredID, A.UpdateTime";
  87. sqlStr += " FROM SQLUser.HB_MedInsuDirectorySelfpayProportion A LEFT JOIN HB_DictionaryDataDetail B ON A.PersonnelType = B.Code ";
  88. sqlStr += " AND (B.HBDictionary_Dr = (SELECT ID FROM SQLUser.HB_Dictionary WHERE InsuCode= 'selfpayPropPsnType' AND Interface_Dr = 1))";
  89. sqlStr += " LEFT JOIN HB_DictionaryDataDetail C ON A.ProportionType = C.Code";
  90. sqlStr += " AND (B.HBDictionary_Dr = (SELECT ID FROM SQLUser.HB_Dictionary WHERE InsuCode= 'selfpayPropType' AND Interface_Dr = 1))";
  91. sqlStr += $" WHERE A.Interface_Dr = {Global.inf.interfaceDr} AND A.Code ='{code}'";
  92. }
  93. return sqlStr;
  94. }
  95. private void QueryAuxInfo()
  96. {
  97. string finalError = "";
  98. bool isFail = false;
  99. if (GetAuxInfo("LimitPrice", out err) != 0)
  100. {
  101. isFail = true;
  102. finalError = err;
  103. }
  104. else
  105. {
  106. JObject joRtn = JObject.Parse(err);
  107. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  108. dgvLimitPrice.DataSource = dt;
  109. }
  110. if (GetAuxInfo("SelfPayProp", out err) != 0)
  111. {
  112. isFail = true;
  113. finalError += err;
  114. }
  115. else
  116. {
  117. JObject joRtn = JObject.Parse(err);
  118. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  119. dgvSelfPayProp.DataSource = dt;
  120. }
  121. if (isFail)
  122. {
  123. MessageBox.Show(finalError);
  124. }
  125. }
  126. private void btnOK_Click(object sender, EventArgs e)
  127. {
  128. Close();
  129. }
  130. private void LimitPriceAndSelfpayPropInfo_Shown(object sender, EventArgs e)
  131. {
  132. QueryAuxInfo();
  133. }
  134. }
  135. }