import type { IDeviceInfo } from '/@/api/device/tyeps/index.type';
import type { IUser } from '/@/api/user/types/index.type';
import type { IPatientInfo } from '/@/api/HemodiPatients/types';

type TOrderCondition = -1 | 1 | 2 | 7 | 3;

type TPatientFrom = -1 | 0 | 1;

export type ItimeSolt = -1 | 0 | 1 | 2 | 3 | 4;

export interface IGetRecordsInTodayParams {
	clientCode: string;
	dateBegin?: string;
	dateEnd?: string;
	nurseBelonged2?: string;
	orderCondition?: TOrderCondition;
	patientFrom?: TPatientFrom;
	patientName?: string;
	timeSlot?: ItimeSolt;
	wards?: string[];
	recordCode?: string;
}

export interface IRecordsInToday {
	aI预测低血压结果: string;
	age: number;
	belongNurseCode: string;
	cacheTime: string | null;
	clientCode: string;
	clzl: string;
	crbText: string;
	deviceCode: string;
	deviceGroupCode: string;
	deviceGroupName: string;
	deviceGroupSortOrder: number;
	deviceName: string;
	deviceNo: string;
	firstMonitorDataTime: string;
	glq: string;
	glqCode: string;
	isContainKnj: number;
	isDaoGuan: number;
	isDoneCleanJob: number;
	isNeiLou: number;
	isOutStockOK: boolean;
	isTodayAsMyBirthday: boolean;
	lastClliang: string;
	md5: string;
	medCountInCurrentWeek: number;
	medStartTime: null | string;
	medState: number;
	notExecutedDrugOrderCount: number;
	patientAvatar: string;
	patientCode: string;
	patientFrom: number;
	patientGender: number;
	patientHemoCode: string;
	patientId: number;
	patientIsPostive: number;
	patientName: string;
	patientPreHemoWeight: number;
	patientPyCode: string;
	preClothesWeight: number;
	pureWeight: number;
	recordCode: string;
	recordIsExecutedDrugOrder: boolean;
	scheduleDate: string;
	scheduleTimeSlot: number; 
	schemeConfirmed: boolean;
	schemeIsConfirm: number;
	schemeName: string;
	schemeNamePlus: string;
	signTime: string;
	sortOrderByDeviceGroup: number;
	xlq: string;
	xlqCode: string;
	xtq: string;
	xtqCode: string;
	一次性管路名称: string;
	一次性管路编号: string;
}


/** 透析医生-类型 */
export interface ISchemeDoctor extends Omit<IUser, 'clientInfos' | 'clientVsUserList' | 'currentClientInfo'> {
	clientInfos: null;
	clientVsUserList: null;
	currentClientInfo: null;
}

export interface ISchemeInfo {
	clientCode: string;
	clothesWeight: number;
	code: string;
	createTime: string;
	createUser: null | number;
	deletedTime: null | string;
	id: number;
	isAllowNullUpdate: any;
	isDeleted: number;
	isTemplate: number;
	preAddTsl: null | any;
	remark: string;
	schemeCa: number;
	schemeCxTime: null | string;
	schemeCxl: null | string;
	schemeExchangeType: string;
	schemeExtendJson: string;
	schemeFormula: number;
	schemeGlTool: string;
	schemeGlu: string;
	schemeIsActive: number;
	schemeIsPlus: number;
	schemeIsSub: number;
	schemeK: number;
	schemeKnj: string;
	schemeKnj2: string;
	schemeKtv: string;
	schemeNaCf: number;
	schemeNaPf: number;
	schemeName: string;
	schemeNamePlus: string;
	schemePlus: any;
	schemePlusCondition: string;
	schemeSj: number;
	schemeSj2: any;
	schemeTSQList: string[];
	schemeTotal: number;
	schemeTotal2: any;
	schemeTsqg: number;
	schemeTsqgCaJiliang: string;
	schemeTsqgCaName: string;
	schemeTxPeriod: number;
	schemeTxPeriodH: number;
	schemeTxPeriodM: number;
	schemeTxyFlow: number;
	schemeWcj: any;
	schemeWcj2: any;
	schemeXlCount: string;
	schemeXlTool: string;
	schemeXtTool: string;
	schemeZhyliang: number;
	updateTime: string | null;
	updateUser: null | number;
	抗凝剂国网上报信息: 抗凝剂国网上报信息;
}

export interface 抗凝剂国网上报信息 {
	抗凝剂_低分子肝素单位: string;
	抗凝剂_低分子肝素总剂量: string;
	抗凝剂_低分子肝素类型: string;
	抗凝剂_低分子肝素追加剂量_IU: string;
	抗凝剂_低分子肝素追加剂量_mg: string;
	抗凝剂_低分子肝素追加时间: string;
	抗凝剂_低分子肝素首剂量_IU: string;
	抗凝剂_低分子肝素首剂量_mg: string;
	抗凝剂_其它抗凝剂: string;
	抗凝剂_备注: string;
	抗凝剂_总剂量: string;
	抗凝剂_是否使用华法林: string;
	抗凝剂_枸橼酸钠_使用时间分钟: string;
	抗凝剂_枸橼酸钠_使用时间小时: string;
	抗凝剂_枸橼酸钠浓度百分比: string;
	抗凝剂_枸橼酸钠速率每小时_ml: string;
	抗凝剂_种类: string;
	抗凝剂_肝素_追加时间分钟: string;
	抗凝剂_肝素_追加时间小时: string;
	抗凝剂_肝素单位: string;
	抗凝剂_肝素追加速率_IU每小时: string;
	抗凝剂_肝素追加速率_mg每小时: string;
	抗凝剂_肝素首剂量_IU: string;
	抗凝剂_肝素首剂量_mg: string;
	抗凝剂_追加剂量: string;
	抗凝剂_阿加曲班_追加时间分钟: string;
	抗凝剂_阿加曲班_追加时间小时: string;
	抗凝剂_阿加曲班单位: string;
	抗凝剂_阿加曲班追加速率_IU每小时: string;
	抗凝剂_阿加曲班追加速率_mg每小时: string;
	抗凝剂_阿加曲班首剂量_IU: string;
	抗凝剂_阿加曲班首剂量_mg: string;
	抗凝剂_首剂量: string;
	枸橼酸钠_其它钠浓度: string;
}



/** 透析单详情-类型 */
export interface IRecordDetail {
	clientCode: string;
	code: string;
	createTime: string | null;
	createUser: null | number;
	deletedTime: null | string;
	detailForPatientAfterBP: string;
	detailForPatientAfterPulse: string;
	detailForPatientAfterWeight: string;
	detailForPatientClothesWeight: string;
	detailForPatientKNJ: string;
	detailForPatientMedCount: null | number;
	detailForPatientMedEndTime: string;
	detailForPatientMedStartTime: string;
	detailForPatientPreBP: string;
	detailForPatientPrePulse: string;
	detailForPatientPreWeight: string;
	deviceCode: string; // 设备code
	deviceInfo: IDeviceInfo | null; // 设备实体
	deviceName: string; // 设备文本值
	diagnoseSnapshot: string;
	glToolName: string;
	glq: string;
	hemoMedRecordConfirmInfo: {
		confirmTime: null | string;
		confirmUser: string | number | null;
		confirmUserInfo: any;
		isConfirm: number;
	} | null;
	historyCount: number;
	huixue: string;
	id: number;
	isDeleted: number;
	lastTimeRecordCode: string; // 上一次透析单编号
	lastTimeRecordDate: string; // 上一次透析单的日期
	medState: number; // 透析单状态
	nextRecordDate: string; // 下一次透析单的日期
	operator: string;
	outstockConfirmOperator: string;
	outstockIsConfirm: number;
	patientCode: string; // 患者编号
	patientDiagnoseText: string; // 患者诊断
	patientHemoMedBodyStateAfterInfo: any;
	patientHemoMedBodyStatePreInfo: any;
	patientHemoMedDialysisScheme: any;
	patientHemoMedDouleCheckInfo: any;
	patientHemoMedFinishInfo: any;
	patientHemoMedMonitorDatas: any;
	patientHemoMedTempDrugOrders: any;
	patientIncreaseWeight: string;
	patientInfo: IPatientInfo | null; // 患者信息
	patientPreHemoWeight: null | number;
	patientPureWeight: null | number;
	patientSnapShotInfo: IPatientInfo | null; // 透析单快照上的患者信息
	patientSnapshot: string;
	patientVsHemoMedSchemeInfo: {
		code: string;
		createTime: string;
		createUser: null | number;
		deletedTime: null | string;
		id: number;
		isDeleted: number;
		patientCode: string; // 患者code
		periodText: string; // 透析频率
		remark: string;
		schemeCode: string; // 透析模式code
		schemeCount: number; // 次数
		schemeDoctor: string; // 医生code
		schemeDoctorInfo: ISchemeDoctor;
		schemeFrequency: number;
		schemeInfo: ISchemeInfo;
		schemeIsEnable: number;
		schemeIsSub: number;
		schemeNamePlus: string;
		schemePeriod: number;
		schemeSortOrder: number;
		updateTime: string | null;
		updateUser: null | number;
	} | null;
	pureWeight: number;
	remark: string; // 备注
	scheduleDate: string;
	scheduleTimeSlot: number;
	schemeConfirmed: boolean;
	schemeIsConfirm: number;
	schemeName: string; // 透析方案
	schemeNamePlus: string;
	sortOrderByAll: any;
	sortOrderByDeviceGroup: number;
	updateTime: string;
	updateUser: null | number;
	xgtlSnapshot: string;
	xlToolName: string;
	xlq: string;
	xtToolName: string;
	xtq: string;
	yinxue: string;
	startCcZhenAName: string;
	startCcZhenVName: string;

}

/** 透析单日期-类型 */
export interface ICalendarRecord {
	date: string;
	day: number;
	medState: number;
	month: number;
	patientCode: string;
	recordCode: string;
	schemeName: string;
	schemePlusName: string;
	timeSlot: number;
	year: number;
}



export interface IListReadyRowsParams {
	clientCode: string;
	queryDateBegin: string;
	queryDateEnd: string;
	timeSlot: number;
	wards: string[];
	patientQueryCode: string;
}

export interface IListReadyRows {
	byg: string;
	ca: string;
	ccZhen: string;
	ccZhenA: string;
	ccZhenType: string;
	ccZhenV: string;
	deviceGroupName: string;
	deviceGroupSortOrder: string;
	deviceName: string;
	deviceNo: string;
	gl: string;
	glToolName: string;
	glu: string;
	hlb: string;
	k: string;
	nsy: string;
	patientCode: string;
	patientName: string;
	patientNo: string;
	realTimeOutStockInfoResponses: any;
	recordCode: string;
	remark: string;
	schemeName: string;
	sortOrder: number | null;
	timeSlot: number;
	vaName: string;
	xlToolName: string;
	xtToolName: string;
	穿刺针A端: string;
	穿刺针V端: string;
	穿刺针A端规格: string;
	穿刺针V端规格: string;
	xtToolSpec: string;
	xlToolSpec: string;
	glToolSpec: string;
}


export interface IListStatInfoParams {
	clientCode: string;
	patientQueryCode: string;
	queryDateBegin: string;
	queryDateEnd: string;
	timeSlot: number;
	wards: string[];
}

export interface IListStatInfo {
	itemName: string;
	itemType: string;
	itemSpec: string;
	sum: number;
}

export interface IPrepareWorkParams {
	clientCode: string;
	patientQueryCode: string;
	queryDateBegin: string;
	queryDateEnd: string;
	timeSlot: number;
	wards: string[];
}

export interface IPrepareWork {
	afterWeight: number | null;
	ca: number | null;
	chaoLvTotal: number | null;
	chufangTSL: number | null;
	deviceCode: string;
	deviceGroupName: string;
	deviceGroupSortOrder: string;
	deviceName: string;
	increaseWeight: number | null;
	jiliang: string;
	kangningJi: string;
	knjCode: string;
	medHour: number;
	medMethod: string;
	medMinutes: number | null;
	medState: number;
	medTool: string;
	mubiaoTSL: string;
	patAge: string;
	patCode: string;
	patGender: string;
	patHemoCode: string;
	patName: string;
	patientNamePy: string;
	preBP: string;
	preWeight: number | null;
	pureWeight: number | null;
	recordCode: string;
	schemeSj: number;
	schemeTotal: number;
	schemeWcj: number;
	signSortIndexL: number | null;
	sortOrderByAll: number | null;
	sortOrderByDeviceGroup: number | null;
	timeslot: number | null;
	txyFlow: number | null;
	vascularAccessName: string;
	vascularAccessPostion: string;
	zhihuanzongliang: number | null;
}

export interface IPrepareWorkMedicineParams {
	clientCode: string;
	patientQueryCode: string;
	queryDateBegin: string;
	queryDateEnd: string;
	timeSlot: number;
	wards: string[];
}

export interface IPrepareWorkMedicine {
	cuhongsu: string;
	deviceGroupName: string;
	deviceGroupSortOrder: string;
	deviceName: string;
	deviceNo: string;
	drugCode: string;
	drugName: string;
	drugUnit: string;
	guhuasanchun: string;
	isConfirm: number;
	isKnj: number;
	jiliang: string;
	knj: string;
	medDate: string;
	medUseCount: string;
	packageUnit: string;
	paliguhuachun: string;
	patientAge: string;
	patientGender: string;
	patientHemoCode: string;
	patientName: string;
	recordCode: string;
	singleUsage: string;
	sortOrder: number | null;
	timeSlot: number;
	zhetangtie: string;
	zuokaniding: string;
}

export interface IPrepareWorkMedicineStatParams {
	clientCode: string;
	patientQueryCode: string;
	queryDateBegin: string;
	queryDateEnd: string;
	timeSlot: number;
	wards: string[];
}

export interface IPrepareWorkMedicineStat {
	count: number;
	deviceCode: string;
	drugCode: string;
	drugName: string;
	drugNamePy: string;
	drugSpec: string;
	isKnj: number;
	packageUnitName: string;
	recordCode: string;
}


export interface IFixedDrugStatisticsParams {
	clientCode: string;
	deviceGroups: string[];
	isSchemeConfirmed: number | null;
	patientQueryCode: string;
	recordDate: string;
	recordEndDate: string;
	recordStartDate: string;
	selectedItems: string[];
	timeSlots: number[];
}


export interface IFixedDrugStatistics {
	group: string;
	patCode: string;
	recordCode: string;
	姓名: string;
	是否确认处方: string;
	机号: string;
	透析号: string;
	[key: string]: any;
	执行护士列表?: string;
	执行护士列表_签名: string;
}


export interface IStatisticBothItemDrugsParams {
	clientCode: string;
	date1: string;
	date2: string;
	timeslots: string;
}

export interface IStatisticBothItemDrugsItem {
	分区: string;
	患者姓名: string;
	机号: string;
	分区排序号: number;
	床号排序号: number;
	治疗项目: { key: number }[];
	透析用药: { key: number }[];
	透析耗材: { key: number }[];
}


export interface IListRecordsByToolUsageDetailsParams {
	dateRange1: string;
	dateRange2: string;
	timeSlot: number;
	itemName: string;
	clientCode: string;
}


export interface IListRecordsByToolUsageDetailsReponse {
	使用数量: { [key: string]: number };
	使用详情: { [key: string]: IListRecordsByToolUsageDetailsDetail[] }
}

export interface IListRecordsByToolUsageDetailsDetail {
	date: string;
	itemCode: string;
	itemName: string;
	medDate: string;
	medTimeSlot: number;
	patientCode: string;
	patientName: string;
	rowCount: any;
	schemeName: string;
	timeRangeText: string;
	type: any;
}