| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using CallCenterApi.DB;
- using System.Data;
- using System.Data.SqlClient;
- namespace CallCenterApi.DAL
- {
- public class T_Sys_Patirnt
- {
- public T_Sys_Patirnt()
- { }
- public CallCenterApi.Model.T_Sys_Patirnt DataRowToModel(DataRow row)
- {
- CallCenterApi.Model.T_Sys_Patirnt model = new Model.T_Sys_Patirnt();
- if (row != null)
- {
- if (row["PatirntID"] != null && row["PatirntID"].ToString() != "")
- {
- model.PatirntID = int.Parse(row["PatirntID"].ToString());
- }
- if (row["Department"] != null)
- {
- model.Department = row["Department"].ToString();
- }
- if (row["PatirntName"] != null)
- {
- model.PatirntName = row["PatirntName"].ToString();
- }
- if (row["PTime"] != null && row["PTime"].ToString() != "")
- {
- model.PTime = DateTime.Parse(row["PTime"].ToString());
- }
-
- if (row["Phone"] != null)
- {
- model.Phone = row["Phone"].ToString();
- }
- if (row["Sex"] != null && row["Sex"].ToString() != "")
- {
- model.Sex = int.Parse(row["Sex"].ToString());
- }
- if (row["Age"] != null && row["Age"].ToString() != "")
- {
- model.Age = int.Parse(row["Age"].ToString());
- }
- if (row["Diagnosis"] != null)
- {
- model.Diagnosis = row["Diagnosis"].ToString();
- }
- if (row["Doctor"] != null)
- {
- model.Doctor = row["Doctor"].ToString();
- }
- if (row["FollowUp"] != null)
- {
- model.FollowUp = int.Parse(row["FollowUp"].ToString());
- }
- if (row["DeleteFlag"] != null)
- {
- model.DeleteFlag = int.Parse(row["DeleteFlag"].ToString());
- }
- if (row["Satisfaction"] != null)
- {
- if (!string.IsNullOrEmpty(row["Satisfaction"].ToString()))
- {
- model.Satisfaction = int.Parse(row["Satisfaction"].ToString());
- }
- }
- if (row["Note"] != null)
- {
- model.Note = row["Note"].ToString();
- }
-
- if (row["FollowUpTime"] != null && row["FollowUpTime"].ToString() != "")
- {
- model.PTime = DateTime.Parse(row["FollowUpTime"].ToString());
- }
- if (row["CallId"] != null)
- {
- model.CallId =Convert.ToInt32(row["CallId"].ToString());
- }
- if (row["ActionID"] != null)
- {
- if (!string.IsNullOrEmpty(row["ActionID"].ToString()))
- {
- model.ActionID = Convert.ToInt32(row["ActionID"].ToString());
- }
-
- }
- }
- return model;
- }
-
- public CallCenterApi.Model.T_Sys_Patirnt GetModel(int PatirntID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("select top 1 * from T_Sys_Patirnt ");
- strSql.Append(" where PatirntID=@PatirntID");
- SqlParameter[] parameters = {
- new SqlParameter("@PatirntID", SqlDbType.Int,4)
- };
- parameters[0].Value = PatirntID;
- CallCenterApi.Model.T_Sys_Patirnt model = new CallCenterApi.Model.T_Sys_Patirnt();
- DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
- if (ds.Tables[0].Rows.Count > 0)
- {
- return DataRowToModel(ds.Tables[0].Rows[0]);
- }
- else
- {
- return null;
- }
- }
- }
- }
|