import { Injectable } from "@angular/core"; import { HttpClient, HttpHeaders } from "@angular/common/http"; import host from "../../assets/js/http"; import { resolve } from "q"; import { Observable } from "rxjs"; @Injectable({ providedIn: "root", }) export class MainService { constructor(private http: HttpClient) {} headers = new HttpHeaders({ "Content-Type": "application/json", "Cache-Control": "no-cache", }); exportHeader = new HttpHeaders().set("Accept", "*/*"); //导出excel表使用 // 单点登录 singleSignOnLogin(data): any { return this.http.post(host.host + "/auth/portalLogin", data, { headers: this.headers, }); } // 登录 login(name: string, pwd: string): any { const data = { username: name, password: pwd, type: "PC", }; return this.http.post(host.host + "/auth/login", data, { headers: this.headers, }); } // 登出 logOut(): any { return this.http.delete(host.host + "/auth/logout2", { headers: this.headers, }); } // 修改密码 upPwd(data): any { return this.http.post(host.host + "/auth/uppwd", data, { headers: this.headers, }); } // 字典表 cachedDictionary = {}; //缓存到内存的字典 getDictionary(type, key, flag = false): any { const data = { type: type, key: key, }; console.log(this.cachedDictionary, "------------db"); if (flag) { //特殊情况下处理,flag是true return this.http.post(host.host + "/common/common/getDictionary", data, { headers: this.headers, }); } else if (this.cachedDictionary[key]) { return new Observable((observer) => { observer.next(this.cachedDictionary[key]); }); } else { return new Observable((observer) => { this.http .post(host.host + "/common/common/getDictionary", data, { headers: this.headers, }) .subscribe((result) => { this.cachedDictionary[key] = result; observer.next(result); }); }); } } //清除字典表缓存 clearDictionary() { this.cachedDictionary = {}; console.log(this.cachedDictionary, "------clearDb"); } // 列表搜索(通用) getFetchDataList(type, target, data): any { return this.http.post( host.host + "/" + type + "/fetchDataList/" + target, data, { headers: this.headers } ); } // 调度台 获取支助人员信息 getSerInfo(type, data): any { return this.http.post(host.host + "/ser/" + type, data, { headers: this.headers, }); } // 通用操作data信息(新增/更新/删除)//coop:操作类型addData:新增,updData更新,rmvData删除 coopData(coop, type, data): any { return this.http.post(host.host + "/data/" + coop + "/" + type, data, { headers: this.headers, }); } // 清空药品 coopDataM(coop, data): any { return this.http.post(host.host + "/" + coop, data, { headers: this.headers, }); } // 通用操作user data信息(新增/更新/删除)//coop:操作类型addData:新增,updData更新,rmvData删除 coopUserData(coop, type, data): any { return this.http.post(host.host + "/user/data/" + coop + "/" + type, data, { headers: this.headers, }); } // 获取院区user信息 getHosUser(type, id): any { return this.http.get(host.host + "/user/data/" + type + "/" + id, {}); } // 通用操作configuration信息 有操作类型(新增/更新/删除)//coop:操作类型addData:新增,updData更新,rmvData删除 coopTypeConfig(coop, type, data): any { return this.http.post( host.host + "/configuration/" + coop + "/" + type, data, { headers: this.headers } ); } // 通用操作configuration信息(新增/更新/删除) coopConfig(type, data): any { return this.http.post(host.host + "/configuration/" + type, data, { headers: this.headers, }); } // 权限相关 getPermission(type): any { return this.http.get(host.host + "/permission/roleMenu/" + type, { headers: this.headers, }); } // fetchData查看详情 getFetchData(type, info, id): any { return this.http.get( host.host + "/" + type + "/fetchData/" + info + "/" + id, { headers: this.headers } ); } // 自定义请求 post postCustom(type, info, data): any { return this.http.post(host.host + "/" + type + "/" + info, data, { headers: this.headers, }); } // 科室二维码打印flag=1 postCustomCode(type, info, data): any { return this.http.post(host.host + "/" + type + "/" + info + "/1", data, { headers: this.headers, }); } // 自定义请求 get getCustom(type, info): any { return this.http.get(host.host + "/" + type + "/" + info, { headers: this.headers, }); } // 调度台-分派工单 assignWorker(data, type): any { return this.http.post(host.host + "/workerOrder/" + type, data, { headers: this.headers, }); } // 调度台-删除工单 delOrder(id): any { return this.http.get(host.host + "/workerOrder/delWorkOrder/" + id, { headers: this.headers, }); } // 工单列表-删除工单 delOrders(ids): any { return this.http.post( host.host + "/workerOrder/delWorkOrders", { ids }, { headers: this.headers } ); } // 调度台工单相关 coopWorkerOrder(type, data): any { return this.http.post(host.host + "/workerOrder/" + type, data, { headers: this.headers, }); } // 调度台-工单历史记录 getWorkOrderLog(id): any { return this.http.get(host.host + "/ser/fetchWorkOrderLog/" + id, { headers: this.headers, }); } // 综合报表 postReportCount(type, data): any { return this.http.post(host.host + "/report/orderCount/" + type, data, { headers: this.headers, }); } // 报表导出 exportReport(type, data): any { return this.http.post(host.host + "/report/export/" + type, data, { headers: this.exportHeader, responseType: "arraybuffer", }); } dataExport(type, data): any { return this.http.post(host.host + "/data/export/" + type, data, { headers: this.exportHeader, responseType: "arraybuffer", }); } //新增/编辑轮巡计划 addRoundRobin(type: string, data: any): any { return this.http.post(host.host + "/orderPlan/" + type, data, { headers: this.headers, }); } //删除轮巡计划 delRoundRobin(id): any { return this.http.get(host.host + "/orderPlan/deletePlan/" + id, { headers: this.headers, }); } //启用/停用轮巡计划 switchRoundRobin(isSwitch, id): any { return this.http.get( `${host.host}/orderPlan/activePlan/${isSwitch}/${id}`, { headers: this.headers } ); } //新增/编辑快捷建单 addShortcutBuildOrders(type: string, data: any): any { return this.http.post(host.host + "/api/" + type + "/quickOrder", data, { headers: this.headers, }); } //删除快捷建单 delShortcutBuildOrders(id): any { return this.http.post(host.host + "/api/rmvData/quickOrder", [id], { headers: this.headers, }); } // 快捷建单二维码批量打印 printShortcutBuildOrders(idArr): any { return this.http.post(host.host + "/api/orderCodes", idArr, { headers: this.headers, }); } //护士端返回二维码信息,flag=0,动态二维码 getDeptCode(idArr) { return this.http.post(host.host + "/dept/deptCodes/0", idArr, { headers: this.headers, }); } //药房端打印二维码的接口 printRequisition(idArr) { return this.http.post(host.host + "/drugsBag/printRequisition", idArr, { headers: this.headers, }); } //药房端待打印变为待配药接口 changeToDispensing(idArr, name) { return this.http.post( host.host + "/drugsBag/changeToDispensing/" + name, idArr, { headers: this.headers } ); } //新建工单->获取新建类型 getAutoWorkTypes(hosId) { return this.http.get(host.host + "/ser/getAutoWorkTypes/" + hosId, { headers: this.headers, }); } //服务台新建工单—调度台建单获取起点科室或者终点科室列表 getdeptList(taskTypeId) { return this.http.post( host.host + "/ser/getdeptList", { taskTypeId }, { headers: this.headers } ); } //服务台新建工单—调度台建单获取患者 getPatientList(data) { return this.http.post(host.host + "/ser/getPatientInfo", data, { headers: this.headers, }); } //服务台新建工单—调度台建单获取起点科室或者终点科室列表 buildOrder(data) { return this.http.post(host.host + "/ser/buildOrder", data, { headers: this.headers, }); } //获取当前用户信息 getCurrentUser1() { return this.http.get(host.host + "/user/data/getCurrentUser", { headers: this.headers, }); } //获取通话记录音频地址 getCallLogPath(data) { return this.http.post(host.host + "/callLog/getRecordByPath", data, { headers: this.headers, }); } //根据工作分配和人员id获取科室信息 getDeptByUser(data) { return this.http.post(host.host + "/api/getDeptByUser", data, { headers: this.headers, }); } //根据工作分配和分组id获取科室信息 getDeptByGroup(data) { return this.http.post(host.host + "/api/getDeptByGroup", data, { headers: this.headers, }); } //微信配置修改 changeWechatConfig(data) { return this.http.post( host.host + "/simple/data/addData/wechatConfig", data, { headers: this.headers } ); } //系统配置修改 changeSysConfig(data) { return this.http.post( host.host + "/simple/data/addListData/systemConfiguration", data, { headers: this.headers } ); } //数据字典楼栋保存接口 saveBuildingList(data) { return this.http.post( host.host + "/simple/data/addListData/building", data, { headers: this.headers } ); } //数据字典楼栋删除接口 delBuildingList(data) { return this.http.post(host.host + "/simple/data/rmvData/building", data, { headers: this.headers, }); } //数据字典楼层保存接口 saveFloorList(data) { return this.http.post(host.host + "/simple/data/addListData/floor", data, { headers: this.headers, }); } //数据字典楼层保存接口 delFloorList(data) { return this.http.post(host.host + "/simple/data/rmvData/floor", data, { headers: this.headers, }); } //simple增删改查,addData新增,addListData批量新增 simplePost(coop, type, data): any { return this.http.post( host.host + "/simple/data/" + coop + "/" + type, data, { headers: this.headers } ); } //api增删改查 apiPost(coop, type, data): any { return this.http.post( host.host + "/api/" + coop + "/" + type, data, { headers: this.headers } ); } //获取工单详情里的历史记录 getWorkOrderRecord(data): any { return this.http.post(host.host + "/workerOrder/getWorkOrderRecord", data, { headers: this.headers, }); } //刷新字典缓存 refreshDic(): any { return this.http.post( host.host + "/common/common/refreshCache", {}, { headers: this.headers } ); } //调度台建单获取可搜索的任务类型列表 getTaskTypeBySearchKey(data): any { return this.http.post(host.host + "/ser/getTaskTypeBySearchKey", data, { headers: this.headers, }); } //切换院区 changeHospital(data): any { return this.http.post(host.host + "/auth/changeHospital", data, { headers: this.headers, }); } //刷新缓存 refreshTaskType(): any { return this.http.get(host.host + "/ser/refreshTaskType", { headers: this.headers, }); } //楼栋配置保存接口 saveBuildings(data) { return this.http.post( host.host + "/simple/data/addListData/workOrderGradeBuilding", data, { headers: this.headers } ); } //删除接口 delBuildings(data) { return this.http.post( host.host + "/simple/data/rmvData/workOrderGradeBuilding", data, { headers: this.headers } ); } //检查信息,患者信息 listMsgByMain(type, data) { return this.http.post(host.host + "/nurse/" + type, data, { headers: this.headers, }); } //院区系统配置修改 changeHospitalSysConfig(data) { return this.http.post( host.host + "/simple/data/addListData/hospitalConfig", data, { headers: this.headers } ); } //删除用户(包含企业微信用户) rmvDataAndWeChatNum(data, flag) { return this.http.post( host.host + "/user/data/rmvDataAndWeChatNum/" + flag, data, { headers: this.headers, } ); } //数据核对 infoSearch(type, id) { return this.http.get(host.host + "/testData/view/" + type + "/" + id, { headers: this.headers, }); } // 更新,新增,删除检查类型设置 upDictionary(data) { return this.http.post(host.host + "/common/common/upDictionary", data, { headers: this.headers, }); } // 护士端定时预约工单立即执行 executeNow(id) { return this.http.get(host.host + "/api/directStartOrder/" + id, { headers: this.headers, }); } //定时下班列表立即执行 executeNowClassesJob(data) { return this.http.post(host.host + "/configuration/directOffDuty", data, { headers: this.headers, }); } //轮巡计划列表立即执行 executeNowOrderPlan(id) { return this.http.get(host.host + "/orderPlan/directOrderPlan/" + id, { headers: this.headers, }); } //查报修列表 listWxIncident(data) { return this.http.post(host.host + "/itsm/listWxIncident", data, { headers: this.headers, }); } //获取附件图片 wechatRequesterIncident(id) { return this.http.get(host.host + "/itsm/common/listAttachment/wechatRequesterIncident/" + id, { headers: this.headers, }); } //查报修流程时间 getProcessTime(data,processInstanceId) { return this.http.post(host.host + "/itsm/bpm/flowTracing/"+processInstanceId, data, { headers: this.headers, }); } //查列表 fetchListBx(type, data) { return this.http.post(host.host + "/itsm/fetchDataList/" + type, data, { headers: this.headers, }); } //查单个 fetchDataBx(target, id) { return this.http.post(host.host + "/itsm/fetchData/" + target + "/" + id,{}, { headers: this.headers, }); } //提交报修 addWxIncident(data) { return this.http.post(host.host + "/itsm/addWxIncident", data, { headers: this.headers, }); } //获取微信报修ID wxbx(data) { return this.http.post(host.host + "/itsm/restful/wxbx", data, { headers: this.headers, }); } //获取ITSM字典 getDictionaryByITSM(data) { return this.http.post(host.host + "/itsm/common/getDictionary", data, { headers: this.headers, }); } //报修评价 degree(data) { return this.http.post(host.host + "/itsm/bpm/degree", data, { headers: this.headers, }); } //复制院区 copyHosTaskType(data) { return this.http.post(host.host + "/api/copyHosTaskType", data, { headers: this.headers, }); } //药房端2统计数据 getDrugsBagStateCount(data) { return this.http.post(host.host + "/ser/getDrugsBagStateCount", data, { headers: this.headers, }); } // 标本视图查询列表接口 specimenView2(data): any { return this.http.post( host.host + "/nurse/specimenView2", data, { headers: this.headers } ); } //问卷发布 managerQuestionnaire(data) { return this.http.post( host.host + "/user/data/managerQuestionnaire", data, { headers: this.headers, } ); } //问卷预览 managerQuestionnairePreview(data,token) { return this.http.post( host.host + "/api/survey/" + token, data, { headers: this.headers, } ); } //问卷提交答案 surveyCommit(data) { return this.http.post( host.host + "/api/survey/commit", data, { headers: this.headers, } ); } //查询回收数据 listQuestionnaire(data) { return this.http.post( host.host + "/user/data/listQuestionnaire", data, { headers: this.headers, } ); } //查询楼栋核酸 getNucleicAcidBuildingSummary(data) { return this.http.post( host.host + "/workerOrder/nucleicAcidBuildingSummary", data, { headers: this.headers, } ); } //打印楼栋核酸 printNucleicAcid(data) { return this.http.post( host.host + "/api/printNucleicAcid", data, { headers: this.headers, } ); } //获取核酸图片 getPreviewImage(type, id) { return this.http.get(host.host + "/common/common/listAttachment/"+ type +"/" + id, { headers: this.headers, }); } //补充打印楼栋核酸 supplementPrintNucleicAcid(data) { return this.http.post( host.host + "/api/supplementPrintNucleicAcid", data, { headers: this.headers, } ); } }