123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- const qs = require('qs');
- const $ = require("jquery");
- var Promise = require('./rePromise');
- let imgReg = /undefined/g
- let iconWarning = require('./../images/icon_warning.png')
- let iconSymptomPush = require('./../images/icon_symptom_push.png')
- let iconLisPush = require('./../images/icon_lis_push.png')
- let iconPacsPush = require('./../images/icon_pacs_push.png')
- let iconScalePush = require('./../images/icon_scale_push.png')
- let iconOperationPush = require('./../images/icon_operation_push.png')
- let iconDrugPush = require('./../images/icon_drug_push.png')
- let iconDiagPush = require('./../images/icon_diag_push.png')
- let iconCommonTreatPush = require('./../images/icon_drug_push.png')
- let iconCheckupPush = require('./../images/icon_checkup_push.png')
- //重写assign方法imgR
- if (typeof Object.assign != 'function') {
- Object.assign = function (target) {
- 'use strict';
- if (target == null) {
- throw new TypeError('Cannot convert undefined or null to object');
- }
- target = Object(target);
- for (var index = 1; index < arguments.length; index++) {
- var source = arguments[index];
- if (source != null) {
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- }
- return target;
- };
- }
- window.console = window.console || (function () {
- var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
- = c.clear = c.exception = c.trace = c.assert = function () { };
- return c;
- })();
- const config = {
- pushInner: '/sys/push/push',
- indicationPush:'/sys/push/indicationPush',
- calculate: '/api/data/calc/calculate',
- disclaimer: '/sys/disclaimerInfo/getDisclaimerInfo',
- information: '/api/data/conceptDetail/getConceptDetail',
- informationMore: '/api/data/conceptDetail/getConceptDetails',
- pushScale: '/api/data/push/pushScale',
- getSysSetInfoDatas: '/sys/plan/getSysPlanInfoDatas',
- getMr: '/sys/mr/getMr', //页面推送患者信息
- getMr2: '/sys/mr/getMr', //icss推送患者信息
- getVersion: '/sys/versionInfo/getVersionInfoAlls',
- getStaticKnowledge: '/graph/conceptInfo/staticKnowledgeIndex',//静态知识检索
- getStaticScale: '/api/data/search/getScale',
- dictionaryInfo: '/sys/dictionaryInfo/getList', //字典信息
- getPushSet:'/sys/plan/getSysPlanInfoDatas', //获取推送配置
- analyse:'/api/data/mrqc/analyse',
- getHosptDeptUsal:'/api/data/concept/getHosptDeptUsal', //获取科室常用标签
- ruleTypeMap:{ //大数据推送参数featureType对应
- '22':'1,2',
- '11':'3',
- '8':'4,5'
- }
- }
- const imageUrlPrefix = 'http://192.168.2.121:82';
- // const getUrlArgObject = function(parm) {
- // var query = decodeURI(window.location.search);
- // var args = qs.parse(qs.parse(query.substr(1)));
- // return args[parm];//返回对象
- // }
- const getUrlArgObject = function getQueryString(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
- var r = window.location.search.substr(1).match(reg);
- var q = window.location.pathname.substr(1).match(reg_rewrite);
- if (r != null) {
- return decodeURIComponent(r[2]);
- } else if (q != null) {
- return decodeURIComponent(q[2]);
- } else {
- return null;
- }
- }
- const post = function (url, data) {
- return new Promise((resolve, reject) => {
- $.ajax({
- method: 'post',
- url: url,
- data: JSON.stringify(data),
- contentType: "application/json; charset=UTF-8",
- beforeSend: function (xmlHttp) {
- xmlHttp.setRequestHeader("If-Modified-Since", "0");
- xmlHttp.setRequestHeader("Cache-Control", "no-cache");
- },
- success: function (res) {
- resolve({ data: res });
- },
- error: function (error) {
- reject(error);
- },
- });
- });
- }
- const newinConf = {
- width: '600', //窗口的文档显示区的宽度。以像素计。
- height: '600', //窗口文档显示区的高度。以像素计。
- left: '0', //窗口的 x 坐标。以像素计。
- top: '0', //窗口的 y 坐标。以像素计。
- openMode: "_blank" //每次都是新窗口打开为_blank,打开同一窗口填写任意字符串
- }
- const newWindowLocation = `width=${newinConf.width}, height=${newinConf.height}, left=${newinConf.left}, top=${newinConf.top} scrollbars=yes`
- const openNewWin = function (url) {
- window.open(url, newinConf.openMode, newWindowLocation)
- }
- //判断浏览器是否为Ie8
- const isIe8 = function () {
- var DEFAULT_VERSION = 8.0;
- var ua = navigator.userAgent.toLowerCase();
- var isIE = ua.indexOf("msie") > -1;
- var safariVersion;
- if (isIE) {
- safariVersion = ua.match(/msie ([\d.]+)/)[1];
- }
- if (safariVersion <= DEFAULT_VERSION) {
- return true
- }
- }
- const throttle = function (fn, threshhold) {
- var timeout
- var start = new Date;
- var threshhold = threshhold || 160
- return function () {
- var context = this, args = arguments, curr = new Date() - 0
- clearTimeout(timeout)//总是干掉事件回调
- if (curr - start >= threshhold) {
- // console.log("now", curr, curr - start)//注意这里相减的结果,都差不多是160左右
- fn.apply(context, args) //只执行一部分方法,这些方法是在某个时间段内执行一次
- start = curr
- } else {
- //让方法在脱离事件后也能执行一次
- timeout = setTimeout(function () {
- fn.apply(context, args)
- }, threshhold);
- }
- }
- }
- const titleConfig = {
- warning:{
- background: "#FFE8DD",
- icon: iconWarning,
- name:"智能警示"
- },
- symptomPush:{
- background: "#EEF5FD",
- icon: iconSymptomPush,
- name:"推荐症状"
- },
- diagPush:{
- background: "#FAECED",
- icon: iconDiagPush,
- name:"智能诊断"
- },
- checkupPush:{
- background: "#EEF5FD",
- icon: iconCheckupPush,
- name:"推荐体格检查"
- },
- scalePush:{
- background: "#ECF4FC",
- icon: iconScalePush,
- name:"推荐量表"
- },
- lisPush:{
- background: "#ECF4FC",
- icon: iconLisPush,
- name:"推荐化验"
- },
- pacsPush:{
- background: "#ECF4FC",
- icon: iconPacsPush,
- name:"推荐辅检"
- },
- drugPush:{
- background: "#E3FEFE",
- icon: iconDrugPush,
- name:"推荐用药"
- },
- operationPush:{
- background: "#E3FEFE",
- icon: iconOperationPush,
- name:"推荐手术及操作"
- },
- }
- module.exports = {
- config,
- post,
- getUrlArgObject,
- imageUrlPrefix,
- throttle,
- openNewWin,
- isIe8,
- titleConfig
- }
|