change-chufang1.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. var self,
  2. docInfo,
  3. prescriptionCode;//续方code
  4. var strOriginalData;//认证专用
  5. mui.plusReady(function() {
  6. docInfo = JSON.parse(plus.storage.getItem("docInfo"));
  7. self = plus.webview.currentWebview();
  8. prescriptionCode = self.prescriptionCode;
  9. bindEvents();
  10. })
  11. function bindEvents(){
  12. function queryData(){
  13. var params ={
  14. code:prescriptionCode,
  15. type:1
  16. }
  17. sendPost("doctor/prescriptionInfo/getContinuedPrescriptionAsDoctor",params, function(){
  18. plus.nativeUI.closeWaiting();
  19. mui.toast("请求失败");
  20. }, function(res){
  21. if(res.status == 200){
  22. strOriginalData = res.data
  23. if(strOriginalData.prescription.status == 3){//已完成调整
  24. $('#startState').hide()
  25. $('#process').show()
  26. $('#success').hide()
  27. $('#fail').hide()
  28. nextDo()
  29. }else if(strOriginalData.prescription.status == 0){//未调整
  30. selectFee()
  31. selectHome()
  32. $('#feeCheck').attr('data-id',strOriginalData.prescription.jwGisterTypeCode)
  33. $('#feeCheck').attr('data-name',strOriginalData.prescription.jwRegisterFee)
  34. $('#doctorHome').attr('data-id',strOriginalData.prescription.jwDeptCode)
  35. $('#startState').show()
  36. $('#process').hide()
  37. $('#success').hide()
  38. $('#fail').hide()
  39. plus.nativeUI.closeWaiting();
  40. }else if(strOriginalData.prescription.status == 2){
  41. plus.nativeUI.closeWaiting();
  42. $('#startState').hide()
  43. $('#process').show()
  44. $('#success').hide()
  45. $('#fail').hide()
  46. mui.toast('续方处于调整中')
  47. }else if(strOriginalData.prescription.status == 4){
  48. plus.nativeUI.closeWaiting();
  49. $('#startState').hide()
  50. $('#process').hide()
  51. $('#success').hide()
  52. $('#fail').show()
  53. }else{
  54. plus.nativeUI.closeWaiting();
  55. $('#startState').hide()
  56. $('#process').hide()
  57. $('#success').show()
  58. $('#fail').hide()
  59. }
  60. }else{
  61. plus.nativeUI.closeWaiting();
  62. mui.toast("获取数据失败");
  63. }
  64. },'get')
  65. }
  66. $('#confirm').click(function(){
  67. var $fee = $('#feeCheck').attr('data-name'),
  68. $type = $('#feeCheck').attr('data-id'),
  69. $dept = $('#doctorHome').attr('data-id');
  70. if($fee && $type && $dept){
  71. plus.nativeUI.showWaiting();
  72. var params = {
  73. code:prescriptionCode,
  74. dept:$dept,
  75. registerFee:$fee,
  76. rateTypeCode:$type
  77. }
  78. sendPost("doctor/prescriptionAdjust/adjustPrescription",params, function(){
  79. plus.nativeUI.closeWaiting();
  80. mui.toast("请求失败");
  81. }, function(res){
  82. plus.nativeUI.closeWaiting();
  83. if(res.status == 200){
  84. $('#startState').hide()
  85. $('#process').show()
  86. refreshHz()
  87. }else{
  88. mui.toast(res.msg)
  89. }
  90. },'post',30000)
  91. }else{
  92. mui.toast('请选择诊查费用和开方科室')
  93. }
  94. })
  95. $('#caConfirm').click(function(){
  96. queryData()
  97. })
  98. function nextDo(){
  99. sendPost("doctor/isAuthentication",{}, function(){
  100. plus.nativeUI.closeWaiting();
  101. mui.toast("请求失败");
  102. }, function(res){
  103. if(res.status == 200){
  104. plus.nativeUI.closeWaiting();
  105. if(res.data.type != 4){
  106. dialog({
  107. content: '您暂未安装CA证书,无法进行续方审核,点击前往安装',
  108. okValue: '前往安装',
  109. cancelValue: '取消',
  110. cancel: function () {
  111. return;
  112. },
  113. ok: function() {
  114. mui.openWindow({
  115. id: "cazhengshu",
  116. url: "cazhengshu.html",
  117. waiting:{autoShow:false},
  118. extras: {
  119. code:res.data.type
  120. }
  121. })
  122. }
  123. }).showModal();
  124. }else{
  125. $('#doctorName').html(docInfo.name)
  126. $('.layer-bg').show();
  127. }
  128. }else{
  129. plus.nativeUI.closeWaiting();
  130. mui.toast("请求证书信息失败");
  131. }
  132. },'get')
  133. }
  134. //输入密码
  135. var psw = 0;
  136. var $li = $('#password').find('li');
  137. $('.number-pad').on('tap','li',function(){
  138. var $this = $(this)
  139. if(!$this.hasClass('no')){
  140. if(!$this.hasClass('del')){
  141. if(psw <=5){
  142. var $one = $li.eq(psw);
  143. $one.addClass('active');
  144. $one.attr('data-val',$this.text().trim());
  145. psw++;
  146. }else{
  147. mui.toast('请点击确定')
  148. }
  149. }else{
  150. if(psw >=1){
  151. psw--;
  152. var $one = $li.eq(psw);
  153. $one.removeClass('active');
  154. $one.attr('data-val','');
  155. }
  156. }
  157. }else{
  158. if(psw ==6){
  159. submitContent()
  160. }
  161. }
  162. })
  163. //提取密码
  164. function takePassword(){
  165. var str = '';
  166. $li.each(function(){
  167. str += $(this).attr('data-val');
  168. })
  169. return str
  170. }
  171. //忘记密码
  172. $('#forget').click(function(){
  173. mui.openWindow({
  174. id: "shenfenrenzheng",
  175. url: "shenfenrenzheng.html",
  176. waiting:{autoShow:false}
  177. })
  178. })
  179. //取消
  180. $('.layer-bg').click(function(){
  181. cancel();
  182. })
  183. $('.xufang-num').click(function(e){ e.stopPropagation() })
  184. $('#cancel').click(function(){
  185. cancel();
  186. })
  187. function cancel(){
  188. $('.layer-bg').hide();
  189. psw = 0;
  190. $li.removeClass('active');
  191. $li.attr('data-val','');
  192. }
  193. function submitContent(){
  194. plus.nativeUI.showWaiting();
  195. var imporMsg = {};
  196. imporMsg.prescription = {};
  197. imporMsg.prescription.jwCode = strOriginalData.prescription.jwCode;
  198. imporMsg.prescription.patientName = strOriginalData.prescription.patientName;
  199. imporMsg.prescription.doctorName = strOriginalData.prescription.doctorName;
  200. imporMsg.prescription.diagnosis = strOriginalData.diagnosis;
  201. var arr=[]
  202. _.map(strOriginalData.prescriptionInfo,function(item){
  203. var obj = _.pick(item, 'drugCode','drugName','jwSubCode','physicAmount','physicAmountUnit','physicAmountUnitName');
  204. arr.push(obj)
  205. })
  206. imporMsg.prescription.prescriptionInfo = arr;
  207. var params ={
  208. strRealNameSoftCertCalledPasswd:takePassword(),
  209. strOriginalData:JSON.stringify(imporMsg),
  210. prescriptionCode:prescriptionCode
  211. }
  212. sendPost("doctor/requestRealNameSoftCertAndSign",params, function(){
  213. plus.nativeUI.closeWaiting();
  214. mui.toast("请求失败");
  215. }, function(res){
  216. if(res.status==200){
  217. if(res.data){
  218. cancel()
  219. passingReview()
  220. }else{
  221. plus.nativeUI.closeWaiting();
  222. mui.toast(res.msg)
  223. }
  224. }else{
  225. plus.nativeUI.closeWaiting();
  226. mui.toast("用户不存在或密码错误")
  227. psw = 0;
  228. $li.removeClass('active');
  229. $li.attr('data-val','');
  230. }
  231. })
  232. }
  233. function passingReview(){
  234. plus.nativeUI.showWaiting();
  235. sendPost("doctor/prescriptionAdjust/uploadCaDigital",{code:prescriptionCode}, function(){
  236. plus.nativeUI.closeWaiting();
  237. mui.toast("请求失败")
  238. },function(res){
  239. plus.nativeUI.closeWaiting();
  240. if(res.status == 200){
  241. refreshHz()
  242. dialog({
  243. content: '提交成功,记得去完成该居民的随访哦',
  244. okValue: '好的',
  245. ok: function() {
  246. var page = plus.webview.getWebviewById("xufangxiangqing");
  247. var page1 = plus.webview.getWebviewById("juminxufangxiangqing");
  248. if(page1){
  249. page1.close('none')
  250. }
  251. if(page && !page1){
  252. page.close('none')
  253. }
  254. mui.back()
  255. }
  256. }).showModal();
  257. }else{
  258. mui.toast(res.msg)
  259. }
  260. },'post',60000)
  261. }
  262. plus.nativeUI.showWaiting();
  263. queryData()
  264. }
  265. //费用下拉
  266. function selectFee(){
  267. var data={
  268. jwHospital:strOriginalData.prescription.jwHospital,
  269. jwDoctorCode:strOriginalData.prescription.jwDoctorCode
  270. }
  271. sendPost("doctor/prescriptionInfo/getRegisterRee",data, function(){
  272. mui.toast("请求失败");
  273. }, function(res){
  274. if(res.status == 200){
  275. var result = res.data;
  276. var html = '<option disabled selected></option>';
  277. $.map(result,function(item,index){
  278. if(item.registerType == strOriginalData.prescription.jwGisterTypeCode){
  279. html += '<option selected value="'+item.registerType+'">'+item.registerTypeName+' '+item.registerFee+' 元'+'</option>';
  280. }else{
  281. html += '<option value="'+item.registerType+'">'+item.registerTypeName+' '+item.registerFee+' 元'+'</option>';
  282. }
  283. })
  284. $('#feeCheck').html(html);
  285. $('#feeCheck').mobiscroll().select({
  286. theme: 'ios',
  287. lang: 'zh',
  288. display: 'bottom',
  289. placeholder:'请按医生级别选择诊查费用',
  290. rows:4,
  291. onSelect: function ( valueText, inst) {
  292. $('#feeCheck').attr('data-id',inst._tempValue)
  293. $('#feeCheck').attr('data-name',valueText.split(' ')[1])
  294. }
  295. })
  296. }
  297. },'get')
  298. }
  299. // 科室下拉
  300. function selectHome(){
  301. var data={
  302. jwHospital:strOriginalData.prescription.jwHospital,
  303. jwDoctorCode:strOriginalData.prescription.jwDoctorCode
  304. }
  305. sendPost("doctor/prescriptionInfo/getDeptList",data, function(){
  306. mui.toast("请求失败");
  307. }, function(res){
  308. if(res.status == 200){
  309. var result = res.data;
  310. var html = '<option disabled selected></option>';
  311. $.map(result,function(item,index){
  312. if(item.deptCode == strOriginalData.prescription.jwDeptCode){
  313. html += '<option selected value="'+item.deptCode+'">'+item.deptName+'</option>';
  314. }else{
  315. html += '<option value="'+item.deptCode+'">'+item.deptName+'</option>';
  316. }
  317. })
  318. $('#doctorHome').html(html);
  319. $('#doctorHome').mobiscroll().select({
  320. theme: 'ios',
  321. lang: 'zh',
  322. display: 'bottom',
  323. placeholder:'请选择您所在科室',
  324. rows:4,
  325. onSelect: function ( valueText, inst) {
  326. $('#doctorHome').attr('data-id',inst._tempValue)
  327. }
  328. })
  329. }
  330. },'get')
  331. }
  332. function refreshHz(){
  333. var page = plus.webview.getWebviewById("xufangguanli");
  334. if(page){
  335. mui.fire(page, "refreshXufang");
  336. }
  337. var page1 = plus.webview.getWebviewById("juminxufangjilu");
  338. if(page1){
  339. mui.fire(page1, "refreshXufang");
  340. }
  341. var page2 = plus.webview.getWebviewById("xufangxiangqing");
  342. if(page2){
  343. mui.fire(page2, "refreshXufang");
  344. }
  345. var page3 = plus.webview.getWebviewById("juminxufangxiangqing");
  346. if(page3){
  347. mui.fire(page3, "refreshXufang");
  348. }
  349. }