#region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
//
// All rights are reserved. Reproduction or transmission in whole or in part, 
// in any form or by any means, electronic, mechanical or otherwise, is 
// prohibited without the prior written consent of the copyright owner.
//
// Filename:SelectConsentSvcDac.cs
//
#endregion
using CLIP.eForm.Consent.Entity;
using CLIP.eForm.Server.Data;
using IBatisNet.DataMapper;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CLIP.eForm.Consent.Dac {
  public class PatientDac : DacBase {
    //앞으로 GetPatientInfo()으로 대체될 임시함수
    public IList<PatientVO> GetPatientDetailInfo(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<PatientVO>("GET_PATIENT_DETAIL_INFO", param);
    }

    public IList<ClnDateForDropdownVO> GetTrmtDateList(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<ClnDateForDropdownVO>("GET_TRMT_DATE_LIST", param);
    }

    public IList<PatientVO> GetPatientInfo(ISqlMapper mapper, Hashtable param) {

      String flag = (String) param["ordType"];

      if (flag.Equals("I") || flag.Equals("E") || flag.Equals("D") || flag.Equals("OP")) {
        //입원 , 응급
        return mapper.QueryForList<PatientVO>("getPatientInfoIn", param);

      } else if (flag.Equals("O") || flag.Equals("S")) {
        //외래 , 종건
        return mapper.QueryForList<PatientVO>("getPatientInfoOut", param);

      } else {
        return null;
      }
    }

    public string GetOcrTag(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<String>("getOcrTag", param);
    }
    public IList<string> GetDiagList(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<string>("getDiagList", param);
    }
    public string GetFileName(ISqlMapper mapper, Hashtable param) {
      mapper.Insert("setFileName", param);
      return mapper.QueryForObject<String>("getFileName", param);
    }

    public string GetOrgImageFileName(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<String>("getFileName", param);
    }

    public void delEformData(ISqlMapper mapper, Hashtable param) {
      mapper.Insert("delEformData", param);
    }
    public int UpdateUserSetup(ISqlMapper mapper, Hashtable param) {
      //mapper.QueryForObject<Int32>("UPDATE_USERSETUP", param);
      return mapper.Update("UPDATE_USERSETUP", param);
    }

    public int checkPrintablePatient(ISqlMapper mapper, Hashtable param) {
      Object res = mapper.QueryForObject("checkPrintablePatient", param);
      return Convert.ToInt32(res);
    }

    public int checkHardcd(ISqlMapper mapper, Hashtable param) {
      Object res = mapper.QueryForObject("checkHardcd", param);
      return Convert.ToInt32(res);
    }
  }
}
