huanzhexinxi.js 24 KB

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