api-service.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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. createPicCaptcha: function(data) {
  240. return httpGet('/open/captcha/createPicCaptcha', {data: data})
  241. },
  242. // regDeptSpeDoctorList: function(data) {
  243. // return httpGet('/doctor/guahao/RegDeptSpeDoctorList', {data: data})
  244. // },
  245. getDoctorInfo: function(data) {
  246. return httpPost('/doctor/guahao/GetDoctorInfo', {data: data})
  247. },
  248. // getDoctorArrange: function(data) {
  249. // return httpGet('/doctor/guahao/GetDoctorArrange', {data: data})
  250. // },
  251. getDoctorArrange: function(data) {
  252. return httpPost('/doctor/guahao/smjk/RegDeptSpeDoctorSectionList', {data: data})
  253. },
  254. doPostReturn: function(data) {
  255. return httpGet('/doctor/guahao/doPostReturn', {data: data})
  256. },
  257. getRegList: function(data) {
  258. return httpGet('/doctor/guahao/GetRegList', {data: data})
  259. },
  260. getPatientReservation: function(data) {
  261. return httpGet('/doctor/guahao/GetPatientReservation', {data: data})
  262. },
  263. //获取通话服务详情
  264. getCallInfo: function(data){
  265. return httpGet("/synergy/customer/getCallInfo", {data: data})
  266. },
  267. //获取通话统计详情
  268. total: function(data){
  269. return httpPost("/callRecordStatics/total", {data: data})
  270. },
  271. //保存通话服务记录详情
  272. saveCallServiceInfo: function(data){
  273. return httpPost("/synergy/customer/saveCallInfo", {data: data})
  274. },
  275. //保存详情里面的跟进状态
  276. saveFollowUp:function(data){
  277. return httpPost('/customer/updateFollowUpById',{data:data})
  278. },
  279. //获取电话服务标签
  280. getCallLables: function(){
  281. return httpGet("/synergy/customer/getCallLabelList")
  282. },
  283. //保存通话标签
  284. saveCallLabels: function(data){
  285. return httpPost("/synergy/customer/saveCallLabel", {data: data})
  286. },
  287. //获取通话详情里的代办事项
  288. getDealList: function(data){
  289. return httpGet("/synergy/customer/getDealList", {data: data})
  290. },
  291. getWorkOrderInfo:function(data){
  292. return httpGet('/synergy/customer/getWorkOrderInfo', {data: data})
  293. },
  294. unitLabels: function(data) {
  295. return httpGet('/synergy/customer/unitLabels', {data: data})
  296. },
  297. getQuestionnaireDetail: function(data) {
  298. return httpGet('/customer/question/getQuestionnaireDetail', {data: data})
  299. },
  300. getQuestions: function(data) {
  301. return httpGet('/customer/screen/getQuestions', {data: data})
  302. },
  303. labels: function(data) {
  304. return httpGet('/synergy/customer/labels', {data: data})
  305. },
  306. loadingInfo: function(data) {
  307. return httpGet('/customer/question/loadingInfo', {data: data})
  308. },
  309. workorderRate: function(data) {
  310. return httpGet('/synergy/customer/workorderRate', {data: data})
  311. },
  312. takeWorkorderNum: function(data) {
  313. return httpGet('/synergy/customer/takeWorkorderNum', {data: data})
  314. },
  315. createServicerLog: function(data) {
  316. return httpPost('/synergy/customer/createServicerLog', {data: data})
  317. },
  318. addFollowup:function(data){
  319. return httpPost('/synergy/customer/addFollowup', {data: data})
  320. },
  321. saveFollowupProjectData:function(data){
  322. return httpPost('/synergy/customer/saveFollowupProjectData', {data: data})
  323. },
  324. saveFollowupDrugs:function(data){
  325. return httpPost('/synergy/customer/saveFollowupDrugs', {data: data})
  326. },
  327. reminderList:function(data){
  328. return httpGet('/synergy/customer/reminderList', {data: data})
  329. },
  330. findByPatient2:function(data){
  331. return httpPost('/synergy/customer/findByPatient', {data: data})
  332. },
  333. getFollowupProjectData:function(data){
  334. return httpGet('/synergy/customer/getFollowupProjectData', {data: data})
  335. },
  336. //获取客服人员列表
  337. getCustomerList: function(){
  338. return httpGet("/synergy/customer/getCustomers");
  339. },
  340. //接收和退回协同服务任务
  341. dealWorkOrder: function(data){
  342. return httpPost('/synergy/customer/dealWorkOrder', {data: data});
  343. },
  344. // 批量接收协同服务任务
  345. batchDealWorkOrder: function(data){
  346. return httpPost('/synergy/customer/batchDealWorkOrder', {data: data});
  347. },
  348. //上传文件
  349. uploadFile: function(data){
  350. return httpPost('/synergy/customer/uploadAccessory', {data: data,contentType: false,cache: false,processData: false})
  351. },
  352. //删除文件
  353. deleteFile: function(data){
  354. return httpPost('/synergy/customer/deleteFile', {data: data});
  355. },
  356. //提交任务
  357. taskSubmit: function(data){
  358. return httpPost("/synergy/customer/taskSubmit", {data: data})
  359. },
  360. getScreenResultDetail: function(data) {
  361. return httpGet('/customer/screen/getScreenResultDetail', {data: data})
  362. },
  363. saveAnswer: function(data) {
  364. return httpPost('/customer/question/saveAnswer', {data: data})
  365. },
  366. getResult: function(data) {
  367. return httpGet('/customer/question/getResult', {data: data})
  368. },
  369. getArticalById: function(data) { //之前的健康教育 代码1
  370. return httpGet('/synergy/customer/getArticalById', {data: data})
  371. },
  372. findManageSynergyWorkorderArticleById: function(data) { //1.5.7健康教育 代码6
  373. return httpGet('/synergy/customer/findManageSynergyWorkorderArticleById', {data: data})
  374. },
  375. findTestInstructionsByOrgCode: function(data) { //体检 代码7
  376. return httpGet('/synergy/customer/findTestInstructionsByOrgCode', {data: data})
  377. },
  378. healthIndexList: function(data) { //体征 代码8
  379. return httpGet('/synergy/customer/healthIndexList', {data: data})
  380. },
  381. standard: function(data) { //体征 预警值
  382. return httpGet('/synergy/customer/standard', {data: data})
  383. },
  384. // 客服首页接口
  385. customerIndex: function(data) {
  386. return httpGet('/synergy/customer/customerIndex', {data: data})
  387. },
  388. // 管理员首页接口
  389. adminIndex: function(data) {
  390. return httpGet('/synergy/customer/adminIndex', {data: data})
  391. },
  392. intervalOnLine: function(data) {
  393. return httpGet('/synergy/customer/intervalOnLine', {data: data})
  394. },
  395. todayCustomerActivy: function(data) {
  396. return httpGet('/synergy/customer/TodayCustomerActivy', {data: data})
  397. },
  398. workorderList: function(data) {
  399. return httpGet('/synergy/customer/workorderList', {data: data})
  400. },
  401. getAnswers:function(data){
  402. return httpGet('/customer/question/getAnswers',{data:data})
  403. },
  404. // 导出
  405. exportWorkorder:function(data){
  406. return httpGet('/synergy/customer/exportWorkorder',{data:data})
  407. },
  408. // 处理居民调查
  409. getTaskByIdcard: function(data) {
  410. return httpGet('/synergy/customer/getTaskByIdcard',{data:data})
  411. },
  412. // 获取居民服务数据
  413. getWorkorderNum: function(data) {
  414. return httpGet('/synergy/customer/getWorkorderNum',{data:data})
  415. },
  416. getAskdetail:function(data){
  417. return httpGet('/customer/question/getOptionsComment',{data:data})
  418. },
  419. //知识库
  420. //知识库文章列表
  421. getArticleList:function(data){
  422. return httpGet('/customer/article/searchPageList',{data:data})
  423. },
  424. //我的文章列表
  425. getMyArticleList:function(data){
  426. return httpGet('/customer/article/searchMyPageList',{data:data})
  427. },
  428. //根据id删除文章
  429. deleteArticleById:function(data){
  430. return httpGet('/customer/article/deleteById',{data:data})
  431. },
  432. //获取一级分类列表(无分页)
  433. searchArticleCategoryList:function(data){
  434. return httpGet('/customer/category/searchCategoryList',{data:data})
  435. },
  436. //根据code适用范围
  437. hospitalsByCity:function(data){
  438. return httpGet('/customer/article/hospitalsByCity',{data:data})
  439. },
  440. //根据code获取分类
  441. queryArticleCategoryByCode:function(data){
  442. return httpGet('/customer/category/queryByCode',{data:data})
  443. },
  444. //根据code删除分类
  445. deleteArticleCategoryByCode:function(data){
  446. return httpGet('/customer/category/updateDel',{data:data})
  447. },
  448. //获取分类列
  449. searchArticleCategoryPageList:function(data){
  450. return httpGet('/customer/category/searchCategoryPageList',{data:data})
  451. },
  452. //新增、修改分类
  453. saveArticleCategory:function(data){
  454. return httpPost('/customer/category/saveCategory',{data:data})
  455. },
  456. //分类code是否存在
  457. hasExistArticleCategoryCode:function(data){
  458. return httpGet('/customer/category/hasExistCode',{data:data})
  459. },
  460. // 添加、修改文章
  461. updateArticle: function(data) {
  462. return httpPost('/customer/article/updateArticle',{data:data})
  463. },
  464. // 根据id获取文章
  465. queryArticleById: function(data) {
  466. return httpGet('/customer/article/queryById',{data:data})
  467. },
  468. //获取适用范围
  469. hospitalsTree: function (data) {
  470. return httpGet('/customer/article/hospitalsTree', { data: data })
  471. },
  472. // 根据id获取文章
  473. getCategoryLevelList: function(data) {
  474. return httpGetWlyy('/third/jkEdu/Article/getCategoryList',{data:data})
  475. },
  476. // 是否有上一次随访的信息
  477. getLastFollowup: function(data) {
  478. return httpPost('/doctor/followup/getLastFollowup',{data:data})
  479. },
  480. // 复制随访信息
  481. copyFollowup: function(data) {
  482. return httpPost('/doctor/followup/copyFollowup',{data:data})
  483. },
  484. // 获取随访信息
  485. getFollowup: function(data) {
  486. return httpGet('/doctor/followup/getFollowup',{data:data})
  487. },
  488. //获得协同服务未完成和未读工单的信息
  489. getWorkorderUnfinished: function(data){
  490. return httpGet("/synergy/customer/workorderListTotal", {data: data})
  491. },
  492. //协同工单获取上一次分配的负责人和参与人列表
  493. getSelectedOrderCollaborates: function(data){
  494. return httpGet("/synergy/customer/selectByWorkorder", {data: data})
  495. },
  496. // 知识库右侧结果搜索接口
  497. searchKnowledgePageList: function(data) {
  498. return httpGet("/customer/article/searchKnowledgePageList", {data: data})
  499. },
  500. // 意见反馈
  501. saveFeedback: function(data) {
  502. return httpPost("/customer/saveFeedback", {data: data})
  503. },
  504. //导出通话记录
  505. exportCall: function() {
  506. window.open(server+'/synergy/customer/callrecordOutExcel')
  507. },
  508. // 通过社保卡号或身份证筛选居民列表
  509. findPatientInfo: function (data) {
  510. return httpPost("/customer/findPatientInfo", { data: data })
  511. },
  512. // 通过id获取知识库文章详情
  513. queryOneById: function (data) {
  514. return httpGet("/customer/article/queryOneById", { data: data })
  515. },
  516. //通过身份证号获取未就诊预约记录
  517. getRegListCall:function(data){
  518. return httpGet("/doctor/guahao/GetRegListCall", { data: data })
  519. },
  520. //协同任务关闭工单
  521. closeWorkorder:function(data){
  522. return httpGet('/synergy/customer/closeWorkorder',{data:data})
  523. },
  524. // 根据身份证号换取居民CODE
  525. getPatientAccetokenByIdcard:function(data) {
  526. return httpPost('/customer/getPatientAccetokenByIdcard', {
  527. data: data
  528. })
  529. },
  530. // 查询跟进记录
  531. selectByCode:function(data) {
  532. return httpPost('/customer/selectByCode', {
  533. data: data
  534. })
  535. },
  536. // 获取后续处理人
  537. selectUser:function(data) {
  538. return httpPost('/customer/selectUser', {
  539. data: data
  540. })
  541. },
  542. // 更新通话记录和跟进记录
  543. updateCallRecordAndFollowupRecord:function(data) {
  544. return httpPost('/customer/updateCallRecordAndFollowupRecord', {
  545. data: data
  546. })
  547. },
  548. }
  549. window.APIService = APIService;
  550. })(jQuery)