using PoJun.Dapper;
using ASHermed.SinoInterface.Api.IRepository.Test;
using ASHermed.SinoInterface.Entity.Test;
using ASHermed.SinoInterface.Repository.MySql;
using ASHermed.SinoInterface.Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ASHermed.SinoInterface.Api.ContractModel.App;
using ASHermed.SinoInterface.Api.IRepository;
using ASHermed.SinoInterface.Api.ContractModel.App.Entity;
using ASHermed.SinoInterface.Api.IRepository.App;

namespace ASHermed.SinoInterface.Api.MySqlRepository.App
{
    public class DicDiagnosisRepository : BaseRepositoryToASHermed_SinoInterface<Dic_Dept>, IDicDiagnosisRepository
    {
        public bool InserDicDiagnosis(Dic_Diagnosis model)
        {
            var sql = @"INSERT INTO `dic_diagnosis`(`AccessToken`, `OutTradeNo`, `CustomerId`, `CheifComplaint`, `Diagnosis`, `HistoryPresentIllness`, `Prescription`,`PastMedicalHistory`, `Physical`, `AllergyHistory`, `Inspection`, `DealWith`, `DeptName`, `CreateDate`, `CreateDocName`, `CreateDocWorkNumber`, `UpdateDate`, `UpdateDocName`, `UpDateDocWorkNumber`, `DiagnosisDetails`, `PatId`, `DocId`, `PID`)                                                   VALUES ( @AccessToken, @OutTradeNo, @CustomerId, @CheifComplaint, @Diagnosis, @HistoryPresentIllness, @Prescription, @PastMedicalHistory, @Physical, @AllergyHistory,@Inspection, @DealWith, @DeptName, @CreateDate, @CreateDocName, @CreateDocWorkNumber, @UpdateDate, @UpdateDocName, @UpDateDocWorkNumber, @DiagnosisDetailsStr, @PatId, @DocId, @PID)";
            return Execute(sql, model) > 0 ? true : false;
        }

        public IEnumerable<Dic_Diagnosis> GetDiagnoseList(string orderNo)
        {
            var sql = @" select Id,AllergyHistory,HistoryPresentIllness,PastMedicalHistory,DealWith,Diagnosis from  `dic_diagnosis` 
                        where OutTradeNo = @OrderNo ";
            var parms = new Dictionary<string, object>();
            parms.Add("@OrderNo", orderNo);
            return Query<Dic_Diagnosis>(sql, parms);
        }
    }
}
