郑州颐和随访系统

T_Sys_Patirnt.cs 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using CallCenterApi.DB;
  7. using System.Data;
  8. using System.Data.SqlClient;
  9. namespace CallCenterApi.DAL
  10. {
  11. public class T_Sys_Patirnt
  12. {
  13. public T_Sys_Patirnt()
  14. { }
  15. public CallCenterApi.Model.T_Sys_Patirnt DataRowToModel(DataRow row)
  16. {
  17. CallCenterApi.Model.T_Sys_Patirnt model = new Model.T_Sys_Patirnt();
  18. if (row != null)
  19. {
  20. if (row["PatirntID"] != null && row["PatirntID"].ToString() != "")
  21. {
  22. model.PatirntID = int.Parse(row["PatirntID"].ToString());
  23. }
  24. if (row["Department"] != null)
  25. {
  26. model.Department = row["Department"].ToString();
  27. }
  28. if (row["PatirntName"] != null)
  29. {
  30. model.PatirntName = row["PatirntName"].ToString();
  31. }
  32. if (row["PTime"] != null && row["PTime"].ToString() != "")
  33. {
  34. model.PTime = DateTime.Parse(row["PTime"].ToString());
  35. }
  36. if (row["Phone"] != null)
  37. {
  38. model.Phone = row["Phone"].ToString();
  39. }
  40. if (row["Sex"] != null && row["Sex"].ToString() != "")
  41. {
  42. model.Sex = int.Parse(row["Sex"].ToString());
  43. }
  44. if (row["Age"] != null && row["Age"].ToString() != "")
  45. {
  46. model.Age = int.Parse(row["Age"].ToString());
  47. }
  48. if (row["Diagnosis"] != null)
  49. {
  50. model.Diagnosis = row["Diagnosis"].ToString();
  51. }
  52. if (row["Doctor"] != null)
  53. {
  54. model.Doctor = row["Doctor"].ToString();
  55. }
  56. if (row["FollowUp"] != null)
  57. {
  58. model.FollowUp = int.Parse(row["FollowUp"].ToString());
  59. }
  60. if (row["DeleteFlag"] != null)
  61. {
  62. model.DeleteFlag = int.Parse(row["DeleteFlag"].ToString());
  63. }
  64. if (row["Satisfaction"] != null)
  65. {
  66. if (!string.IsNullOrEmpty(row["Satisfaction"].ToString()))
  67. {
  68. model.Satisfaction = int.Parse(row["Satisfaction"].ToString());
  69. }
  70. }
  71. if (row["Note"] != null)
  72. {
  73. model.Note = row["Note"].ToString();
  74. }
  75. if (row["FollowUpTime"] != null && row["FollowUpTime"].ToString() != "")
  76. {
  77. model.PTime = DateTime.Parse(row["FollowUpTime"].ToString());
  78. }
  79. if (row["CallId"] != null)
  80. {
  81. model.CallId =Convert.ToInt32(row["CallId"].ToString());
  82. }
  83. if (row["ActionID"] != null)
  84. {
  85. if (!string.IsNullOrEmpty(row["ActionID"].ToString()))
  86. {
  87. model.ActionID = Convert.ToInt32(row["ActionID"].ToString());
  88. }
  89. }
  90. }
  91. return model;
  92. }
  93. public CallCenterApi.Model.T_Sys_Patirnt GetModel(int PatirntID)
  94. {
  95. StringBuilder strSql = new StringBuilder();
  96. strSql.Append("select top 1 * from T_Sys_Patirnt ");
  97. strSql.Append(" where PatirntID=@PatirntID");
  98. SqlParameter[] parameters = {
  99. new SqlParameter("@PatirntID", SqlDbType.Int,4)
  100. };
  101. parameters[0].Value = PatirntID;
  102. CallCenterApi.Model.T_Sys_Patirnt model = new CallCenterApi.Model.T_Sys_Patirnt();
  103. DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
  104. if (ds.Tables[0].Rows.Count > 0)
  105. {
  106. return DataRowToModel(ds.Tables[0].Rows[0]);
  107. }
  108. else
  109. {
  110. return null;
  111. }
  112. }
  113. }
  114. }