123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- var request = getRequest(),
- teamCode = request.teamCode,
- patient = request.patient,
- state,
- diseases,
- startDate = '',
- endDate = '',
- totalCount = 0;
- $(function(){
- if(!teamCode){
- getPatientInfo();
- }else{
- getFilter();
- getList();
- }
- bindEvents();
- })
- function getPatientInfo(){
- var params = {patient: patient};
- prescriptionListAPI.getPatientInfo({data: params}).then(function(res){
- if(res.status == 200){
- teamCode = res.data.jtAdminTeam;
- getFilter();
- getList();
- }else{
- showWarningMsg(res.msg);
- }
- })
- }
- function getFilter(){
- var params = {
- teamCode: teamCode,
- patient: patient
- };
- prescriptionListAPI.getFilter({data: params}).then(function(res){
- if(res.status == 200){
- fillDropDown(res);
- }else{
- showWarningMsg(res.msg);
- }
- });
- }
- function getList(isRefresh){
- var params = {
- startDate: startDate,
- endDate: endDate,
- state: state,
- diseases: diseases,
- teamCode: teamCode,
- patient: patient
- };
- prescriptionListAPI.getPrescriptionListCount({data: params}).then(function(res){
- if(res.status == 200){
- totalCount = res.data.total;
- if(isRefresh){
- $("#prescriptTable").bootstrapTable('refresh');
- }
- var options = $.extend(prescriptionListAPI.getPrescriptionListTableAjaxObj, {
- queryParams: queryParams,
- queryParamsType: "limit",
- pagination: true,
- paginationLoop: true,
- sidePagination: 'server',
- pageNumber: 1,
- pageSize: 10,
- responseHandler: function (res) {
- return {
- rows: res.data,
- total: totalCount
- }
- },
- columns: [{
- field: '',
- title:'',
- formatter: function(val, row, index){
- var html = template('info_tmp', row);
- return html;
- }
- },{
- field: 'createTime',
- title: '申请时间',
- class: 'c-999 pr20',
- align: 'right',
- formatter: function(val, row, index){
- return '<span class="pr10">'+val+'</span>';
- }
- }],
- onClickRow: function(row, $el){
- document.location.href = "prescription-detail.html?code="+row.code+'&id='+teamCode;
- }
- })
- $("#prescriptTable").bootstrapTable(options);
- }else{
- showWarningMsg(res.msg);
- }
- });
- }
- function queryParams(params) {
- return {
- page: params.offset/params.limit + 1,
- size: params.limit,
- startDate: startDate,
- endDate: endDate,
- state: state,
- diseases: diseases,
- teamCode: teamCode,
- patient: patient
- };
- }
- function fillDropDown(res){
- var statusHtml = template('status_tmp', {list: res.data.states});
- $("#status").append(statusHtml);
- var diseaseHtml = template('disease_tmp', {list: res.data.diseases});
- $("#disease").append(diseaseHtml);
- }
- function bindEvents(){
- $("#status").on('change', function(){
- var $this = $(this);
- state = $this.val();
- $('#prescriptTable').bootstrapTable('refreshOptions',{pageNumber:1});
- getList(true);
- });
- $("#disease").on('change', function(){
- var $this = $(this);
- diseases = $this.val();
- $('#prescriptTable').bootstrapTable('refreshOptions',{pageNumber:1});
- getList(true);
- });
- $("#time").on('change', function(){
- var $this = $(this);
- var seDate = getStartEndDate($this.val());
- startDate = seDate.startDate;
- endDate = seDate.endDate;
- $('#prescriptTable').bootstrapTable('refreshOptions',{pageNumber:1});
- getList(true);
- });
- template.helper('getStatusName', function(status){
- if(parseInt(status)< -1){
- return "续方取消";
- }
- return getStatusName(status);
- })
- }
|