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