123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568 |
- function ribao_init() {
- $("#js_input_user_sex").val("女"); //设置初始值
- $('#btnRB').on('click', function () {
- window.location.href = "/yeweihui/home.html";
- });
- $("#js_input_user_sex").select({
- title: "选择性别",
- items: [
- {
- title: "男",
- value: "1",
- },
- {
- title: "女",
- value: "2",
- }]
- });
- $("#js_input_user_status").select({
- title: "选择基本状况",
- items: [
- {
- title: "正常",
- value: "0",
- }, {
- title: "心脑血管疾病(服用ARB)",
- value: "1",
- },
- {
- title: "心脑血管疾病(未服ARB)",
- value: "2",
- },
- {
- title: "呼吸系统病史",
- value: "3",
- },
- {
- title: "肿瘤病史",
- value: "4",
- },
- {
- title: "糖尿病史",
- value: "5",
- },
- {
- title: "服用过激素药物",
- value: "6",
- },
- {
- title: "妊娠期",
- value: "7",
- }, {
- title: "其他",
- value: "8",
- }]
- });
- $("#js_input_user_kesou").select({
- title: "选择咳嗽情况",
- items: [
- {
- title: "无咳嗽",
- value: "0",
- },
- {
- title: "偶尔短暂咳嗽",
- value: "1",
- },
- {
- title: "频繁咳嗽轻度影响生活",
- value: "2",
- },
- {
- title: "频繁咳嗽重度影响生活",
- value: "3",
- }]
- });
- $("#js_input_user_jirou").select({
- title: "选择肌肉情况",
- items: [
- {
- title: "无",
- value: "0",
- },
- {
- title: "加重",
- value: "1",
- },
- {
- title: "好转",
- value: "2",
- },
- {
- title: "无变化",
- value: "3",
- }]
- });
- $("#js_input_user_huxi").select({
- title: "选择呼吸情况",
- items: [
- {
- title: "无",
- value: "0",
- },
- {
- title: "加重",
- value: "1",
- },
- {
- title: "好转",
- value: "2",
- },
- {
- title: "无变化",
- value: "3",
- },
- {
- title: "严重",
- value: "4",
- }]
- });
- $("#js_input_user_danjiangeli").select({
- title: "选择胸闷情况",
- items: [
- {
- title: "无",
- value: "0",
- },
- {
- title: "有",
- value: "1",
- }]
- });
- $("#js_input_user_fali").select({
- title: "选择乏力情况",
- items: [
- {
- title: "无",
- value: "0",
- },
- {
- title: "加重",
- value: "1",
- },
- {
- title: "好转",
- value: "2",
- },
- {
- title: "无变化",
- value: "3",
- }]
- });
- $("#js_input_user_fuxie").select({
- title: "选择乏力情况",
- items: [
- {
- title: "无",
- value: "0",
- },
- {
- title: "有",
- value: "1",
- }]
- });
- $("#rb_switch").bind("click", function () {
- if ($("#switchQuezhen").val() == "off") {
- $("#switchQuezhen").val("on");
- } else {
- $("#switchQuezhen").val("off");
- }
- });
- $("#rb_switch2").bind("click", function () {
- if ($("#js_input_user_danjiangeli").val() == "off") {
- $("#js_input_user_danjiangeli").val("on");
- } else {
- $("#js_input_user_danjiangeli").val("off");
- }
- });
- }
- //近日报告
- function ribaoInitialization(reportId) {
- if (reportId == null)
- return;
- $.ajax({
- url: '/home/home/queryRibaoRefresh',
- data: {
- reportId: reportId
- },
- type: 'GET',
- success: function (data) {
- console.log(data);
- if (data.data.length > 0) {
- $('#btn_shangbao').text('上报');
- hasData = true;
- data.data.forEach(function (v) {
- ribao_cell(v);
- });
- } else {
- $('#btn_shangbao').text('全家报平安');
- }
- },
- error: function () {
- }
- });
- }
- //刷新今日日报
- function ribao_refrash() {
- var userId = $("#userId").val();
- $.ajax({
- url: '/home/home/queryRibao',
- data: {
- userCreate: userId
- },
- type: 'GET',
- success: function (data) {
- console.log(data);
- if (data.data == undefined) {
- $('#rb_family').empty();
- }
- else {
- $('#rb_family').empty();
- if (data.data.length > 0) {
- hasData = true;
- data.data.forEach(function (v) {
- ribao_cell(v);
- });
- } else {
- }
- }
- },
- error: function () {
- }
- });
- }
- function ribao_cell(v) {
- var userName = v.userName + ":";
- var grender = getGreder(v.grender);
- var age = v.age;
- var familyStatus = "基本状况:" + getFamilyStatus(v.familyStatus) + ";";
- var medical = "是否确诊:" + getGreder(v.grender) + ";";
- var temperature = "体温:" + v.temperature + ";";
- var cough = "咳嗽:" + getCough(v.cough) + ";";
- var muscle = "肌肉酸痛:" + getMuscle(v.muscle) + ";";
- var dyspnea = "呼吸困难:" + getDyspnea(v.dyspnea) + ";";
- var chest = "胸闷:" + getChest(v.chest) + ";";
- var fatigue = "乏力:" + getFatigue(v.fatigue) + ";";
- var diarrhea = "腹泻:" + getDiarrhea(v.diarrhea) + ";";
- var diarrheaNum = "腹泻次数:" + v.diarrheaNum + "次;";
- var others = "其他:" + v.others;
- $('#rb_family').append($('<div class="weui-media-box weui-media-box_text">\n' +
- ' <h4 class="weui-media-box__title">' + userName + ' ' + grender + ' ' + age + ' <a style="color: #2a62bc" onclick=\'deleteSuspected(' + JSON.stringify(v.suspectedId) + ')\'>删除</a></h4>\n' +
- ' <p class="weui-media-box__desc">' + familyStatus + medical + temperature + cough + muscle + dyspnea + chest + fatigue + diarrhea + diarrheaNum + others + '</p>\n' +
- ' </div>\n' +
- ' '));
- }
- function ribao_add() {
- $('#btnAdd').on('click', function () {
- if ($('#ribao')[0].style.display == 'none') {
- $('#notOpenRibao').toggle();
- $('#ribao')[0].style.display = '';
- } else {
- $('#notOpenRibao')[0].style.display = '';
- $('#ribao')[0].style.display = 'none';
- }
- });
- }
- function ribao_cancel() {
- $('#cancel').on('click', function () {
- if ($('#ribao')[0].style.display == 'none') {
- $('#notOpenRibao').toggle();
- $('#ribao')[0].style.display = '';
- } else {
- $('#notOpenRibao')[0].style.display = '';
- $('#ribao')[0].style.display = 'none';
- }
- });
- }
- function ribaoCommit() {
- // console.log("sss");
- // console.log(
- // "姓名", $("#js_input_user_name").val(),
- // "性别", $("#js_input_user_sex").val(), "实际值", $("#js_input_user_sex").attr("data-values"),
- // "年龄", $("#js_input_user_age").val(),
- // "基本状况", $("#js_input_user_status").val(),
- // "状况描述", $("#jibenmiaoshu").val(),
- // "是否确诊", $("#switchQuezhen").val(),
- // "体温", $("#js_input_user_tiwen").val(),
- // "咳嗽", $("#js_input_user_kesou").val(),
- // "肌肉酸痛", $("#js_input_user_jirou").val(),
- // "呼吸困难", $("#js_input_user_huxi").val(),
- // "胸闷", $("#js_input_user_xiongmen").val(),
- // "乏力", $("#js_input_user_fali").val(),
- // "腹泻", $("#js_input_user_fuxie").val(),
- // "次数", $("#js_input_user_cishu").val(),
- // "其他", $("#shuruqita").val(),
- // );
- // return;
- var userId = $("#userId").val();
- var userName = $("#js_input_user_name").val();
- var grender = $("#js_input_user_sex").attr("data-values") == undefined ? 0 : $("#js_input_user_sex").attr("data-values");
- var age = $("#js_input_user_age").val()== "" ? 0 : $("#js_input_user_age").val();
- var familyStatus = $("#js_input_user_status").attr("data-values") == undefined ? 0 : $("#js_input_user_status").attr("data-values");
- var statusDesp = $("#jibenmiaoshu").val()== undefined ? "" : $("#jibenmiaoshu").val();
- var medical = $("#switchQuezhen").val() == "on" ? 1 : 0;
- var temperature = $("#js_input_user_tiwen").val()== "" ? 0 : $("#js_input_user_tiwen").val();
- var cough = $("#js_input_user_kesou").attr("data-values") == undefined ? 0 : $("#js_input_user_kesou").attr("data-values");
- var muscle = $("#js_input_user_jirou").attr("data-values") == undefined ? 0 : $("#js_input_user_jirou").attr("data-values");
- var dyspnea = $("#js_input_user_huxi").attr("data-values") == undefined ? 0 : $("#js_input_user_huxi").attr("data-values");
- var chest = $("#js_input_user_xiongmen").attr("data-values") == undefined ? 0 : $("#js_input_user_xiongmen").attr("data-values");
- var fatigue = $("#js_input_user_fali").attr("data-values") == undefined ? 0 : $("#js_input_user_fali").attr("data-values");
- var diarrhea = $("#js_input_user_fuxie").attr("data-values") == undefined ? 0 : $("#js_input_user_fuxie").attr("data-values");
- var diarrheaNum = $("#js_input_user_cishu").val()== "" ? 0 : $("#jibenmiaoshu").val();
- var others = $("#shuruqita").val()== undefined ? "" : $("#jibenmiaoshu").val();
- $.ajax({
- url: '/home/addRibao',
- type: "post",
- data: {
- "userCreate": userId,
- "userName": userName,
- "grender": grender,
- "age": age,
- "familyStatus": familyStatus,
- "statusDesp": statusDesp,
- "medical": medical,
- "temperature": temperature,
- "cough": cough,
- "muscle": muscle,
- "dyspnea": dyspnea,
- "chest": chest,
- "fatigue": fatigue,
- "diarrhea": diarrhea,
- "diarrheaNum": diarrheaNum,
- "others": others,
- },
- success: function (data) {
- if ($('#ribao')[0].style.display == 'none') {
- $('#notOpenRibao').toggle();
- $('#ribao')[0].style.display = '';
- } else {
- $('#notOpenRibao')[0].style.display = '';
- $('#ribao')[0].style.display = 'none';
- }
- ribao_refrash();
- },
- });
- }
- function deleteSuspected(suspectedId) {
- $.ajax({
- url: '/home/deleteSuspected',
- type: "post",
- data: {
- "suspectedId": suspectedId
- },
- success: function (data) {
- ribao_refrash();
- },
- });
- }
- function addReport() {
- var userId = $("#userId").val();
- var safety_num = $("#ribao_safety_num").val();
- if (safety_num == "") {
- alert("请填写居家人数");
- return;
- }
- $.ajax({
- url: '/home/addReport',
- type: "post",
- data: {
- "userCreate": userId,
- "safetyNum": safety_num,
- },
- success: function (data) {
- $.toast("操作成功");
- },
- });
- }
- $("#my-input-ribao").calendar({
- dateFormat: 'yyyy-mm-dd',
- inputReadOnly: false,
- onChange: function (p, values, displayValues) {
- var reportDate = values.toString();
- var userId = $("#userId").val();
- $.ajax({
- url: '/home/home/queryRibaoReportDate',
- data: {
- "userCreate": userId,
- "reportDate": reportDate,
- },
- type: 'GET',
- success: function (data) {
- if (data.data == undefined) {
- $('#ribao_famliy').empty();
- }
- else {
- if (data.data.length > 0) {
- $('#ribao_famliy').empty();
- data.data.forEach(function (v) {
- helpValue1(v);
- });
- } else {
- }
- }
- },
- error: function () {
- }
- });
- }
- });
- function helpValue1(v) {
- var userName = v.userName + ":";
- var grender = getGreder(v.grender);
- var age = v.age;
- var familyStatus = "基本状况:" + getFamilyStatus(v.familyStatus) + ";";
- var medical = "是否确诊:" + getGreder(v.grender) + ";";
- var temperature = "体温:" + v.temperature + ";";
- var cough = "咳嗽:" + getCough(v.cough) + ";";
- var muscle = "肌肉酸痛:" + getMuscle(v.muscle) + ";";
- var dyspnea = "呼吸困难:" + getDyspnea(v.dyspnea) + ";";
- var chest = "胸闷:" + getChest(v.chest) + ";";
- var fatigue = "乏力:" + getFatigue(v.fatigue) + ";";
- var diarrhea = "腹泻:" + getDiarrhea(v.diarrhea) + ";";
- var diarrheaNum = "腹泻次数:" + v.diarrheaNum + "次;";
- var others = "其他:" + v.others;
- $('#ribao_famliy').append($('<div class="weui-media-box weui-media-box_text">\n' +
- ' <h4 class="weui-media-box__title">' + userName + ' ' + grender + ' ' + age + '</h4>\n' +
- ' <p class="weui-media-box__desc">' +familyStatus + medical + temperature + cough + muscle + dyspnea + chest + fatigue + diarrhea + diarrheaNum + others + '</p>\n' +
- ' </div>\n' +
- ' '));
- }
- function getGreder(greder) {
- if (greder == 1)
- return "男";
- else if (greder == 2)
- return "女";
- return "";
- }
- function getFamilyStatus(familyStatus) {
- if (familyStatus == 0)
- return "正常";
- if (familyStatus == 1)
- return "心脑血管疾病(服用ARB)";
- else if (familyStatus == 2)
- return "心脑血管疾病(未服ARB)";
- else if (familyStatus == 3)
- return "呼吸系统病史";
- else if (familyStatus == 4)
- return "肿瘤病史";
- else if (familyStatus == 5)
- return "糖尿病史";
- else if (familyStatus == 6)
- return "服用过激素药物";
- else if (familyStatus == 7)
- return "妊娠期";
- else if (familyStatus == 8)
- return "其他";
- return "";
- }
- function getCough(cough) {
- if (cough == 0)
- return "无咳嗽";
- else if (cough == 1)
- return "偶尔短暂咳嗽";
- else if (cough == 2)
- return "频繁咳嗽轻度影响生活";
- else if (cough == 3)
- return "频繁咳嗽重度影响生活";
- return "";
- }
- function getMuscle(muscle) {
- if (muscle == 0)
- return "无";
- else if (muscle == 1)
- return "加重";
- else if (muscle == 2)
- return "好转";
- else if (muscle == 3)
- return "无变化";
- return "";
- }
- function getDyspnea(dyspnea) {
- if (dyspnea == 0)
- return "无";
- else if (dyspnea == 1)
- return "加重";
- else if (dyspnea == 2)
- return "好转";
- else if (dyspnea == 3)
- return "无变化";
- else if (dyspnea == 4)
- return "严重";
- return "";
- }
- function getChest(chest) {
- if (chest == 0)
- return "无";
- else if (chest == 1)
- return "端坐呼吸";
- else if (chest == 2)
- return "活动无耐力";
- else if (chest == 3)
- return "无变化";
- return "";
- }
- function getFatigue(fatigue) {
- if (fatigue == 0)
- return "无";
- else if (fatigue == 1)
- return "加重";
- else if (fatigue == 2)
- return "好转";
- else if (fatigue == 3)
- return "无变化";
- return "";
- }
- function getMedical(medical) {
- if (medical == 0)
- return "为确诊";
- else if (medical == 1)
- return "确诊";
- return "";
- }
- function getDiarrhea(diarrhea) {
- if (diarrhea == 0)
- return "无";
- else if (diarrhea == 1)
- return "有";
- return "";
- }
|