huanzhexinxi.js 24 KB

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