123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621 |
- mui.plusReady(function(){
- var docInfo = JSON.parse(plus.storage.getItem("docInfo")),
- self = plus.webview.currentWebview(),
- teamCode = self.teamCode?self.teamCode:'',
- info= self.infoStr?JSON.parse(self.infoStr):'',
- isLeader;
-
- var $patiInfo = $('#patient-info');
-
- var strOriginalData;//认证专用
- var prescriptionCode = info?info.code:self.prescriptionCode;
-
- //判断是否为该团队团队长
- if(docInfo.isLeader && teamCode == docInfo.adminTeamCode){
- isLeader = 1;
- }else{
- isLeader=0
- }
- queryData();
- bindEvent();
-
- function queryData(){
- plus.nativeUI.showWaiting();
- var params ={
- code:prescriptionCode,
- type:isLeader
- }
- sendPost("doctor/prescriptionInfo/getContinuedPrescriptionAsDoctor",params, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("请求失败");
- }, function(res){
- plus.nativeUI.closeWaiting();
- if(res.status == 200){
- strOriginalData = res.data;
- var html = template('pati_tmp',{data:res.data,isLeader:isLeader})
- $patiInfo.html(html);
- //判断团队长
- if(isLeader){
- $('.layer-res').show();
- if(res.data.prescription.status == 0){
- $('.header-link').show();
- $('.header-link2').hide();
- }else if(res.data.prescription.status == 2 ||res.data.prescription.status == 3){
- $('.header-link2').show();
- $('.header-link').hide();
- }
- //加载插件
- if(res.data.prescription.status == 0 || res.data.prescription.status == 31){
- $('.os-main').css('padding-bottom','147px')
- selectFee();
- selectHome();
- selectResult();
- nopassReason();
- }else{
- $('.os-main').css('padding-bottom','10px')
- }
- }
- }else{
- mui.toast("获取数据失败");
- }
- },'get')
- }
- function bindEvent(){
- //选择调整平台
- $(".header-link").on('tap', function(){
- mui('#sheet1').popover('toggle');
- })
- //防止在调整中,再次请求接口
- $(".header-link2").on('tap', function(){
- mui.openWindow({
- id: "change-chufang1",
- url: "change-chufang1.html",
- waiting:{autoShow:false},
- extras: {
- prescriptionCode:prescriptionCode,
- state:strOriginalData.prescription.status
- }
- })
- })
- $('.j-change-method').click(function(){
- var $this = $(this)
- mui('#sheet1').popover('toggle');
- if($this.index()==1){
- mui.openWindow({
- id: "change-chufang1",
- url: "change-chufang1.html",
- waiting:{autoShow:false},
- extras: {
- state:strOriginalData.prescription.status,
- prescriptionCode:prescriptionCode,
- jwHospital:strOriginalData.prescription.jwHospital,
- jwDoctorCode:strOriginalData.prescription.jwDoctorCode
- }
- })
- }else{
- nextPage();
- }
- })
- function nextPage(){
- var usefulMsg = {};
- usefulMsg.prescriptionCode = prescriptionCode;
- usefulMsg.diagnosis = strOriginalData.diagnosis;
- usefulMsg.prescriptionInfo = strOriginalData.prescriptionInfo;
- mui.openWindow({
- id: "change-chufang2",
- url: "change-chufang2.html",
- extras: {
- jsonStr:usefulMsg
- }
- })
- }
- //调整处方
- $patiInfo.on('click','#changeMethod',function(){
- nextPage()
- })
- //不通过原因
- $patiInfo.on('click','.nopass-list li',function(){
- var $this = $(this)
- if($this.hasClass('active')){
- $this.removeClass('active')
- }else{
- $this.addClass('active')
- }
- fillWord()
- })
-
- function fillWord(){
- var str=''
- $.map($('.nopass-list li.active'),function(o,i){
- str += $('.nopass-list li.active').eq(i).text()+',';
- })
- $('#textarea').val(str.substr(0,str.length-1))
- }
- $patiInfo.on('click','#old-data',function(){
- mui.openWindow({
- id: "chufangxiangqing",
- url: "chufangxiangqing.html",
- extras: {
- code:strOriginalData.prescription.jwCode,
- patient:strOriginalData.prescription.patient
- }
-
- })
- })
- //跳转订单
- $patiInfo.on('click','#booking',function(){
- mui.openWindow({
- id: "dingdangenzong",
- url: "dingdangenzong.html",
- extras: {
- prescriptionCode:prescriptionCode,
- teamCode:teamCode
- }
- })
- })
-
- $patiInfo.on('click','#history_msg',function(){
- var $this = $(this)
- mui.openWindow({
- id: "juminxufangjilu",
- url: "juminxufangjilu.html",
- extras: {
- patiCode:strOriginalData.prescription.patient,
- teamCode:teamCode,
- patiName:strOriginalData.prescription.patientName
- }
- })
- })
- //回答居民
- $('.layer-res').click(function(){
- if(strOriginalData.prescription.status == 100){
- mui.openWindow({
- id: "xufangzixunxiangqing",
- url: "xufangzixunxiangqing.html",
- extras: {
- sessionId:strOriginalData.prescription.patient+'_'+strOriginalData.prescription.consult+'_'+8,
- sessionName:strOriginalData.prescription.patientName,
- sessionTime:checkDate(strOriginalData.prescription.createTime),
- patiCode:strOriginalData.prescription.patient,
- status:2,
- type:8
- }
- })
- }else{
- mui.openWindow({
- id: "xufangzixun.html",
- url: "../../message/html/xufangzixun.html",
- extras: {
- type:8,
- sessionId:strOriginalData.prescription.patient+'_'+strOriginalData.prescription.consult+'_'+8,
- sessionName:strOriginalData.prescription.patientName
- }
- })
- }
- })
-
- //提交审核
- $patiInfo.on('click','#confirm',function(){
- if($('#showResult').attr('data-id')){
- if($('#showResult').attr('data-id')==2){
- if($('#textarea').val().trim()){
- passingReview();
- }else{
- mui.toast('请填写不通过原因')
- }
- }else if($('#doctorHome').attr('data-id') && $('#feeCheck').attr('data-id')){
- nextDo();
- }else{
- mui.toast('请完善续方审核')
- }
- }else{
- mui.toast('请完善续方审核')
- }
- })
-
- function nextDo(){
- plus.nativeUI.showWaiting();
- sendPost("doctor/isAuthentication",{}, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("请求失败");
- }, function(res){
- if(res.status == 200){
- plus.nativeUI.closeWaiting();
- if(res.data.type != 4){
- dialog({
- content: '您暂未安装CA证书,无法进行续方审核,点击前往安装',
- okValue: '前往安装',
- cancelValue: '取消',
- cancel: function () {
- return;
- },
- ok: function() {
- mui.openWindow({
- id: "cazhengshu",
- url: "cazhengshu.html",
- waiting:{autoShow:false},
- extras: {
- code:res.data.type
- }
- })
- }
- }).showModal();
- }else{
- $('#doctorName').html(docInfo.name)
- $('.layer-bg').show();
- }
- }else{
- plus.nativeUI.closeWaiting();
- mui.toast("请求证书信息失败");
- }
- },'get')
- }
-
- //输入密码
- var psw = 0;
- var $li = $('#password').find('li');
- $('.number-pad').on('tap','li',function(){
- var $this = $(this)
- if(!$this.hasClass('no')){
- if(!$this.hasClass('del')){
- if(psw <=5){
- var $one = $li.eq(psw);
- $one.addClass('active');
- $one.attr('data-val',$this.text().trim());
- psw++;
- }else{
- mui.toast('请点击确定')
- }
- }else{
- if(psw >=1){
- psw--;
- var $one = $li.eq(psw);
- $one.removeClass('active');
- $one.attr('data-val','');
- }
- }
- }else{
- if(psw ==6){
- submitContent()
- }
- }
- })
- //时间格式
- function checkDate(d) {
- var t = new Date(d);
- var month = (t.getMonth() + 1) < 10 ? '0' + (t.getMonth() + 1) : (t.getMonth() + 1);
- var day = t.getDate() < 10 ? '0' + t.getDate() : t.getDate();
- return month+day
- }
- //提取密码
- function takePassword(){
- var str = '';
- $li.each(function(){
- str += $(this).attr('data-val');
- })
- return str
- }
- //忘记密码
- $('#forget').click(function(){
- mui.openWindow({
- id: "shenfenrenzheng",
- url: "shenfenrenzheng.html",
- waiting:{autoShow:false}
- })
- })
- //取消
- $('.layer-bg').click(function(){
- cancel();
- })
- $('.xufang-num').click(function(e){ e.stopPropagation() })
- $('#cancel').click(function(){
- cancel();
- })
- function cancel(){
- $('.layer-bg').hide();
- psw = 0;
- $li.removeClass('active');
- $li.attr('data-val','');
- }
-
- function submitContent(){
- plus.nativeUI.showWaiting();
- var imporMsg = {};
- imporMsg.prescription = {};
- imporMsg.prescription.jwCode = strOriginalData.prescription.jwCode;
- imporMsg.prescription.patientName = strOriginalData.prescription.patientName;
- imporMsg.prescription.doctorName = strOriginalData.prescription.doctorName;
- imporMsg.prescription.diagnosis = strOriginalData.diagnosis;
- var arr=[]
- _.map(strOriginalData.prescriptionInfo,function(item){
- var obj = _.pick(item, 'drugCode','drugName','jwSubCode','physicAmount','physicAmountUnit','physicAmountUnitName');
- arr.push(obj)
- })
- imporMsg.prescription.prescriptionInfo = arr;
- var params ={
- strRealNameSoftCertCalledPasswd:takePassword(),
- strOriginalData:JSON.stringify(imporMsg),
- prescriptionCode:prescriptionCode
- }
- sendPost("doctor/requestRealNameSoftCertAndSign",params, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("请求失败");
- }, function(res){
- if(res.status==200){
- if(res.data){
- cancel()
- passingReview()
- }else{
- plus.nativeUI.closeWaiting();
- mui.toast(res.msg)
- }
- }else{
- plus.nativeUI.closeWaiting();
- mui.toast("用户不存在或密码错误")
- psw = 0;
- $li.removeClass('active');
- $li.attr('data-val','');
- }
- })
- }
- function passingReview(){
- plus.nativeUI.showWaiting();
- //不通过CODE
- var reasonCode=[];
- $.map($('.nopass-list li.active'),function(o,i){
- reasonCode.push($('.nopass-list li.active').eq(i).attr('data-code'))
- })
-
- var datas = {
- code:prescriptionCode,
- registerFee:$('#feeCheck').attr('data-name'),
- rateTypeCode:$('#feeCheck').attr('data-id'),
- dept:$('#doctorHome').attr('data-id'),
- reason:$('#textarea').val(),
- reasonCode:reasonCode.join(','),
- state:$('#showResult').attr('data-id')
- }
- sendPost("doctor/prescriptionInfo/reviewPrescription",datas, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("提交审核超时")
- },function(res){
- plus.nativeUI.closeWaiting();
- if(res.status == 200){
- if(res.data){
- refreshHz()
- if($('#showResult').attr('data-id') == 1){
- dialog({
- content: '提交审核成功,记得去完成该居民的随访哦',
- okValue: '好的',
- ok: function() {
- mui.back()
- }
- }).showModal();
- }else{
- mui.toast('提交成功')
- setTimeout(function(){
- mui.back()
- },500)
- }
- }else{
- refreshHz()
- mui.toast("开方失败")
-
- }
- }else{
- mui.toast("提交审核失败")
- }
- })
- }
- }
-
- template.helper('setStatus',function(o){
- if(o == -5){return '<span style="color: #999">线下取消</span>'}
- if(o == -4){return '<span style="color: #999">线下退费</span>'}
- if(o == -3){ return '<span style="color:#999">续方取消(24小时未支付)</span>' }
- if(o == -2){ return '<span style="color:#999">续方取消(居民主动取消)</span>' }
- if(o == -1){ return '<span style="color:#ff4c4c">审核未通过</span>' }
- if(o == 0 || o == 10){ return '<span style="color:#ffa54b">审核中</span>' }
- if(o == 2){ return '<span style="color:#ffa54b">调整中</span>' }
- if(o == 3){ return '<span style="color:#ffa54b">调整成功/待ca认证</span>' }
- if(o == 4){ return '<span style="color:#ffa54b">调整失败</span>' }
- if(o == 20){ return '<span style="color:#ffa54b">药师审核中</span>' }
- if(o == 21){ return '<span style="color:#ff4c4c">药师审核失败</span>' }
- if(o == 30){ return '<span style="color:#ffa54b">开方中</span>' }
- if(o == 31){ return '<span style="color:#ff4c4c">开方失败</span>' }
- if(o == 40 || o == 41){ return '<span style="color:#db6bbd">待支付</span>' }
- if(o == 50){ return '<span style="color:#ffa54b">配药中</span>' }
- if(o == 60){ return '<span style="color:#db6bbd">等待领药</span>' }
- if(o == 61 || o == 62 || o == 65 || o == 69){ return '<span style="color:#06bf04">配送中</span>' }
- if(o == 100){ return '<span style="color:#17b3ec">已完成</span>' }
- })
- template.helper('setReview',function(o){
- if(o == 0){ return '<span style="color:#ffa54b">审核中</span>' }
- if(o == 1){ return '<span style="color:#17b3ec">审核通过</span>' }
- if(o == -1){ return '<span style="color:#ff4c4c">审核未通过</span>' }
- if(o == -2){ return '<span style="color:#ff4c4c">审核无效</span>' }
- })
-
- template.helper('setPrescription',function(array){
- var arr=[];
- $.map(array,function(item,index){
- arr.push(item.name)
- })
- return arr.join(',')
- })
-
- template.helper('setRestTime',function(minDate,sDate){
- var now = getNowDate();
- var createDate = sDate.split(' ');
- var diff = getDays(createDate[0],now);
- if(diff<minDate){
- return '<span style="color:#17b3ec">'+(minDate-diff)+'天</span>'
- }else{
- return '<span style="color:#ff4c4c">已用完</span>'
- }
- })
- //相隔几天
- function getDays(sDate,eDate){
- var oDate1;
- var oDate2;
- var iDays;
- oDate1= sDate.split("-");
- oDate2= eDate.split("-");
- var strDateS = new Date(oDate1[0], oDate1[1]-1, oDate1[2]);
- var strDateE = new Date(oDate2[0], oDate2[1]-1, oDate2[2]);
- iDays = parseInt(Math.abs(strDateE - strDateS ) / 1000 / 60 / 60 /24)
- return iDays ;
- }
- //现在时间
- function getNowDate() {
- var date = new Date();
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var day = date.getDate();
- var hour = date.getHours();
- var minute = date.getMinutes();
- var second = date.getSeconds();
- return year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
- }
-
- //费用下拉
- function selectFee(){
- var data={
- jwHospital:strOriginalData.prescription.jwHospital,
- jwDoctorCode:strOriginalData.prescription.jwDoctorCode
- }
- sendPost("doctor/prescriptionInfo/getRegisterRee",data, function(){
- mui.toast("请求失败");
- }, function(res){
- if(res.status == 200){
- var result = res.data;
- var html = '<option disabled selected></option>';
- $.map(result,function(item,index){
- if(item.registerType == strOriginalData.prescription.jwGisterTypeCode){
- html += '<option selected value="'+item.registerType+'">'+item.registerTypeName+' '+item.registerFee+' 元'+'</option>';
- }else{
- html += '<option value="'+item.registerType+'">'+item.registerTypeName+' '+item.registerFee+' 元'+'</option>';
- }
- })
- $('#feeCheck').html(html);
- $('#feeCheck').mobiscroll().select({
- theme: 'ios',
- lang: 'zh',
- display: 'bottom',
- placeholder:'请按医生级别选择诊查费用',
- rows:4,
- onSelect: function ( valueText, inst) {
- $('#feeCheck').attr('data-id',inst._tempValue)
- $('#feeCheck').attr('data-name',valueText.split(' ')[1])
- }
- })
- }
- },'get')
- }
- // 科室下拉
- function selectHome(){
- var data={
- jwHospital:strOriginalData.prescription.jwHospital,
- jwDoctorCode:strOriginalData.prescription.jwDoctorCode
- }
- sendPost("doctor/prescriptionInfo/getDeptList",data, function(){
- mui.toast("请求失败");
- }, function(res){
- if(res.status == 200){
- var result = res.data;
- var html = '<option disabled selected></option>';
- $.map(result,function(item,index){
- if(item.deptCode ==strOriginalData.prescription.jwDeptCode){
- html += '<option selected value="'+item.deptCode+'">'+item.deptName+'</option>';
- }else{
- html += '<option value="'+item.deptCode+'">'+item.deptName+'</option>';
- }
- })
- $('#doctorHome').html(html);
- $('#doctorHome').mobiscroll().select({
- theme: 'ios',
- lang: 'zh',
- display: 'bottom',
- placeholder:'请选择您所在科室',
- rows:4,
- onSelect: function ( valueText, inst) {
- $('#doctorHome').attr('data-id',inst._tempValue)
- }
- })
- }
- },'get')
- }
- //审核下拉
- function selectResult(){
- $('#showResult').mobiscroll().select({
- theme: 'ios',
- lang: 'zh',
- display: 'bottom',
- placeholder:'请选择审核结果',
- rows:4,
- onSelect: function ( valueText, inst) {
- $('#showResult').attr('data-id',inst._tempValue)
- if(inst._tempValue ==2){
- $('#nopass').show()
- $('#feeList').hide()
- $('#homeList').hide()
- }else if(inst._tempValue ==1){
- $('#nopass').hide()
- $('#feeList').show()
- $('#homeList').show()
- }else{
- $('#nopass').hide()
- $('#feeList').hide()
- $('#homeList').hide()
- }
- $('.os-main').css('padding-bottom',$('.xf-position').height()+10)
- }
- })
- }
- //不通过原因
- function nopassReason(){
- sendPost("doctor/prescriptionInfo/getReasonByType",{type:0}, function(){
- mui.toast("请求失败");
- }, function(res){
- if(res.status = 200){
- var str=""
- $.map(res.data,function(o,i){
- str += '<li data-code="'+o.code+'">'+o.value+'</li>'
- })
- $('.nopass-list').html(str)
- }
- },'get')
- }
-
- function reloadPageData(){
- queryData()
- }
- window.addEventListener("refreshXufang", function(){
- reloadPageData()
- })
-
- function refreshHz(){
- var page = plus.webview.getWebviewById("xufangguanli");
- if(page){
- mui.fire(page, "refreshXufang");
- }
- var page1 = plus.webview.getWebviewById("juminxufangjilu");
- if(page1){
- mui.fire(page1, "refreshXufang");
- }
- var page2 = plus.webview.getWebviewById("xufangxiangqing");
- if(page2){
- mui.fire(page2, "refreshXufang");
- }
- var page3 = plus.webview.getWebviewById("xufangxiaoxi");
- if(page3){
- mui.fire(page3, "refreshPage");
- }
- var page4 = plus.webview.getWebviewById("xufangzixun");
- if(page4){
- mui.fire(page4, "refreshPage");
- }
- }
- })
|