denizen.js 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. var self; //当前页面对象
  2. var patiCode; //居民标识
  3. var currDays = 7; //默认日期类型
  4. var indexType = "1"; //指标类型
  5. var currIndexCode = "" //当前要显示的指标类型
  6. var docType=""//医生类别
  7. var signType = "";
  8. var oPatiInfo =null;
  9. var iscroller = null;
  10. var doctorCode = null;
  11. var qyRelation;
  12. var overdue; //判断患者与医生的签约状态是否已过期
  13. var currService;
  14. var jtServerCode=[];//服务类型名称
  15. var jtAdminTeamId; // 标记患者的签约团队id
  16. var isDebug=true;//开放点击函数直接改为false
  17. Function.prototype.isdebug=function(callback){
  18. if(isDebug) return mui.toast("功能开发中,敬请期待");
  19. if(callback) callback();
  20. this.call(this.constructor);
  21. }
  22. function getNowDate() {
  23. var date = new Date();
  24. var month = date.getMonth() + 1;
  25. var strDate = date.getDate();
  26. if (month >= 1 && month <= 9) {
  27. month = "0" + month;
  28. }
  29. if (strDate >= 0 && strDate <= 9) {
  30. strDate = "0" + strDate;
  31. }
  32. var currentdate = date.getFullYear() + "-" + month + "-" + strDate;
  33. return currentdate;
  34. }
  35. var date_end = getNowDate();
  36. function getDateBefore(days){//获取多少天前的日期
  37. var now = new Date();
  38. var date = new Date(now.getTime() - days * 24 * 3600 * 1000);
  39. var year = date.getFullYear();
  40. var month = date.getMonth() + 1;
  41. var day = date.getDate();
  42. var hour = date.getHours();
  43. var minute = date.getMinutes();
  44. var second = date.getSeconds();
  45. return year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
  46. };
  47. var date_begin = getDateBefore(6);
  48. mui.plusReady(function() {
  49. self = plus.webview.currentWebview();
  50. patiCode = self.patiCode || '915cc456-5b1d-11e6-8344-fa163e8aee56';
  51. doctorCode = JSON.parse(plus.storage.getItem("docInfo")).code;
  52. overdue = self.overdue;
  53. var docType = plus.storage.getItem("docType");
  54. if(docType!=3){//健康医生不查看家庭成员
  55. $(".jtcyli").show()
  56. }
  57. $("#pati_info").attr("code",patiCode);
  58. localStorage.removeItem('updateService');
  59. getPatiInfo();
  60. initScroller();
  61. });
  62. mui.back = function(){
  63. // self.opener().reload(true);
  64. //如果父窗口为im, 更新im
  65. if(self.opener().id=='p2dzixun'){
  66. mui.fire(self.opener(), 'update');
  67. }
  68. self.close();
  69. }
  70. //获取病人信息
  71. function getPatiInfo(){
  72. sendPost("/doctor/patient_label_info/patient",
  73. {patient: patiCode}, null,
  74. function(res){
  75. if(res.status == 200){
  76. oPatiInfo = res.data;
  77. oPatiInfo.signType = 0;
  78. jtAdminTeamId = res.data.jtAdminTeam;
  79. //判断居民类型 如果是慢病病人 则续方管理模块出现否则隐藏
  80. for(var i in oPatiInfo.serverTypes){
  81. if(oPatiInfo.serverTypes[i].server_type==4||oPatiInfo.serverTypes[i].server_type==5){
  82. $("#mbda").show();
  83. }
  84. }
  85. //判断居民是否为女性 则产检模块出现否则隐藏
  86. if(oPatiInfo.sex == 2){
  87. $("#fybj").show();
  88. }
  89. if(oPatiInfo.ssDoctor==doctorCode || oPatiInfo.ssDoctorHealth==doctorCode){
  90. oPatiInfo.signType = 1;
  91. }
  92. if(oPatiInfo.jtDoctor==doctorCode || oPatiInfo.jtDoctorHealth==doctorCode){
  93. oPatiInfo.signType = oPatiInfo.signType == 1 ? 3 : 2;
  94. oPatiInfo.expensesStatus1 = oPatiInfo.expensesStatus;
  95. }
  96. //服务类型
  97. if(oPatiInfo.serverTypes){
  98. $.map(oPatiInfo.serverTypes,function(item,index){
  99. jtServerCode.push(item.server_type)
  100. })
  101. }
  102. bindEvents();
  103. dealPatiInfoTmpl(oPatiInfo);
  104. $(".div-dianhua").attr("data-mobile",oPatiInfo.mobile).attr("data-phone",oPatiInfo.phone);
  105. } else {
  106. mui.toast("获取病人信息失败");
  107. }
  108. },'POST','',true);
  109. }
  110. function sendWeixinRemind() {
  111. sendPost("doctor/family_contract/wechat_focus_remind",
  112. {patient: patiCode,isAll:0}, null,
  113. function(res){
  114. if(res.status == 200){
  115. oPatiInfo.wechatFocusRemind = 1;
  116. showRemindBtn(true);
  117. } else {
  118. oPatiInfo.wechatFocusRemind = 1;
  119. showRemindBtn(true);
  120. mui.toast(res.msg);
  121. }
  122. },'POST','',true);
  123. }
  124. function showRemindBtn(isReminded) {
  125. var $remind = $("#remind_gz");
  126. $remind.show();
  127. if(isReminded) {
  128. $remind.addClass("ytx");
  129. $remind.find("a").text("已提醒关注");
  130. } else {
  131. $remind.removeClass("ytx");
  132. $remind.find("a").text("提醒关注微信");
  133. }
  134. }
  135. function checkWeixinRemind(data) {
  136. return new Promise(function(resolve, reject) {
  137. sendPost("doctor/family_contract/is_patient_remind_focus",
  138. {patient: patiCode}, null,
  139. function(res){
  140. if(res.status == 200){
  141. if(res.data==0) { // 0: 当日未提醒
  142. isWeiXinRemind(data);
  143. }
  144. } else {
  145. mui.toast(res.msg);
  146. }
  147. },'POST','',true)
  148. });
  149. }
  150. function isWeiXinRemind (data) {
  151. if(data) {
  152. var isReminded = data.wechatFocusRemind=="1"? true: false,
  153. // 签约类型: 1-->三师 2-->家庭 3-->三师 、家庭两者都有
  154. signType = data.signType,
  155. // 缴费状态: 2-->已退费 1-->已缴费 0-->未交费
  156. expensesStatus = data.expensesStatus,
  157. openid = data.openid;
  158. if(!openid) {
  159. // 有签约家庭医生,但未交费,则有该悬浮按钮
  160. if((signType=="2" || signType=="3") && expensesStatus=="1") {
  161. showRemindBtn(isReminded);
  162. }
  163. // 2、如只有三师签约,但无openid,则有该悬浮按钮
  164. else if(signType == "1") {
  165. showRemindBtn(isReminded);
  166. }
  167. }
  168. }
  169. }
  170. //查询某个患者今天是否已提醒
  171. function isYitixing(){
  172. sendPost("/doctor/family_contract/is_patient_remind_expenses",{patient:patiCode},null,function(res){
  173. if(res.status==200){
  174. if(res.data==1){//data为1已提醒 为0未提醒
  175. $("#remindPay").addClass("ytx");
  176. //则显示“已提醒缴费"
  177. $("#remindPay a").text("已提醒缴费");
  178. }else{
  179. $("#remindPay").removeClass("ytx");
  180. $("#remindPay a").text("提醒缴费");
  181. }
  182. }
  183. })
  184. }
  185. //缴费提醒
  186. function jiaofeitixing(){
  187. sendPost("/doctor/family_contract/expenses_remind",{patient:patiCode,isAll:"0"},null,function(res){
  188. mui.toast(res.msg);
  189. if(res.status==200){
  190. isYitixing();//查询某个患者今天是否已提醒
  191. }
  192. })
  193. }
  194. //提醒缴费
  195. $("#remindPay").on("tap",function(){
  196. mui("#sheet1").popover('toggle');
  197. if($(this).hasClass("ytx")){//今日已提醒
  198. mui.toast("居民今天已经收到过缴费提醒了哦,不可再次提醒");
  199. }else{//今日未提醒,则缴费提醒
  200. jiaofeitixing();
  201. }
  202. })
  203. /*提醒续签*/
  204. function sendRenewRemind(){
  205. var url = "/doctor/sign/remindPatientRenew",
  206. params = {patient: oPatiInfo.code};
  207. sendPost(url, params, null, function(res){
  208. if(res.status == 200){
  209. if(res.data == 1 || res.data == 2){
  210. $("#remindXQ").find("a").text("已提醒续签");
  211. $("#remindXQ").addClass("ytx");
  212. }
  213. mui.toast(res.msg);
  214. }else{
  215. mui.toast(res.msg)
  216. }
  217. }, "post", "", true);
  218. }
  219. ////获取服务类型
  220. function getServiceDropdown(){
  221. sendPost("/doctor/sign/getSigndict",{}, null, function(res){
  222. if(res.status == 200){
  223. fillServiceDropdown(res);
  224. }else{
  225. mui.toast(res.msg)
  226. }
  227. }, "get", "", true);
  228. }
  229. //普通 老年 高血 糖尿 孕妇 儿童 贫困 计生 重性 残疾 结核
  230. function filterSer(name){
  231. var $li = $('.dw-bf').find('div.dw-li');
  232. $li.addClass('dw-v');
  233. var nameArr = name.split(',');
  234. $.map(nameArr,function(item,index){
  235. if(item.trim() == '普通人群'){
  236. var arr = [2,3,6,7,8,9,10]
  237. $.map(arr,function(it,index){
  238. $li.eq(it).removeClass('dw-v')
  239. })
  240. }
  241. if(item.trim() == '老年人'){
  242. var arr = [4,5]
  243. $.map(arr,function(it,index){
  244. $li.eq(it).removeClass('dw-v')
  245. })
  246. }
  247. if(item.trim() == '高血压' ||item.trim() == '糖尿病'||item.trim() == '贫困人口'||item.trim() == '计生特殊人群'||item.trim() == '重性精神疾病'||item.trim() == '残疾人'||item.trim() == '结核病' ){
  248. var arr = [0]
  249. $.map(arr,function(it,index){
  250. $li.eq(it).removeClass('dw-v')
  251. })
  252. }
  253. if(item.trim() == '0-6岁儿童'){
  254. var arr = [1,4]
  255. $.map(arr,function(it,index){
  256. $li.eq(it).removeClass('dw-v')
  257. })
  258. }
  259. if(item.trim() == '孕产妇'){
  260. var arr = [1,5]
  261. $.map(arr,function(it,index){
  262. $li.eq(it).removeClass('dw-v')
  263. })
  264. }
  265. })
  266. }
  267. ////设置服务类型下拉
  268. function fillServiceDropdown(data){
  269. var $serviceSel = $('#selFuwu'),
  270. data = data.data,
  271. has = false,
  272. saveOldData ='',
  273. html="";
  274. for(i=0; i<data.length; i++){
  275. has = false;
  276. for(j=0;j<jtServerCode.length;j++){
  277. if(jtServerCode[j] == data[i].code){
  278. html += '<option selected value="'+data[i].code+'">'+data[i].name+'</option>';
  279. has = true;
  280. }
  281. }
  282. if(!has){
  283. html += '<option value="'+data[i].code+'">'+data[i].name+'</option>'
  284. }
  285. }
  286. $serviceSel.html(html);
  287. $serviceSel.mobiscroll().select({
  288. theme: 'ios',
  289. lang: 'zh',
  290. display: 'bottom',
  291. rows:6,
  292. placeholder: '请选择服务类型',
  293. onSelect: function ( valueText, inst) {
  294. if(valueText != saveOldData){
  295. currService = inst._tempValue?inst._tempValue.join(','):'';
  296. localStorage.setItem('updateService',currService);
  297. $('#smallTipSev').show();
  298. $("#diseases").html("无");
  299. }
  300. },
  301. onChange: function (event, inst){
  302. filterSer(event)
  303. },
  304. onShow: function (event, inst) {
  305. saveOldData = inst;
  306. filterSer(inst)
  307. }
  308. })
  309. }
  310. // 滚动条实例初始化
  311. function initScroller() {
  312. //阻尼系数
  313. var deceleration = mui.os.ios?0.003:0.0009;
  314. mui('.mui-scroll-wrapper').scroll({
  315. bounce: false,
  316. indicators: true, //是否显示滚动条
  317. deceleration:deceleration
  318. });
  319. iscroller = mui(".mui-scroll").pullToRefresh({
  320. down: {
  321. callback: function() {
  322. var self = this;
  323. setTimeout(function() {
  324. refreshPage();
  325. self.endPullDownToRefresh();
  326. }, 1000);
  327. }
  328. }
  329. });
  330. }
  331. /*
  332. * 拼接居民信息模板
  333. */
  334. function dealPatiInfoTmpl(patiInfoObj) {
  335. signType = patiInfoObj.signType;
  336. $("#pati_info_wrap").html(template("pati_info_tmpl", patiInfoObj));
  337. $('#view_wrap').show();
  338. initPatientData(3);
  339. getServiceDropdown();
  340. }
  341. /*
  342. * 获取患者续签状态
  343. */
  344. function getPatientRenewInfo(patiInfo){
  345. var url = "/doctor/sign/checkCanRenew",
  346. params = {patient: patiInfo.code};
  347. sendGet(url, params, null, function(res){
  348. if(res.status == 200){
  349. var state = res.data.code;
  350. if(state != "1" && state != "2"){
  351. oPatiInfo.isRenewable = 0;
  352. }else{
  353. oPatiInfo.isRenewable = 1;
  354. }
  355. //增加判断说是否显示右上角”更多”的图片
  356. if(oPatiInfo.expensesStatus == "1" && oPatiInfo.openid && !oPatiInfo.isRenewable){
  357. $(".header-link").hide();
  358. }else{
  359. $(".header-link").show();
  360. isWeiXinRemind(oPatiInfo);
  361. if(oPatiInfo && oPatiInfo.expensesStatus!=1 && oPatiInfo.expensesStatus!=2){
  362. if(oPatiInfo.signType!=1) {
  363. $("#remindPay").show();
  364. isYitixing();//查询某个患者今天是否已提醒
  365. }
  366. }
  367. if(oPatiInfo.isRenewable){
  368. $("#remindXQ").show();
  369. if(oPatiInfo.isRemindRenew == "1"){
  370. $("#remindXQ").find("a").text("已提醒续签");
  371. $("#remindXQ").addClass("ytx");
  372. }
  373. }
  374. }
  375. }else{
  376. mui.toast(res.msg);
  377. }
  378. }, true);
  379. }
  380. /*
  381. * 查看居民资料
  382. */
  383. function toInfo() {
  384. var $el = $(this);
  385. mui.openWindow("denizen-info.html", "denizen-info", {
  386. extras: {
  387. patiPhoto: $el.find('.doc-avatar img').attr('src'),
  388. patiCode: patiCode,
  389. signType: signType,
  390. teamCode: self.teamCode,
  391. //添加续签状态值
  392. qyRelation: qyRelation,
  393. renewable: oPatiInfo.isRenewable
  394. }
  395. })
  396. }
  397. function openwdsb(){
  398. // var params={};
  399. // params.patient = patiCode;
  400. // openWebviewExtras("../../wdsb/html/my-equipments.html",params);
  401. mui.openWindow('../../jkjl/html/health-record.html', 'health-record', {
  402. extras: {
  403. patientCode: patiCode,
  404. patientName: oPatiInfo.name,
  405. qyRelation: qyRelation
  406. }
  407. })
  408. }
  409. /*
  410. * 服务记录
  411. */
  412. function fwjl() {
  413. mui.openWindow('fuwujilu.html', 'fuwujilu', {
  414. extras: {
  415. patientCode: patiCode,
  416. patientName: oPatiInfo.name,
  417. qyRelation: qyRelation
  418. }
  419. });
  420. }
  421. /*
  422. * 健康指导
  423. */
  424. function jkzd() {
  425. // diaAdd.close();
  426. mui.openWindow('../../hzzd/html/guidance_list.html', 'jkzd', {
  427. extras: {
  428. code: patiCode
  429. }
  430. });
  431. }
  432. /*
  433. * 体征预警
  434. */
  435. function tzyj() {
  436. // diaAdd.close();
  437. mui.openWindow('tzyj.html', 'tzyj', {
  438. extras: {
  439. code: patiCode
  440. }
  441. });
  442. }
  443. /*
  444. * 健康记录点击事件
  445. */
  446. /*
  447. * 药物记录
  448. */
  449. function ywjl(dom) {
  450. var text = $(dom).find("p").eq(0).text();
  451. if(text == "-") {
  452. mui.toast("暂无健康记录");
  453. return;
  454. }
  455. mui.openWindow('../../hzgl/html/health-record-drug.html', 'health-record-drug', {
  456. extras: {
  457. pCode: patiCode
  458. }
  459. });
  460. }
  461. /*
  462. * 饮食记录
  463. */
  464. function ysjl(dom) {
  465. var text = $(dom).find("p").eq(0).text();
  466. if(text == "-") {
  467. mui.toast("暂无健康记录");
  468. return;
  469. }
  470. mui.openWindow('../../hzgl/html/health-record-diet.html', 'health-record-diet', {
  471. extras: {
  472. pCode: patiCode
  473. }
  474. });
  475. }
  476. /*
  477. * 运动记录
  478. */
  479. function ydjl(dom) {
  480. var text = $(dom).find("p").eq(0).text();
  481. if(text == "-") {
  482. mui.toast("暂无健康记录");
  483. return;
  484. }
  485. mui.openWindow('../../hzgl/html/health-record-sport.html', 'health-record-sport', {
  486. extras: {
  487. pCode: patiCode
  488. }
  489. });
  490. }
  491. /*
  492. * 分组
  493. */
  494. function fz() {
  495. mui.openWindow('../../zxyy/html/xuanzeyiyuan.html', 'xuanzeyiyuan', {
  496. extras: {
  497. pCode: patiCode
  498. }
  499. });
  500. }
  501. function toSelectJb(){
  502. var self = plus.webview.currentWebview();
  503. var update = localStorage.getItem('updateService');
  504. var oldData = jtServerCode.join(',');
  505. mui.openWindow({
  506. url: 'disease-label-edit.html',
  507. id: 'disease-label-edit',
  508. extras: {
  509. patientCode: patiCode,
  510. viewId: self.id,
  511. signCode:oPatiInfo.signCode,//变更服务类型用
  512. serviceCode: update?update:oldData,
  513. isChange:$("#smallTipSev").is(":hidden")?false:true//判断是否处于变更
  514. }
  515. });
  516. }
  517. var labelName =[];
  518. function initPatientData(){
  519. sendPost("doctor/family_contract/doctor_patient_sign_exist", {doctor: doctorCode, patient: patiCode}, null, function(res){
  520. if(res.status==200){
  521. if(res.data.status==-1 || res.data.status==0){
  522. qyRelation = 0;
  523. //没有签约关系
  524. //判断医生是否是该患者所在的团队的团队长
  525. var teamInfo = JSON.parse(plus.storage.getItem('teamInfo')),
  526. isTeamLeader = false;
  527. for(var i=0; i<teamInfo.data.length; i++){
  528. var item = teamInfo.data[i];
  529. if(item.id == jtAdminTeamId){
  530. isTeamLeader = true;
  531. break;
  532. }
  533. }
  534. if(isTeamLeader){
  535. $('#diseasesWrap').show();
  536. $('#serviceTypes').show();
  537. }else{
  538. $('#diseasesWrap').hide();
  539. $('#serviceTypes').hide();
  540. }
  541. if(overdue){
  542. //获取患者是否可续签的状态
  543. getPatientRenewInfo(oPatiInfo);
  544. }
  545. } else {
  546. qyRelation = 1;
  547. //获取患者是否可续签的状态
  548. getPatientRenewInfo(oPatiInfo);
  549. $('#footer').show();
  550. $('#diseasesWrap').show();
  551. $('#serviceTypes').show();
  552. initPatiLabels();//修复bug#【医生端】居民信息:居民标签经常显示为无。
  553. }
  554. } else {
  555. $('#diseasesWrap').hide();
  556. queryFailed(res);
  557. }
  558. },'POST','',true);
  559. getReqPromise("doctor/family_contract/patient_doctor_teams",{patient:patiCode},'POST', true)
  560. .then(function(res) {
  561. if(res.status==200) {
  562. var data = res.data;
  563. // 当当前医生与用户无签约关系(不包括签约团队的团队长),则不显示服务记录
  564. if(data.hasSign=="1") {
  565. $('#fwjl').show();
  566. } else {
  567. $('#fwjl').hide();
  568. }
  569. } else {
  570. mui.toast(res.msg);
  571. }
  572. }).catch(function(e){
  573. console && console.error(e);
  574. })
  575. }
  576. function initPatiLabels(){
  577. sendPostNoAsync("/doctor/patient_label_info/patient_label",{labelType:"",patient:patiCode},queryFailed,function(res){
  578. if(res.status==200){
  579. for(var j in res.data){
  580. if(res.data[j].labelType==3||res.data[j].labelType==4){
  581. labelName.push(res.data[j].labelName);
  582. }
  583. }
  584. if(labelName.length>0){
  585. $("#diseases").html(_.uniq(labelName).join(","));
  586. }else{
  587. $("#diseases").html("无");
  588. }
  589. }else{
  590. queryFailed(res);
  591. }
  592. });
  593. }
  594. function queryFailed(res){
  595. if(res.msg){
  596. if (res.msg != '查询失败') {
  597. mui.toast(res.msg);
  598. }
  599. }else{
  600. mui.toast("标签加载失败!");
  601. }
  602. }
  603. function loadRecentEvents() {
  604. template.helper("toJson", function(v, i) {
  605. return JSON.stringify(v);
  606. });
  607. // strSSID: "B09036263193"
  608. getReqPromise(healthProfileServer+"wlyy_service/record/outpatient",{
  609. strSSID: oPatiInfo.ssc,
  610. startNum: 0,
  611. endNum: 50
  612. },'GET',true).then(function(res){
  613. if(res.status == 200) {
  614. var list = JSON.parse(res.data);
  615. if(list && list.length) {
  616. $('#no_result_wrap').hide();
  617. $('#recent_events').show();
  618. $('#recent_events').append(template('recent_event_tmpl',{list: list.slice(0,4)}));
  619. $('#more_event').show();
  620. iscroller.refresh();
  621. } else {
  622. $('#recent_events').hide();
  623. $('#more_event').hide();
  624. $('#no_result_wrap').show();
  625. }
  626. } else {
  627. mui.toast(res.msg);
  628. }
  629. }).catch(function(e) { console && console.error(e)});
  630. }
  631. $('#more_event').on('tap',function() {
  632. openWebview("jiuzhenjilu.html",{patiInfo: oPatiInfo})
  633. }.isdebug);
  634. $('.fix-adds').on('tap', function() {
  635. $(".div-dialog-content").show();
  636. $(".modal-overlay").addClass("modal-overlay-visible");
  637. }.isdebug);
  638. $('.div-dialog-content').on('tap',"div", function() {
  639. if(!$(this).hasClass("quxiao")){
  640. hideBing();
  641. if($(this).hasClass("addjkzd")){//健康指导
  642. jkzd();
  643. }else if($(this).hasClass("addfzgl")){//分组管理
  644. fz();
  645. }else if($(this).hasClass("addtzyj")){//体征预警
  646. tzyj();
  647. }else if($(this).hasClass("addtzsb")){//体征设备
  648. openwdsb();
  649. }else if($(this).hasClass("addjtcy")){//家庭成员
  650. jtcy();
  651. }
  652. }else if($(this).hasClass("quxiao")){//取消
  653. $('.fix-adds').show();
  654. $(".div-dialog-content").hide();
  655. $(".modal-overlay").removeClass("modal-overlay-visible");
  656. }
  657. }.isdebug);
  658. function hideBing(){
  659. $('.fix-adds').show();
  660. $(".div-dialog-content").hide();
  661. $(".modal-overlay").removeClass("modal-overlay-visible");
  662. }
  663. $(".modal-overlay").on('tap', function() {
  664. hideBing();
  665. }.isdebug);
  666. $('#recent_events').on('tap','li',function() {
  667. var data = JSON.parse($(this).attr("data-json"));
  668. openWebview("health-profile.html",{eventInfo: data,patiInfo: oPatiInfo});
  669. }.isdebug);
  670. /*
  671. * 家庭成员
  672. */
  673. function jtcy() {
  674. mui.openWindow('jiatingchengyuan.html', 'jiatingchengyuan', {
  675. extras: {
  676. code: patiCode,
  677. patiInfo: oPatiInfo,
  678. qyRelation: qyRelation
  679. }
  680. });
  681. }
  682. /*
  683. * 咨询记录
  684. */
  685. function zxjl() {
  686. mui.openWindow('zixunjilu.html', 'zixunjilu', {
  687. extras: {
  688. code: patiCode,
  689. qyRelation: qyRelation
  690. }
  691. });
  692. }
  693. /*
  694. * 指导记录
  695. */
  696. function zdjl() {
  697. mui.openWindow('zhidaojilu.html', 'zhidaojilu', {
  698. extras: {
  699. code: patiCode,
  700. qyRelation: qyRelation
  701. }
  702. });
  703. }
  704. /*
  705. * 代预约记录
  706. */
  707. function dyyjl(){
  708. mui.openWindow('../../wdyy/html/my-appointment.html', 'my-appointment', {
  709. extras: {
  710. patient: patiCode,
  711. qyRelation: qyRelation
  712. }
  713. });
  714. }
  715. /*
  716. * 代预约
  717. */
  718. function dyy() {
  719. mui.openWindow('../../wdyy/html/appointment-register.html', 'appointment-register', {
  720. extras: {
  721. patient: patiCode
  722. }
  723. });
  724. }
  725. /*
  726. * 康复管理
  727. */
  728. function kfgl(){
  729. console.log("aaa");
  730. mui.toast("功能开发中,敬请期待");
  731. }
  732. //拨打电话
  733. $(".div-dianhua").on("tap",function(){
  734. var moblie = $(this).attr("data-mobile");
  735. var phone = $(this).attr("data-phone");
  736. //观察者模式下,不可以拨打被观察者患者的电话
  737. var userAgent = plus.navigator.getUserAgent(),
  738. index = userAgent.indexOf("}"),
  739. s = userAgent.substr(0, index+1),
  740. item = JSON.parse(s);
  741. if(item.observer){
  742. mui.toast("观察者模式无法拨打患者电话");
  743. }else{
  744. if(moblie){
  745. dialog({
  746. content: moblie,
  747. okValue:'立即拨号',
  748. ok: function (){
  749. window.location.href = "tel:"+moblie;
  750. },
  751. cancelValue: '不了,谢谢',
  752. cancel: function () {
  753. return;
  754. }
  755. }).showModal();
  756. }else{
  757. if(phone){
  758. dialog({
  759. content: "对不起,"+$(".patient-name").html()+"未绑定手机号码,是否拨打联系人电话?",
  760. okValue:'立即拨号',
  761. ok: function (){
  762. window.location.href = "tel:"+phone;
  763. },
  764. cancelValue: '不了,谢谢',
  765. cancel: function () {
  766. return;
  767. }
  768. }).showModal();
  769. }else{
  770. dialog({
  771. content: "对不起,"+$(".patient-name").html()+"未绑定手机号码,无法电话联系",
  772. okValue:'我知道了',
  773. ok: function (){
  774. return;
  775. },
  776. }).showModal();
  777. }
  778. }
  779. }
  780. })
  781. function refreshPage () {
  782. labelName =[];
  783. jtServerCode = [];
  784. localStorage.removeItem('updateService');
  785. getPatiInfo();
  786. }
  787. window.addEventListener("refresh1", function(){
  788. refreshPage();
  789. var xxWv = plus.webview.getWebviewById("huanzhe-by-type");
  790. // 如果有打开分组列表也要刷新列表
  791. if(xxWv){
  792. mui.fire(xxWv, "refresh");
  793. }
  794. var xxindex = plus.webview.getWebviewById("huanzhe.html");
  795. // 如果有打开分组列表也要刷新列表
  796. if(xxindex){
  797. mui.fire(xxindex, "refresh");
  798. }
  799. })
  800. window.addEventListener("setDiseaseTypes", function(e){
  801. $('#diseases').html(e.detail.names);
  802. oPatiInfo.diseases = e.detail.diseases;
  803. })
  804. //门诊记录
  805. $(".div-menzhen-btn").on("tap",function(){
  806. openWebview("menzhenjilu.html",{patiInfo: oPatiInfo})
  807. }.isdebug)
  808. //住院记录
  809. $(".div-zhuyuan-btn").on("tap",function(){
  810. openWebview("zhuyuanjilu.html",{patiInfo: oPatiInfo})
  811. }.isdebug)
  812. //检查检验记录
  813. $(".div-jianche-btn").on("tap",function(){
  814. openWebview("jianchajianyan.html",{patiInfo: oPatiInfo})
  815. }.isdebug)
  816. //用药记录
  817. $(".div-yongyao-btn").on("tap",function(){
  818. openWebview("yongyaojilu.html",{patiInfo: oPatiInfo})
  819. }.isdebug)
  820. //健康体检
  821. $(".div-jiankangtijian-btn").on("tap",function(){
  822. openWebview("jiankangtijian.html",{patiInfo: JSON.parse(self.patiInfo)})
  823. }.isdebug)
  824. /*
  825. * 健康教育
  826. */
  827. function jkjy() {
  828. // mui.openWindow('../../jkjy/html/jiankangjiaoyu.html', 'jiankangjiaoyu', {
  829. mui.openWindow('../../jkjy/html/article-store.html', 'jiankangjiaoyu', {
  830. extras: {
  831. patient: patiCode,
  832. patientName: oPatiInfo.name,
  833. teamCode: jtAdminTeamId
  834. }
  835. });
  836. }
  837. function xfjl() {
  838. mui.openWindow('../../prescription/html/juminxufangjilu.html', 'juminxufangjilu', {
  839. extras: {
  840. teamCode:oPatiInfo.jtAdminTeam,
  841. patiCode: patiCode,
  842. patiName: oPatiInfo.name
  843. }
  844. })
  845. }
  846. function fybj() {
  847. mui.openWindow('../../fybj/html/yunjianjihua.html', 'yunjianjihua', {
  848. extras: {
  849. patiCode: patiCode,
  850. doctorCode:doctorCode
  851. }
  852. })
  853. }
  854. function myjl() {
  855. mui.openWindow('../../fybj/html/mianyijihua.html', 'mianyijihua', {
  856. extras: {
  857. patiCode: patiCode
  858. }
  859. })
  860. }
  861. /* 事件绑定*/
  862. function bindEvents(){
  863. //服务记录
  864. $("#fwjl,#gxb,#jmbq").on('tap', fwjl.isdebug);
  865. //健康记录
  866. $("#tzsb").on('tap', openwdsb.isdebug);
  867. //康复管理
  868. $("#kfbg").on('tap', kfgl.isdebug);
  869. //家庭成员
  870. $("#family").on('tap', jtcy.isdebug);
  871. //提醒关注
  872. $("#remind_gz").on('tap', function(){
  873. mui("#sheet1").popover('toggle');
  874. if($(this).hasClass("ytx")){//今日已提醒
  875. mui.toast("居民今天已经收到过提醒了哦,不可再次提醒");
  876. }else{//今日未提醒
  877. sendWeixinRemind();
  878. }
  879. }.isdebug);
  880. //健康指导
  881. $("#jkzd").on('tap', jkzd.isdebug);
  882. //体征预警
  883. $("#tzyj").on('tap', tzyj.isdebug);
  884. //分组
  885. $("#fz").on('tap', fz.isdebug);
  886. //干预
  887. $("#gy").on('tap', gy);
  888. //转慢病
  889. // $("#zmbicon").on('tap', adddoc);
  890. //体征设备2
  891. $("#tzsbicon").on('tap', openwdsb.isdebug);
  892. $("#pati_info_wrap").on('tap', '#pati_info', toInfo);
  893. $("#pati_info_wrap").on('tap', "#diseasesWrap", toSelectJb.isdebug);
  894. //健康教育
  895. $(".div-jkjy-btn").on('tap', jkjy.isdebug);
  896. //代预约
  897. $(".div-dyy-btn").on('tap', dyy.isdebug);
  898. //康复管理
  899. $(".div-kfgl-btn").on('tap', kfgl.isdebug);
  900. //续方记录
  901. // $(".div-xufangjilu-btn").on('tap', xfjl);
  902. //慢病管理
  903. $(".div-manbing-btn").on('tap', function(){
  904. openWebview("../../mbgl/html/jumin-manbingdangan.html", {patient: oPatiInfo.code});
  905. }.isdebug)
  906. //产检计划
  907. $('.div-fybj-btn').on('tap', fybj.isdebug)
  908. //免疫记录
  909. $('.div-myjl-btn').on('tap', myjl.isdebug)
  910. //新增指导
  911. $(".div-add-guide-btn").on('tap', jkzd.isdebug);
  912. //随访
  913. $(".div-suifang-btn").on('tap',function(){
  914. // openWebview("../../suifang/html/choose_suifang.html", {patiCode: oPatiInfo.code});
  915. openWebview("../../suifang/html/suifang_list.html", {patientCode: oPatiInfo.code});
  916. }.isdebug);
  917. //显示更过操作
  918. $(".header-link").on('tap', function(){
  919. mui('#sheet1').popover('toggle');
  920. });
  921. /*提醒续签*/
  922. $("#remindXQ").on('tap', function(){
  923. mui("#sheet1").popover('toggle');
  924. if($(this).hasClass("ytx")){//今日已提醒
  925. mui.toast("居民今天已经收到过提醒了哦,不可再次提醒");
  926. }else{//今日未提醒
  927. sendRenewRemind();
  928. }
  929. }.isdebug);
  930. }