common.js 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708
  1. var session = null;
  2. var MenuBtnMap = null;//按钮权限
  3. var url = document.location.pathname;
  4. var itmp = url.indexOf("/", 1);
  5. var webpath = itmp < 0 ? url : url.substr(0, itmp);
  6. if (webpath.indexOf('/') == -1) {
  7. webpath = '/' + webpath;
  8. }
  9. Commonjs = {
  10. /**
  11. * 医院ID
  12. * @return {}
  13. */
  14. hospitalId : '1023577',
  15. hospitalName: '健康之路演示医院',
  16. /**
  17. *
  18. * @param {Object} url
  19. * @param {Object} param
  20. * @param {Object} flag
  21. * @return {TypeName}
  22. */
  23. getRootPath : window.location.protocol + '//' + window.location.host + webpath,
  24. getRoot : window.location.protocol + '//' + window.location.host,
  25. ajax :function (url,param,flag){
  26. var obj = null;
  27. $.ajax({
  28. type: 'POST',
  29. url: url+'?v='+(new Date()),
  30. data: param,
  31. async: flag,
  32. timeout : 6000,
  33. cache : false,
  34. dataType: 'json',
  35. success: function(data){
  36. obj = data;
  37. }
  38. });
  39. if(!flag) return obj;
  40. },
  41. trim : function(str) {
  42. return str.replace(/(^\s*)|(\s*$)/g, "");
  43. },
  44. getUrlParam : function (val) {
  45. var uri = window.location.search;
  46. var re = new RegExp("" +val+ "\=([^\&\?]*)", "ig");
  47. return ((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):null);
  48. },
  49. isEmpty : function(s){
  50. if(s == undefined){
  51. return true;
  52. }else{
  53. if(s == null || s == '' || s == 'undefined'
  54. || s == 'null' || s.length < 1){
  55. return true;
  56. }
  57. }
  58. return false;
  59. },
  60. getUrl : function(model){
  61. if(!this.isEmpty(model)){
  62. return '../'+model+'_doAll.do';
  63. }else{
  64. return '';
  65. }
  66. },
  67. getParams : function(headCode,Service,page){
  68. var params = {};
  69. params.Req = {};
  70. params.Req.Service = {};
  71. if(!this.isEmpty(headCode)){
  72. params.Req.TransactionCode = headCode;
  73. }else return null;
  74. if(!this.isEmpty(Service)){
  75. params.Req.Service = Service;
  76. if(!this.isEmpty(page)){
  77. params.Req.Service.Page = {};
  78. params.Req.Service.Page = page;
  79. }
  80. }else return null;
  81. return params;
  82. },
  83. jsonToString : function(obj){
  84. var THIS = this;
  85. switch(typeof(obj)){
  86. case 'string':
  87. return '"' + obj.replace(/(["\\])/g, '\\$1') + '"';
  88. case 'array':
  89. return '[' + obj.map(THIS.jsonToString).join(',') + ']';
  90. case 'object':
  91. if(obj instanceof Array){
  92. var strArr = [];
  93. var len = obj.length;
  94. for(var i=0; i<len; i++){
  95. strArr.push(THIS.jsonToString(obj[i]));
  96. }
  97. return '[' + strArr.join(',') + ']';
  98. }else if(obj==null){
  99. return 'null';
  100. }else{
  101. var string = [];
  102. for (var property in obj) string.push(THIS.jsonToString(property) + ':' + THIS.jsonToString(obj[property]));
  103. return '{' + string.join(',') + '}';
  104. }
  105. case 'number': return obj;
  106. case false: return obj;
  107. }
  108. },
  109. getSession : function(url) {
  110. var param = {};
  111. if(session == null){
  112. if(Commonjs.isEmpty(url)){
  113. session = this.ajax('../login_getSession.do',param,false);
  114. }else{
  115. session = this.ajax(url,param,false);
  116. }
  117. }
  118. return session;
  119. }, setCookie:function (a, b, c) {
  120. var d = new Date;
  121. d.setDate(d.getDate() + c), cookieVal = a + "=" + escape(b) + (null == c ? "" : ";expires=" + d.toGMTString()), document.cookie = cookieVal;
  122. }, getCookie:function (a) {
  123. return document.cookie.length > 0 && (c_start = document.cookie.indexOf(a + "="), -1 != c_start) ? (c_start = c_start + a.length + 1, c_end = document.cookie.indexOf(";", c_start), -1 == c_end && (c_end = document.cookie.length), unescape(document.cookie.substring(c_start, c_end))) : "";
  124. }, delCookie:function (a) {
  125. var b = new Date;
  126. b.setTime(b.getDate() - 10000), this.getCookie(a) && (document.cookie = a + "=v; expires=" + b.toGMTString());
  127. },updateSession : function(newSession,url) {
  128. var param = {};
  129. param.Session=JSON.stringify(newSession);
  130. if(Commonjs.isEmpty(url)){
  131. this.ajax('../login_updateSession.do',param,false);
  132. }else{
  133. session = this.ajax(url,param,false);
  134. }
  135. Session = newSession;
  136. },
  137. /**
  138. * 获取渠道下拉列表
  139. * @param {Object} elementid (select的id)
  140. * @param {Object} selval (选中值)
  141. * @return {TypeName}
  142. */
  143. loadChannelSelect : function(elementid, selval) {
  144. var param = {};
  145. var Service = {};
  146. Service.key = "";
  147. var code = 91000;
  148. var params = Commonjs.getParams(code,Service);//获取参数
  149. param.Api = "GetChannelSelect";
  150. param.Params = Commonjs.jsonToString(params);
  151. var d = Commonjs.ajax('./channel_callDemoApi.do',param,false);
  152. if(d.RespCode != 10000){
  153. return;
  154. }
  155. var options = '';
  156. options += "<option value=''>--请选择--</option>";
  157. $.each(d.Data,function(i,item){
  158. options += "<option value='" + item.ChannelId + "'>" + item.ChannelName + "</option>";
  159. });
  160. $("#"+elementid).empty();
  161. $("#"+elementid).append(options);
  162. if(!Commonjs.isEmpty(selval)) {
  163. $("#"+elementid).val(selval);
  164. }
  165. },
  166. resizeAllPage : function() {
  167. var winHeight=$(window).height();
  168. $(".aside .scroll-pane").height(winHeight-61).jScrollPane({"autoReinitialise": true,"overflow":true});
  169. if (!($.browser.msie && ($.browser.version == "6.0") && !$.support.style)) {
  170. $(".container-wrap>.scroll-pane").height(winHeight-111).jScrollPane({"autoReinitialise": true});
  171. }else{
  172. $(".container-wrap>.scroll-pane").height(winHeight-111).width($(window).width()-195);
  173. }
  174. },
  175. getDate : function(day) {
  176. var today = new Date();
  177. var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
  178. today.setTime(targetday_milliseconds); // 注意,这行是关键代码
  179. var tYear = today.getFullYear();
  180. var tMonth = today.getMonth();
  181. var tDate = today.getDate();
  182. tMonth = Commonjs.doHandleMonth(tMonth + 1);
  183. tDate = Commonjs.doHandleMonth(tDate);
  184. return tYear + "-" + tMonth + "-" + tDate;
  185. },
  186. doHandleMonth : function(month){
  187. var m = month;
  188. if (month.toString().length == 1) {
  189. m = "0" + month;
  190. }
  191. return m;
  192. },
  193. /**
  194. * icon不传则为提示错误信息, 成功icon传add
  195. *
  196. * @param {Object} msg
  197. * @param {Object} icon
  198. */
  199. alert: function(msg,icon) {
  200. var ic = icon;
  201. if(icon==undefined||Commonjs.isEmpty(icon)) {
  202. ic = 'error';
  203. }
  204. art.dialog({
  205. lock : true,
  206. artIcon : ic,
  207. opacity : 0.4,
  208. width : 250,
  209. title : '提示',
  210. time : 3,
  211. content : msg,
  212. ok : function() {
  213. }
  214. });
  215. },
  216. /**
  217. * 获取客户端操作系统
  218. * @return {TypeName}
  219. */
  220. getOS : function() {
  221. var sUserAgent = navigator.userAgent;
  222. var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");
  223. var isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC") || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel");
  224. if (isMac) return "Mac";
  225. var isUnix = (navigator.platform == "X11") && !isWin && !isMac;
  226. if (isUnix) return "Unix";
  227. var isLinux = (String(navigator.platform).indexOf("Linux") > -1);
  228. var bIsAndroid = sUserAgent.toLowerCase().match(/android/i) == "android";
  229. if (isLinux) {
  230. if(bIsAndroid) return "Android";
  231. else return "Linux";
  232. }
  233. if (isWin) {
  234. var isWin2K = sUserAgent.indexOf("Windows NT 5.0") > -1 || sUserAgent.indexOf("Windows 2000") > -1;
  235. if (isWin2K) return "Win2000";
  236. var isWinXP = sUserAgent.indexOf("Windows NT 5.1") > -1 ||
  237. sUserAgent.indexOf("Windows XP") > -1;
  238. if (isWinXP) return "WinXP";
  239. var isWin2003 = sUserAgent.indexOf("Windows NT 5.2") > -1 || sUserAgent.indexOf("Windows 2003") > -1;
  240. if (isWin2003) return "Win2003";
  241. var isWinVista= sUserAgent.indexOf("Windows NT 6.0") > -1 || sUserAgent.indexOf("Windows Vista") > -1;
  242. if (isWinVista) return "WinVista";
  243. var isWin7 = sUserAgent.indexOf("Windows NT 6.1") > -1 || sUserAgent.indexOf("Windows 7") > -1;
  244. if (isWin7) return "Win7";
  245. }
  246. return "other";
  247. },
  248. checkOS : function() {
  249. var os = Commonjs.getOS();
  250. if(os=='Win2000'||os=='WinXP'||os=='Win2003')
  251. return true;
  252. return false;
  253. },
  254. /**
  255. * 滚动条对象
  256. *
  257. * @param {Object} formId
  258. */
  259. getJscrollpane : null,
  260. /**
  261. * @param {Object} menuId
  262. * 设置改界面按钮的状态,建议在$(function(){最后代码添加})、还有在手动js生成html的时候添加
  263. */
  264. btnPermissionControl:function(menuId){
  265. if ( MenuBtnMap == null ){
  266. //加载按钮数据
  267. var map = {};
  268. var menuData = Commonjs.getSession().Data;
  269. if(menuData.length!=undefined) {
  270. for(var i = 0; i < menuData.length; i++){
  271. var btnArray = menuData[i].BtnPermissionData;
  272. if(btnArray!=undefined && btnArray.length>0){
  273. var tempMenuId = btnArray[0].MenuId;
  274. map[tempMenuId] = btnArray;
  275. }
  276. // btnJson = btnJson.substring(9,btnJson.length);
  277. // btnJson = btnJson.substring(0,btnJson.length-3);
  278. // var btnArray = eval('(' + btnJson + ')');
  279. // if(btnArray.length>0){
  280. // var menuId = btnArray[0].menuId;
  281. // map[menuId] = btnArray;
  282. // }
  283. }
  284. }
  285. MenuBtnMap = map;
  286. }
  287. //循环判断
  288. if( MenuBtnMap[menuId].length>0 ){
  289. for(var i = 0; i < MenuBtnMap[menuId].length; i++){
  290. var btn = MenuBtnMap[menuId][i];
  291. if(btn.State == 0){
  292. $("[btnPermission='"+btn.ButtonType+"']").unbind('click');
  293. $("[btnPermission='"+btn.ButtonType+"']").removeAttr('onclick');
  294. }
  295. }
  296. }
  297. },
  298. //用于兼容对象和对象数组方法,返回对象数组
  299. getObjArray:function (obj) {
  300. if (obj == null || obj == undefined) {
  301. return;
  302. }
  303. if (obj instanceof Array) {
  304. return obj;
  305. } else {
  306. // 把一个的对象放进数组里面返回
  307. var o = new Array();
  308. o.push(obj);
  309. return o;
  310. }
  311. }
  312. }
  313. //////////////////////////////////////////// huangql添加部分 //////////////////////////////////
  314. ComWbj = {
  315. //表单验证:验证单个控件,不符合弹出红色浮动提示框
  316. checkOne:function(formId){
  317. $("#"+formId).validationEngine();
  318. },
  319. //整个表单验证:点击提交按钮时才触发验证规则
  320. checkFormAll:function(formId){
  321. var v = $("#"+formId).validationEngine("validate");
  322. if(v==false){
  323. return;
  324. $("#"+formId).submit(function(){return false;});
  325. }
  326. },
  327. telCheck:function(id){ /* 电话号码没有中杠号时,把电话号码的区号后面,自动添加一个空格号*/
  328. var num = $("#"+id).val(); var str = "";
  329. //var reg_3 = /^(010|02[0-9]|852|853)([0-9]{4}|[0-9]{5}|[0-9]{7}|[0-9]{8})$/; //验证电话号码区号为3位
  330. var reg_3 = /^(010|02[0-9]|852|853)([0-9]{3}|[0-9]{4}|[0-9]{5}|[0-9]{6}|[0-9]{7}|[0-9]{8})$/; //验证电话号码区号为3位
  331. if( reg_3.test(num) & (num.indexOf("-") == -1 || num.indexOf("—")) ){
  332. str = num.substr(0,3).replace(num.substr(0,3), num.substr(0,3)+' ');
  333. $("#"+id).val(str+num.substr(3,num.length));
  334. }
  335. var reg_4 = /^(0[3-9][0-9][0-9])([0-9]{3}|[0-9]{4}|[0-9]{5}|[0-9]{6}|[0-9]{7}|[0-9]{8})$/; //验证电话号码区号为4位
  336. if( reg_4.test(num) & (num.indexOf("-") == -1|| num.indexOf("—")) ){
  337. str = num.substr(0,4).replace(num.substr(0,4), num.substr(0,4)+' ');
  338. $("#"+id).val(str+num.substr(4,num.length));
  339. }
  340. },
  341. /**
  342. 清空特殊字符、自动清空null和undefined
  343. *@param id:input控件的ID号
  344. *@param objStr:过滤的对象:name或者address或者time或者all
  345. *@use 姓名过滤:<input type="text" onBlur="ComWbj.stripStr('deptName','name');" id="deptName" />
  346. *@use 地址过滤:<input type="text" onBlur="ComWbj.stripStr('address','address');" id="address" />
  347. *@use 过滤全部:<textarea onblur="ComWbj.stripStr('deptIntro','all')" id="deptIntro" cols="40" rows="5"></textarea>
  348. */
  349. stripStr:function(id, objStr) {
  350. var val=$("#"+id).val();
  351. var containSpecial = "";
  352. var rs = "";
  353. if(val == "null" || val == "undefined"){
  354. rs="";
  355. }else{
  356. if(objStr == "name") containSpecial = RegExp(/[(\1)(\2)(\3)(\4)(\5)(\6)(\7)(\8)(\9)(\0)(\A)(\B)(\C)(\D)(\E)(\F)(\G)(\H)(\I)(\J)(\K)(\L)(\M)(\N)(\O)(\P)(\Q)(\R)(\S)(\T)(\U)(\V)(\W)(\X)(\Y)(\Z)(\T)(\U)(\V)(\W)(\Z)(\a)(\b)(\c)(\d)(\e)(\f)(\g)(\h)(\i)(\j)(\k)(\l)(\m)(\n)(\o)(\p)(\q)(\r)(\s)(\t)(\u)(\v)(\w)(\x)(\y)(\z)(\ )(\~)(\!)(\!)(\@)(\#)(\$)(\¥)(\*)(\&)(\。)(\,)(\;)(\:)(\%)(\^)(\&)(\*)(\-)(\_)(\+)(\=)(\|)(\\)(\;)(\:)(\`)(\')(\")(\‘)(\’)(\“)(\”)(\,)(\.)(\/)(\?)(\?)]+/);
  357. else if(objStr == "address") containSpecial = RegExp(/[(\1)(\2)(\3)(\4)(\5)(\6)(\7)(\8)(\9)(\0)(\A)(\B)(\C)(\D)(\E)(\F)(\G)(\H)(\I)(\J)(\K)(\L)(\M)(\N)(\O)(\P)(\Q)(\R)(\S)(\T)(\U)(\V)(\W)(\X)(\Y)(\Z)(\T)(\U)(\V)(\W)(\Z)(\a)(\b)(\c)(\d)(\e)(\f)(\g)(\h)(\i)(\j)(\k)(\l)(\m)(\n)(\o)(\p)(\q)(\r)(\s)(\t)(\u)(\v)(\w)(\x)(\y)(\z)(\ )(\~)(\!)(\!)(\@)(\$)(\¥)(\&)(\。)(\%)(\^)(\&)(\_)(\+)(\=)(\|)(\\)(\;)(\;)(\:)(\')(\")(\‘)(\“)(\?)(\?)]+/);
  358. else if(objStr == "time") containSpecial = RegExp(/[(\1)(\2)(\3)(\4)(\5)(\6)(\7)(\8)(\9)(\0)(\A)(\B)(\C)(\D)(\E)(\F)(\G)(\H)(\I)(\J)(\K)(\L)(\M)(\N)(\O)(\P)(\Q)(\R)(\S)(\T)(\U)(\V)(\W)(\X)(\Y)(\Z)(\T)(\U)(\V)(\W)(\Z)(\a)(\b)(\c)(\d)(\e)(\f)(\g)(\h)(\i)(\j)(\k)(\l)(\m)(\n)(\o)(\p)(\q)(\r)(\s)(\t)(\u)(\v)(\w)(\x)(\y)(\z)(\ )(\~)(\!)(\@)(\#)(\$)(\¥)(\……)(\*)(\&)(\()(\))(\【)(\】)(\。)(\,)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=)(\[)(\])(\{)(\})(\|)(\\)(\;)(\')(\")(\,)(\.)(\<)(\>)(\?)(\)]+/);
  359. else containSpecial = RegExp(/[(\1)(\2)(\3)(\4)(\5)(\6)(\7)(\8)(\9)(\0)(\A)(\B)(\C)(\D)(\E)(\F)(\G)(\H)(\I)(\J)(\K)(\L)(\M)(\N)(\O)(\P)(\Q)(\R)(\S)(\T)(\U)(\V)(\W)(\X)(\Y)(\Z)(\T)(\U)(\V)(\W)(\Z)(\a)(\b)(\c)(\d)(\e)(\f)(\g)(\h)(\i)(\j)(\k)(\l)(\m)(\n)(\o)(\p)(\q)(\r)(\s)(\t)(\u)(\v)(\w)(\x)(\y)(\z)(\ )(\~)(\!)(\@)(\#)(\$)(\¥)(\……)(\*)(\&)(\()(\))(\【)(\】)(\。)(\,)(\%)(\^)(\&)(\*)(\()(\))(\-)(\—)(\_)(\+)(\=)(\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\:)(\“)(\”)(\‘)(\’)(\`)(\《)(\》)(\!)(\')(\")(\,)(\、)(\.)(\●)(\/)(\<)(\>)(\?)(\?)]+/);
  360. for (var i = 0; i < val.length; i++) { rs = rs + val.substr(i, 1).replace(containSpecial, ''); }
  361. }
  362. return $("#"+id).val(rs);
  363. },
  364. /**
  365. 清空指定的特殊字符
  366. *@param id:input控件的ID号
  367. *@param str:指定的特殊字符(中间以(\)分隔,比如要删除# +,写成:(\#)(\+))
  368. *@use 比如需要清空+ & #:<textarea onblur="stripOutStr(this,'[$\']')" id="deptIntro" cols="40" rows="5"></textarea>
  369. */
  370. stripOutStr:function(id,str) {
  371. var pattern = new RegExp(str)
  372. var s=$(id).val();
  373. var rs = "";
  374. for (var i = 0; i < s.length; i++) { rs = rs + s.substr(i, 1).replace(pattern, ''); }
  375. },
  376. /**
  377. * 功能:将浮点数四舍五入,取小数点后2位
  378. * 用法: changeTwoDecimal(3.1415926) 返回 3.14
  379. * changeTwoDecimal(3.1475926) 返回 3.15
  380. */
  381. changeTwoDecimal:function(x) {
  382. var f_x = parseFloat(x);
  383. if (isNaN(f_x)){
  384. ComWbj.alertIconNo("提示","function:changeTwoDecimal->parameter error","warning");
  385. return false;
  386. }
  387. var f_x = Math.round(x*100)/100;
  388. return f_x;
  389. },
  390. trim:function(id){ $("#"+id).val($("#"+id).val().replace(/(^\s*)|(\s*$)/g, "")); }, //去除input输入框的首尾空格
  391. trimStr:function(str){ return str.replace(/(^\s*)|(\s*$)/g, ""); }, //去除字符串首尾空格
  392. /**
  393. 截取字符串
  394. *@param str:被截取的字符串
  395. *@param start:从start位开始截取
  396. **@param end:从end位结束
  397. */
  398. subStrChar:function(str,start,end){ return str.substr(start,end); },
  399. getSex:function(sex){ //根据数字1和2判断男女
  400. var s ='';
  401. switch (parseInt(sex)){
  402. case 1: s='男'; break;
  403. case 2: s='女'; break;
  404. default: s='未知'; break;
  405. }
  406. return s;
  407. },
  408. getDoctorType:function(type){ //根据数字1和2判断男女
  409. var s ='';
  410. switch (parseInt(type)){
  411. case 1: s='医生'; break;
  412. case 2: s='药师'; break;
  413. case 3: s='技师'; break;
  414. case 3: s='护士'; break;
  415. default: s='其他'; break;
  416. }
  417. return s;
  418. },
  419. isNull:function(param){ //判断对象是否为空
  420. if(typeof(param) == undefined || typeof(param) == 'undefined' || param == null || param == '')
  421. return true;
  422. else
  423. return false;
  424. },
  425. strIsNull:function(str){ //判断字符串是否为空
  426. if(str == null || str == undefined){
  427. return '';
  428. }else{
  429. return str;
  430. }
  431. },
  432. isNotNull:function(param){ return !ComWbj.isNull(param); }, //判断对象是否不为空
  433. clearArry:function(arry){ //清空数组中的空值
  434. for(var f = 0 ;f < arry.length; f++){
  435. if(arry[f] == "" || typeof(arry[f]) == "undefined"){ arry.splice(f,1); f= f-1;}
  436. }
  437. },
  438. /*************************************** 弹窗 ****************************************************/
  439. /*关闭弹窗*/
  440. closePop:function(id){
  441. $('#'+id).hide();
  442. },
  443. /*显示弹窗*/
  444. showPop:function(id){
  445. $('#'+id).show();
  446. },
  447. //开启消息正在加载提示
  448. openPG:function(){
  449. YihuUtil.dialog({
  450. title:'消息正在加载....',
  451. content : '<img src="../yygh/pg1.gif"/>',
  452. lock : true,
  453. padding : 0,
  454. id: 'pg'
  455. });
  456. },
  457. //结束消息正在加载
  458. closePG:function(){
  459. YihuUtil.wid().art.dialog.list["pg"].close();
  460. },
  461. //打开进度条
  462. openProgress:function(){
  463. $.messager.progress({
  464. title:'进度',
  465. msg:'正在提交,请稍等...'
  466. });
  467. },
  468. //关闭进度条
  469. closeProgress:function(){
  470. $.messager.progress('close');
  471. },
  472. //确定提示: 调用:alertMsg('导入成功20条数据','');
  473. alertMsg:function(msg,action){
  474. YihuUtil.dialog({
  475. title:"提示",
  476. content: msg,
  477. button : [{
  478. name : '确定',
  479. callback : action
  480. }]
  481. });
  482. },
  483. //自定义弹出框
  484. alertMsgOk:function(a, b) {
  485. YihuUtil.dialog( {
  486. title : a,
  487. id : 'alertMsgOk',
  488. content : b,
  489. lock : true,
  490. button : [ {
  491. name : 'OK',
  492. focus : true
  493. } ]
  494. })
  495. },
  496. //自定义弹出框3,带icon标志符号(关闭时不会自动刷新当前页面)
  497. alertIconNo:function(a, b,icon) {
  498. YihuUtil.dialog( {
  499. title : a,
  500. id : 'alertIconNoReload',
  501. content : b,
  502. icon:icon,
  503. close:function(){
  504. },
  505. lock : true,
  506. button : [ {
  507. name : 'OK',
  508. focus : true
  509. } ]
  510. })
  511. },
  512. //自定义弹出框,带icon标志符号(关闭会刷新当前页面)
  513. alertIcon:function(a, b,icon) {
  514. YihuUtil.dialog( {
  515. title : a,
  516. id : 'alertIcon',
  517. content : b,
  518. icon:icon,
  519. close:function(){
  520. window.location.reload();
  521. },
  522. lock : true,
  523. button : [ {
  524. name : 'OK',
  525. focus : true
  526. } ]
  527. })
  528. },
  529. alertAutoClose:function(a, b, icon, url) { //未使用
  530. YihuUtil.dialog( {
  531. title : a,
  532. id : 'alertAutoClose',
  533. content : b,
  534. icon:icon,
  535. time: 3000,
  536. close:function(){
  537. location.href = url;
  538. },
  539. lock : true
  540. })
  541. },
  542. alertClose:function() { //未使用
  543. YihuUtil.dialog( {
  544. time: 3000
  545. })
  546. },
  547. /**
  548. * 短暂提示,自动关闭
  549. * @param content {String} 提示内容
  550. * @param time {Number} 显示时间 (默认1.5秒)
  551. * @param url {String} 要跳转的地址,不需要跳转时可以写成null
  552. */
  553. artTips:function (title, icon, content, time, url) {
  554. return artDialog({
  555. id: 'Tips',
  556. title: title,
  557. icon: icon,
  558. cancel: false,
  559. fixed: true,
  560. lock: true,
  561. ok: false,
  562. close: function(){
  563. if(url != null){
  564. location.href = url;
  565. }
  566. }
  567. })
  568. .content('<div style="padding: 20px;font-size:14px;">' + content + '</div>')
  569. .time(time || 1);
  570. },
  571. /**
  572. * 短暂提示,自动关闭
  573. * @param content {String} 提示内容
  574. * @param time {Number} 显示时间 (默认1.5秒)
  575. * @param url {String} 自定义 by wuyiqing
  576. */
  577. sofunartTips:function (title, icon, content, time,fun) {
  578. return artDialog({
  579. id: 'Tips',
  580. title: title,
  581. icon: icon,
  582. cancel: false,
  583. fixed: true,
  584. lock: true,
  585. ok: false,
  586. close: function(){
  587. fun();
  588. }
  589. })
  590. .content('<div style="padding: 20px;font-size:14px;">' + content + '</div>')
  591. .time(time || 1);
  592. },
  593. /**
  594. 删除提示框
  595. * @param message: 删除提示信息
  596. * @param action: do操作的地址
  597. * @param param: 删除需要的具体参数数组
  598. * @return
  599. */
  600. alertDel:function(message,action,param){
  601. alertify.confirm(message, function (e) {
  602. if(e) {//确认删除
  603. doAjaxLoadData(action, param, function(resp) {
  604. if(resp.Code == 10000){
  605. window.location.reload();
  606. alertify.success("已删除成功!");
  607. }
  608. });
  609. }
  610. });
  611. },
  612. /**
  613. 删除提示框(存在特定不允许删除的条件时,弹出不可删除的提示信息)
  614. * @param url: do操作的地址
  615. * @param param: 删除需要的具体参数数组
  616. * @EX
  617. */
  618. alertDelTwo:function(url, params){
  619. YihuUtil.dialog({
  620. title:"提示",
  621. content: '确认要删除么?',
  622. button : [{
  623. name: '确认',
  624. callback: function () {
  625. doAjaxLoadData(url, params, function(result) {
  626. if (result.code == -1) {
  627. ComWbj.alertIconNo("提示",result.message,"error");
  628. } else {
  629. ComWbj.alertIcon("提示","删除成功!","succeed");
  630. }
  631. });
  632. }
  633. },
  634. {
  635. name: '取消'
  636. }]
  637. });
  638. },
  639. //页面弹出:写有html的层
  640. alertHtml:function(title,id,fun) {
  641. YihuUtil.dialog( {
  642. title : title,
  643. id : 'testID',
  644. padding: '0px 0px',
  645. content : document.getElementById(id),
  646. lock : true,
  647. close : function() {
  648. },
  649. button : [
  650. {
  651. name: '确定',
  652. //callback: function () {
  653. callback: function fun() {
  654. Demo_getVal(this.DOM.dialog[0]);
  655. return true;
  656. },
  657. focus: true
  658. },
  659. {
  660. name: '确定2',
  661. callback: function () {
  662. }
  663. },
  664. {
  665. name: '取消'
  666. }
  667. ]
  668. /*button : [
  669. {
  670. name: '确定',
  671. callback: function () {
  672. Demo_getVal(this.DOM.dialog[0]);
  673. return false;
  674. },
  675. focus: true
  676. },
  677. {
  678. name: '不同意',
  679. callback: function () {
  680. alert('你不同意')
  681. }
  682. },
  683. {
  684. name: '无效按钮',
  685. disabled: true
  686. },
  687. {
  688. name: '关闭我'
  689. }
  690. ]*/
  691. });
  692. },
  693. /*设置弹窗垂直居中*/
  694. popBoxMiddle:function(id){
  695. popbox=$("#"+id);
  696. for(i=0;i<popbox.length;i++){
  697. popbox.eq(i).css("margin-top",function(){
  698. return "-"+$(this).height()/2+"px";
  699. })
  700. }
  701. },
  702. //打开遮罩界面 (dialogName:弹窗的名称;title:标题;id:iframe的ID)
  703. pocmessage:function(dialogName,id,title,o,index,val) {
  704. YihuUtil.dialog( {
  705. title : title, id : dialogName, padding: '0', content : document.getElementById(id), lock : true,
  706. close : function() {
  707. if(o){
  708. if(index == 3){
  709. loadDeptSelect(o.id);
  710. }else if(index == 2 && val != null && val != 0){
  711. loadDoctorSelect(val,o.id);
  712. }
  713. ComWbj.closePop(dialogName);
  714. }else window.location.reload();
  715. },
  716. button : [ ]
  717. });
  718. },
  719. closeDiaLog:function(id){ YihuUtil.wid().art.dialog.list[id].close(); }, //关闭YihuUtil.dialog弹出框
  720. /****************************************** 复选框操作 **************************************************/
  721. /**
  722. 复选框全选
  723. * @param checkAll: 勾选全选的复选框的name属性名称
  724. * @param checkChild: 列表中被选中的复选框name属性名称
  725. */
  726. checkAll:function(checkAll,checkChild){
  727. var checked= $("input[name='"+checkAll+"']").attr('checked');
  728. if(checked!='checked') checked=false;
  729. $.each($("input[name='"+checkChild+"']"),function(i,item){
  730. $(this).attr('checked',checked);
  731. });
  732. },
  733. /**
  734. 获取复选框选中项的值
  735. * @param name: 列表中被选中的复选框name属性名称
  736. */
  737. getChecks:function(name){
  738. var hy='';
  739. var hys=[];
  740. $.each($("input[name='"+checks+"']:checked"),function(i,item){
  741. hys.push(item.value);
  742. });
  743. hy=hys.toString();
  744. return hy;
  745. },
  746. /**
  747. 下拉列表框中有多个复选框:点击后下拉框可多选,若选择多个,中间用“,”隔开;若选择太多,框内无法显示,则以“…”号表示
  748. * @param name: 列表中被选中的复选框name属性名称
  749. * @param textId: 显示内容的文本框ID
  750. * @param selectDivId: 装载复选框的DIV的ID
  751. */
  752. setSelectChecks:function(name,textId,selectDivId){
  753. var strText = $("#"+textId).text(); //文本框最终要显示的内容
  754. $("#"+textId).live('click', function() { //点击时,显示select列表
  755. $("#"+selectDivId).slideDown();
  756. })
  757. $("input[name='"+ name +"']").live('click', function() { //选中复选框的值
  758. var strSplit = strText.split(",");
  759. if($(this).attr('checked') == "checked"){
  760. strText = strText + ',' + $(this).val();
  761. }else{
  762. if($(this).val() == strSplit[strSplit.length-1]){ //如果是最后个词,是没有逗号
  763. strText = strText.replace( "," + $(this).val() , "");
  764. }else{
  765. strText = strText.replace( $(this).val() + "," , "");
  766. }
  767. if(strSplit.length == 1){
  768. strText = strText.replace( $(this).val() , "--请选择--");
  769. }
  770. }
  771. if(strText.substr(0,1) == ","){
  772. $("#"+textId).text(ComWbj.subStrChar(strText,1,strText.length));
  773. }else if(strText.substr(0,8) == "--请选择--,"){
  774. $("#"+textId).text(ComWbj.subStrChar(strText,8,strText.length));
  775. }else{
  776. $("#"+textId).text(ComWbj.subStrChar(strText,0,strText.length));
  777. }
  778. });
  779. $("#"+selectDivId).live('mouseover', function() { //显示
  780. $(this).show();
  781. });
  782. $("#"+selectDivId).live('mouseout', function() { //隐藏
  783. $(this).hide();
  784. });
  785. },
  786. /****************************************** 下拉列表操作 **************************************************/
  787. /**
  788. 设置下拉列表框的值
  789. *@param id:select 的 id
  790. *@param list:select 的 list值
  791. *@param itemId:option 的 value值
  792. *@param itemName:option 的 name值
  793. */
  794. setSelectVal:function(id,list,itemId,itemName){
  795. var options = '';
  796. options += "<option value=''>--请选择--</option>";
  797. $.each(list,function(i,item){
  798. options += "<option value='" + itemId + "'>" + itemName + "</option>";
  799. });
  800. $("#"+id).empty();
  801. $("#"+id).append(options);
  802. },
  803. /****************************************** 单选按钮操作 **************************************************/
  804. radioIsChecked:function(n){ //判断一组中的某个单选按钮是否选中
  805. alert($(":radio[name='ReplyType']").eq(n).is(":checked"));
  806. },
  807. /*************************** 排序 医生信息->医生排序;科室信息->科室排序 ***************************************/
  808. ZH:function(list,i,fs){ //重排序
  809. if(fs==1){
  810. var dd={};
  811. dd=list[i];
  812. list[i]=list[i-1];
  813. list[i-1]=dd;
  814. }else if(fs==2){
  815. var dd={};
  816. dd=list[i];
  817. list[i]=list[i+1];
  818. list[i+1]=dd;
  819. }else{
  820. var dd={};
  821. dd=list[i];
  822. for(var j=i;j>0;){
  823. list[j]=list[j-1]
  824. j=j-1;
  825. }
  826. list[0]=dd;
  827. }
  828. return list;
  829. },
  830. goUp:function(i){ //上移
  831. if(i==0){ return false; }
  832. SORTLIST = ComWbj.ZH(SORTLIST,i,1); //SORTLIST是全局变量
  833. PlayV();
  834. },
  835. goFirst:function(i){ //置顶
  836. if(i==0){ return false; }
  837. SORTLIST = ComWbj.ZH(SORTLIST,i,3); //SORTLIST是全局变量
  838. PlayV();
  839. },
  840. goDown:function(i){ //下移
  841. if(i==(SORTLIST.length-1)){
  842. return false;
  843. }
  844. SORTLIST = ComWbj.ZH(SORTLIST,i,2); //SORTLIST是全局变量
  845. PlayV();
  846. },
  847. /**
  848. * 快捷:向上
  849. * */
  850. fastUpZH:function(list,i,fs,num){ //list是要排序的列表;i是当前对象;fs是向上或者向下排序;num是共跳转多少行
  851. var temp = []; //要排序的列表
  852. var rr = []; var ss = []; var a; var z; var x; var y; var j;
  853. var s = []; //上
  854. var ff = []; //中
  855. var b = []; //下
  856. if(fs==11){ //之前
  857. for(var j=i-num;j<=i;j++){ temp[j] = list[j]; } //要排序的列表
  858. ComWbj.clearArry(temp); //清空数组空值
  859. for(a=0;a<=num;a++){ //重新生成正确的排序
  860. if(a != num) rr[a] = temp[a];
  861. else ss[0] = temp[a];
  862. }
  863. for(z=0;z<i-num;z++){ s[z] = list[z]; } //要排序的列表
  864. ff = $.merge(ss, rr); //将正确的排序保存到数组
  865. y=0;
  866. for(x=i*1+1*1;x<list.length;x++){ b[y] = list[x]; y++; } //要排序的列表
  867. list = $.merge( $.merge(s,ff), b); //将正确的排序保存到数组
  868. }else{ //之后
  869. for(j=i*1-num*1+1*1;j<=i;j++){ temp[j] = list[j]; } //要排序的列表
  870. ComWbj.clearArry(temp); //清空数组空值
  871. for(a=0;a<num;a++){ //重新生成正确的排序
  872. if(a !=num*1-1*1 ) rr[a] = temp[a];
  873. else ss[0] = temp[a];
  874. }
  875. for(z=0;z<i*1-num*1+1*1;z++){ s[z] = list[z]; } //要排序的列表
  876. ff = $.merge(ss,rr); //将正确的排序保存到数组
  877. y=0;
  878. for(x=i*1+1*1;x<list.length;x++){ b[y] = list[x]; y++; } //要排序的列表
  879. list = $.merge( $.merge(s,ff), b); //将正确的排序保存到数组
  880. }
  881. return list;
  882. },
  883. /**
  884. * 快捷:向下
  885. * */
  886. fastDownZH:function(list,i,fs,num){ //list是要排序的列表;i是当前对象;fs是向上或者向下排序;num是共跳转多少行
  887. var temp = []; //要排序的列表
  888. var rr = []; var ss = []; var a; var z; var x; var y; var j;
  889. var s = []; //上
  890. var ff = []; //中
  891. var b = []; //下
  892. if(fs==11){ //之前
  893. for(var j=i-num;j<=i;j++){ temp[j] = list[j]; } //要排序的列表
  894. ComWbj.clearArry(temp); //清空数组空值
  895. for(a=0;a<=num;a++){ //重新生成正确的排序
  896. if(a != num) rr[a] = temp[a];
  897. else ss[0] = temp[a];
  898. }
  899. for(z=0;z<i-num;z++){ s[z] = list[z]; } //要排序的列表
  900. ff = $.merge(ss, rr); //将正确的排序保存到数组
  901. y=0;
  902. for(x=i*1+1*1;x<list.length;x++){ b[y] = list[x]; y++; } //要排序的列表
  903. list = $.merge( $.merge(s,ff), b); //将正确的排序保存到数组
  904. }else{ //之后
  905. for(j=i;j<=i*1+num*1;j++){ temp[j] = list[j]; } //要排序的列表
  906. ComWbj.clearArry(temp); //清空数组空值
  907. for(a=0;a<=num;a++){ //重新生成正确的排序
  908. if(a >0 ) rr[a] = temp[a];
  909. else ss[0] = temp[a];
  910. }
  911. for(z=0;z<i;z++){ s[z] = list[z]; } //要排序的列表
  912. ff = $.merge(rr,ss); //将正确的排序保存到数组
  913. y=0;
  914. for(x=i*1+1*1+num*1;x<list.length;x++){ b[y] = list[x]; y++; } //要排序的列表
  915. list = $.merge( $.merge(s,ff), b); //将正确的排序保存到数组
  916. ComWbj.clearArry(list); //清空数组空值
  917. }
  918. return list;
  919. },
  920. /**** 具体查看:user/js/zwqxsz.js:function init() *****/
  921. //在li集合中向上移动
  922. up:function(obj){
  923. var _div = $(obj).parent().parent(),
  924. _divp = _div.parent() ,
  925. _divs = _divp.children("li") ,
  926. _divindex = _divs.index(_div);
  927. if(_divindex>0){
  928. _divs.eq(_divindex-1).before(_div);
  929. }
  930. },
  931. //在li集合中向下移动
  932. down:function(obj){
  933. var _div = $(obj).parent().parent() ,
  934. _divp = _div.parent() ,
  935. _divs = _divp.children("li") ,
  936. _divindex = _divs.index(_div);
  937. if(_divindex<_divs.length-1){
  938. _divs.eq(_divindex+1).after(_div);
  939. }
  940. },
  941. vagueDate:function(id,Diseasejson){
  942. $("#"+id).focus(function(){
  943. return false;
  944. }).autocomplete(Diseasejson,{
  945. max:15,
  946. scrollHeight: 300,
  947. matchContains: true,
  948. formatItem: function(row, i, max){ return row.name },
  949. formatMatch: function(row, i, max) { return row.name + "[" + row.sname+"]"; },
  950. formatResult: function(row) { return row.name; }
  951. });
  952. $("#"+id).click().autocomplete(Diseasejson,{
  953. max:15,
  954. scrollHeight: 300,
  955. matchContains: true,
  956. formatItem: function(row, i, max){ return row.name },
  957. formatMatch: function(row, i, max) { return row.name + "[" + row.sname+"]"; },
  958. formatResult: function(row) { return row.name; }
  959. });
  960. $("#"+id).result(function(event, data, formatted){
  961. if(data){
  962. $("#"+id).val(data.id); $("#"+id).val(data.name); $("#"+id).val(data.name);
  963. }else{
  964. $("#"+id).val(0); $("#"+id).val(''); $("#"+id).val('');
  965. }
  966. });
  967. },
  968. /**
  969. 仿芒果网智能提示
  970. *@param TopOrgName:第一次点击时,展示出来的列表对象
  971. *@param FindOrdName:用户输入值时,匹配好的列表对象
  972. *@param inputID:隐藏域ID
  973. */
  974. suggestComplete:function(TopOrgName,FindOrdName,inputID){
  975. },
  976. /*************************** 跟时间有关 ***************************************/
  977. /**
  978. 比较日期
  979. *@param stattime:开始时间
  980. *@param endtime:结束时间
  981. *@param str:提示的信息
  982. *@use if(!compareDate($('#DateTimeStart').val(),$('#DateTimeEnd').val())){
  983. ComWbj.alertMessage('开始时间不能比结束时间大','');
  984. return;
  985. }
  986. */
  987. compareDate:function(stattime,endtime,str){
  988. var start=new Date(stattime.replace("-", "/").replace("-", "/"));
  989. var endTime=$("#endTime").val();
  990. var end=new Date(endtime.replace("-", "/").replace("-", "/"));
  991. if(end<start){
  992. ComWbj.alertIconNo("提示",str,"warning");
  993. return;
  994. }
  995. },
  996. /**
  997. 返回N天[前或者后]当前日期的字符串格式(-或者/格式)
  998. *@param Nday: 多少天后
  999. *@param str: 字符串格式(-或者/格式)
  1000. *@调用EX getDateStr(7,'/');
  1001. */
  1002. getDateStr:function(Nday,str,opt) {
  1003. var dd = new Date();
  1004. if(opt == "+") dd.setDate(dd.getDate()+Nday);//获取Nday天前的日期
  1005. else dd.setDate(dd.getDate()-Nday);//获取Nday天后的日期
  1006. var y = dd.getFullYear();
  1007. var m = dd.getMonth()+1;//获取当前月份的日期
  1008. var d = dd.getDate();
  1009. if(m < 10) m = "0"+m;
  1010. if(d<10) d = "0"+d;
  1011. if(str == "-") return y+"-"+m+"-"+d;
  1012. else if(str == "/") return y+"/"+m+"/"+d;
  1013. },
  1014. //获取完整的时间,返回EX:2014年07月18日 10:21:16 星期五
  1015. clockOn:function() {
  1016. var now = new Date();
  1017. var year = now.getFullYear();
  1018. var month = now.getMonth();
  1019. var date = now.getDate();
  1020. var day = now.getDay();
  1021. var hour = now.getHours();
  1022. var minu = now.getMinutes();
  1023. var sec = now.getSeconds();
  1024. var week;
  1025. month = month + 1;
  1026. if (month < 10) month = "0" + month;
  1027. if (date < 10) date = "0" + date;
  1028. if (hour < 10) hour = "0" + hour;
  1029. if (minu < 10) minu = "0" + minu;
  1030. if (sec < 10) sec = "0" + sec;
  1031. var arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
  1032. week = arr_week[day];
  1033. var time = "";
  1034. time = year + "年" + month + "月" + date + "日" + " " + hour + ":" + minu + ":" + sec + " " + week;
  1035. $("#bgclock").html(time);
  1036. var timer = setTimeout("clockon()", 200);
  1037. },
  1038. //根据数字:1、2、3,返回字符串时段(上午、下午、晚上)
  1039. getTime:function(timeID){
  1040. var time='';
  1041. switch (parseInt(timeID)){
  1042. case 1: time='上午'; break;
  1043. case 2: time='下午'; break;
  1044. case 3: time='晚上'; break;
  1045. default: break;
  1046. }
  1047. return time;
  1048. },
  1049. getSubstrTime:function(time){
  1050. if(time == null || time == undefined){
  1051. return '';
  1052. }else{
  1053. return time.substring(0,11);
  1054. }
  1055. },
  1056. //根据数字:1、2、3、4、5、6、7,设置字符串星期值
  1057. getWeek:function(weekID){
  1058. var xq='未知';
  1059. switch (weekID) {
  1060. case 0: xq='星期日'; break;
  1061. case 1: xq='星期一'; break;
  1062. case 2: xq='星期二'; break;
  1063. case 3: xq='星期三'; break;
  1064. case 4: xq='星期四'; break;
  1065. case 5: xq='星期五'; break;
  1066. case 6: xq='星期六'; break;
  1067. default: break;
  1068. }
  1069. return xq;
  1070. },
  1071. //根据系统当前时间获取星期几
  1072. chinaWeek:function(){
  1073. var weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  1074. var myDate = new Date(Date.parse(v.replace(/-/g, "/")));
  1075. return weekDay[myDate.getDay()];
  1076. },
  1077. /*************************** 点击input时,弹出树 ***************************************/
  1078. /**
  1079. 在input下面弹出装载树的层
  1080. * @param mainId: 要弹出层的控件的ID
  1081. * @param divId: 装载内容的控件的ID名
  1082. */
  1083. showMenu:function(mainId,divId){
  1084. var divObj = $("#"+mainId);
  1085. var divOffset = $("#"+mainId).offset();
  1086. $("#"+divId).css( { left : divOffset.left + "px",
  1087. top : divOffset.top + divObj.outerHeight() + "px"
  1088. }).slideDown("fast");
  1089. },
  1090. /**
  1091. * @param divId: 弹出的层内容的ID
  1092. */
  1093. hideMenu:function(divId){ $("#"+divId).fadeOut("fast"); },
  1094. /**
  1095. 选中弹出层里面的值
  1096. * @param mainId: 要弹出层的控件的ID
  1097. * @param divId: 装载内容的控件的ID名
  1098. */
  1099. changeMenu:function(mainId,divId){
  1100. $("#"+mainId).mouseout(function(event){
  1101. var div = document.getElementById(divId);
  1102. var x=event.pageX;
  1103. var y=event.pageY;
  1104. var divx1 = div.offsetLeft;
  1105. var divy1 = div.offsetTop;
  1106. var divx2 = div.offsetLeft + div.offsetWidth;
  1107. var divy2 = div.offsetTop + div.offsetHeight;
  1108. if( x < divx1 || x > divx2 || y < divy1 || y > divy2){
  1109. ComWbj.hideMenu(divId);
  1110. }
  1111. })
  1112. $("#"+divId).mouseout(function(event){
  1113. var div = document.getElementById(divId);
  1114. var x=event.pageX;
  1115. var y=event.pageY;
  1116. var divx1 = div.offsetLeft;
  1117. var divy1 = div.offsetTop;
  1118. var divx2 = div.offsetLeft + div.offsetWidth;
  1119. var divy2 = div.offsetTop + div.offsetHeight;
  1120. if( x < divx1 || x > divx2 || y < divy1 || y > divy2){
  1121. ComWbj.hideMenu(divId);
  1122. }
  1123. })
  1124. },
  1125. /*************************** 图片相关 ***************************************/
  1126. /**
  1127. 查看图片:放大、缩小
  1128. * @param url: 大图的url
  1129. */
  1130. lookImg:function(url){
  1131. YihuUtil.dialog( {
  1132. title : '查看图片',
  1133. id : 'lookImg',
  1134. padding: '0px 0px',
  1135. content : '<div style=" width:500px; height:500px;overflow:auto;"><img src="'+url+'" id="lookImg" style="width:500px; height:500px;" /></div>',
  1136. lock : true,
  1137. button : [ {
  1138. name : '放大',
  1139. focus : true,
  1140. callback:function(){
  1141. var doc = this.DOM.dialog[0];
  1142. var t1=$(doc).find("#lookImg");
  1143. var width=t1.css('width');
  1144. t1.css('width',parseInt(width)*1.1+'px');
  1145. var height=t1.css('height');
  1146. t1.css('height',parseInt(height)*1.1+'px');
  1147. return false;
  1148. }
  1149. },{
  1150. name : '缩小',
  1151. callback:function(){
  1152. var doc = this.DOM.dialog[0];
  1153. var t1=$(doc).find("#lookImg");
  1154. var width=t1.css('width');
  1155. t1.css('width',parseInt(width)/1.1+'px');
  1156. var height=t1.css('height');
  1157. t1.css('height',parseInt(height)/1.1+'px');
  1158. return false;
  1159. }
  1160. } ]
  1161. })
  1162. },
  1163. /*************************** 跟页面显示有关(css) ***************************************/
  1164. /**
  1165. 颜色区分:设置一种不同颜色
  1166. * @param val: 列表显示的值
  1167. * @param name: 要显示不同颜色,所匹配的名称
  1168. * @param color: 设置的样式名
  1169. * @调用EX setColor_1(name,"待接收","c_djs");
  1170. */
  1171. setColor_1:function(val,name,color){
  1172. if(val==name){
  1173. return "class='"+color+"'";
  1174. }
  1175. },
  1176. /**
  1177. 颜色区分:设置俩种不同颜色
  1178. * @param val: 列表显示的值
  1179. * @param name1: 要显示不同颜色,所匹配的名称
  1180. * @param color1: 设置的颜色值
  1181. *
  1182. * @param name2: 要显示不同颜色,所匹配的名称
  1183. * @param color2: 设置的样式名
  1184. * @调用EX setColor_1(name,"待接收","c_djs","待就诊","c_jz");
  1185. */
  1186. setColor_2:function(val,name1,color1,name2,color2){
  1187. if(val==name1){
  1188. return "class='"+color1+"'";
  1189. }else if(val==name2){
  1190. return "class='"+color2+"'";
  1191. }
  1192. },
  1193. /**
  1194. 选项卡:tab切换
  1195. *@param tabconId:装载内容的层的ID名
  1196. *@param menuId: 装载li的Ul的ID名
  1197. *@use tabs('tabcon','tabmenu');
  1198. *注意 :要定义样式名:tab-con,用于控制显示和隐藏div
  1199. */
  1200. tabs:function(tabconId,menuId){
  1201. $tabcon = $("#"+tabconId);
  1202. $tabcon.find(".tab-con:first-child").show();
  1203. $("#"+menuId).delegate(
  1204. "li",
  1205. "click",
  1206. function() {
  1207. var i = $(this).index();
  1208. $("#"+menuId).find("li").removeClass("on");
  1209. $(this).addClass("on");
  1210. $tabcon.find(".tab-con").hide().end().find(
  1211. ".tab-con:eq(" + i + ")").show();
  1212. })
  1213. },
  1214. setScreenAutoHeight:function(id){ //根据桌面可视范围设置高度
  1215. var h = window.screen.availHeight;
  1216. $("#"+id).css("height",h-400);
  1217. },
  1218. /*********************************************** 页面常用的辅助功能 ***************************************/
  1219. /**
  1220. 新窗口预览
  1221. *@param url:预览要跳转的页面地址
  1222. */
  1223. preview:function(url){
  1224. if( $.browser.msie && ( $.browser.version == '8.0' || $.browser.version == '7.0' || $.browser.version == '6.0') ){
  1225. alert("为了让您看到更好的展示效果,请您在最新版本的IE,或者火狐、谷歌浏览器中预览您的微官网!");
  1226. }else{
  1227. window.open(url,'','width=380px,height=600px');
  1228. }
  1229. },
  1230. /**
  1231. 打印
  1232. *@param url:打印结果页面地址
  1233. *@param data:要传给打印结果页面的数据
  1234. */
  1235. printHtml:function(url,data){
  1236. var k=window.showModalDialog(url,data,"dialogWidth=750px;dialogHeight=500px;status:no;location=No;");// toolbar=No代表新窗口不显示工具栏(设置为yes则相反) location=No窗口不显示地址栏(同上) status=No窗口不显示状态栏(同上) membar=No窗口不显示菜单(同上) scrollbars=auto表示窗口滚动条自动显示 resizable=yes表示窗口可以用鼠标调整大小 width=500设置窗口宽度 height=500设置窗口高度。
  1237. },
  1238. isPC:function () { //判断是PC还是手机
  1239. var userAgentInfo = navigator.userAgent;
  1240. var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
  1241. var flag = true;
  1242. for (var v = 0; v < Agents.length; v++) {
  1243. if (userAgentInfo.indexOf(Agents[v]) > 0) {
  1244. flag = false;
  1245. break;
  1246. }
  1247. }
  1248. return flag;
  1249. },
  1250. copyText: function (id) { //复制文本内容
  1251. var targetText = document.getElementById(id);
  1252. try {
  1253. var clipText = targetText.createTextRange();
  1254. clipText.execCommand("Copy");
  1255. ComWbj.alertIconNo('提示','复制成功,可以按Ctrl+V粘贴','succeed');
  1256. } catch(e) {
  1257. ComWbj.alertIconNo('提示','您的浏览器不支持剪贴板复制,请手工复制文本框内容!','warning');
  1258. targetText.focus();//获得焦点
  1259. targetText.select();//选中文本
  1260. }
  1261. },
  1262. /*********************************************** 页面常用的控件 ***************************************/
  1263. /**
  1264. 百度的富文本编辑器:Ueditor
  1265. *@param id:装载富文本编辑器的div的ID
  1266. *@use ue1=ComWbj.baiduUeditor('content1');
  1267. ue2=ComWbj.baiduUeditor('content2'); //一个页面可以定义多个富文本编辑器
  1268. 取值:var GeContent1=ue1.getContent();
  1269. var GeContent2=ue2.getContent();
  1270. */
  1271. baiduUeditor:function(id){
  1272. //var ue = UE.getEditor(id,{ autoHeight: false ,
  1273. return UE.getEditor(id,{ autoHeight: false ,
  1274. autoClearinitialContent :false,
  1275. autoFloatEnabled: false,
  1276. catchRemoteImageEnable:false,
  1277. toolbars: [ [
  1278. 'undo', //撤销
  1279. 'redo', //重做
  1280. 'bold', //加粗
  1281. 'indent', //首行缩进
  1282. 'italic', //斜体
  1283. 'underline', //下划线
  1284. 'strikethrough', //删除线
  1285. 'subscript', //下标
  1286. 'fontborder', //字符边框
  1287. 'superscript', //上标
  1288. 'formatmatch', //格式刷
  1289. 'blockquote', //引用
  1290. 'pasteplain', //纯文本粘贴模式
  1291. 'selectall', //全选
  1292. 'horizontal', //分隔线
  1293. 'removeformat', //清除格式
  1294. 'time', //时间
  1295. 'date', //日期
  1296. 'unlink', //取消链接
  1297. 'inserttable', //插入表格
  1298. 'insertrow', //前插入行
  1299. 'insertcol', //前插入列
  1300. 'mergeright', //右合并单元格
  1301. 'mergedown', //下合并单元格
  1302. 'deleterow', //删除行
  1303. 'deletecol', //删除列
  1304. 'splittorows', //拆分成行
  1305. 'splittocols', //拆分成列
  1306. 'splittocells', //完全拆分单元格
  1307. 'deletecaption', //删除表格标题
  1308. 'inserttitle', //插入标题
  1309. 'mergecells', //合并多个单元格
  1310. 'deletetable', //删除表格
  1311. 'cleardoc', //清空文档
  1312. 'insertparagraphbeforetable', //"表格前插入行"
  1313. 'insertcode', //代码语言
  1314. 'fontfamily', //字体
  1315. 'fontsize', //字号
  1316. 'paragraph', //段落格式
  1317. 'simpleupload', //单图上传
  1318. 'insertimage', //多图上传
  1319. 'insertvideo',//插入视频
  1320. 'edittable', //表格属性
  1321. 'edittd', //单元格属性
  1322. 'link', //超链接
  1323. 'spechars', //特殊字符
  1324. 'searchreplace', //查询替换
  1325. 'map', //Baidu地图
  1326. 'gmap', //Google地图
  1327. 'justifyleft', //居左对齐
  1328. 'justifyright', //居右对齐
  1329. 'justifycenter', //居中对齐
  1330. 'justifyjustify', //两端对齐
  1331. 'forecolor', //字体颜色
  1332. 'backcolor', //背景色
  1333. 'insertorderedlist', //有序列表
  1334. 'insertunorderedlist', //无序列表
  1335. 'fullscreen', //全屏
  1336. 'directionalityltr', //从左向右输入
  1337. 'directionalityrtl', //从右向左输入
  1338. 'rowspacingtop', //段前距
  1339. 'rowspacingbottom', //段后距
  1340. 'pagebreak', //分页
  1341. 'imagecenter', //居中
  1342. 'lineheight', //行间距
  1343. 'edittip ', //编辑提示
  1344. 'customstyle', //自定义标题
  1345. 'autotypeset', //自动排版
  1346. 'touppercase', //字母大写
  1347. 'tolowercase', //字母小写
  1348. 'drafts', // 从草稿箱加载
  1349. 'charts', // 图表
  1350. 'source', //源代码
  1351. 'preview', //预览
  1352. 'help' //帮助
  1353. ]]
  1354. });
  1355. },
  1356. /**
  1357. 分页控件
  1358. *@param totalcounts:列表总数
  1359. *@param pagecount:一共多少页
  1360. *@param pagesize:页面展示数量
  1361. */
  1362. allPages: function (totalcounts, pagecount, pagesize) {
  1363. $("#pager").pager( {
  1364. totalcounts : totalcounts,
  1365. pagesize : pagesize,
  1366. pagenumber : $("#pagenumber").val(),
  1367. pagecount : pagecount,
  1368. buttonClickCallback : function(a) {
  1369. $("#pagenumber").val(a);
  1370. init();
  1371. }
  1372. });
  1373. },
  1374. getTotalPage:function(total,pagesize){ //hql 2014-8-5:获取多少页
  1375. var ys=total%pagesize; var zs=total/pagesize;
  1376. if(ys==0) return parseInt(zs);
  1377. else return parseInt(zs)+1;
  1378. },
  1379. /**
  1380. * 初始化树.
  1381. * @param treedata
  1382. * @param treeoption
  1383. * @return
  1384. */
  1385. initTree:function(treedata,treeoption){
  1386. var htmls = '<ul>';
  1387. $.each(treedata,function(index,val){
  1388. var formatli = null;
  1389. if(treeoption.formatli){ formatli = treeoption.formatli; }
  1390. if(formatli){
  1391. var li = formatli(index,treedata,val);
  1392. var children = val.children;
  1393. if(children.length > 0){ li += initTree(children,treeoption,true); }
  1394. htmls += li;
  1395. }
  1396. });
  1397. htmls += '</ul>';
  1398. $("#"+treeoption.id).html(htmls);
  1399. $("#"+treeoption.id).SimpleTree({
  1400. click: treeoption.onclick
  1401. });
  1402. return htmls;
  1403. },
  1404. /**
  1405. * 生成树要用的数据类型 *
  1406. * @param data 数据集
  1407. * @param attrpid 父级id的属性名称
  1408. * @param attrpidv 父级id的属性名称的值是多少表示改对象是父级对象
  1409. * @param id 主键属性名称
  1410. * @return
  1411. */
  1412. initTreeData:function(data,attrpid,attrpidv,id){
  1413. var treedate = [];
  1414. var chdata = {};
  1415. $.each(data,function(index,val){
  1416. if(val[attrpid] == attrpidv) treedate.push(val);
  1417. val.children = [];
  1418. chdata[val[id]]=val;
  1419. });
  1420. $.each(data,function(index,val){
  1421. if(val[attrpid] != attrpidv){
  1422. if(chdata[val[attrpid]]!=undefined) chdata[val[attrpid]].children.push(val);
  1423. }
  1424. });
  1425. return treedate;
  1426. },
  1427. //hql 2014-8-6: 点击新增坐诊科室,弹出树
  1428. clickTreeInput: function(treeData,treeUl,treeInput,treeDiv, setTreeNode){
  1429. var setting = {
  1430. view : { showIcon : false, showLine : false },
  1431. data: { key: {
  1432. name: "deptName"
  1433. }
  1434. },
  1435. callback : {
  1436. onAsyncSuccess : function() { },
  1437. onClick : setTreeNode
  1438. }
  1439. };
  1440. $.fn.zTree.init($("#"+treeUl), setting, treeData);
  1441. ComWbj.showMenu(treeInput,treeDiv);
  1442. },
  1443. /**
  1444. 图片上传
  1445. *@param id:点击触发上传事件的file控件的ID号
  1446. *@param imgID:用于显示上传好的img控件的ID号
  1447. *@use <div class="xd"><!--请注意:btn-gray-l这个class名,input和button要一致-->
  1448. <input id="up" onchange="uploadImg('up','disImg');" class="cs jd iefa btn-gray-l" type="file"/>
  1449. <input type="button" class="btn-gray-l" value="上传图片"></input>
  1450. </div>
  1451. */
  1452. upLoadImg:function(id, imgID) {
  1453. var filename = $("#" + id).val();
  1454. if (filename == null || filename == '') return;
  1455. if(filename.indexOf(".")>-1){
  1456. var p=filename.lastIndexOf(".");
  1457. var strp=filename.substring(p,filename.length)+'|';
  1458. if(".jpeg|.gif|.jpg|.png|.bmp|.pic|".indexOf(strp.toLowerCase())==-1){
  1459. ComWbj.alertIconNo('图片选择错误提示','图片格式必须为.jpeg|.jpg|.gif|.png','warning');
  1460. return;
  1461. }
  1462. }
  1463. var arrID = [ id ];
  1464. $.yihuUpload.ajaxFileUpload( {
  1465. url : '/WbjUI/servlet/UploadFileServlet?param={hosid:' + YihuUtil.getSession().orgid
  1466. + '}&File=true&filename=' + filename + "&Api=WBJ", // 用于文件上传的服务器端请求地址
  1467. secureuri : false,// 一般设置为false
  1468. fileElementId : arrID,// 文件上传空间的id属性 <input type="file" id="file" name="file" />
  1469. dataType : 'json',// 返回值类型 一般设置为json
  1470. success : function(data, status) {
  1471. var uri = data.Uri;
  1472. var name = data.NewFileName;
  1473. var fname = data.FileName;
  1474. var size = data.Size;
  1475. var old = $("#" + id + "_f");
  1476. $("#" + imgID).attr("src", uri);
  1477. },
  1478. error : function(data, status, e) {
  1479. ComWbj.alertIconNo("提示","上传失败!",'error');
  1480. }
  1481. });
  1482. },
  1483. /**
  1484. * 设置数据表格的参数
  1485. *
  1486. * @param tableId:表格ID
  1487. * @param url:ajax请求地址
  1488. * @param columns:表格具体的列
  1489. */
  1490. dataTable:function(tableId,url,columns){
  1491. $("#" + tableId).dataTable({
  1492. "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",//定义DataTable布局的一个强大属性
  1493. "sPaginationType": "bootstrap",//分页样式使用bootstrap
  1494. "sScrollX": "100%", //表格的宽度
  1495. "sScrollXInner": "100%", //表格的内容宽度
  1496. "bScrollCollapse": true, //当显示的数据不足以支撑表格的默认的高度时,依然显示纵向的滚动条。(默认是false)
  1497. "bPaginate": true, //是否显示分页
  1498. "bLengthChange": true, //每页显示的记录数
  1499. "bFilter": true, //搜索栏
  1500. "bSort": true, //是否支持排序功能
  1501. "bInfo": true, //显示表格信息
  1502. "bAutoWidth": true, //自适应宽度
  1503. //"sAjaxDataProp":data, //sAjaxDataProp
  1504. "sAjaxSource": url,
  1505. //"fnServerData": executeQuery,
  1506. "fnServerParams": function (aoData) {
  1507. aoData.push({"name": "conds", "value": data});
  1508. }, //ajax请求地址
  1509. "aaSorting": [[1, "asc"]], //设置默认的列——排序 ,第一个参数表示数组 (由0开始)。1 表示Browser列。第二个参数为 desc或是asc
  1510. "aoColumns": columns,//列设置,表有几列,数组就有几项
  1511. "bProcessing": true,
  1512. "bStateSave": true, //保存状态到cookie *************** 很重要 , 当搜索的时候页面一刷新会导致搜索的消失。使用这个属性就可避免了
  1513. "sPaginationType": "full_numbers", //分页,一共两种样式,full_numbers和two_button(默认)
  1514. "oLanguage": {
  1515. "sLengthMenu": "每页显示 _MENU_ 条记录",
  1516. "sZeroRecords": "Sorry~ 未找到!您可以试试搜索其他词",
  1517. "sInfo": "当前显示 _START_ 到 _END_ 条,共 _TOTAL_ 条记录",
  1518. "sInfoEmtpy": "喔喔...查询不到相关数据了",
  1519. "sInfoFiltered": "数据表中共有 _MAX_ 条记录)",
  1520. "sProcessing": "正在加载中...",
  1521. "sSearch": "搜索",
  1522. "sUrl": "", //多语言配置文件,可将oLanguage的设置放在一个txt文件中,例:Javascript/datatable/dtCH.txt
  1523. "oPaginate": {
  1524. "sFirst": "首页",
  1525. "sPrevious": " 上一页 ",
  1526. "sNext": " 下一页 ",
  1527. "sLast": "尾页 "
  1528. }
  1529. }, //多语言配置
  1530. "bJQueryUI": false, //可以添加 jqury的ui theme 需要添加css
  1531. "aLengthMenu": [[10, 25, 50, -1], ["每页10条", "每页25条", "每页50条", "显示所有数据"]] //设置每页显示记录的下拉菜单
  1532. });
  1533. },
  1534. /**
  1535. 仿芒果网智能提示
  1536. *@param orgNameId:搜索机构名称的输入框ID
  1537. *@param hiddenOrdId:
  1538. *@param listDivId:展示查询结果的div的ID
  1539. *@param orgId:对应机构id
  1540. */
  1541. getAllOrgName:function(orgNameId,hiddenOrdId,listDivId,orgId){
  1542. //智能联想提示
  1543. var TopOrgName = new Array();
  1544. var FindOrdName = new Array();
  1545. var params = {};
  1546. params.start = 0;
  1547. params.limit = 10;
  1548. if(orgId!=null){
  1549. params.orgid = orgId;
  1550. }else{
  1551. params.orgid = session.orgid;
  1552. }
  1553. params.status = 1 // :开启,-1:关闭,0待审核
  1554. //params.medicalorgtype = $('#medicalorgtype').val(); //机构类别 1 医院 2 社区
  1555. //params.provinceid = $('#sheng').val(); //省份
  1556. //params.cityid = $('#shi').val(); //城市id
  1557. $.post('/WbjUI/wbj2/business/web/ReferralZcsq_queryReferralPath.do', params, function (result) {
  1558. if(result.Code==10000){
  1559. $.each(result.Result,function(i,item){
  1560. if( result.Result.length > 10){
  1561. if(i < 10){
  1562. TopOrgName[i] = new Array('','' + item.hospitalname + '','','');
  1563. }
  1564. }else{
  1565. TopOrgName[i] = new Array('','' + item.hospitalname + '','','');
  1566. }
  1567. FindOrdName[i] = new Array('','' + item.hospitalname + '','','');
  1568. });
  1569. }else {
  1570. ComWbj.alertIconNo('提示',result.Message,'error');
  1571. }
  1572. }, "json");
  1573. $("#"+orgNameId).suggest(
  1574. FindOrdName,
  1575. {
  1576. hot_list:TopOrgName,
  1577. dataContainer:'#'+hiddenOrdId,
  1578. onSelect:function(){
  1579. //$("#city2").click();
  1580. },
  1581. attachObject:'#'+listDivId
  1582. },"机构"
  1583. );
  1584. ComWbj.suggestComplete(TopOrgName,FindOrdName,"hidden_ordId"); //智能提示插件
  1585. },
  1586. /**
  1587. 仿芒果网智能提示
  1588. *@param orgNameId:搜索机构名称的输入框ID
  1589. *@param hiddenOrdId:
  1590. *@param listDivId:展示查询结果的div的ID
  1591. */
  1592. getAllDoctorName:function(doctorNameId,hiddenDoctorId,listDivId){
  1593. //智能联想提示
  1594. var TopDoctorName = new Array();
  1595. var FindDoctorName = new Array();
  1596. var params = {};
  1597. var pa = "{'orgId':" + session.orgid + ",'pageIndex':1,'userTypes':'1,3,4','pageSize':100}";
  1598. param.Param=pa;
  1599. param.Api = "baseinfo.DepartUserApi.queryUserInfoList";
  1600. doAjaxLoadData("../bmry_doAll.do", param,function(resp) {
  1601. if (resp.Code == '10000') {
  1602. $.each(resp.Result,function(i,item){
  1603. if( resp.Result.length > 10){
  1604. if(i < 10){
  1605. TopDoctorName[i] = new Array('','' + item.userName + '','','');
  1606. }
  1607. }else{
  1608. TopDoctorName[i] = new Array('','' + item.userName + '','','');
  1609. }
  1610. FindDoctorName[i] = new Array('','' + item.userName + '','','');
  1611. });
  1612. }else {
  1613. ComWbj.alertIconNo('提示',resp.Message,'error');
  1614. }
  1615. }, "json");
  1616. $("#"+doctorNameId).suggest(
  1617. FindDoctorName,
  1618. {
  1619. hot_list:TopDoctorName,
  1620. dataContainer:'#'+hiddenDoctorId,
  1621. onSelect:function(){
  1622. //$("#city2").click();
  1623. },
  1624. attachObject:'#'+listDivId
  1625. },"医生"
  1626. );
  1627. ComWbj.suggestComplete(TopDoctorName,FindDoctorName,"hidden_ordId"); //智能提示插件
  1628. },
  1629. suggest:function(input, options) {}
  1630. }