Commit bbaeed7fdcdb1eaeb4631875354c335e4ced99fb

Authored by wangjialin
1 parent 1e2bdafafe
Exists in dev_wjl and in 1 other branch dev-wrh

修改膳食调查录入

Showing 2 changed files with 261 additions and 5 deletions

littleApp_child/pages/diet/measuret.js View file @ bbaeed7
... ... @@ -17,7 +17,7 @@
17 17 "蛋黄泥",
18 18 "蔬菜泥",
19 19 "水果泥",
20   - "食用油",
  20 + "食用油",//
21 21 "稠粥、烂面条",
22 22 "肝泥",
23 23 "蛋黄碎",
24 24  
... ... @@ -183,11 +183,48 @@
183 183 love:0,
184 184 },
185 185 ],
  186 + foodList1:[],
  187 + foodList2:[],
  188 + foodList3:[],
  189 + foodList4:[],
  190 + foodListNames1:[
  191 + "铁强化米粉",
  192 + "蔬菜泥",
  193 + "水果泥",
  194 + "蛋黄泥",
  195 + "肉泥",
  196 + "稠粥、烂面条",
  197 + ],
  198 + foodListNames2:[
  199 + "稠粥、烂面条",
  200 + "蔬菜末",
  201 + "水果末",
  202 + "蛋黄羹",
  203 + "肉末",
  204 + "食用油",
  205 + "肝泥",
  206 + "豆腐"
  207 + ],
  208 + foodListNames3:[
  209 + "稠粥、烂面条",
  210 + "蔬菜碎",
  211 + "水果碎",
  212 + "蛋黄碎",
  213 + "肉碎",
  214 + "肝泥",
  215 + "豆腐"
  216 + ],
  217 + foodListNames4:[
  218 + "稠粥、烂面条",
  219 + "蔬菜碎",
  220 + "水果碎"
  221 + ],
186 222 hospitalId: "",
187 223 toDay:"",
188 224 pid:"",
189 225 show:false,
190 226 array:[],
  227 + yl:0
191 228 },
192 229  
193 230 foodClick(e) {
194 231  
195 232  
196 233  
... ... @@ -219,15 +256,109 @@
219 256 // this.foodList[i].love = 0;
220 257 // }
221 258 },
  259 + foodClick1(e) {
  260 + let Names = this.data.foodListNames;
  261 + let items = this.data.foodList;
  262 + const values = e.detail.value;
  263 + console.log('哈哈哈',values);
  264 + const yf=this.getLeadingNumbers1(values[0])
  265 + console.log('yf',yf);
  266 + if(yf=='11'||yf=='21'){
  267 + Names = this.data.foodListNames1;
  268 + items = this.data.foodList1;
  269 + }else if(yf=='12'||yf=='22'){
  270 + Names = this.data.foodListNames2;
  271 + items = this.data.foodList2;
  272 + }else if(yf=='13'||yf=='23'){
  273 + Names = this.data.foodListNames3;
  274 + items = this.data.foodList3;
  275 + }else if(yf=='14'||yf=='24'){
  276 + Names = this.data.foodListNames4;
  277 + items = this.data.foodList4;
  278 + }
  279 + for (let i = 0, lenI = items.length; i < lenI; ++i) {
  280 + items[i].add = 0;
  281 + items[i].love = 0;
  282 +
  283 + for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  284 + if(yf=='11'||yf=='21'){
  285 + if (Names[i]+'11' === values[j]) {
  286 + items[i].add = 1;
  287 + }else if (Names[i]+'21' === values[j]) {
  288 + items[i].love = 1;
  289 + }
  290 + }else if(yf=='12'||yf=='22'){
  291 + if (Names[i]+'12' === values[j]) {
  292 + items[i].add = 1;
  293 + }else if (Names[i]+'22' === values[j]) {
  294 + items[i].love = 1;
  295 + }
  296 + }else if(yf=='13'||yf=='23'){
  297 + if (Names[i]+'13' === values[j]) {
  298 + items[i].add = 1;
  299 + }else if (Names[i]+'23' === values[j]) {
  300 + items[i].love = 1;
  301 + }
  302 + }else if(yf=='14'||yf=='24'){
  303 + if (Names[i]+'14' === values[j]) {
  304 + items[i].add = 1;
  305 + }else if (Names[i]+'24' === values[j]) {
  306 + items[i].love = 1;
  307 + }
  308 + }
  309 + }
  310 + // if (Names[i]+yf === values[j]) {
  311 + // items[i].add = 1;
  312 + // }else if (Names[i]+yf === values[j]) {
  313 + // items[i].love = 1;
  314 + // }
  315 + if(items[i].add === 0){
  316 + items[i].love = 0;
  317 + }
  318 + }
  319 + if(yf=='11'||yf=='21'){
  320 + this.setData({
  321 + foodList1:items
  322 + })
  323 + console.log('list1',this.data.foodList1);
  324 + }else if(yf=='12'||yf=='22'){
  325 + this.setData({
  326 + foodList2:items
  327 + })
  328 + console.log('list2',this.data.foodList2);
  329 + }else if(yf=='13'||yf=='23'){
  330 + this.setData({
  331 + foodList3:items
  332 + })
  333 + console.log('list3',this.data.foodList3);
  334 + }else if(yf=='14'||yf=='24'){
  335 + this.setData({
  336 + foodList4:items
  337 + })
  338 + console.log('list4',this.data.foodList4);
  339 + }
  340 + console.log('list');
  341 + // if(this.foodList[i].add == 0){
  342 + // this.foodList[i].love = 0;
  343 + // }
  344 + },
222 345 saveFoodlist(){
223 346 var that = this;
  347 + let listss=that.data.foodList
  348 + if(that.data.hospitalId==666668&&(that.data.yl<5||that.data.yl>23)){
  349 + networkUtil.showErrorToast('孩子目前还未到六月龄')
  350 + return
  351 + }
224 352 this.setData({
225 353 show : true
226 354 })
  355 + if(that.data.hospitalId==666668){
  356 + listss=[...that.data.foodList1,...that.data.foodList2,...that.data.foodList3,...that.data.foodList4]
  357 + }
227 358 networkUtil._post(api.setFootList,{
228 359 hospitalId:this.data.hospitalId,
229 360 pid:this.data.pid,
230   - diets:this.data.foodList
  361 + diets:listss
231 362 },(res) => {
232 363 if(0 == res.data.errorcode){
233 364 this.getList();
... ... @@ -268,6 +399,17 @@
268 399 item.createTime = exchgeDate.getYearMD(item.createTime )
269 400 });
270 401 console.log(data)
  402 + let ss=[]
  403 + if(res.data.data.length>0){
  404 + ss=res.data.data
  405 + ss.forEach((item,index)=>{
  406 + item.diets1=item.diets.slice(0,6)
  407 + item.diets2=item.diets.slice(6,14)
  408 + item.diets3=item.diets.slice(14,21)
  409 + item.diets4=item.diets.slice(21,24)
  410 + })
  411 + }
  412 + console.log('sss',ss);
271 413 this.setData({
272 414 array: res.data.data
273 415 })
274 416  
... ... @@ -296,9 +438,36 @@
296 438 hospitalId: app.globalData.userInfo.hospitalId,
297 439 pid:app.globalData.userInfo.pid,
298 440 })
  441 + var list1=this.data.foodList.slice(0,6)
  442 + var list2=this.data.foodList.slice(6,14)
  443 + var list3=this.data.foodList.slice(14,21)
  444 + var list4=this.data.foodList.slice(21,24)
  445 + this.setData({
  446 + foodList1:list1,
  447 + foodList2:list2,
  448 + foodList3:list3,
  449 + foodList4:list4
  450 + })
  451 + if(app.globalData.userInfo.hospitalId==666668){
  452 + if(app.globalData.userInfo.monthage.includes("月")){
  453 + let yl=this.getLeadingNumbers(app.globalData.userInfo.monthage)
  454 + console.log('月龄',yl);
  455 + this.setData({
  456 + yl:yl
  457 + })
  458 + }
  459 + }
299 460 this.getList();
300 461 },
301   -
  462 + getLeadingNumbers(str) {
  463 + // const match = str.match(/\d+$/);
  464 + const match = str.match(/^\d+/);
  465 + return match ? match[0] : null;
  466 + },
  467 + getLeadingNumbers1(str) {
  468 + const match = str.match(/\d+$/);
  469 + return match ? match[0] : null;
  470 + },
302 471 /**
303 472 * 生命周期函数--监听页面初次渲染完成
304 473 */
littleApp_child/pages/diet/measuret.wxml View file @ bbaeed7
... ... @@ -14,7 +14,7 @@
14 14 <checkbox value="cb" checked="true" color="#ed7d31" />表示爱吃
15 15 </label>
16 16 </view>
17   - <view class="measuret_body">
  17 + <view class="measuret_body" wx:if="{{hospitalId!=666668}}">
18 18 <checkbox-group bindchange="foodClick">
19 19 <view class="section section_gap" wx:for="{{foodList}}" wx:for-index="$index" wx:for-item="item">
20 20 <view class="body-view">
21 21  
... ... @@ -25,13 +25,100 @@
25 25 </view>
26 26 </checkbox-group>
27 27 </view>
  28 + <view class="measuret_body" wx:if="{{hospitalId==666668}}">
  29 + <view style="font-size: 26rpx;">六月龄膳食调查</view>
  30 + <checkbox-group bindchange="foodClick1">
  31 + <view class="section section_gap" wx:for="{{foodList1}}" wx:for-index="$index" wx:for-item="item">
  32 + <view class="body-view">
  33 + <checkbox type="checkbox" value="{{foodListNames1[$index]}}11" checked="{{item.add}}" color="#68bcfa" />
  34 + <checkbox type="checkbox" value="{{foodListNames1[$index]}}21" disabled = "{{item.add == 0}}" checked="{{item.love}}" color="#ed7d31" />
  35 + </view>
  36 + <view class="section__title">{{foodListNames1[$index]}}</view>
  37 + </view>
  38 + </checkbox-group>
  39 + <view style="font-size: 26rpx;">七月龄膳食调查</view>
  40 + <checkbox-group bindchange="foodClick1">
  41 + <view class="section section_gap" wx:for="{{foodList2}}" wx:for-index="$index" wx:for-item="item">
  42 + <view class="body-view">
  43 + <checkbox type="checkbox" value="{{foodListNames2[$index]}}12" checked="{{item.add}}" color="#68bcfa" />
  44 + <checkbox type="checkbox" value="{{foodListNames2[$index]}}22" disabled = "{{item.add == 0}}" checked="{{item.love}}" color="#ed7d31" />
  45 + </view>
  46 + <view class="section__title">{{foodListNames2[$index]}}</view>
  47 + </view>
  48 + </checkbox-group>
  49 + <view style="font-size: 26rpx;">八月龄膳食调查</view>
  50 + <checkbox-group bindchange="foodClick1">
  51 + <view class="section section_gap" wx:for="{{foodList3}}" wx:for-index="$index" wx:for-item="item">
  52 + <view class="body-view">
  53 + <checkbox type="checkbox" value="{{foodListNames3[$index]}}13" checked="{{item.add}}" color="#68bcfa" />
  54 + <checkbox type="checkbox" value="{{foodListNames3[$index]}}23" disabled = "{{item.add == 0}}" checked="{{item.love}}" color="#ed7d31" />
  55 + </view>
  56 + <view class="section__title">{{foodListNames3[$index]}}</view>
  57 + </view>
  58 + </checkbox-group>
  59 + <view style="color: #fff;">1</view>
  60 + <view style="font-size: 26rpx;">九月龄膳食调查</view>
  61 + <checkbox-group bindchange="foodClick1">
  62 + <view class="section section_gap" wx:for="{{foodList4}}" wx:for-index="$index" wx:for-item="item">
  63 + <view class="body-view">
  64 + <checkbox type="checkbox" value="{{foodListNames4[$index]}}14" checked="{{item.add}}" color="#68bcfa" />
  65 + <checkbox type="checkbox" value="{{foodListNames4[$index]}}24" disabled = "{{item.add == 0}}" checked="{{item.love}}" color="#ed7d31" />
  66 + </view>
  67 + <view class="section__title">{{foodListNames4[$index]}}</view>
  68 + </view>
  69 + </checkbox-group>
  70 + </view>
28 71 </view>
29 72 <view style="clear:both"></view>
30 73 </view>
31 74 <view class="my_apport" bindtap="getBabyNutritionList" style="margin: 5px auto;position: relative;width: 120px;">
32 75 查看历史报告
33 76 </view>
34   -<scroll-view scroll-y="true" style="pointer-events:none">
  77 +<scroll-view scroll-y="true" style="pointer-events:none" wx:if="{{hospitalId==666668}}">
  78 + <view class="card" wx:for="{{array}}" wx:for-item="item">
  79 + <view class="title">
  80 + <text class="time">录入时间:{{item.createTime||yyyy/mm/dd}}</text>
  81 + </view>
  82 + <view class="measuret_body list">
  83 + <view style="font-size: 26rpx;">六月龄膳食调查</view>
  84 + <view class="section section_gap" wx:for="{{item.diets1}}" wx:for-index="$index" wx:for-item="item">
  85 + <view class="body-view">
  86 + <checkbox type="checkbox" checked="{{item.add}}" color="#68bcfa" />
  87 + <checkbox type="checkbox" checked="{{item.love}}" color="#ed7d31" />
  88 + </view>
  89 + <view class="section__title">{{foodListNames1[$index]}}</view>
  90 + </view>
  91 + <view style="font-size: 26rpx;">七月龄膳食调查</view>
  92 + <view class="section section_gap" wx:for="{{item.diets2}}" wx:for-index="$index" wx:for-item="item">
  93 + <view class="body-view">
  94 + <checkbox type="checkbox" checked="{{item.add}}" color="#68bcfa" />
  95 + <checkbox type="checkbox" checked="{{item.love}}" color="#ed7d31" />
  96 + </view>
  97 + <view class="section__title">{{foodListNames2[$index]}}</view>
  98 + </view>
  99 + <view style="color: #fff;"> 1</view>
  100 + <view style="font-size: 26rpx;">八月龄膳食调查</view>
  101 + <view class="section section_gap" wx:for="{{item.diets3}}" wx:for-index="$index" wx:for-item="item">
  102 + <view class="body-view">
  103 + <checkbox type="checkbox" checked="{{item.add}}" color="#68bcfa" />
  104 + <checkbox type="checkbox" checked="{{item.love}}" color="#ed7d31" />
  105 + </view>
  106 + <view class="section__title">{{foodListNames3[$index]}}</view>
  107 + </view>
  108 + <view style="color: #fff;"> 1</view>
  109 + <view style="font-size: 26rpx;">九月龄膳食调查</view>
  110 + <view class="section section_gap" wx:for="{{item.diets4}}" wx:for-index="$index" wx:for-item="item">
  111 + <view class="body-view">
  112 + <checkbox type="checkbox" checked="{{item.add}}" color="#68bcfa" />
  113 + <checkbox type="checkbox" checked="{{item.love}}" color="#ed7d31" />
  114 + </view>
  115 + <view class="section__title">{{foodListNames4[$index]}}</view>
  116 + </view>
  117 + </view>
  118 + <view style="clear:both"></view>
  119 + </view>
  120 +</scroll-view>
  121 +<scroll-view scroll-y="true" style="pointer-events:none" wx:if="{{hospitalId!=666668}}">
35 122 <view class="card" wx:for="{{array}}" wx:for-item="item">
36 123 <view class="title">
37 124 <text class="time">录入时间:{{item.createTime||yyyy/mm/dd}}</text>