ribao.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. function ribao_init() {
  2. $('#btnRB').on('click', function () {
  3. window.location.href = "/yeweihui/home.html";
  4. });
  5. $("#js_input_user_sex").select({
  6. title: "选择性别",
  7. items: [
  8. {
  9. title: "男",
  10. value: "1",
  11. },
  12. {
  13. title: "女",
  14. value: "2",
  15. }]
  16. });
  17. $("#js_input_user_status").select({
  18. title: "选择基本状况",
  19. items: [
  20. {
  21. title: "正常",
  22. value: "0",
  23. }, {
  24. title: "心脑血管疾病(服用ARB)",
  25. value: "1",
  26. },
  27. {
  28. title: "心脑血管疾病(未服ARB)",
  29. value: "2",
  30. },
  31. {
  32. title: "呼吸系统病史",
  33. value: "3",
  34. },
  35. {
  36. title: "肿瘤病史",
  37. value: "4",
  38. },
  39. {
  40. title: "糖尿病史",
  41. value: "5",
  42. },
  43. {
  44. title: "服用过激素药物",
  45. value: "6",
  46. },
  47. {
  48. title: "妊娠期",
  49. value: "7",
  50. }, {
  51. title: "其他",
  52. value: "8",
  53. }]
  54. });
  55. $("#js_input_user_kesou").select({
  56. title: "选择咳嗽情况",
  57. items: [
  58. {
  59. title: "无咳嗽",
  60. value: "0",
  61. },
  62. {
  63. title: "偶尔短暂咳嗽",
  64. value: "1",
  65. },
  66. {
  67. title: "频繁咳嗽轻度影响生活",
  68. value: "2",
  69. },
  70. {
  71. title: "频繁咳嗽重度影响生活",
  72. value: "3",
  73. }]
  74. });
  75. $("#js_input_user_jirou").select({
  76. title: "选择肌肉情况",
  77. items: [
  78. {
  79. title: "无",
  80. value: "0",
  81. },
  82. {
  83. title: "加重",
  84. value: "1",
  85. },
  86. {
  87. title: "好转",
  88. value: "2",
  89. },
  90. {
  91. title: "无变化",
  92. value: "3",
  93. }]
  94. });
  95. $("#js_input_user_huxi").select({
  96. title: "选择呼吸情况",
  97. items: [
  98. {
  99. title: "无",
  100. value: "0",
  101. },
  102. {
  103. title: "加重",
  104. value: "1",
  105. },
  106. {
  107. title: "好转",
  108. value: "2",
  109. },
  110. {
  111. title: "无变化",
  112. value: "3",
  113. },
  114. {
  115. title: "严重",
  116. value: "4",
  117. }]
  118. });
  119. $("#js_input_user_xiongmen").select({
  120. title: "选择胸闷情况",
  121. items: [
  122. {
  123. title: "无",
  124. value: "0",
  125. },
  126. {
  127. title: "端坐呼吸",
  128. value: "1",
  129. },
  130. {
  131. title: "活动无耐力",
  132. value: "2",
  133. },
  134. {
  135. title: "无变化",
  136. value: "3",
  137. }]
  138. });
  139. $("#js_input_user_fali").select({
  140. title: "选择乏力情况",
  141. items: [
  142. {
  143. title: "无",
  144. value: "0",
  145. },
  146. {
  147. title: "加重",
  148. value: "1",
  149. },
  150. {
  151. title: "好转",
  152. value: "2",
  153. },
  154. {
  155. title: "无变化",
  156. value: "3",
  157. }]
  158. });
  159. $("#js_input_user_fuxie").select({
  160. title: "选择乏力情况",
  161. items: [
  162. {
  163. title: "无",
  164. value: "0",
  165. },
  166. {
  167. title: "有",
  168. value: "1",
  169. }]
  170. });
  171. $("#rb_switch").bind("click", function () {
  172. if ($("#switchQuezhen").val() == "off") {
  173. $("#switchQuezhen").val("on");
  174. } else {
  175. $("#switchQuezhen").val("off");
  176. }
  177. });
  178. }
  179. //近日报告
  180. function ribaoInitialization(reportId) {
  181. if (reportId == null)
  182. return;
  183. $.ajax({
  184. url: '/home/home/queryRibaoRefresh',
  185. data: {
  186. reportId: reportId
  187. },
  188. type: 'GET',
  189. success: function (data) {
  190. console.log(data);
  191. if (data.data.length > 0) {
  192. $('#btn_shangbao').text('上报');
  193. hasData = true;
  194. data.data.forEach(function (v) {
  195. ribao_cell(v);
  196. });
  197. } else {
  198. $('#btn_shangbao').text('全家报平安');
  199. }
  200. },
  201. error: function () {
  202. }
  203. });
  204. }
  205. //刷新今日日报
  206. function ribao_refrash() {
  207. var userId = $("#userId").val();
  208. $.ajax({
  209. url: '/home/home/queryRibao',
  210. data: {
  211. userCreate: userId
  212. },
  213. type: 'GET',
  214. success: function (data) {
  215. console.log(data);
  216. if (data.data == undefined) {
  217. $('#ribao_famliy').empty();
  218. }
  219. else {
  220. if (data.data.length > 0) {
  221. hasData = true;
  222. $('#rb_family').empty();
  223. data.data.forEach(function (v) {
  224. ribao_cell(v);
  225. });
  226. } else {
  227. }
  228. }
  229. },
  230. error: function () {
  231. }
  232. });
  233. }
  234. function ribao_cell(v) {
  235. var userName = v.userName + ":";
  236. var grender = getGreder(v.grender);
  237. var age = v.age;
  238. var familyStatus = "基本状况:" + getFamilyStatus(v.familyStatus) + ";";
  239. var medical = "是否确诊:" + getGreder(v.grender) + ";";
  240. var temperature = "体温:" + v.temperature + ";";
  241. var cough = "咳嗽:" + getCough(v.cough) + ";";
  242. var muscle = "肌肉酸痛:" + getMuscle(v.muscle) + ";";
  243. var dyspnea = "呼吸困难:" + getDyspnea(v.dyspnea) + ";";
  244. var chest = "胸闷:" + getChest(v.chest) + ";";
  245. var fatigue = "乏力:" + getFatigue(v.fatigue) + ";";
  246. var diarrhea = "腹泻:" + getDiarrhea(v.diarrhea) + ";";
  247. var diarrheaNum = "腹泻次数:" + v.diarrheaNum + "次;";
  248. var others = "其他:" + v.others;
  249. $('#rb_family').append($('<div class="weui-media-box weui-media-box_text">\n' +
  250. ' <h4 class="weui-media-box__title">' + userName + '&nbsp;&nbsp;&nbsp;' + grender + '&nbsp;&nbsp;&nbsp;' + age + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="color: #2a62bc" onclick=\'deleteSuspected(' + JSON.stringify(v.suspectedId) + ')\'>删除</a></h4>\n' +
  251. ' <p class="weui-media-box__desc">' + familyStatus + medical + temperature + cough + muscle + dyspnea + chest + fatigue + diarrhea + diarrheaNum + others + '</p>\n' +
  252. ' </div>\n' +
  253. ' '));
  254. }
  255. function ribao_add() {
  256. $('#btnAdd').on('click', function () {
  257. if ($('#ribao')[0].style.display == 'none') {
  258. $('#notOpenRibao').toggle();
  259. $('#ribao')[0].style.display = '';
  260. } else {
  261. $('#notOpenRibao')[0].style.display = '';
  262. $('#ribao')[0].style.display = 'none';
  263. }
  264. });
  265. }
  266. function ribao_cancel() {
  267. $('#cancel').on('click', function () {
  268. if ($('#ribao')[0].style.display == 'none') {
  269. $('#notOpenRibao').toggle();
  270. $('#ribao')[0].style.display = '';
  271. } else {
  272. $('#notOpenRibao')[0].style.display = '';
  273. $('#ribao')[0].style.display = 'none';
  274. }
  275. });
  276. }
  277. function ribaoCommit() {
  278. // console.log("sss");
  279. // console.log(
  280. // "姓名", $("#js_input_user_name").val(),
  281. // "性别", $("#js_input_user_sex").val(), "实际值", $("#js_input_user_sex").attr("data-values"),
  282. // "年龄", $("#js_input_user_age").val(),
  283. // "基本状况", $("#js_input_user_status").val(),
  284. // "状况描述", $("#jibenmiaoshu").val(),
  285. // "是否确诊", $("#switchQuezhen").val(),
  286. // "体温", $("#js_input_user_tiwen").val(),
  287. // "咳嗽", $("#js_input_user_kesou").val(),
  288. // "肌肉酸痛", $("#js_input_user_jirou").val(),
  289. // "呼吸困难", $("#js_input_user_huxi").val(),
  290. // "胸闷", $("#js_input_user_xiongmen").val(),
  291. // "乏力", $("#js_input_user_fali").val(),
  292. // "腹泻", $("#js_input_user_fuxie").val(),
  293. // "次数", $("#js_input_user_cishu").val(),
  294. // "其他", $("#shuruqita").val(),
  295. // );
  296. // return;
  297. var userId = $("#userId").val();
  298. var userName = $("#js_input_user_name").val();
  299. var grender = $("#js_input_user_sex").attr("data-values") == undefined ? 0 : $("#js_input_user_sex").attr("data-values");
  300. var age = $("#js_input_user_age").val()== "" ? 0 : $("#js_input_user_age").val();
  301. var familyStatus = $("#js_input_user_status").attr("data-values") == undefined ? 0 : $("#js_input_user_status").attr("data-values");
  302. var statusDesp = $("#jibenmiaoshu").val()== undefined ? "" : $("#jibenmiaoshu").val();
  303. var medical = $("#switchQuezhen").val() == "on" ? 1 : 0;
  304. var temperature = $("#js_input_user_tiwen").val()== "" ? 0 : $("#js_input_user_tiwen").val();
  305. var cough = $("#js_input_user_kesou").attr("data-values") == undefined ? 0 : $("#js_input_user_kesou").attr("data-values");
  306. var muscle = $("#js_input_user_jirou").attr("data-values") == undefined ? 0 : $("#js_input_user_jirou").attr("data-values");
  307. var dyspnea = $("#js_input_user_huxi").attr("data-values") == undefined ? 0 : $("#js_input_user_huxi").attr("data-values");
  308. var chest = $("#js_input_user_xiongmen").attr("data-values") == undefined ? 0 : $("#js_input_user_xiongmen").attr("data-values");
  309. var fatigue = $("#js_input_user_fali").attr("data-values") == undefined ? 0 : $("#js_input_user_fali").attr("data-values");
  310. var diarrhea = $("#js_input_user_fuxie").attr("data-values") == undefined ? 0 : $("#js_input_user_fuxie").attr("data-values");
  311. var diarrheaNum = $("#js_input_user_cishu").val()== "" ? 0 : $("#jibenmiaoshu").val();
  312. var others = $("#shuruqita").val()== undefined ? "" : $("#jibenmiaoshu").val();
  313. $.ajax({
  314. url: '/home/addRibao',
  315. type: "post",
  316. data: {
  317. "userCreate": userId,
  318. "userName": userName,
  319. "grender": grender,
  320. "age": age,
  321. "familyStatus": familyStatus,
  322. "statusDesp": statusDesp,
  323. "medical": medical,
  324. "temperature": temperature,
  325. "cough": cough,
  326. "muscle": muscle,
  327. "dyspnea": dyspnea,
  328. "chest": chest,
  329. "fatigue": fatigue,
  330. "diarrhea": diarrhea,
  331. "diarrheaNum": diarrheaNum,
  332. "others": others,
  333. },
  334. success: function (data) {
  335. if ($('#ribao')[0].style.display == 'none') {
  336. $('#notOpenRibao').toggle();
  337. $('#ribao')[0].style.display = '';
  338. } else {
  339. $('#notOpenRibao')[0].style.display = '';
  340. $('#ribao')[0].style.display = 'none';
  341. }
  342. ribao_refrash();
  343. },
  344. });
  345. }
  346. function deleteSuspected(suspectedId) {
  347. $.ajax({
  348. url: '/home/deleteSuspected',
  349. type: "post",
  350. data: {
  351. "suspectedId": suspectedId
  352. },
  353. success: function (data) {
  354. ribao_refrash();
  355. },
  356. });
  357. }
  358. function addReport() {
  359. var userId = $("#userId").val();
  360. var safety_num = $("#ribao_safety_num").val();
  361. if (safety_num == "") {
  362. alert("请填写居家人数");
  363. return;
  364. }
  365. $.ajax({
  366. url: '/home/addReport',
  367. type: "post",
  368. data: {
  369. "userCreate": userId,
  370. "safetyNum": safety_num,
  371. },
  372. success: function (data) {
  373. $.toast("操作成功");
  374. },
  375. });
  376. }
  377. $("#my-input-ribao").calendar({
  378. dateFormat: 'yyyy-mm-dd',
  379. inputReadOnly: false,
  380. onChange: function (p, values, displayValues) {
  381. var reportDate = values.toString();
  382. var userId = $("#userId").val();
  383. $.ajax({
  384. url: '/home/home/queryRibaoReportDate',
  385. data: {
  386. "userCreate": userId,
  387. "reportDate": reportDate,
  388. },
  389. type: 'GET',
  390. success: function (data) {
  391. if (data.data == undefined) {
  392. $('#ribao_famliy').empty();
  393. }
  394. else {
  395. if (data.data.length > 0) {
  396. $('#ribao_famliy').empty();
  397. data.data.forEach(function (v) {
  398. helpValue1(v);
  399. });
  400. } else {
  401. }
  402. }
  403. },
  404. error: function () {
  405. }
  406. });
  407. }
  408. });
  409. function helpValue1(v) {
  410. var userName = v.userName + ":";
  411. var grender = getGreder(v.grender);
  412. var age = v.age;
  413. var familyStatus = "基本状况:" + getFamilyStatus(v.familyStatus) + ";";
  414. var medical = "是否确诊:" + getGreder(v.grender) + ";";
  415. var temperature = "体温:" + v.temperature + ";";
  416. var cough = "咳嗽:" + getCough(v.cough) + ";";
  417. var muscle = "肌肉酸痛:" + getMuscle(v.muscle) + ";";
  418. var dyspnea = "呼吸困难:" + getDyspnea(v.dyspnea) + ";";
  419. var chest = "胸闷:" + getChest(v.chest) + ";";
  420. var fatigue = "乏力:" + getFatigue(v.fatigue) + ";";
  421. var diarrhea = "腹泻:" + getDiarrhea(v.diarrhea) + ";";
  422. var diarrheaNum = "腹泻次数:" + v.diarrheaNum + "次;";
  423. var others = "其他:" + v.others;
  424. $('#ribao_famliy').append($('<div class="weui-media-box weui-media-box_text">\n' +
  425. ' <h4 class="weui-media-box__title">' + userName + '&nbsp;&nbsp;&nbsp;' + grender + '&nbsp;&nbsp;&nbsp;' + age + '</h4>\n' +
  426. ' <p class="weui-media-box__desc">' +familyStatus + medical + temperature + cough + muscle + dyspnea + chest + fatigue + diarrhea + diarrheaNum + others + '</p>\n' +
  427. ' </div>\n' +
  428. ' '));
  429. }
  430. function getGreder(greder) {
  431. if (greder == 1)
  432. return "男";
  433. else if (greder == 2)
  434. return "女";
  435. return "";
  436. }
  437. function getFamilyStatus(familyStatus) {
  438. if (familyStatus == 0)
  439. return "正常";
  440. if (familyStatus == 1)
  441. return "心脑血管疾病(服用ARB)";
  442. else if (familyStatus == 2)
  443. return "心脑血管疾病(未服ARB)";
  444. else if (familyStatus == 3)
  445. return "呼吸系统病史";
  446. else if (familyStatus == 4)
  447. return "肿瘤病史";
  448. else if (familyStatus == 5)
  449. return "糖尿病史";
  450. else if (familyStatus == 6)
  451. return "服用过激素药物";
  452. else if (familyStatus == 7)
  453. return "妊娠期";
  454. else if (familyStatus == 8)
  455. return "其他";
  456. return "";
  457. }
  458. function getCough(cough) {
  459. if (cough == 0)
  460. return "无咳嗽";
  461. else if (cough == 1)
  462. return "偶尔短暂咳嗽";
  463. else if (cough == 2)
  464. return "频繁咳嗽轻度影响生活";
  465. else if (cough == 3)
  466. return "频繁咳嗽重度影响生活";
  467. return "";
  468. }
  469. function getMuscle(muscle) {
  470. if (muscle == 0)
  471. return "无";
  472. else if (muscle == 1)
  473. return "加重";
  474. else if (muscle == 2)
  475. return "好转";
  476. else if (muscle == 3)
  477. return "无变化";
  478. return "";
  479. }
  480. function getDyspnea(dyspnea) {
  481. if (dyspnea == 0)
  482. return "无";
  483. else if (dyspnea == 1)
  484. return "加重";
  485. else if (dyspnea == 2)
  486. return "好转";
  487. else if (dyspnea == 3)
  488. return "无变化";
  489. else if (dyspnea == 4)
  490. return "严重";
  491. return "";
  492. }
  493. function getChest(chest) {
  494. if (chest == 0)
  495. return "无";
  496. else if (chest == 1)
  497. return "端坐呼吸";
  498. else if (chest == 2)
  499. return "活动无耐力";
  500. else if (chest == 3)
  501. return "无变化";
  502. return "";
  503. }
  504. function getFatigue(fatigue) {
  505. if (fatigue == 0)
  506. return "无";
  507. else if (fatigue == 1)
  508. return "加重";
  509. else if (fatigue == 2)
  510. return "好转";
  511. else if (fatigue == 3)
  512. return "无变化";
  513. return "";
  514. }
  515. function getMedical(medical) {
  516. if (medical == 0)
  517. return "为确诊";
  518. else if (medical == 1)
  519. return "确诊";
  520. return "";
  521. }
  522. function getDiarrhea(diarrhea) {
  523. if (diarrhea == 0)
  524. return "无";
  525. else if (diarrhea == 1)
  526. return "有";
  527. return "";
  528. }