123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- var obj,
- code,
- name,
- patientInfo = {},
- patientInfoArr = [],
- self,
- arrSumInfo = [];
-
- var newPickerf,newPickers,newPicket
- //创建变量
- var $specialty = $("#specialty"),
- $healthy = $('#healthy'),
- $custom = $('#custom'),
- $concealment = $('#concealment');
- $recovery = $('#recovery');
- $nongroup = $('#nongroup');
- //初始化mui
- mui.init();
- //mui文档就绪执行函数
- mui.plusReady(function() {
- //获取基础信息
- obj = init();
- //获取页面信息
- self = plus.webview.currentWebview();
- //初始化页面
- initPage();
- //获取没标签居民数目(数字)
- residentCount();
- //获取没标签居民数(具体的居民列表)
- residentList()
- //事件绑定执行函数
- bindEvent();
- })
- function init() {
- var userAgent = JSON.parse(plus.storage.getItem('userAgent'));
- var teamInfo = JSON.parse(plus.storage.getItem('teamInfo'));
- var doctorInfo = JSON.parse(plus.storage.getItem("docInfo"));
- return {
- userAgent: userAgent,
- teamInfo: teamInfo,
- doctorInfo: doctorInfo
- }
- }
- function initPage(){
- newPickerf = new mui.PopPicker({});
- newPickers = new mui.PopPicker({});
- newPickert= new mui.PopPicker({});
- getSelect(7)
- getSelect(8)
- getSelect(4)
- }
- function getSelect(type) {
- sendGet('/doctor/specialist/findLabelbyType', {
- type: type,
- teamCode: ""
- }, null, function(res) {
- if(res.status == 200) {
- var arr = []
- for(i in res.data) {
- res.data[i].text = res.data[i].labelName;
- }
- if (type==7) {
- newPickerf.setData(res.data)
- }if (type==8) {
- newPickers.setData(res.data)
- }if (type==4) {
- newPickert.setData(res.data)
- }
- } else {
- mui.toast(res.msg);
- }
- plus.nativeUI.closeWaiting();
- }, 'GET', '', true);
- }
- function residentCount() {
- sendGet('/doctor/specialist/findSpecialistPatientRelationCout', {
- doctor: obj.doctorInfo.code
- }, null, function(res) {
- if(res.status == 200) {
- $('#sum').html(res.data)
- } else {
- mui.toast(res.msg);
- }
- }, 'GET', '', true);
- }
- function residentList() {
- sendGet('/doctor/specialist/findNoLabelPatientRelation', {
- doctor: obj.doctorInfo.code
- }, null, function(res) {
- if(res.status == 200) {
- for(var i in res.data){
- res.data[i].photo = getImgUrl(res.data[i].photo)
- }
- $('.n-list').html(template('no_label_resident', {
- list: res.data
- }));
- } else {
- mui.toast(res.msg);
- }
- }, 'GET', '', true);
- }
- function bindEvent() {
- $specialty.on('tap', function(e) {
- e.stopPropagation();
- newPickerf.show(function(selectItems) {
- $concealment.html(selectItems[0].text);
- $concealment.attr('data-code', selectItems[0].labelCode)
- $concealment.attr('data-type', selectItems[0].labelType)
- })
- });
- $healthy.on('tap', function(e) {
- e.stopPropagation();
- newPickers.show(function(selectItems) {
- $recovery.html(selectItems[0].text)
- $recovery.attr('data-code', selectItems[0].labelCode)
- $recovery.attr('data-type', selectItems[0].labelType)
- })
- });
- $custom.on('tap', function() {
- newPickert.show(function(selectItems) {
- $nongroup.html(selectItems[0].text)
- $nongroup.attr('data-code', selectItems[0].labelCode)
- $nongroup.attr('data-type', selectItems[0].labelType)
- })
- });
- $("#times").on("tap", function(e) {
- e.stopPropagation();
- e.preventDefault();
- });
- //点击确定的时候设置居民标签
- var juage = true;
- $('#makeSure').on('tap', function(e) {
- if(juage==true){
- var disType = $concealment.html();
- var situaType = $recovery.html();
- var Grouping = $nongroup.html();
-
- var residentSum = $(".n-list input[name=jvmin]:checked");
- var j_list = $(".n-list input[name=jvmin]:checked").parent().parent();
-
- if(disType.length == 0 || disType == '请选择专病类型') {
- dialog({
- contentType: 'tipsbox',
- skin: 'bk-popup',
- content: '专病类型不能为空!',
- closeTime: 2000
- }).showModal();
- return false;
- } else if(situaType.length == 0 || situaType == '请选择健康情况') {
- dialog({
- contentType: 'tipsbox',
- skin: 'bk-popup',
- content: '健康情况不能为空!',
- closeTime: 2000
- }).showModal();
- return false;
- } else if(residentSum.length == 0) {
- dialog({
- contentType: 'tipsbox',
- skin: 'bk-popup',
- content: '请选择居民!',
- closeTime: 2000
- }).showModal();
- return false;
- }
-
- for(var k = 0; k < j_list.length; k++) {
- var middleVar = {};
- var code = j_list[k].getAttribute('data-code');
- var name = j_list[k].getAttribute('data-name');
- middleVar = {
- patient: code,
- pname: name
- }
- patientInfoArr.push(middleVar);
- }
- //获取疾病类型标签
- var dName = $concealment.html();
- var dCode = $concealment.attr('data-code');
- var dType = $concealment.attr('data-type');
- //获取健康状况标签
- var hName = $recovery.html();
- var hCode = $recovery.attr('data-code');
- var hType = $recovery.attr('data-type');
-
- //获取自定义分组标签
- var cName = $nongroup.html();
- var cCode = $nongroup.attr('data-code');
- var cType = $nongroup.attr('data-type');
- //设置居民标签接口的参数
- var contain = [];
- if(Grouping.length != 0 || Grouping != '未分组') {
- for(var h = 0; h < 3; h++) {
- if(h == 0) {
- var obj1 ={};
- for(var j = 0;j<patientInfoArr.length;j++){
- patientInfoArr[j].labelName = dName;
- patientInfoArr[j].label = dCode;
- patientInfoArr[j].labelType = dType;
- obj1 = $.extend({},patientInfoArr[j]);
- arrSumInfo.push(obj1);
- }
- }if(h==1){
- var obj2= {};
- for(var j = 0;j<patientInfoArr.length;j++){
- patientInfoArr[j].labelName = hName;
- patientInfoArr[j].label = hCode;
- patientInfoArr[j].labelType = hType;
- obj2 = $.extend({},patientInfoArr[j]);
- arrSumInfo.push(obj2);
- }
- }else if(h==2){
- var obj3= {};
- for(var j = 0;j<patientInfoArr.length;j++){
- patientInfoArr[j].labelName = cName;
- patientInfoArr[j].label = cCode;
- patientInfoArr[j].labelType = cType;
- obj3 = $.extend({},patientInfoArr[j]);
- arrSumInfo.push(obj3);
- }
- }
- }
-
- }else{
- for(var h = 0; h < 2; h++) {
- if(h == 0) {
- var obj1 ={};
- for(var j = 0;j<patientInfoArr.length;j++){
- patientInfoArr[j].labelName = dName;
- patientInfoArr[j].label = dCode;
- patientInfoArr[j].labelType = dType;
- obj1 = $.extend({},patientInfoArr[j]);
- arrSumInfo.push(obj1);
- }
- }if(h==1){
- var obj2= {};
- for(var j = 0;j<arr_sj.patientInfoArr;j++){
- patientInfoArr[j].labelName = hName;
- patientInfoArr[j].label = hCode;
- patientInfoArr[j].labelType = hType;
- obj2 = $.extend({},patientInfoArr[j]);
- arrSumInfo.push(obj2);
- }
- }
- }
-
- }
-
- // 设置居民标签
- var labelUrl = '/doctor/specialist/setPatientLabelInfo';
- // 设置参数
- var params = {
- json:JSON.stringify(arrSumInfo)
- }
- sendPost(labelUrl, params, null, function(res){
- if (res.status==200) {
-
- mui.confirm('您的居民标签定义好了,是否继续分配计管医师?(计管医师可帮助您制定康复计划)',
- "提示",["继续", "退出"],function(e){
- //选择继续的时候
- if(e.index==0){
- var wv = mui.openWindow({
- url:'fenpeijianguanshi.html',
- id:'fenpeijianguanshi',
- extras:{
- residentArr:patientInfoArr
- }
- })
- //选择退出的时候(刷新人数,返回居民首页)
- }else{
- residentList();
- residentCount();
- //返回居民首页
- backPage();
- }
- }
- )
-
- } else{
- mui.toast(res.msg);
- }
- },'POST','',true)
- }
- juage = false;
-
- })
- }
- //返回上一个页面
- function backPage(){
- var wv = plus.webview.getWebviewById('huanzhe-specal.html');
- // console.log(wv)
- if (wv) {
-
- mui.fire(wv,'refresh');
- }
- mui.back();
- }
|