ribao.js 15 KB

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