api-service.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. (function($){
  2. $.support.cors = true
  3. var platform = 4
  4. var agentName = "userAgent"
  5. var isProduction = false// 是否是正式环境
  6. var imgUrlDomain, server, serverWlyy,healthRecordServer
  7. healthRecordServer="http://www.xmtyw.cn/wlyy/profileweb/#/" //健康档案服务
  8. healthRecordServer="https://www.xmtyw.cn/wlyytest/profileweb/#/" //健康档案服务wlyytest
  9. if(isProduction) {
  10. server = "http://www.xmtyw.cn/wlyy"; //正式环境
  11. imgUrlDomain = "http://www.xmtyw.cn/"; //正式环境
  12. serverWlyy = "http://www.xmtyw.cn/wlyy"
  13. } else {
  14. server = "https://www.xmtyw.cn/wlyytest"//测试
  15. // server = "http://192.168.131.243:8180"//培强
  16. // server = "http://192.168.131.123:8180/wlyy_manager" // 文杰
  17. // server = "http://192.168.131.144:8180/wlyy_manager" // 冬梅
  18. // server = "http://192.168.131.112:8180/wlyy_manager" // 志南
  19. serverWlyy = "https://www.xmtyw.cn/wlyytest"//测试
  20. // serverWlyy = "http://192.168.131.105:8080"//兴旺
  21. // serverWlyy = "http://192.168.131.243:8180"//培强
  22. // serverWlyy = "http://192.168.131.144:8080"//冬梅
  23. // serverWlyy = "http://192.168.131.143:8080"//冬梅
  24. imgUrlDomain = "http://www.xmtyw.cn/"; // 测试环境
  25. // healthRecordServer="http://192.168.131.29:8080/#/" //泽华
  26. }
  27. function httpGet(url,options) {
  28. //发送ajax请求
  29. return new Promise(function(resolve, reject) {
  30. $.ajax(server + url,
  31. $.extend({},{
  32. type: 'GET',
  33. dataType: 'JSON',
  34. beforeSend: function(request) {
  35. var storage = window.localStorage.getItem("app_storage")
  36. if(storage){
  37. storage = JSON.parse(storage)
  38. }
  39. if(storage){
  40. loginDoctorCache = storage.api_login_doctor || {}
  41. let userAgentObj = {
  42. 'id': loginDoctorCache.id,
  43. 'uid': loginDoctorCache.uid,
  44. 'imei': storage.IMEI,
  45. 'token': loginDoctorCache.token,
  46. 'platform': platform
  47. }
  48. request.setRequestHeader(agentName, JSON.stringify(userAgentObj));
  49. }
  50. // var userAgent = window.sessionStorage.getItem("LoginUser");
  51. // if(userAgent) {
  52. // userAgent = JSON.parse(userAgent)
  53. // request.setRequestHeader(agentName, JSON.stringify({
  54. // "id":userAgent.id,"uid":userAgent.code,"mobile":userAgent.mobile
  55. // }));
  56. // }
  57. },
  58. error: function(res) {
  59. reject(res)
  60. },
  61. success: function(res) {
  62. if(res.status && res.status == -200) {
  63. toastr && toastr.warning("登录失效,请重新登录!")
  64. setTimeout(function() {
  65. window.location.replace('login_v2.html')
  66. },2000)
  67. return ;
  68. } else {
  69. resolve(res)
  70. }
  71. }
  72. },options));
  73. })
  74. }
  75. function httpPost(url,options) {
  76. //发送ajax请求
  77. return new Promise(function(resolve, reject) {
  78. $.ajax(server + url,
  79. $.extend({},{
  80. type: 'POST',
  81. dataType: 'JSON',
  82. beforeSend: function(request) {
  83. var storage = window.localStorage.getItem("app_storage")
  84. if(storage){
  85. storage = JSON.parse(storage)
  86. }
  87. if(storage){
  88. loginDoctorCache = storage.api_login_doctor || {}
  89. let userAgentObj = {
  90. 'id': loginDoctorCache.id,
  91. 'uid': loginDoctorCache.uid,
  92. 'imei': storage.IMEI,
  93. 'token': loginDoctorCache.token,
  94. 'platform': platform
  95. }
  96. request.setRequestHeader(agentName, JSON.stringify(userAgentObj));
  97. }
  98. // var userAgent = window.sessionStorage.getItem("LoginUser");
  99. // if(userAgent) {
  100. // userAgent = JSON.parse(userAgent)
  101. // request.setRequestHeader(agentName, JSON.stringify({
  102. // "id":userAgent.id,"uid":userAgent.code,"mobile":userAgent.mobile
  103. // }));
  104. // }
  105. },
  106. error: function(res) {
  107. reject(res)
  108. },
  109. success: function(res) {
  110. if(res.status && res.status == -200) {
  111. toastr && toastr.warning("登录失效,请重新登录!")
  112. setTimeout(function() {
  113. window.location.replace('login_v2.html')
  114. },2000)
  115. return ;
  116. } else {
  117. resolve(res)
  118. }
  119. }
  120. },options));
  121. })
  122. }
  123. function httpGetWlyy(url,options) {
  124. //发送ajax请求
  125. var newserver=serverWlyy?serverWlyy:server
  126. return new Promise(function(resolve, reject) {
  127. $.ajax(newserver + url,
  128. $.extend({},{
  129. type: 'GET',
  130. dataType: 'JSON',
  131. beforeSend: function(request) {
  132. var userAgent = window.sessionStorage.getItem("LoginUser");
  133. if(userAgent) {
  134. userAgent = JSON.parse(userAgent)
  135. request.setRequestHeader(agentName, JSON.stringify({
  136. "id":userAgent.id,"uid":userAgent.code,"mobile":userAgent.mobile
  137. }));
  138. }
  139. },
  140. error: function(res) {
  141. reject(res)
  142. },
  143. success: function(res) {
  144. if(res.status && res.status == -200) {
  145. toastr && toastr.warning("登录失效,请重新登录!")
  146. setTimeout(function() {
  147. window.location.replace('login_v2.html')
  148. },2000)
  149. return ;
  150. } else {
  151. resolve(res)
  152. }
  153. }
  154. },options));
  155. })
  156. }
  157. APIService = {
  158. server: server,
  159. serverWlyy: serverWlyy,
  160. imgUrlDomain: imgUrlDomain,
  161. agentName: agentName,
  162. httpGet:httpGet,
  163. httpPost:httpPost,
  164. httpGetWlyy:httpGetWlyy,
  165. healthRecordServer:healthRecordServer,
  166. login: function(data) {
  167. return httpPost('/customer/login',{data: data})
  168. },
  169. logout: function() {
  170. return httpGet('/customer/logout')
  171. },
  172. findServerInfo: function(data) {
  173. return httpGet('/customer/findServerInfo',{data: data})
  174. },
  175. findByMobile: function(data) {
  176. return httpGet('/customer/findByMobile',{data: data})
  177. },
  178. // findByPatient: function(data) {
  179. // return httpGet('/customer/findByPatient',{data: data})
  180. // },
  181. findByPatient: function(data) {
  182. return httpPost('/doctor/patient_label_info/patient',{data: data})
  183. },
  184. captchaWithDoctor: function(doctorCode, data) {
  185. return httpPost('/doctor/captcha/withDoctorCode/'+ doctorCode,{data: data})
  186. },
  187. sendMsgAndWx: function(data) {
  188. return httpPost('/customer/sendMsg', {data: data})
  189. },
  190. addCallRecord: function(data) {
  191. return httpPost('/customer/addCallRecord', {data: data})
  192. },
  193. updateCallRecordService: function(data) {
  194. return httpPost('/customer/updateCallRecordService', {data: data})
  195. },
  196. updateCallRecordEndTime: function(data) {
  197. return httpPost('/customer/updateCallRecordEndTime', {data: data})
  198. },
  199. getCallRecords: function(data) {
  200. return httpPost('/customer/getCallRecords', {data: data})
  201. },
  202. getCallServiceCode: function(data) {
  203. return httpPost('/customer/getCallServiceCode', {data: data})
  204. },
  205. saveCallService: function(data) {
  206. return httpPost('/customer/saveCallService', {data: data})
  207. },
  208. getCallRecordInfo: function(data) {
  209. return httpPost('/customer/getCallRecordInfo', {data: data})
  210. },
  211. getCallServices: function(data) {
  212. return httpPost('/customer/getCallServices', {data: data})
  213. },
  214. getCallServiceInfo: function(data) {
  215. return httpPost('/customer/getCallServiceInfo', {data: data})
  216. },
  217. updateCallService: function(data) {
  218. return httpPost('/customer/updateCallService', {data: data})
  219. },
  220. delCallService: function(data) {
  221. return httpPost('/customer/delCallService', {data: data})
  222. },
  223. getOrgList: function(data) {
  224. return httpPost('/doctor/guahao/GetOrgListToMysql', {data: data})
  225. },
  226. getOrgDeptList: function(data) {
  227. return httpPost('/doctor/guahao/GetOrgDepListToMysql', {data: data})
  228. },
  229. cancelOrder: function(data) {
  230. return httpPost('/doctor/guahao/CancelOrder', {data: data})
  231. },
  232. createOrderByDoctor: function(data) {
  233. return httpPost('/doctor/guahao/CreateOrderByDoctor', {data: data})
  234. },
  235. regDeptSpeDoctorList: function(data) {
  236. return httpPost('/doctor/guahao/GetDoctorList', {data: data})
  237. },
  238. // regDeptSpeDoctorList: function(data) {
  239. // return httpGet('/doctor/guahao/RegDeptSpeDoctorList', {data: data})
  240. // },
  241. getDoctorInfo: function(data) {
  242. return httpPost('/doctor/guahao/GetDoctorInfo', {data: data})
  243. },
  244. // getDoctorArrange: function(data) {
  245. // return httpGet('/doctor/guahao/GetDoctorArrange', {data: data})
  246. // },
  247. getDoctorArrange: function(data) {
  248. return httpPost('/doctor/guahao/smjk/RegDeptSpeDoctorSectionList', {data: data})
  249. },
  250. doPostReturn: function(data) {
  251. return httpGet('/doctor/guahao/doPostReturn', {data: data})
  252. },
  253. getRegList: function(data) {
  254. return httpGet('/doctor/guahao/GetRegList', {data: data})
  255. },
  256. getPatientReservation: function(data) {
  257. return httpGet('/doctor/guahao/GetPatientReservation', {data: data})
  258. },
  259. //获取通话服务详情
  260. getCallInfo: function(data){
  261. return httpGet("/synergy/customer/getCallInfo", {data: data})
  262. },
  263. //获取通话统计详情
  264. total: function(data){
  265. return httpPost("/callRecordStatics/total", {data: data})
  266. },
  267. //保存通话服务记录详情
  268. saveCallServiceInfo: function(data){
  269. return httpPost("/synergy/customer/saveCallInfo", {data: data})
  270. },
  271. //保存详情里面的跟进状态
  272. saveFollowUp:function(data){
  273. return httpPost('/customer/updateFollowUpById',{data:data})
  274. },
  275. //获取电话服务标签
  276. getCallLables: function(){
  277. return httpGet("/synergy/customer/getCallLabelList")
  278. },
  279. //保存通话标签
  280. saveCallLabels: function(data){
  281. return httpPost("/synergy/customer/saveCallLabel", {data: data})
  282. },
  283. //获取通话详情里的代办事项
  284. getDealList: function(data){
  285. return httpGet("/synergy/customer/getDealList", {data: data})
  286. },
  287. getWorkOrderInfo:function(data){
  288. return httpGet('/synergy/customer/getWorkOrderInfo', {data: data})
  289. },
  290. unitLabels: function(data) {
  291. return httpGet('/synergy/customer/unitLabels', {data: data})
  292. },
  293. getQuestionnaireDetail: function(data) {
  294. return httpGet('/customer/question/getQuestionnaireDetail', {data: data})
  295. },
  296. getQuestions: function(data) {
  297. return httpGet('/customer/screen/getQuestions', {data: data})
  298. },
  299. labels: function(data) {
  300. return httpGet('/synergy/customer/labels', {data: data})
  301. },
  302. loadingInfo: function(data) {
  303. return httpGet('/customer/question/loadingInfo', {data: data})
  304. },
  305. workorderRate: function(data) {
  306. return httpGet('/synergy/customer/workorderRate', {data: data})
  307. },
  308. takeWorkorderNum: function(data) {
  309. return httpGet('/synergy/customer/takeWorkorderNum', {data: data})
  310. },
  311. createServicerLog: function(data) {
  312. return httpPost('/synergy/customer/createServicerLog', {data: data})
  313. },
  314. addFollowup:function(data){
  315. return httpPost('/synergy/customer/addFollowup', {data: data})
  316. },
  317. saveFollowupProjectData:function(data){
  318. return httpPost('/synergy/customer/saveFollowupProjectData', {data: data})
  319. },
  320. saveFollowupDrugs:function(data){
  321. return httpPost('/synergy/customer/saveFollowupDrugs', {data: data})
  322. },
  323. reminderList:function(data){
  324. return httpGet('/synergy/customer/reminderList', {data: data})
  325. },
  326. findByPatient2:function(data){
  327. return httpPost('/synergy/customer/findByPatient', {data: data})
  328. },
  329. getFollowupProjectData:function(data){
  330. return httpGet('/synergy/customer/getFollowupProjectData', {data: data})
  331. },
  332. //获取客服人员列表
  333. getCustomerList: function(){
  334. return httpGet("/synergy/customer/getCustomers");
  335. },
  336. //接收和退回协同服务任务
  337. dealWorkOrder: function(data){
  338. return httpPost('/synergy/customer/dealWorkOrder', {data: data});
  339. },
  340. // 批量接收协同服务任务
  341. batchDealWorkOrder: function(data){
  342. return httpPost('/synergy/customer/batchDealWorkOrder', {data: data});
  343. },
  344. //上传文件
  345. uploadFile: function(data){
  346. return httpPost('/synergy/customer/uploadAccessory', {data: data,contentType: false,cache: false,processData: false})
  347. },
  348. //删除文件
  349. deleteFile: function(data){
  350. return httpPost('/synergy/customer/deleteFile', {data: data});
  351. },
  352. //提交任务
  353. taskSubmit: function(data){
  354. return httpPost("/synergy/customer/taskSubmit", {data: data})
  355. },
  356. getScreenResultDetail: function(data) {
  357. return httpGet('/customer/screen/getScreenResultDetail', {data: data})
  358. },
  359. saveAnswer: function(data) {
  360. return httpPost('/customer/question/saveAnswer', {data: data})
  361. },
  362. getResult: function(data) {
  363. return httpGet('/customer/question/getResult', {data: data})
  364. },
  365. getArticalById: function(data) { //之前的健康教育 代码1
  366. return httpGet('/synergy/customer/getArticalById', {data: data})
  367. },
  368. findManageSynergyWorkorderArticleById: function(data) { //1.5.7健康教育 代码6
  369. return httpGet('/synergy/customer/findManageSynergyWorkorderArticleById', {data: data})
  370. },
  371. findTestInstructionsByOrgCode: function(data) { //体检 代码7
  372. return httpGet('/synergy/customer/findTestInstructionsByOrgCode', {data: data})
  373. },
  374. healthIndexList: function(data) { //体征 代码8
  375. return httpGet('/synergy/customer/healthIndexList', {data: data})
  376. },
  377. standard: function(data) { //体征 预警值
  378. return httpGet('/synergy/customer/standard', {data: data})
  379. },
  380. // 客服首页接口
  381. customerIndex: function(data) {
  382. return httpGet('/synergy/customer/customerIndex', {data: data})
  383. },
  384. // 管理员首页接口
  385. adminIndex: function(data) {
  386. return httpGet('/synergy/customer/adminIndex', {data: data})
  387. },
  388. intervalOnLine: function(data) {
  389. return httpGet('/synergy/customer/intervalOnLine', {data: data})
  390. },
  391. todayCustomerActivy: function(data) {
  392. return httpGet('/synergy/customer/TodayCustomerActivy', {data: data})
  393. },
  394. workorderList: function(data) {
  395. return httpGet('/synergy/customer/workorderList', {data: data})
  396. },
  397. getAnswers:function(data){
  398. return httpGet('/customer/question/getAnswers',{data:data})
  399. },
  400. // 导出
  401. exportWorkorder:function(data){
  402. return httpGet('/synergy/customer/exportWorkorder',{data:data})
  403. },
  404. // 处理居民调查
  405. getTaskByIdcard: function(data) {
  406. return httpGet('/synergy/customer/getTaskByIdcard',{data:data})
  407. },
  408. // 获取居民服务数据
  409. getWorkorderNum: function(data) {
  410. return httpGet('/synergy/customer/getWorkorderNum',{data:data})
  411. },
  412. getAskdetail:function(data){
  413. return httpGet('/customer/question/getOptionsComment',{data:data})
  414. },
  415. //知识库
  416. //知识库文章列表
  417. getArticleList:function(data){
  418. return httpGet('/customer/article/searchPageList',{data:data})
  419. },
  420. //我的文章列表
  421. getMyArticleList:function(data){
  422. return httpGet('/customer/article/searchMyPageList',{data:data})
  423. },
  424. //根据id删除文章
  425. deleteArticleById:function(data){
  426. return httpGet('/customer/article/deleteById',{data:data})
  427. },
  428. //获取一级分类列表(无分页)
  429. searchArticleCategoryList:function(data){
  430. return httpGet('/customer/category/searchCategoryList',{data:data})
  431. },
  432. //根据code适用范围
  433. hospitalsByCity:function(data){
  434. return httpGet('/customer/article/hospitalsByCity',{data:data})
  435. },
  436. //根据code获取分类
  437. queryArticleCategoryByCode:function(data){
  438. return httpGet('/customer/category/queryByCode',{data:data})
  439. },
  440. //根据code删除分类
  441. deleteArticleCategoryByCode:function(data){
  442. return httpGet('/customer/category/updateDel',{data:data})
  443. },
  444. //获取分类列
  445. searchArticleCategoryPageList:function(data){
  446. return httpGet('/customer/category/searchCategoryPageList',{data:data})
  447. },
  448. //新增、修改分类
  449. saveArticleCategory:function(data){
  450. return httpPost('/customer/category/saveCategory',{data:data})
  451. },
  452. //分类code是否存在
  453. hasExistArticleCategoryCode:function(data){
  454. return httpGet('/customer/category/hasExistCode',{data:data})
  455. },
  456. // 添加、修改文章
  457. updateArticle: function(data) {
  458. return httpPost('/customer/article/updateArticle',{data:data})
  459. },
  460. // 根据id获取文章
  461. queryArticleById: function(data) {
  462. return httpGet('/customer/article/queryById',{data:data})
  463. },
  464. //获取适用范围
  465. hospitalsTree: function (data) {
  466. return httpGet('/customer/article/hospitalsTree', { data: data })
  467. },
  468. // 根据id获取文章
  469. getCategoryLevelList: function(data) {
  470. return httpGetWlyy('/third/jkEdu/Article/getCategoryList',{data:data})
  471. },
  472. // 是否有上一次随访的信息
  473. getLastFollowup: function(data) {
  474. return httpPost('/doctor/followup/getLastFollowup',{data:data})
  475. },
  476. // 复制随访信息
  477. copyFollowup: function(data) {
  478. return httpPost('/doctor/followup/copyFollowup',{data:data})
  479. },
  480. // 获取随访信息
  481. getFollowup: function(data) {
  482. return httpGet('/doctor/followup/getFollowup',{data:data})
  483. },
  484. //获得协同服务未完成和未读工单的信息
  485. getWorkorderUnfinished: function(data){
  486. return httpGet("/synergy/customer/workorderListTotal", {data: data})
  487. },
  488. //协同工单获取上一次分配的负责人和参与人列表
  489. getSelectedOrderCollaborates: function(data){
  490. return httpGet("/synergy/customer/selectByWorkorder", {data: data})
  491. },
  492. // 知识库右侧结果搜索接口
  493. searchKnowledgePageList: function(data) {
  494. return httpGet("/customer/article/searchKnowledgePageList", {data: data})
  495. },
  496. // 意见反馈
  497. saveFeedback: function(data) {
  498. return httpPost("/customer/saveFeedback", {data: data})
  499. },
  500. //导出通话记录
  501. exportCall: function() {
  502. window.open(server+'/synergy/customer/callrecordOutExcel')
  503. },
  504. // 通过社保卡号或身份证筛选居民列表
  505. findPatientInfo: function (data) {
  506. return httpPost("/customer/findPatientInfo", { data: data })
  507. },
  508. // 通过id获取知识库文章详情
  509. queryOneById: function (data) {
  510. return httpGet("/customer/article/queryOneById", { data: data })
  511. },
  512. //通过身份证号获取未就诊预约记录
  513. getRegListCall:function(data){
  514. return httpGet("/doctor/guahao/GetRegListCall", { data: data })
  515. },
  516. //协同任务关闭工单
  517. closeWorkorder:function(data){
  518. return httpGet('/synergy/customer/closeWorkorder',{data:data})
  519. },
  520. // 根据身份证号换取居民CODE
  521. getPatientAccetokenByIdcard:function(data) {
  522. return httpPost('/customer/getPatientAccetokenByIdcard', {
  523. data: data
  524. })
  525. },
  526. // 查询跟进记录
  527. selectByCode:function(data) {
  528. return httpPost('/customer/selectByCode', {
  529. data: data
  530. })
  531. },
  532. // 获取后续处理人
  533. selectUser:function(data) {
  534. return httpPost('/customer/selectUser', {
  535. data: data
  536. })
  537. },
  538. // 更新通话记录和跟进记录
  539. updateCallRecordAndFollowupRecord:function(data) {
  540. return httpPost('/customer/updateCallRecordAndFollowupRecord', {
  541. data: data
  542. })
  543. },
  544. }
  545. window.APIService = APIService;
  546. })(jQuery)