UNPKG

h5-cli

Version:

hello

140 lines (115 loc) 5.92 kB
"use strict"; define(function (require, exports, module) { var PageModule = require("component/PageModule"); var page = PageModule.render({ init: function init() { this.unionId = this.query.unionId; this.corpId = this.query.corpId; this.patientId = this.query.patientId; this.patientName = this.query.patientName; this.patientHosId = this.query.patientHosId; this.registerData = this.cache.getCacheModule("zhuyuan-cache"); this.hospitalize = this.registerData.get("hospitalize").value; this.regEvent(); this.renderPatient(this.patientName, this.hospitalize.idNo || "****"); this.renderHospitalizeInfo(); var pageSize = 100; var pageNumber = 1; this.loadData(this.corpId, this.patientId, pageSize, pageNumber); }, loadData: function loadData(corpId, patientId, pageSize, pageNum) { $('#J_Page').addClass("wait"); this.getCache("/user-web/restapi/inhos/inhosbilllist", { unionId: this.unionId, patientId: patientId, corpId: corpId, pageSize: pageSize, pageNum: pageNum, visitId: 1 }); }, renderPatient: function renderPatient(name, idNo) { $('#inpatient-name').text(name); $('#inpatient-idNo').text("\u8eab\u4efd\u8bc1:" + idNo); }, renderHospitalizeInfo: function renderHospitalizeInfo() { var list = this.hospitalize.items; var x = 0; for (x in list) { if (list[x].patientHosId == this.patientHosId) { var area = list[x].area == "null" ? "" : list[x].area; var bedNo = list[x].bedNo == "null" || !list[x].bedNo ? "" : list[x].bedNo; $('#hos-date').html(list[x].createDate); $('#hospitalize-status').html(list[x].status); $('#hos-name').html(list[x].corpName); $('#hos-dept').html(list[x].deptName); $('#hos-no').html(list[x].patientHosId); $('#area').html(area); $('#bed-no').html(bedNo); $('#cost-sum').html((this.util.moneyFormat(list[x].cost) || "0") + "\u5143"); return true; } } }, //\u8df3\u8f6c\u5230\u9009\u62e9\u5c31\u8bca\u4eba\u9875\u9762 choosePatient: function choosePatient() { var chooseUrl = window.location.origin + window.location.pathname.slice(0, window.location.pathname.indexOf("/pages/") + 7) + "patient-list.html?saveKey=zhuyuan-cache&selectView=1"; if (this.util.isInYuantuApp()) { choiseUrl += "?backview=1"; this.util.brige("openView", { url: chooseUrl, animation: "bottom-in" }); } else { //\u76f4\u63a5\u8df3\u8f6c chrome \u5386\u53f2\u8bb0\u5f55\u4e0d\u4f1a\u8bb0\u5f55\u5f53\u524dURL Google Chrome 46.0.2490.71 (64-bit) setTimeout(function () { window.location.href = chooseUrl; }, 500); } }, //\u7ed1\u5b9a\u9875\u9762\u4e8b\u4ef6 regEvent: function regEvent() { var self = this; //\u5728\u6d4f\u89c8\u5668\u4e2d\u5f53\u524d\u9875\u9762\u9009\u62e9\u5b8c\u5c31\u8bca\u4eba\u76f4\u63a5\u8df3\u8f6c\u5230\u7b2c\u4e00\u4e2a\u754c\u9762 if (this.patientId != this.registerData.get("patient").value) { window.history.back(true); return; } //\u5220\u9664\u4e0a\u4e00\u6b21\u7684\u9009\u62e9\u8bb0\u5f55 //\u4e0b\u4e00\u4e2a\u754c\u9762\u9009\u62e9\u7684\u5c31\u8bca\u4eba\uff0c\u4f1a\u901a\u8fc7windvane\u4f20\u9012\u8fc7\u6765 lib.windvane.on(function (result) { if (result.ret == "SUCCESS") { var data = result.data ? JSON.parse(result.data) : {}; //alert(data.patientId+ data.patientName); self.util.brige("pushDataToParent", { autoBack: true, data: JSON.stringify({ patientId: data.patientId, patientName: data.patientName, origin: "daily-list" }) }); } }); }, onSuccess: function onSuccess(result) { this.render(result.data); $('#J_Page').removeClass("wait"); }, render: function render(data) { var self = this; self.renderPatient(this.patientName, this.hospitalize.idNo || "****"); var len = 0; if (!data.items) { len = 0; } else { len = data.items.length; } var tmpl = '{@each list as item}' + '<a class="daily-item ui-border-tb ui-arrowlink" href="daily-detail.html?target=_blank&date=${item.tradeTime}&corpId=' + self.corpId + '&unionId=' + self.unionId + '&patientId=' + this.patientId + '&patientName=' + this.patientName + '&patientHosId=' + this.patientHosId + '">' + '\u6bcf\u65e5\u6e05\u5355<em class="date-em">${item.tradeTime}</em>' + '<em class="daily-cost">${item.cost|moneyFormat}\u5143</em>' + '</a>' + '{@/each}' + '{@if len == 0}<div style="height: 200px;"><div class="ui-notice"> <i></i> <p>\u6ca1\u6709\u65e5\u6e05\u5355</p> </div></div>{@/if}'; this.juicer.register("moneyFormat", this.util.moneyFormat); this.renderTo(tmpl, { list: data.items }, "#J_List"); } }); page.init(); module.exports = page; });