api.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. const api = {
  2. getGraph: '/kg/getGraph',
  3. getNode: '/kg/getNode',
  4. getSchema: '/api/ltkg/kg/getSchema',
  5. getTree: '/kg/getTree',
  6. entity_predict: 'api/ltkg/nlp/getNlp',
  7. getMrInfo: '/api/ltkg/presetInfo/getMrInfo',
  8. getAnswer: '/api/ltkg/qa/charBot',
  9. getTerm: '/api/ltkg/term/getTerm',
  10. check: 'http://192.168.2.121:7010/test/testStandConvert',
  11. findEntity: "/entity/findEntity", //实体详情查询(根据id查询实体)
  12. deleteEntity: "/entity/deleteEntity", //批量删除实体
  13. mergeEntity: "/entity/mergeEntity",//实体合并
  14. createEntity: "/entity/createEntity",//批量新增实体
  15. updateEntityName: "/entity/updateEntityName",
  16. createRelationship: "/relationship/createRelationship",
  17. findRelationshipType: "/relationship/findRelationshipType", //根据名称模糊查询关系
  18. updateRelationshipType: "/relationship/updateRelationshipType",
  19. createEntityProperty: "/property/createEntityProperty", //批量新增实体属性
  20. deleteRelationship: "/relationship/deleteRelationship",//批量删除关系
  21. findEntityListByName: "/entity/findEntityListByName", //实体列表查询(根据标签和名字模糊查询实体)
  22. updateEntityProperty: "/property/updateEntityProperty", //更新实体属性
  23. deleteEntityProperty: "/property/deleteEntityProperty", //删除实体属性
  24. getCountList: "/kg/count/getCountList",
  25. getCountInfo: "/kg/count/getCountInfo"
  26. };
  27. $(".goto-homeStatic").on("click", function () {
  28. window.location.href = "http://192.168.2.121:5666" + $(this).attr("link");
  29. });
  30. const getUrlArgObject = function (name) {//
  31. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  32. var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
  33. var r = window.location.search.slice(1).match(reg);
  34. var q = window.location.pathname.slice(1).match(reg_rewrite);
  35. if (r != null) {
  36. return decodeURIComponent(r[2]);
  37. } else if (q != null) {
  38. return decodeURIComponent(q[2]);
  39. } else {
  40. return null;
  41. }
  42. }
  43. //判断隐藏logo
  44. const ifHideLogo = function () {
  45. const hideLg = getUrlArgObject("hideLg");
  46. if (hideLg) {
  47. $(".ltLogo").hide();
  48. }
  49. }
  50. const post = function (url, data, pId) {
  51. const securityCode = getUrlArgObject("code");
  52. const appKeyId = getUrlArgObject("appI");
  53. const appKeySecret = getUrlArgObject("appS");
  54. const productId = getUrlArgObject("productId");
  55. return new Promise((resolve, reject) => {
  56. $.ajax({
  57. method: 'post',
  58. url: '/api' + url,
  59. data: JSON.stringify(data),
  60. contentType: "application/json; charset=UTF-8",
  61. beforeSend: function (xmlHttp) {
  62. xmlHttp.setRequestHeader("If-Modified-Since", "0");
  63. xmlHttp.setRequestHeader("Cache-Control", "no-cache");
  64. xmlHttp.setRequestHeader("appKeyId", appKeyId);
  65. xmlHttp.setRequestHeader("appKeySecret", appKeySecret);
  66. xmlHttp.setRequestHeader("securityCode", securityCode);
  67. xmlHttp.setRequestHeader("productId", productId);
  68. },
  69. success: function (res) {
  70. resolve({ data: res });
  71. },
  72. error: function (error) {
  73. reject(error);
  74. },
  75. });
  76. });
  77. }
  78. const typeLis = {
  79. "临床表现": "symptom",
  80. "疾病名称": "disease",
  81. "手术名称": "operation",
  82. "药物名称": "drug",
  83. "药物过敏原": "drug",
  84. "实验室检查套餐": "lis",
  85. "实验室检查": "lis",
  86. "辅助检查": "pacs",
  87. "体征": "vital",
  88. }
  89. const typeLisName = {
  90. "临床表现": "症状",
  91. "疾病名称": "疾病",
  92. //"手术名称": "手术和操作",
  93. "药物名称": "药品",
  94. "药物过敏原": "药品",
  95. "实验室检查套餐": "实验室检查",
  96. "实验室检查": "实验室检查",
  97. "辅助检查": "辅助检查",
  98. "体征": "辅助检查",
  99. }
  100. module.exports = {
  101. post,
  102. api,
  103. typeLisName,
  104. typeLis,
  105. getUrlArgObject,
  106. ifHideLogo
  107. }