Commit 9c7ea8e0c9bc30722a545949deadb02d92d27581

Authored by [wangbo]
1 parent 8dda5f6a96

体成分分析

Showing 3 changed files with 848 additions and 0 deletions

platform-dal/src/main/java/com/lyms/platform/pojo/VolumeComponentAnalysisModel.java View file @ 9c7ea8e
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.common.result.BaseModel;
  4 +import org.springframework.data.mongodb.core.mapping.Document;
  5 +
  6 +/**
  7 + * 体成分分析
  8 + */
  9 +@Document(collection = "lyms_volume_component_analysis")
  10 +public class VolumeComponentAnalysisModel extends BaseModel {
  11 + private String id;
  12 + private String hospitalId;
  13 + private String parentId;
  14 + private String uuId;//  ABC-001;,    //单位代码
  15 + private String deviceID;// 16ART1B0007;       //仪器编号
  16 + private String deviceType;// BCA-1D;,              //仪器型号
  17 + private String memberId; // 13902345678;,       //测试者编号
  18 + private String testID; // ;201704281014;,         //测试序号
  19 + private String testDate; // 20170428;,            //测试日期
  20 + private String name;// 张三;,               //姓名(UTF-8编码)
  21 + private String sex;// 1;,                    //性别 (男1,女2)
  22 + private String height;// 178.5;,              //身高
  23 + private String birthYear;// 1985;,            //出生年份
  24 + private String weight; // 72.5;,              //体重
  25 + private String fat;// 23.1;,                 //脂肪
  26 + private String bone;// 3.8;,                //骨质
  27 + private String protein;// 18.6;,             //蛋白质
  28 + private String water;// 33.5;,              //水分
  29 + private String muscle;// 40.1;,             //肌肉
  30 + private String smm;// 18.5;,              //骨骼肌
  31 + private String pbf;// 22.1;,               //体脂百分比
  32 + private String bmi;// 22.4;,              //体质指数
  33 + private String bmr;// 1665.0;,           //基础代谢
  34 + private String whr;// 0.89;,            //腰臀比(2位小数)
  35 + private String edema;// 0.33;,           //水肿系数(2位小数)
  36 + private String vfi;// 12.0;,             //内脏脂肪指数
  37 + private String bodyAge;// 23;,          //身体年龄
  38 + private String score;//78.0;,            //健康评分
  39 + private String bodyType;// 4;,          //体型判定
  40 + private String lbm;// 50.1;,            //瘦体重(去脂体重)
  41 + private String icw;// 23.0;,            //细胞内液
  42 + private String ecw;// 10.5;,           //细胞外液
  43 + private String standardWeight;// 70.5;,   //目标体重
  44 + private String weightControl;// 2.0;,   //体重控制
  45 + private String fatControl;// 1.3;,      //脂肪控制量
  46 + private String muscleControl;// 0.7;,  //肌肉控制量
  47 + private String liverRisk;// 65;        //脂肪肝风险系数
  48 + private String trFat;// 14.5;,        //躯干脂肪量
  49 + private String laFat;// 2.1;,         //左上肢脂肪
  50 + private String raFat;// 2.1;,         //右上肢脂肪
  51 + private String llFat;// 5.2;,         //左下肢脂肪
  52 + private String rlFat;// 5.2;,         //右下肢脂肪
  53 + private String trWater;// 17.9;,     //躯干水分量
  54 + private String laWater;// 2.6;,      //左上肢水分
  55 + private String raWater;// 2.9;,      //右上肢水分
  56 + private String llWater;// 4.2;,      //左下肢水分
  57 + private String rlWater;// 4.3;,      //右下肢水分
  58 + private String trMuscle;// 23.9;,     //躯干肌肉量
  59 + private String laMuscle;// 6.6;,      //左上肢肌肉
  60 + private String raMuscle;// 6.9;,      //右上肢肌肉
  61 + private String llMuscle;// 14.2;,      //左下肢肌肉
  62 + private String rlMuscle;// 14.3;      //右下肢肌肉
  63 + private String weightMax; // 84.5;,    //体重正常范围的高值
  64 + private String weightMin; // 69.5;,    //体重正常范围的低值
  65 + private String fatMax; // 22.5;,      //体重正常范围的高值
  66 + private String fatMin; // 13.6;,      //体重正常范围的低值
  67 + private String boneMax; // 3.7;,    //骨质正常范围的高值
  68 + private String boneMin; // 3.1;,    //骨质正常范围的低值
  69 + private String proteinMax; // 22.5;,    //蛋白质正常范围的高值
  70 + private String proteinMin; // 17.5;,    //蛋白质正常范围的低值
  71 + private String waterMax; // 43.6;,    //水分正常范围的高值
  72 + private String waterMin; // 32.5;,    //水分正常范围的低值
  73 + private String muscleMax; // 54.5;,    //肌肉正常范围的高值
  74 + private String muscleMin; // 36.5;,    //肌肉正常范围的低值
  75 + private String smmMax; // 32.5;,    //骨骼肌正常范围的高值
  76 + private String smmMin; // 24.1;,    //骨骼肌正常范围的低值
  77 + private String pbfMax; // 10.0;,    //体脂率正常范围的高值
  78 + private String pbfMin; // 20.0;,    //体脂率正常范围的低值
  79 + private String bmiMax; // 18.5;,    //体质指数正常范围的高值
  80 + private String bmiMin; // 23.9;,    //体质指数正常范围的低值
  81 + private String whrMax; // 0.7;,    //腰臀比正常范围的高值
  82 + private String whrMin; // 0.8;,    //腰臀比正常范围的低值
  83 + private String edemaMax; // 0.3;,    //水肿系数正常范围的高值
  84 + private String edemaMin; // 0.35;,    //水肿系数正常范围的低值
  85 + private String vfiMax; // 5;,    //内脏脂肪指数正常范围的高值
  86 + private String vfiMin; // 10;    //内脏脂肪指数正常范围的低值
  87 +
  88 + public String getHospitalId() {
  89 + return hospitalId;
  90 + }
  91 +
  92 + public void setHospitalId(String hospitalId) {
  93 + this.hospitalId = hospitalId;
  94 + }
  95 +
  96 + public String getParentId() {
  97 + return parentId;
  98 + }
  99 +
  100 + public void setParentId(String parentId) {
  101 + this.parentId = parentId;
  102 + }
  103 +
  104 + public String getId() {
  105 + return id;
  106 + }
  107 +
  108 + public void setId(String id) {
  109 + this.id = id;
  110 + }
  111 +
  112 + public String getUuId() {
  113 + return uuId;
  114 + }
  115 +
  116 + public void setUuId(String uuId) {
  117 + this.uuId = uuId;
  118 + }
  119 +
  120 + public String getDeviceID() {
  121 + return deviceID;
  122 + }
  123 +
  124 + public void setDeviceID(String deviceID) {
  125 + this.deviceID = deviceID;
  126 + }
  127 +
  128 + public String getDeviceType() {
  129 + return deviceType;
  130 + }
  131 +
  132 + public void setDeviceType(String deviceType) {
  133 + this.deviceType = deviceType;
  134 + }
  135 +
  136 + public String getMemberId() {
  137 + return memberId;
  138 + }
  139 +
  140 + public void setMemberId(String memberId) {
  141 + this.memberId = memberId;
  142 + }
  143 +
  144 + public String getTestID() {
  145 + return testID;
  146 + }
  147 +
  148 + public void setTestID(String testID) {
  149 + this.testID = testID;
  150 + }
  151 +
  152 + public String getTestDate() {
  153 + return testDate;
  154 + }
  155 +
  156 + public void setTestDate(String testDate) {
  157 + this.testDate = testDate;
  158 + }
  159 +
  160 + public String getName() {
  161 + return name;
  162 + }
  163 +
  164 + public void setName(String name) {
  165 + this.name = name;
  166 + }
  167 +
  168 + public String getSex() {
  169 + return sex;
  170 + }
  171 +
  172 + public void setSex(String sex) {
  173 + this.sex = sex;
  174 + }
  175 +
  176 + public String getHeight() {
  177 + return height;
  178 + }
  179 +
  180 + public void setHeight(String height) {
  181 + this.height = height;
  182 + }
  183 +
  184 + public String getBirthYear() {
  185 + return birthYear;
  186 + }
  187 +
  188 + public void setBirthYear(String birthYear) {
  189 + this.birthYear = birthYear;
  190 + }
  191 +
  192 + public String getWeight() {
  193 + return weight;
  194 + }
  195 +
  196 + public void setWeight(String weight) {
  197 + this.weight = weight;
  198 + }
  199 +
  200 + public String getFat() {
  201 + return fat;
  202 + }
  203 +
  204 + public void setFat(String fat) {
  205 + this.fat = fat;
  206 + }
  207 +
  208 + public String getBone() {
  209 + return bone;
  210 + }
  211 +
  212 + public void setBone(String bone) {
  213 + this.bone = bone;
  214 + }
  215 +
  216 + public String getProtein() {
  217 + return protein;
  218 + }
  219 +
  220 + public void setProtein(String protein) {
  221 + this.protein = protein;
  222 + }
  223 +
  224 + public String getWater() {
  225 + return water;
  226 + }
  227 +
  228 + public void setWater(String water) {
  229 + this.water = water;
  230 + }
  231 +
  232 + public String getMuscle() {
  233 + return muscle;
  234 + }
  235 +
  236 + public void setMuscle(String muscle) {
  237 + this.muscle = muscle;
  238 + }
  239 +
  240 + public String getSmm() {
  241 + return smm;
  242 + }
  243 +
  244 + public void setSmm(String smm) {
  245 + this.smm = smm;
  246 + }
  247 +
  248 + public String getPbf() {
  249 + return pbf;
  250 + }
  251 +
  252 + public void setPbf(String pbf) {
  253 + this.pbf = pbf;
  254 + }
  255 +
  256 + public String getBmi() {
  257 + return bmi;
  258 + }
  259 +
  260 + public void setBmi(String bmi) {
  261 + this.bmi = bmi;
  262 + }
  263 +
  264 + public String getBmr() {
  265 + return bmr;
  266 + }
  267 +
  268 + public void setBmr(String bmr) {
  269 + this.bmr = bmr;
  270 + }
  271 +
  272 + public String getWhr() {
  273 + return whr;
  274 + }
  275 +
  276 + public void setWhr(String whr) {
  277 + this.whr = whr;
  278 + }
  279 +
  280 + public String getEdema() {
  281 + return edema;
  282 + }
  283 +
  284 + public void setEdema(String edema) {
  285 + this.edema = edema;
  286 + }
  287 +
  288 + public String getVfi() {
  289 + return vfi;
  290 + }
  291 +
  292 + public void setVfi(String vfi) {
  293 + this.vfi = vfi;
  294 + }
  295 +
  296 + public String getBodyAge() {
  297 + return bodyAge;
  298 + }
  299 +
  300 + public void setBodyAge(String bodyAge) {
  301 + this.bodyAge = bodyAge;
  302 + }
  303 +
  304 + public String getScore() {
  305 + return score;
  306 + }
  307 +
  308 + public void setScore(String score) {
  309 + this.score = score;
  310 + }
  311 +
  312 + public String getBodyType() {
  313 + return bodyType;
  314 + }
  315 +
  316 + public void setBodyType(String bodyType) {
  317 + this.bodyType = bodyType;
  318 + }
  319 +
  320 + public String getLbm() {
  321 + return lbm;
  322 + }
  323 +
  324 + public void setLbm(String lbm) {
  325 + this.lbm = lbm;
  326 + }
  327 +
  328 + public String getIcw() {
  329 + return icw;
  330 + }
  331 +
  332 + public void setIcw(String icw) {
  333 + this.icw = icw;
  334 + }
  335 +
  336 + public String getEcw() {
  337 + return ecw;
  338 + }
  339 +
  340 + public void setEcw(String ecw) {
  341 + this.ecw = ecw;
  342 + }
  343 +
  344 + public String getStandardWeight() {
  345 + return standardWeight;
  346 + }
  347 +
  348 + public void setStandardWeight(String standardWeight) {
  349 + this.standardWeight = standardWeight;
  350 + }
  351 +
  352 + public String getWeightControl() {
  353 + return weightControl;
  354 + }
  355 +
  356 + public void setWeightControl(String weightControl) {
  357 + this.weightControl = weightControl;
  358 + }
  359 +
  360 + public String getFatControl() {
  361 + return fatControl;
  362 + }
  363 +
  364 + public void setFatControl(String fatControl) {
  365 + this.fatControl = fatControl;
  366 + }
  367 +
  368 + public String getMuscleControl() {
  369 + return muscleControl;
  370 + }
  371 +
  372 + public void setMuscleControl(String muscleControl) {
  373 + this.muscleControl = muscleControl;
  374 + }
  375 +
  376 + public String getLiverRisk() {
  377 + return liverRisk;
  378 + }
  379 +
  380 + public void setLiverRisk(String liverRisk) {
  381 + this.liverRisk = liverRisk;
  382 + }
  383 +
  384 + public String getTrFat() {
  385 + return trFat;
  386 + }
  387 +
  388 + public void setTrFat(String trFat) {
  389 + this.trFat = trFat;
  390 + }
  391 +
  392 + public String getLaFat() {
  393 + return laFat;
  394 + }
  395 +
  396 + public void setLaFat(String laFat) {
  397 + this.laFat = laFat;
  398 + }
  399 +
  400 + public String getRaFat() {
  401 + return raFat;
  402 + }
  403 +
  404 + public void setRaFat(String raFat) {
  405 + this.raFat = raFat;
  406 + }
  407 +
  408 + public String getLlFat() {
  409 + return llFat;
  410 + }
  411 +
  412 + public void setLlFat(String llFat) {
  413 + this.llFat = llFat;
  414 + }
  415 +
  416 + public String getRlFat() {
  417 + return rlFat;
  418 + }
  419 +
  420 + public void setRlFat(String rlFat) {
  421 + this.rlFat = rlFat;
  422 + }
  423 +
  424 + public String getTrWater() {
  425 + return trWater;
  426 + }
  427 +
  428 + public void setTrWater(String trWater) {
  429 + this.trWater = trWater;
  430 + }
  431 +
  432 + public String getLaWater() {
  433 + return laWater;
  434 + }
  435 +
  436 + public void setLaWater(String laWater) {
  437 + this.laWater = laWater;
  438 + }
  439 +
  440 + public String getRaWater() {
  441 + return raWater;
  442 + }
  443 +
  444 + public void setRaWater(String raWater) {
  445 + this.raWater = raWater;
  446 + }
  447 +
  448 + public String getLlWater() {
  449 + return llWater;
  450 + }
  451 +
  452 + public void setLlWater(String llWater) {
  453 + this.llWater = llWater;
  454 + }
  455 +
  456 + public String getRlWater() {
  457 + return rlWater;
  458 + }
  459 +
  460 + public void setRlWater(String rlWater) {
  461 + this.rlWater = rlWater;
  462 + }
  463 +
  464 + public String getTrMuscle() {
  465 + return trMuscle;
  466 + }
  467 +
  468 + public void setTrMuscle(String trMuscle) {
  469 + this.trMuscle = trMuscle;
  470 + }
  471 +
  472 + public String getLaMuscle() {
  473 + return laMuscle;
  474 + }
  475 +
  476 + public void setLaMuscle(String laMuscle) {
  477 + this.laMuscle = laMuscle;
  478 + }
  479 +
  480 + public String getRaMuscle() {
  481 + return raMuscle;
  482 + }
  483 +
  484 + public void setRaMuscle(String raMuscle) {
  485 + this.raMuscle = raMuscle;
  486 + }
  487 +
  488 + public String getLlMuscle() {
  489 + return llMuscle;
  490 + }
  491 +
  492 + public void setLlMuscle(String llMuscle) {
  493 + this.llMuscle = llMuscle;
  494 + }
  495 +
  496 + public String getRlMuscle() {
  497 + return rlMuscle;
  498 + }
  499 +
  500 + public void setRlMuscle(String rlMuscle) {
  501 + this.rlMuscle = rlMuscle;
  502 + }
  503 +
  504 + public String getWeightMax() {
  505 + return weightMax;
  506 + }
  507 +
  508 + public void setWeightMax(String weightMax) {
  509 + this.weightMax = weightMax;
  510 + }
  511 +
  512 + public String getWeightMin() {
  513 + return weightMin;
  514 + }
  515 +
  516 + public void setWeightMin(String weightMin) {
  517 + this.weightMin = weightMin;
  518 + }
  519 +
  520 + public String getFatMax() {
  521 + return fatMax;
  522 + }
  523 +
  524 + public void setFatMax(String fatMax) {
  525 + this.fatMax = fatMax;
  526 + }
  527 +
  528 + public String getFatMin() {
  529 + return fatMin;
  530 + }
  531 +
  532 + public void setFatMin(String fatMin) {
  533 + this.fatMin = fatMin;
  534 + }
  535 +
  536 + public String getBoneMax() {
  537 + return boneMax;
  538 + }
  539 +
  540 + public void setBoneMax(String boneMax) {
  541 + this.boneMax = boneMax;
  542 + }
  543 +
  544 + public String getBoneMin() {
  545 + return boneMin;
  546 + }
  547 +
  548 + public void setBoneMin(String boneMin) {
  549 + this.boneMin = boneMin;
  550 + }
  551 +
  552 + public String getProteinMax() {
  553 + return proteinMax;
  554 + }
  555 +
  556 + public void setProteinMax(String proteinMax) {
  557 + this.proteinMax = proteinMax;
  558 + }
  559 +
  560 + public String getProteinMin() {
  561 + return proteinMin;
  562 + }
  563 +
  564 + public void setProteinMin(String proteinMin) {
  565 + this.proteinMin = proteinMin;
  566 + }
  567 +
  568 + public String getWaterMax() {
  569 + return waterMax;
  570 + }
  571 +
  572 + public void setWaterMax(String waterMax) {
  573 + this.waterMax = waterMax;
  574 + }
  575 +
  576 + public String getWaterMin() {
  577 + return waterMin;
  578 + }
  579 +
  580 + public void setWaterMin(String waterMin) {
  581 + this.waterMin = waterMin;
  582 + }
  583 +
  584 + public String getMuscleMax() {
  585 + return muscleMax;
  586 + }
  587 +
  588 + public void setMuscleMax(String muscleMax) {
  589 + this.muscleMax = muscleMax;
  590 + }
  591 +
  592 + public String getMuscleMin() {
  593 + return muscleMin;
  594 + }
  595 +
  596 + public void setMuscleMin(String muscleMin) {
  597 + this.muscleMin = muscleMin;
  598 + }
  599 +
  600 + public String getSmmMax() {
  601 + return smmMax;
  602 + }
  603 +
  604 + public void setSmmMax(String smmMax) {
  605 + this.smmMax = smmMax;
  606 + }
  607 +
  608 + public String getSmmMin() {
  609 + return smmMin;
  610 + }
  611 +
  612 + public void setSmmMin(String smmMin) {
  613 + this.smmMin = smmMin;
  614 + }
  615 +
  616 + public String getPbfMax() {
  617 + return pbfMax;
  618 + }
  619 +
  620 + public void setPbfMax(String pbfMax) {
  621 + this.pbfMax = pbfMax;
  622 + }
  623 +
  624 + public String getPbfMin() {
  625 + return pbfMin;
  626 + }
  627 +
  628 + public void setPbfMin(String pbfMin) {
  629 + this.pbfMin = pbfMin;
  630 + }
  631 +
  632 + public String getBmiMax() {
  633 + return bmiMax;
  634 + }
  635 +
  636 + public void setBmiMax(String bmiMax) {
  637 + this.bmiMax = bmiMax;
  638 + }
  639 +
  640 + public String getBmiMin() {
  641 + return bmiMin;
  642 + }
  643 +
  644 + public void setBmiMin(String bmiMin) {
  645 + this.bmiMin = bmiMin;
  646 + }
  647 +
  648 + public String getWhrMax() {
  649 + return whrMax;
  650 + }
  651 +
  652 + public void setWhrMax(String whrMax) {
  653 + this.whrMax = whrMax;
  654 + }
  655 +
  656 + public String getWhrMin() {
  657 + return whrMin;
  658 + }
  659 +
  660 + public void setWhrMin(String whrMin) {
  661 + this.whrMin = whrMin;
  662 + }
  663 +
  664 + public String getEdemaMax() {
  665 + return edemaMax;
  666 + }
  667 +
  668 + public void setEdemaMax(String edemaMax) {
  669 + this.edemaMax = edemaMax;
  670 + }
  671 +
  672 + public String getEdemaMin() {
  673 + return edemaMin;
  674 + }
  675 +
  676 + public void setEdemaMin(String edemaMin) {
  677 + this.edemaMin = edemaMin;
  678 + }
  679 +
  680 + public String getVfiMax() {
  681 + return vfiMax;
  682 + }
  683 +
  684 + public void setVfiMax(String vfiMax) {
  685 + this.vfiMax = vfiMax;
  686 + }
  687 +
  688 + public String getVfiMin() {
  689 + return vfiMin;
  690 + }
  691 +
  692 + public void setVfiMin(String vfiMin) {
  693 + this.vfiMin = vfiMin;
  694 + }
  695 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/VolumeComponentAnalysisController.java View file @ 9c7ea8e
  1 +package com.lyms.platform.operate.web.controller;
  2 +
  3 +
  4 +import com.lyms.platform.common.annotation.TokenRequired;
  5 +import com.lyms.platform.common.base.BaseController;
  6 +import com.lyms.platform.common.result.BaseObjectResponse;
  7 +import com.lyms.platform.operate.web.facade.MeasureInfoFacade;
  8 +import com.lyms.platform.operate.web.facade.VolumeComponentAnalysisFacade;
  9 +import com.lyms.platform.pojo.VolumeComponentAnalysisModel;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Controller;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestMethod;
  14 +import org.springframework.web.bind.annotation.RequestParam;
  15 +import org.springframework.web.bind.annotation.ResponseBody;
  16 +
  17 +import javax.servlet.http.HttpServletRequest;
  18 +
  19 +/**
  20 + * 体成分分析
  21 + **/
  22 +@Controller
  23 +public class VolumeComponentAnalysisController extends BaseController {
  24 +
  25 +
  26 + @Autowired
  27 + private MeasureInfoFacade measureInfoFacade;
  28 +
  29 +
  30 + @Autowired
  31 + private VolumeComponentAnalysisFacade volumeComponentAnalysisFacade;
  32 +
  33 +
  34 + /**
  35 + * 体成分分析获取孕妇基本信息
  36 + */
  37 + @RequestMapping(method = RequestMethod.GET, value = "/getComponentPatientInfo")
  38 + @ResponseBody
  39 + public BaseObjectResponse getComponentPatientInfo(@RequestParam(value = "certType", required = true) Integer certType,
  40 + @RequestParam(value = "certNo", required = true) String certNo,
  41 + @RequestParam(value = "hospitalId", required = true) String hospitalId,
  42 + HttpServletRequest request) {
  43 + return measureInfoFacade.getNutritionPatientInfo(certType, certNo, hospitalId);
  44 + }
  45 +
  46 + /**
  47 + * 添加蓝牙体成分分析后的数据
  48 + */
  49 + @RequestMapping(method = RequestMethod.GET, value = "/addComponentAnalysis")
  50 + @ResponseBody
  51 + public BaseObjectResponse addComponentAnalysis(VolumeComponentAnalysisModel volume) {
  52 +
  53 + return volumeComponentAnalysisFacade.addComponentAnalysis(volume);
  54 +
  55 + }
  56 +
  57 + /**
  58 + * 获取体成分分析记录
  59 + */
  60 + @RequestMapping
  61 + @ResponseBody
  62 + @TokenRequired
  63 + public BaseObjectResponse queryComponentAnalysis(String key, String vcCardNo, Integer stateWeek, Integer endWeek, Integer age,
  64 + Integer fetusNumber, Integer page, Integer limit, HttpServletRequest request) {
  65 + return volumeComponentAnalysisFacade.queryComponentAnalysis(page, limit, key, vcCardNo, stateWeek, endWeek, age, fetusNumber, getUserId(request));
  66 + }
  67 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/VolumeComponentAnalysisFacade.java View file @ 9c7ea8e
  1 +package com.lyms.platform.operate.web.facade;
  2 +
  3 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  4 +import com.lyms.platform.common.result.BaseObjectResponse;
  5 +import com.lyms.platform.common.result.PageResult;
  6 +import com.lyms.platform.common.result.RespBuilder;
  7 +import com.lyms.platform.common.utils.DateUtil;
  8 +import com.lyms.platform.operate.web.service.impl.BaseServiceImpl;
  9 +import com.lyms.platform.pojo.TemporaryUserModel;
  10 +import com.lyms.platform.pojo.VolumeComponentAnalysisModel;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.data.domain.Sort;
  13 +import org.springframework.data.mongodb.core.MongoTemplate;
  14 +import org.springframework.data.mongodb.core.query.Criteria;
  15 +import org.springframework.data.mongodb.core.query.Query;
  16 +import org.springframework.stereotype.Component;
  17 +
  18 +import java.util.*;
  19 +
  20 +@Component
  21 +public class VolumeComponentAnalysisFacade extends BaseServiceImpl {
  22 +
  23 + @Autowired
  24 + private OrganizationGroupsFacade groupsFacade;
  25 +
  26 + @Autowired
  27 + private MongoTemplate mongoTemplate;
  28 +
  29 +
  30 + public BaseObjectResponse addComponentAnalysis(VolumeComponentAnalysisModel volume) {
  31 + mongoTemplate.insert(volume);
  32 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  33 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  34 + objectResponse.setErrormsg("成功");
  35 + return objectResponse;
  36 + }
  37 +
  38 +
  39 + /**
  40 + * 查询体成分分析列表信息
  41 + */
  42 + public BaseObjectResponse queryComponentAnalysis(Integer page, Integer limit, String key, String vcCardNo, Integer stateWeek, Integer endWeek, Integer age,
  43 + Integer fetusNumber, Integer userId) {
  44 + mongoTemplate.find(Query.query(Criteria.where("").is(1)), VolumeComponentAnalysisModel.class);
  45 + boolean flag = false;
  46 + List<String> hospital = groupsFacade.findGroupHospital(userId, false);
  47 + Criteria criteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospital);
  48 + Criteria pCriteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospital);
  49 + if (org.apache.commons.lang.StringUtils.isNotBlank(key)) {
  50 + pCriteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("userName").regex(key), Criteria.where("cardID").regex(key));
  51 + flag = true;
  52 + }
  53 + if (stateWeek != null && endWeek != null) {
  54 + Date start = DateUtil.getWeekStart(endWeek);
  55 + Date end = DateUtil.getWeekEnd(stateWeek);
  56 + pCriteria.and("lastMenses").gt(start).lte(end);
  57 + flag = true;
  58 + }
  59 + if (age != null) {
  60 + Date start = DateUtil.getBeforeAge(age);
  61 + Date end = DateUtil.getBeforeAge(age + 1);
  62 + pCriteria.and("birth").gt(end).lte(start);
  63 + flag = true;
  64 + }
  65 + if (flag) {
  66 + List<TemporaryUserModel> patients = mongoTemplate.find(Query.query(pCriteria), TemporaryUserModel.class);
  67 + List<String> ids = new ArrayList<>();
  68 + if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(patients)) {
  69 + for (TemporaryUserModel patient : patients) {
  70 + ids.add(patient.getId());
  71 + }
  72 + }
  73 + criteria.and("_id").in(ids);
  74 + }
  75 + PageResult pageResult = findMongoPage(TemporaryUserModel.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit);
  76 + List<TemporaryUserModel> bloodSugars = (List<TemporaryUserModel>) pageResult.getGrid();
  77 + List<Map> list = new ArrayList();
  78 + for (TemporaryUserModel temporaryUser : bloodSugars) {
  79 + Map<String, Object> map = new HashMap<>();
  80 +
  81 + list.add(map);
  82 + }
  83 + pageResult.setGrid(list);
  84 + return RespBuilder.buildSuccess(pageResult);
  85 + }
  86 +}