Example #1
0
        /// <summary>
        /// 通过患者识别码查找患者
        /// </summary>
        /// <param name="patientCode"></param>
        /// <returns></returns>
        public PatientData GetPatientByPatientCode(string patientCode)
        {
            SQL sql = CreateSQL("根据患者识别码查询患者信息", "select 患者ID, 患者识别码,姓名,身份证号,患者信息,患者关联ID,删除标记 " +
                                " from 影像患者信息 where 患者识别码=:患者识别码");

            sql.AddParameter("患者识别码", patientCode);

            DataTable dtPatient = sql.ExecuteSql();

            if (dtPatient == null || dtPatient.Rows.Count <= 0)
            {
                return(null);
            }

            PatientData patiData = new PatientData();

            patiData.BindRowData(dtPatient.Rows[0]);

            return(patiData);
        }
Example #2
0
        /// <summary>
        /// 新建一个患者
        /// </summary>
        /// <param name="patData"></param>
        /// <returns></returns>
        public bool NewPatient(PatientData patData)
        {
            ////新建患者之前,先查询是新建还是修改
            //sql = CreateSQL("查询患者是否存在", "select count(患者ID)  from 影像患者信息 where 患者ID = :患者ID");
            //sql.AddParameter("患者ID", DbType.String, patData.患者ID);
            //string strHere =  _dbHelper.ExecuteSQLOneOutput(sql).ToString();

            //if (strHere == "1")
            //{
            //    return UpdatePatient(patData);
            //}

            SQL sql = CreateSQL("插入患者信息", "insert into " +
                                " 影像患者信息(患者id, 患者识别码, 姓名, 身份证号, 患者信息, 患者关联id, 删除标记) " +
                                " values " +
                                " (:患者id,:患者识别码,:姓名,:身份证号,:患者信息,:患者关联id,:删除标记)");

            SqlParamInfo[] sqlPars = GetPatientPars(patData);
            sql.AddParameterRange(sqlPars);

            DataTable dtResult = sql.ExecuteSql();

            return(true);
        }