dailiqianyue_bac1.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. var idCardReg = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/,
  2. mobileReg = /^[1][3578][0-9]{9}$/,
  3. doctorCode,name, idCard, ssc, mobile, emerMobile, key, encyIdCard,
  4. healthManagementCode=[],
  5. healthManagementName=[],
  6. diseaseCode=[],
  7. diseaseName=[],
  8. currHealthManagement,currHealthManagementName,
  9. self,
  10. encryURL = "login/public_key",
  11. docInfo =null,
  12. userAgent,
  13. docType;
  14. // 登录者相关信息(包括userAgent)
  15. var loginerInfo = null,
  16. // 基础环境信息(包括当前webview、encry相关)
  17. baseEnv = null;
  18. // 专科医生li容器
  19. var $doctorZK = $('#doctor_zk'),
  20. // 慢病类别li容器
  21. $disease = $("#disease"),
  22. // 添加附件图标按钮
  23. $imgArea = $('.add-img'),
  24. // 提交按钮
  25. $upload = $('#upload'),
  26. // 姓名
  27. $nameInput = $("#name").find("input"),
  28. // 身份证
  29. $idcardInput = $("#idcard").find("input"),
  30. // 医保卡号
  31. $sscInput = $("#ssc").find("input"),
  32. // 手机号码
  33. $mobileInput = $("#mobile").find("input"),
  34. // 应急人联系电话
  35. $emerMoblieInput = $("#emerMoblie").find("input"),
  36. // 居民分组
  37. $groupInput = $("#li_group input"),
  38. // 是否慢病
  39. $chronicDiseaseSwitch = $(".tag_cyc"),
  40. // 慢病类别
  41. $diseaseInput = $("#disease input"),
  42. // 全科医生
  43. $doctorQKInput = $('#dortor_qke input[data-val=dortor_qke]'),
  44. // 健康管理师
  45. $doctorJGInput = $('#healthManagement input[data-val=healthManagement]'),
  46. // 专科医生
  47. $doctorZKInput = $("#doctor_zk input"),
  48. // 政府补贴费
  49. $expensesInput: $("#li_expenses input"),
  50. // 家庭医生签约协议(勾选框)
  51. $agree = $(".input-group-pack");
  52. var getLoginerInfo = function() {
  53. // 登录的相关信息
  54. var userAgent = JSON.parse(plus.storage.getItem("userAgent")),
  55. // 登录的医生类别
  56. docType = plus.storage.getItem("docType"),
  57. // 登录的医生信息
  58. docInfo= plus.storage.getItem("docInfo"),
  59. // 该医生(登录者)所在社区(机构)编码
  60. hospital = plus.storage.getItem("hospital");
  61. return {
  62. userAgent: userAgent,
  63. docInfo: $.extend(docInfo,{docType:docType},{hospital: hospital})
  64. }
  65. },
  66. getBaseEnvPromise = function () {
  67. var env = {
  68. webview: plus.webview.currentWebview(),
  69. encryURL: "login/public_key",
  70. encryKey: ""
  71. };
  72. return new Promise(function(resolve, reject) {
  73. RSAUtils.getKeyFromServer(encryURL, function(res) {
  74. if(res.status == 200) {
  75. var mod = res.data.modulus;
  76. var exp = res.data.exponent;
  77. // key = RSAUtils.getKeyPair(exp, "", mod);
  78. env.encryKey = RSAUtils.getKeyPair(exp, "", mod);
  79. resolve(env);
  80. }
  81. });
  82. });
  83. },
  84. // 打开协议书页面
  85. toXieYiShu = function() {
  86. mui.openWindow('../../qygl/html/xieyishu.html', 'xieyishu', {});
  87. },
  88. // 获取全科医生
  89. qke = function (){
  90. var userAgent = loginerInfo.userAgent,
  91. hospital =userAgent.hospital;
  92. getReqPromise("/doctor/findDoctorByLevelAndHospital",{hospital:hospital,level:2})
  93. .then(function(res) {
  94. if(res.status == 200) {
  95. var doctors = res.doctors,
  96. qkeCodes=[],
  97. qkeNames=[];
  98. // 萃取数组对象中code、name,返回一个数组
  99. qkeCodes = _.pluck(doctors, 'code');
  100. qkeNames = _.pluck(doctors, 'name');
  101. qkeSelect(qkeCodes,qkeNames);
  102. }
  103. }).catch(function(e) {
  104. console && console.error(e);
  105. });
  106. }
  107. // 设置全科医生下拉框
  108. qkeSelect = function (qkeCodes,qkeNames) {
  109. $doctorQKInput.mobiscroll({
  110. theme: 'ios',
  111. lang: 'zh',
  112. customWheels: true,
  113. wheels: [
  114. [{
  115. keys: qkeCodes,
  116. values: qkeNames
  117. }]
  118. ],
  119. onSelect: function(valueText, inst) {
  120. var dd = eval("[" + valueText + "]"),
  121. name=dd[0].values,
  122. currExpenses = dd[0].keys;
  123. $(this).val(name);
  124. $doctorQKInput.attr("data-code",currExpenses);
  125. }
  126. });
  127. },
  128. // 获取健康管理医生列表
  129. reqDoctorJG = function() {
  130. var docInfo = loginerInfo.docInfo,
  131. // 登录医生的类别。1:专科医生,2:全科医生,3:健康管理师
  132. docType = docInfo.docInfo,
  133. // 请求路径,根据医生类别不同而不同
  134. url,
  135. // 请求参数
  136. params,
  137. // 所在机构(社区)
  138. hospital = docInfo.hospital;
  139. if(docType==2){
  140. url = "/doctor/doctor_combobox";
  141. params={type:3,hospital:hospital}
  142. }else{
  143. url = "/doctor/findDoctorByLevelAndHospital";
  144. params={hospital:hospital,level:docType}
  145. }
  146. getReqPromise(url,params).then(function(res) {
  147. var doctors, healthManagementCodes, healthManagementNames;
  148. if(res.status == 200) {
  149. // 如果是健康管理师 取res.doctors,如果是全科医生取res.list
  150. doctors = (docType==3)? res.doctors: ((docType==2)? res.list: []);
  151. // 萃取数组对象中code、name,返回一个数组
  152. healthManagementCodes = _.pluck(doctors, 'code');
  153. healthManagementNames = _.pluck(doctors, 'name');
  154. activHealthM(healthManagementCodes, healthManagementNames);
  155. };
  156. }).catch(function(e) { console && console.error(e); });
  157. },
  158. // 健康管理师下拉框
  159. function activHealthM(codes,names) {
  160. $doctorJGInput.mobiscroll({
  161. theme: 'ios',
  162. lang: 'zh',
  163. customWheels: true,
  164. wheels: [
  165. [{
  166. keys: codes,
  167. values: names
  168. }]
  169. ],
  170. onSelect: function(valueText, inst) {
  171. var dd = eval("[" + valueText + "]");
  172. $(this).val(dd[0].values);
  173. currHealthManagement = dd[0].keys;
  174. currHealthManagementName = dd[0].values;
  175. }
  176. });
  177. },
  178. // 获取政府补贴数据
  179. setExpenses = function (){
  180. var expensesCodes=[],expensesNames=[];
  181. getReqPromise("/common/getDictByDictName?name=SIGN_EXPENSES",null, "GET")
  182. .then(function(res) {
  183. if(res.status == 200) {
  184. var expensesList = res.list;
  185. // 萃取数组对象中code、value属性值,返回一个数组
  186. expensesCodes = _.pluck(expensesList, 'code');
  187. expensesNames = _.pluck(expensesList, 'value');
  188. activExpensesM(expensesCodes,expensesNames);
  189. };
  190. }).catch(function(e) {
  191. console && console.error(e);
  192. });
  193. },
  194. // 设置政府补贴下拉框
  195. activExpensesM = function (expensesCodes,expensesNames) {
  196. $expensesInput.mobiscroll({
  197. theme: 'ios',
  198. lang: 'zh',
  199. customWheels: true,
  200. wheels: [
  201. [{
  202. keys: expensesCodes,
  203. values: expensesNames
  204. }]
  205. ],
  206. onSelect: function(valueText, inst) {
  207. var dd = eval("[" + valueText + "]"),
  208. name=dd[0].values,
  209. currExpenses = dd[0].keys;
  210. $(this).val(name);
  211. $expensesInput.attr("data-code",currExpenses);
  212. }
  213. });
  214. },
  215. // 请求慢病类别列表数据
  216. reqDiseaseTypes = function() {
  217. // TODO 慢病类别列表数据(此版本先固定)
  218. var diseaseData= {"msg":"查询成功!","list":[{"code":"1","name":"高血压",},{"code":"2","name":"糖尿病",}],"status":200} ;
  219. // 萃取数组对象中code、value属性值,返回一个数组
  220. var codes = _.pluck(expensesList, 'code'),
  221. names = _.pluck(expensesList, 'value');
  222. initDiseaseTypes(codes, names);
  223. },
  224. // 初始化慢病类别列表
  225. initDiseaseTypes = function(codes, names) {
  226. $diseaseInput.mobiscroll({
  227. theme: 'ios',
  228. lang: 'zh',
  229. customWheels: true,
  230. wheels: [
  231. [{
  232. keys: codes,
  233. values: names
  234. }]
  235. ],
  236. onSelect: function(valueText, inst) {
  237. var dd = eval("[" + valueText + "]"),
  238. currdiseaseCode = dd[0].keys;
  239. $(this).val(dd[0].values);
  240. $diseaseInput.attr("data-code",currdiseaseCode);
  241. }
  242. });
  243. },
  244. getSSCNoByIdcard = function(idcard) {
  245. var checkUrl = "doctor/patient_cardno";
  246. getReqPromise(checkUrl,{idcard:idcard}).then(function(res) {
  247. if(res.status=='200'){
  248. $sscInput.val(res.data);
  249. if(res.data){
  250. $sscInput.attr("readonly","readonly");
  251. } else {
  252. $sscInput.removeAttr("readonly");
  253. }
  254. } else {
  255. mui.toast(res.msg);
  256. }
  257. });
  258. },
  259. // 慢病输入显示控制
  260. showChronicDiseaseInput = function(isShow) {
  261. if(true) {
  262. $chronicDiseaseSwitch.addClass("on");
  263. $doctorZK.css("display","-webkit-box");
  264. $disease.css("display","-webkit-box");
  265. } else {
  266. $chronicDiseaseSwitch.addClass("on");
  267. $doctorZK.css("display","-webkit-box");
  268. $disease.css("display","-webkit-box");
  269. }
  270. },
  271. // 图片缩放
  272. scaleRefresh = function (dom) {
  273. ImagesZoom.init({
  274. "elem": dom,
  275. "delBack": function(index) {
  276. $(".pic-count").text($(".pic-count").text() - 1); //删除图片后的回调
  277. $(dom).find("li").eq(index).remove();
  278. }
  279. });
  280. },
  281. getImagesPromise = function() {
  282. return new Promise(function(resolve, reject) {
  283. var uploadImgUrl = getCompressImg();
  284. if(uploadImgUrl) {
  285. uploadImg(uploadImgUrl, function(uploadObj) {
  286. var res = JSON.parse(uploadObj.responseText);
  287. resolve(res);
  288. });
  289. }
  290. });
  291. },
  292. // 获取表单数据
  293. getInputs = function() {
  294. var data = {
  295. name: $nameInput.val().trim(), // 姓名
  296. idcard: $idcardInput.val().trim(), // 身份证
  297. ssc: $sscInput.val().trim(), // 医保卡号
  298. mobile: $mobileInput.val().trim(), // 手机号码
  299. emerMoblie: $emerMoblieInput.val().trim(), // 应急人联系电话
  300. group: $groupInput.attr("data-code"), // 居民分组
  301. ismb: $chronicDiseaseSwitch.hasClass('on'), // 是否慢病,
  302. disease: $diseaseInput.attr("data-code") || 0, // 慢病类别code
  303. doctorQK: $doctorQKInput.attr("data-code"), // 全科医生code
  304. doctorNameQK: $doctorQKInput.val(), // 全科医生名字
  305. doctorJG: $doctorJGInput.attr("data-code"), // 健康管理师code
  306. doctorNameJG: $doctorJGInput.val(), // 健康管理师名字
  307. doctorZK: $doctorZKInput.attr("data-code"), // 专科医生code
  308. doctorNameZK: $doctorZKInput.val(), // 专科医生名字
  309. expenses: $expensesInput.attr("data-code"), // 政府补贴费
  310. uploadImgUrls: getCompressImg(), // 附件
  311. images: null,// 附件
  312. agree: $agree.hasClass("checked") // 家庭医生签约协议(是否勾选)
  313. };
  314. getImagesPromise().then(function(res) {
  315. if(res) {
  316. data.images = res.urls
  317. }
  318. });
  319. return data;
  320. },
  321. // 必输验证
  322. validRequired: function(data) {
  323. var fieldsStr = "name,idcard,ssc,mobile,doctorQK,doctorJG,agree",
  324. fieldsStr += data.ismb? ',doctorZK,disease': '',
  325. fieldMap = {
  326. name: "姓名",idcard:"身份证",ssc:"医保卡号",mobile:"手机号码",doctorQK:"全科医生",doctorJG:"健康管理师",doctorZK:"专科医生",disease:"疾病类型"
  327. },
  328. fields = fieldsStr.split(","),
  329. invalidField;
  330. invalidField = _.find(fields,function(key) {
  331. return !!data[key];
  332. });
  333. if(invalidField) {
  334. if(invalidField=="agree") {
  335. mui.toast("您还未接受签约协议");
  336. } else {
  337. mui.toast(fieldMap[invalidField]+'不能为空');
  338. }
  339. return false;
  340. } else {
  341. return true;
  342. }
  343. },
  344. // 输入格式验证
  345. validFormat: function(data) {
  346. var idCardReg = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/,
  347. mobileReg = /^[1][3578][0-9]{9}$/,
  348. sscReg = /^[a-zA-Z0-9]+$/;
  349. if(!idCardReg.test(data.idCard)) {
  350. $idcardInput.css("color","red")
  351. mui.toast("请填写有效身份证号");
  352. return false;
  353. }
  354. if(!sscReg.test(data.ssc)) {
  355. $sscInput.css("color","red")
  356. mui.toast("请填写有效的医保卡卡号");
  357. return false;
  358. }
  359. if(!mobileReg.test(data.mobile)) {
  360. $mobileInput.css("color","red");
  361. mui.toast("请填写有效的手机号码");
  362. return false;
  363. }
  364. if(data.emerMoblie && !mobileReg.test(data.emerMoblie)) {
  365. $emerMoblieInput.css("color","red")
  366. mui.toast("请填写有效的应急人联系方式");
  367. return false;
  368. }
  369. return true;
  370. },
  371. validInputByDBPromise = function(data) {
  372. var checkUrl = "doctor/family_contract/checkMoblie";
  373. return getReqPromises([{url: checkUrl,data:{mobile: data.mobile}}]).then(function(res) {
  374. var checkRes = res[0];
  375. if(checkRes.status==200) {
  376. if(checkRes.data.islive == "false") {
  377. dialog({
  378. content: "该手机号已签约!",
  379. ok: function() {
  380. $mobileInput.val("");
  381. }
  382. }).showModal();
  383. return false;
  384. } else {
  385. return true;
  386. }
  387. } else {
  388. mui.toast("手机号验证失败!");
  389. // $mobileInput.val("");
  390. return false;
  391. }
  392. });
  393. },
  394. // 所有输入验证
  395. validInputsPromise = function() {
  396. plus.nativeUI.showWaiting();
  397. // 表单数据
  398. var data = getInputs();
  399. return Promise.resolve()
  400. .then(function() {
  401. var flag = validRequired(data);
  402. if(!flag) throw new Error("必输校验失败");
  403. return flag;
  404. })
  405. .then(function(flag) {
  406. var flag = validFormat(data);
  407. if(!flag) throw new Error("格式校验失败");
  408. return flag;
  409. })
  410. .then(function() {
  411. return validInputByDBPromise(data);
  412. })
  413. .then(function(flag) {
  414. if(flag) return data;
  415. });
  416. },
  417. sendData = function (data) {
  418. var submitUrl = "doctor/family_contract/agent",
  419. docInfo = loginerInfo.docInfo,
  420. params = $.extend({},data,{
  421. doctor: data.doctorQK, //全科医生code
  422. doctorName: data.doctorNameQK, //全科医生名字
  423. signDoctorCode: docInfo.code, // 签约人code
  424. signDoctorName: docInfo.name, // 签约人名字
  425. signDoctorLevel: docInfo.docType, // 签约人等级
  426. idcard: RSAUtils.encryStr(baseEnv.encryKey, data.idcard),
  427. healthDoctor: data.doctorJG,
  428. healthDoctorName: data.doctorNameJG
  429. });
  430. //如果选择慢病
  431. if(data.ismb) {
  432. params.majorDoctor = data.doctorZK;
  433. params.majorDoctorName = data.doctorNameZK;
  434. }
  435. getReqPromise(submitUrl, params).then(function() {
  436. plus.nativeUI.closeWaiting();
  437. if(res.status == 200) {
  438. mui.confirm("代理签约成功, 是否继续代理签约?", "提示", ['是', '否'], function(e){
  439. if(e.index==0){
  440. baseEnv.webview.reload();
  441. } else{
  442. mui.fire(baseEnv.webview.opener(), 'updatePatiAmount');
  443. mui.later(function() {
  444. var hzWv = plus.webview.getWebviewById("huanzhe.html");
  445. if(hzWv) {
  446. mui.fire(hzWv, "update");
  447. }
  448. var syWv = plus.webview.getWebviewById("home2.html");
  449. if(syWv) {
  450. mui.fire(syWv, "refreshPatCount");
  451. }
  452. mui.back();
  453. }, 500);
  454. }
  455. })
  456. } else {
  457. mui.toast(res.msg);
  458. }
  459. });
  460. },
  461. bindEvents = function() {
  462. // 添加附件
  463. $imgArea.on('tap', '.add', function() {
  464. showActionSheet($imgArea[0], this);
  465. });
  466. // 提交
  467. $upload.on('tap', function() {
  468. plus.nativeUI.showWaiting();
  469. validInputsPromise().then(function(data) {
  470. if(data) {
  471. sendData(data);
  472. }
  473. });
  474. });
  475. // 选择分组
  476. $("body").on("click","#li_group",function(){
  477. mui.openWindow({
  478. url:"../../qygl/html/xiaoxichuli_fzgl.html",
  479. id:"xiaoxichuli_fzgl.html"
  480. })
  481. })
  482. // 点击家庭医生签约协议(勾选框)
  483. .on('click', '.input-group-pack', function() {
  484. $(this).toggleClass("checked");
  485. });
  486. $doctorZKInput.on("click",function(){
  487. mui.openWindow('hospital_list.html', 'hospital_list', {
  488. extras: {
  489. hosptialType: 1,
  490. callbackview:"dailiqianyue",
  491. callbackmethod:"getDoctor"
  492. }
  493. });
  494. })
  495. // 删除图片
  496. mui(".add-img").on("tap", ".icon-del", function() {
  497. var oli = this.parentElement;
  498. var oul = this.parentElement.parentElement;
  499. oul.removeChild(oli);
  500. });
  501. window.addEventListener('getDoctor', function(event) {
  502. $doctorZKInput.val(event.detail.name);
  503. $doctorZKInput.attr("data-code",event.detail.code);
  504. });
  505. /*分组事件*/
  506. window.addEventListener("group", function group(e) {
  507. var groupcode=e.detail.code
  508. var groupName=e.detail.name
  509. $groupInput.val(groupName).attr("data-code",groupcode)
  510. });
  511. };
  512. // 页面业务处理流程开始
  513. new Promise(function(resolve, reject) {
  514. mui.plusReady(function() {
  515. // plus已经准备好,可以往下执行
  516. resolve(true);
  517. })
  518. }).then(function() {
  519. // 获取基础环境信息
  520. getBaseEnvPromise().then(function(env) {
  521. baseEnv = env;
  522. }).then(function() {
  523. // 获取登录医生信息
  524. loginerInfo = getLoginerInfo();
  525. // 请求并初始化全科医生下拉框数据
  526. qke();
  527. // 请求并初始化健康管理师下拉框数据
  528. reqDoctorJG();
  529. // 请求并初始化政府补贴下拉框数据
  530. setExpenses();
  531. // 请求并初始化慢病类别下拉框数据
  532. reqDiseaseTypes();
  533. //图片缩放( 动态添加了上传的图片后运行一下下面这条这个)
  534. scaleRefresh(".upload-img-list");
  535. // 绑定页面事件
  536. bindEvents();
  537. }).catch(function(e) {
  538. console && console.error(e);
  539. })
  540. });
  541. mui.plusReady(function() {}
  542. mui.plusReady(function() {
  543. userAgent = JSON.parse(plus.storage.getItem("userAgent"));//登录的意思信息
  544. docType = JSON.parse(plus.storage.getItem("docType"));//登录的医生类别
  545. $("#doctor_zk").hide();
  546. docInfo= plus.storage.getItem("docInfo");
  547. docInfo = JSON.parse(docInfo);
  548. self = plus.webview.currentWebview();
  549. RSAUtils.getKeyFromServer(encryURL, function(res) {
  550. if(res.status == 200) {
  551. var mod = res.data.modulus;
  552. var exp = res.data.exponent;
  553. key = RSAUtils.getKeyPair(exp, "", mod);
  554. }
  555. });
  556. if(docType==2)//全科医生登录不显示 选择全科医生选项
  557. {
  558. $("#dortor_qke").hide()
  559. }else if(docType==3){//健康医生登录的时候 健康医生那个地方不能让选
  560. $("#healthManagement .no").show();
  561. }
  562. var hospital = plus.storage.getItem("hospital");
  563. //console.log(hospital);
  564. //健康管理师查询
  565. var healthManagementUrl//查询接口
  566. var params//参数
  567. if(docType==2){
  568. healthManagementUrl = "/doctor/doctor_combobox";
  569. params={type:3,hospital:hospital}
  570. }else{
  571. healthManagementUrl = "/doctor/findDoctorByLevelAndHospital";
  572. params={hospital:hospital,level:docType}
  573. }
  574. sendPost(healthManagementUrl, params, function(){
  575. mui.toast("健康管理师查询失败!");
  576. }, function(res) {
  577. if(res.status == 200) {
  578. if(docType==1){//专科
  579. }else if(docType==3){//健康管理师
  580. currHealthManagement=docInfo.code
  581. currHealthManagementName=docInfo.name
  582. $('#healthManagement input[data-val=healthManagement]').val(currHealthManagementName).attr("data-code",currHealthManagement);
  583. var healthManagementList = res.doctors;
  584. for(var i = 0; i < healthManagementList.length; i++) {
  585. healthManagementCode[i] = healthManagementList[i].code;
  586. healthManagementName[i] = healthManagementList[i].name;
  587. }
  588. }else{//全科
  589. //console.log(JSON.stringify(res))
  590. var healthManagementList = res.list;
  591. for(var i = 0; i < healthManagementList.length; i++) {
  592. healthManagementCode[i] = healthManagementList[i].code;
  593. healthManagementName[i] = healthManagementList[i].name;
  594. }
  595. }
  596. activHealthM();
  597. };
  598. });
  599. /* 签约三师 */
  600. function validIdCard(data) {
  601. // 该医生(登录者)所在社区(机构)编码
  602. var hospital = plus.storage.getItem("hospital"),
  603. // 该医生(登录者)基础信息
  604. docInfo = plus.storage.getItem("docInfo"),
  605. // 该医生(登录者)所在社区主编码(截取前8位,后两位是服务站)
  606. communityCode = hospital.slice(0,8),
  607. // 三师中全科医生所在社区主编码(截取前8位,后两位是服务站)
  608. qkCommunityCode = data.hospital.slice(0,8),
  609. // 该医生(登录者)编码
  610. doctor = docInfo.code,
  611. // 三师中全科医生编码
  612. qkDoctor = data.doctor,
  613. // 三师中全科医生是否在本社区
  614. isInCommunity = data.hospital,
  615. // 全科医生是否是该医生
  616. isSameDoctor = doctor == qkDoctor
  617. // ①三师中全科医生不在本社区,则弹窗提示“该居民已签约三师,无法继续签约”,点击“我知道了”,关闭弹窗,退出代理签约
  618. }
  619. // $("#idcard input").on("blur", function() {
  620. // $("#disease input").css("pointer-events", "");
  621. // $("#healthManagement input").css("pointer-events","");
  622. // $("#doctor_zk input").css("pointer-events", "");
  623. //// $("#ssc input").removeAttr("readonly");
  624. //
  625. // var $this = $(this);
  626. // var card = $this.val().trim();
  627. // if(!idCardReg.test(card) || !card) {
  628. // $("#idcard input").css("color","red")
  629. // mui.toast("请输入正确的身份证号!");
  630. // $("#ssc input").val("")
  631. // //$this.val("");
  632. //
  633. // return;
  634. // }else{
  635. // $("#idcard input").css("color","")
  636. // }
  637. // var checkUrl = "doctor/family_contract/patient_sanshi_signinfo";
  638. // sendPost(checkUrl,{idCard:card},null,function(res){
  639. // //console.log(JSON.stringify(res));
  640. // if(res.status=='200'){
  641. // var resultData =res.data;
  642. // //是三师签约,团队保持一致
  643. //
  644. // if(resultData.signStatus==1){
  645. // //如果当前登录是健康管理师
  646. // var qkcode="";
  647. // if(docType==2){
  648. // qkcode=docInfo.code;
  649. // }else if(docType==3){
  650. // qkcode=$('#dortor_qke input[data-val=dortor_qke]').attr("data-code");
  651. // }
  652. //
  653. //
  654. // //有三师签约,且全科医生不一致的情况下,不能进行签约
  655. // if(qkcode=="0" || qkcode==""){
  656. // mui.alert("请先选择全科医生,在填写身份证号");
  657. // $("#idcard input").val("")
  658. // $("#ssc input").val("")
  659. // return false;
  660. // }else if(qkcode!=resultData.doctor){
  661. //
  662. // //清空人员身份证
  663. // $('#idcard input').val("").attr("data-code","");
  664. // /*$("#info_list input").val("");
  665. // $("#info_list input").attr("data-code","");*/
  666. // mui.alert("存在三师签约,由于团队不一致无法进行签约!");
  667. // return false;
  668. // }else{
  669. // $("#doctor_zk").show();
  670. // $("#doctor_zk input").val(resultData.majorDoctorName);
  671. // $("#doctor_zk input").attr("data-code",resultData.majorDoctor);
  672. // $("#healthManagement input").val(resultData.healthDoctorName);
  673. // currHealthManagement = resultData.healthDoctor;
  674. // currHealthManagementName = resultData.healthDoctorName;
  675. // $("#healthManagement input").attr("data-code",resultData.healthDoctor);
  676. // $("#disease input").val(resultData.diseaseName);
  677. // $("#disease input").attr("data-code",resultData.disease);
  678. // $("#disease input").css("pointer-events","none");
  679. // $("#healthManagement input").css("pointer-events","none");
  680. // $("#doctor_zk input").css("pointer-events","none");
  681. // }
  682. //
  683. // }else if(resultData.signStatus==2){
  684. // alert(resultData.msg);
  685. // $("#info_list input").val("");
  686. // $("#info_list input").attr("data-code","");
  687. // return false;
  688. // } else {
  689. // activHealthM();
  690. // disease() ;
  691. // }
  692. // }
  693. //
  694. // getSSCNoByIdcard(card);
  695. //
  696. // });