using ASHermed.SinoInterface.Api.ContractModel;
using ASHermed.SinoInterface.Api.ContractModel.App;
using ASHermed.SinoInterface.Api.ContractModel.Framework.Login;
using ASHermed.SinoInterface.ContractModel;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using ASHermed.SinoInterface.Api.ContractModel.TCTrans.Input;
using ASHermed.SinoInterface.Api.ContractModel.TCTrans.Output;
using TCRBAppointmentReference;
using ASHermed.SinoInterface.Api.ContractModel.App.Model;

namespace ASHermed.SinoInterface.Api.IService
{
    /// <summary>
	///TC服务
	/// </summary>
	public interface ITCService
    {

        List<PAPerson> GetPat(string phone, string birthday);
        List<PAPerson> GetPatient(string mrn, string phone, string birthDate);

        bool LockApt(string ubrn, string usrn, string mode);

        bool CommitApt(string deptId, string servId, string ubrn, string usrn, string patId);
        bool NewCommitApt(string ubrn, string patId);
        Scheduling GetScheduling(string dateFrom, string dateTo, string deptId, string servId, string careProvId);
        Scheduling GetSchedulingNew(string dateFrom, string dateTo, string deptId, string servId, string careProvId);
        /// <summary>
        /// 获取TC服务项
        /// </summary>
        /// <param name="deptId"></param>
        /// <returns></returns>
        List<ServProj> GetServiceList(string deptId);

        AppointmentsForPatient GetAppointmentsForPatient(string mrn);
        EpisodeWithDiagnosesInLastYear GetEpisodeWithDiagnosesInLastYear(string mrn);
        List<EpisodesForPatient> GetEpisodesForPatient(string mrn);
        List<GetDrugs> GetDrugs();
        int AddTcPatInfo(Pub_Pat_Info model, string howKnow = "009");
        int UpdatePatInfo(PAPerson tcPatInfo, string cardId);
        int CancelAppt(string ubrn, string usrn);
        bool LockAptSave(string ubrn, string usrn, string Mode);

        List<GetReportList> GetReportList(string mrn);
        string GetFileContent(string documentID, string mrn);
        void CacheScheduling(string deptId, string servId);
        bool UpdatePatientPortalLink(string token, string patientID, bool isPatientPortalInstalled);
        List<Regcombos> GetClinicalInfo(string episodeNo, int language);
        OpenResult PAPersonEditOpen(int id);
        bool CustomCRMPAPerson(CustomCRMPAPerson request);
        /// <summary>
        /// 上传文件到TC
        /// </summary>
        /// <param name="picparref">TC新增时反的RowId</param>
        /// <param name="picdesc">图片备注</param>
        /// <param name="attachmentfileName">文件名</param>
        /// <param name="attachment">文件流 base64</param>
        /// <returns></returns>
        bool CustomCRMPictures(string picparref, string picdesc, string attachmentfileName, string attachment);
        bool CustomCRMMRPictures(string picparref, string picdesc, string attachmentfileName, string attachment, string uploadaddr = "");

        bool UpdateAppointment(string usrn, string remarks);
        GetSlots GetSlotsForLocationID(string datefrom, string dateto, int hisDeptId);
        GetSlots GetSlotsForCareProvID(string datefrom, string dateto, int hisDocId);
        int AddTcNewPat(TcNewPatModel model);

        /// <summary>
        /// 查询患者
        /// </summary>
        /// <param name="input"></param>
        /// <exception cref="Exception">入参错误tc不会返回结果，直接报错，"Received an invalid header name: 'HTTP/1.1'."</exception>
        /// <exception cref="Exception">xml解析失败</exception>
        /// <returns></returns>
        Task<GetPatientOutput> GetPatientAsync(GetPatientInput input);

        GetCPWithSlotsForDateResponse GetCPWithSlotsForDate(string dateFrom, string dateTo, string deptId, string servId, string careProvId = "");
        List<AptSlot> GetAptScheduling(string dateFrom, string dateTo, string deptId, string servId, string careProvId);
    }
}
