瀏覽代碼

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

陈少旭 1 年之前
父節點
當前提交
80e3be2481

+ 1 - 0
controllers/common_api_controller.go 查看文件

177
 	adminUser := this.GetAdminUserInfo()
177
 	adminUser := this.GetAdminUserInfo()
178
 	orgid := adminUser.CurrentOrgId
178
 	orgid := adminUser.CurrentOrgId
179
 	major, _ := service.GetInspectionMajor(orgid)
179
 	major, _ := service.GetInspectionMajor(orgid)
180
+	fmt.Println("major22222222222222222222222222222222222222", major)
180
 	if len(major) == 0 {
181
 	if len(major) == 0 {
181
 		configurationlist, total, err := service.GetConfigurationlist(orgid, limit, page)
182
 		configurationlist, total, err := service.GetConfigurationlist(orgid, limit, page)
182
 		pressure, err := service.GetDefaultBloodPressure(orgid)
183
 		pressure, err := service.GetDefaultBloodPressure(orgid)

+ 10 - 2
controllers/drug_stock_api_contorller.go 查看文件

3463
 	orgId := adminUserInfo.CurrentOrgId
3463
 	orgId := adminUserInfo.CurrentOrgId
3464
 	if order_type == 1 {
3464
 	if order_type == 1 {
3465
 		list, err := service.GetDrugWarehouseInfoPrint(startTime, endTime, orgId)
3465
 		list, err := service.GetDrugWarehouseInfoPrint(startTime, endTime, orgId)
3466
+		manufacturerList, _ := service.GetAllManufacturerList(orgId)
3467
+		dealerList, _ := service.GetAllDealerList(orgId)
3466
 		if err == nil {
3468
 		if err == nil {
3467
 			c.ServeSuccessJSON(map[string]interface{}{
3469
 			c.ServeSuccessJSON(map[string]interface{}{
3468
-				"list": list,
3470
+				"list":             list,
3471
+				"manufacturerList": manufacturerList,
3472
+				"dealerList":       dealerList,
3469
 			})
3473
 			})
3470
 			return
3474
 			return
3471
 		}
3475
 		}
3502
 	}
3506
 	}
3503
 	adminUserInfo := c.GetAdminUserInfo()
3507
 	adminUserInfo := c.GetAdminUserInfo()
3504
 	orgId := adminUserInfo.CurrentOrgId
3508
 	orgId := adminUserInfo.CurrentOrgId
3509
+	dealerList, _ := service.GetAllDealerList(orgId)
3510
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3505
 	if order_type == 2 {
3511
 	if order_type == 2 {
3506
 		list, err := service.GetDrugOutOrderInfoPrintList(startTime, endTime, orgId)
3512
 		list, err := service.GetDrugOutOrderInfoPrintList(startTime, endTime, orgId)
3507
 		if err == nil {
3513
 		if err == nil {
3508
 			c.ServeSuccessJSON(map[string]interface{}{
3514
 			c.ServeSuccessJSON(map[string]interface{}{
3509
-				"list": list,
3515
+				"list":             list,
3516
+				"dealerList":       dealerList,
3517
+				"manufacturerList": manufacturerList,
3510
 			})
3518
 			})
3511
 			return
3519
 			return
3512
 		}
3520
 		}

+ 9 - 5
controllers/gobal_config_api_controller.go 查看文件

1891
 	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
1891
 	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
1892
 	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, adminInfo.CurrentOrgId)
1892
 	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, adminInfo.CurrentOrgId)
1893
 	houseList, _ := service.GetAllStoreHouseList(adminInfo.CurrentOrgId)
1893
 	houseList, _ := service.GetAllStoreHouseList(adminInfo.CurrentOrgId)
1894
+	dealerList, _ := service.GetAllDealerList(adminInfo.CurrentOrgId)
1895
+	manufacturerList, _ := service.GetAllManufacturerList(adminInfo.CurrentOrgId)
1894
 	if err != nil {
1896
 	if err != nil {
1895
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1897
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1896
 		return
1898
 		return
1897
 	}
1899
 	}
1898
 	c.ServeSuccessJSON(map[string]interface{}{
1900
 	c.ServeSuccessJSON(map[string]interface{}{
1899
-		"order":        order,
1900
-		"total":        total,
1901
-		"orderPrint":   orderPrint,
1902
-		"drugTypeList": drugTypeList,
1903
-		"houseList":    houseList,
1901
+		"order":            order,
1902
+		"total":            total,
1903
+		"orderPrint":       orderPrint,
1904
+		"drugTypeList":     drugTypeList,
1905
+		"houseList":        houseList,
1906
+		"dealerList":       dealerList,
1907
+		"manufacturerList": manufacturerList,
1904
 	})
1908
 	})
1905
 }
1909
 }
1906
 
1910
 

+ 19 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go 查看文件

380
 			newprescribe.TargetUltrafiltration = dewater_amount
380
 			newprescribe.TargetUltrafiltration = dewater_amount
381
 			newprescribe.PrescriptionWater = dewater_amount
381
 			newprescribe.PrescriptionWater = dewater_amount
382
 			newprescribe.Chaptalization = dialysisSolution.Chaptalization
382
 			newprescribe.Chaptalization = dialysisSolution.Chaptalization
383
+			newprescribe.PrescribingNumber = 1
383
 			newprescribe.Status = 1
384
 			newprescribe.Status = 1
384
 			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 {
385
 			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 {
385
 				newprescribe.Remark = dialysisSolution.Remark
386
 				newprescribe.Remark = dialysisSolution.Remark
397
 				newprescribe.DisplaceLiquiValue = 32
398
 				newprescribe.DisplaceLiquiValue = 32
398
 				newprescribe.DialysateFlow = 500
399
 				newprescribe.DialysateFlow = 500
399
 			}
400
 			}
401
+
402
+			if adminUserInfo.Org.Id == 10121 {
403
+				newprescribe.DialysisDurationHour = 4
404
+				newprescribe.DialysisDurationMinute = 0
405
+				newprescribe.BloodAccess = 0
406
+			}
400
 			//插入透析处方
407
 			//插入透析处方
401
 			err := service.AddSigleRecord(&newprescribe)
408
 			err := service.AddSigleRecord(&newprescribe)
402
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
409
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
467
 				newprescribe.Status = 1
474
 				newprescribe.Status = 1
468
 				newprescribe.Remark = lastDialysisPrescribe.Remark
475
 				newprescribe.Remark = lastDialysisPrescribe.Remark
469
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
476
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
477
+				newprescribe.PrescribingNumber = 1
470
 				if adminUserInfo.Org.Id == 10340 {
478
 				if adminUserInfo.Org.Id == 10340 {
471
 					newprescribe.TargetUltrafiltration = 0
479
 					newprescribe.TargetUltrafiltration = 0
472
 				}
480
 				}
481
+				if adminUserInfo.Org.Id == 10121 {
482
+					newprescribe.DialysisDurationHour = 4
483
+					newprescribe.DialysisDurationMinute = 0
484
+					newprescribe.BloodAccess = 0
485
+				}
473
 				err := service.AddSigleRecord(&newprescribe)
486
 				err := service.AddSigleRecord(&newprescribe)
474
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
487
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
475
 				redis := service.RedisClient()
488
 				redis := service.RedisClient()
534
 				newprescribe.TargetUltrafiltration = dewater_amount
547
 				newprescribe.TargetUltrafiltration = dewater_amount
535
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
548
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
536
 				newprescribe.Status = 1
549
 				newprescribe.Status = 1
550
+				newprescribe.PrescribingNumber = 1
537
 
551
 
538
 				if adminUserInfo.Org.Id == 10340 {
552
 				if adminUserInfo.Org.Id == 10340 {
539
 					newprescribe.TargetUltrafiltration = 0
553
 					newprescribe.TargetUltrafiltration = 0
540
 				}
554
 				}
555
+				if adminUserInfo.Org.Id == 10121 {
556
+					newprescribe.DialysisDurationHour = 4
557
+					newprescribe.DialysisDurationMinute = 0
558
+					newprescribe.BloodAccess = 0
559
+				}
541
 				err := service.AddSigleRecord(&newprescribe)
560
 				err := service.AddSigleRecord(&newprescribe)
542
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
561
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
543
 				redis := service.RedisClient()
562
 				redis := service.RedisClient()

+ 301 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

118
 
118
 
119
 				hisAdvices, _ := service.GetAllHisAdvicesByList(orgID, date.Unix())
119
 				hisAdvices, _ := service.GetAllHisAdvicesByList(orgID, date.Unix())
120
 				inforMation, _ := service.GetTodayInforMation(orgID, date.Unix())
120
 				inforMation, _ := service.GetTodayInforMation(orgID, date.Unix())
121
+
122
+				//monitor, _ := service.GetMonitorByListSix(orgID, date.Unix())
121
 				for key, item := range scheduals {
123
 				for key, item := range scheduals {
122
 
124
 
123
 					for _, infor := range inforMation {
125
 					for _, infor := range inforMation {
204
 							break
206
 							break
205
 						}
207
 						}
206
 					}
208
 					}
209
+
210
+					////	监测
211
+					//scheduals[key].VMMonitoringRecord = make([]models.VMMonitoringRecord, 0)
212
+					//for _, moni := range monitor {
213
+					//	if item.PatientId == moni.PatientId {
214
+					//		scheduals[key].VMMonitoringRecord = append(scheduals[key].VMMonitoringRecord, moni)
215
+					//	}
216
+					//}
207
 				}
217
 				}
208
 				//缓存数据
218
 				//缓存数据
209
 				scheduals_json, err := json.Marshal(&scheduals)
219
 				scheduals_json, err := json.Marshal(&scheduals)
9362
 	}
9372
 	}
9363
 
9373
 
9364
 }
9374
 }
9375
+
9376
+func (c *DialysisAPIController) GetControlMonitorList() {
9377
+
9378
+	partition, _ := c.GetInt64("partition")
9379
+	monitorDate := c.GetString("date")
9380
+	patient_id, _ := c.GetInt64("patient_id")
9381
+	pat_type, _ := c.GetInt64("pat_type")
9382
+	timeLayout := "2006-01-02"
9383
+	loc, _ := time.LoadLocation("Local")
9384
+
9385
+	var theStartTime int64
9386
+	if len(monitorDate) > 0 {
9387
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", monitorDate+" 00:00:00", loc)
9388
+		if err != nil {
9389
+			theStartTime = 0
9390
+		}
9391
+		theStartTime = theTime.Unix()
9392
+	}
9393
+	adminInfo := c.GetMobileAdminUserInfo()
9394
+	orgID := adminInfo.Org.Id
9395
+	monitor, err := service.GetNewMonitorRecord(orgID, theStartTime, partition, patient_id)
9396
+
9397
+	if err != nil {
9398
+		c.ErrorLog("获取排班信息失败:%v", err)
9399
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
9400
+	} else {
9401
+		if len(monitor) > 0 {
9402
+			//获取所有床位
9403
+			numberList, _ := service.GetAllDeviceNumberByList(orgID)
9404
+			//获取所有分区
9405
+			zoneList, _ := service.GetAllZoneByList(orgID)
9406
+			//获取透析处方
9407
+			prescriptions, _ := service.GetAllPrescriptionByListSix(orgID, theStartTime)
9408
+			//获取透前评估
9409
+			assessmentBefores, _ := service.GetAllAssessmentBeforesByListOne(orgID, theStartTime)
9410
+			//获取上机
9411
+			dialysisOrders, _ := service.GetAllDialysisOrdersByListNight(orgID, theStartTime, pat_type)
9412
+			//获取透后
9413
+			AssessmentAfterDislysis, _ := service.GetAllAssessmentAfterDislysisByListSix(orgID, theStartTime)
9414
+
9415
+			//获取透后监测
9416
+			monitorlist, _ := service.GetNewAllMonitorList(orgID, theStartTime, pat_type)
9417
+
9418
+			//获取所有的患者
9419
+			patients, _ := service.GetAllPatientListByListOne(orgID)
9420
+
9421
+			//获取所有透析模式
9422
+			treatments, _ := service.GetAllTreatModeByList(orgID)
9423
+
9424
+			//获取所有医嘱
9425
+			adviceList, _ := service.GetAdviceList(orgID, theStartTime, pat_type)
9426
+
9427
+			//获取双人核对
9428
+			checkList, _ := service.GetDobuleCheck(orgID, theStartTime)
9429
+
9430
+			//治疗小结
9431
+			summaryList, _ := service.GetTreatmentSummaryForList(orgID, theStartTime)
9432
+
9433
+			//待消毒
9434
+			informationList, _ := service.GetDialysisInformationList(orgID, theStartTime)
9435
+
9436
+			for key, item := range monitor {
9437
+				// 获取床位信息
9438
+				for _, it := range numberList {
9439
+					if item.BedId == it.ID {
9440
+						monitor[key].DeviceNumber = it
9441
+						break
9442
+					}
9443
+				}
9444
+
9445
+				//获取分区信息
9446
+				for _, it := range zoneList {
9447
+					if item.PartitionId == it.ID {
9448
+						monitor[key].DeviceZone = it
9449
+					}
9450
+				}
9451
+
9452
+				for _, prescription := range prescriptions {
9453
+					if item.PatientId == prescription.PatientId {
9454
+						monitor[key].Prescription = prescription
9455
+						break
9456
+					}
9457
+				}
9458
+
9459
+				for _, it := range checkList {
9460
+					if item.PatientId == it.PatientId {
9461
+						monitor[key].DoubleCheck = it
9462
+						break
9463
+					}
9464
+				}
9465
+
9466
+				for _, it := range summaryList {
9467
+					if item.PatientId == it.PatientId {
9468
+						monitor[key].TreatmentSummaryForList = it
9469
+						break
9470
+					}
9471
+				}
9472
+
9473
+				// 透前评估
9474
+				for _, assessmentBefore := range assessmentBefores {
9475
+					if item.PatientId == assessmentBefore.PatientId {
9476
+						monitor[key].AssessmentBeforeDislysis = assessmentBefore
9477
+						break
9478
+					}
9479
+				}
9480
+
9481
+				// 透析上下机
9482
+				for _, dialysisOrder := range dialysisOrders {
9483
+					if item.PatientId == dialysisOrder.PatientId {
9484
+						monitor[key].DialysisOrder = dialysisOrder
9485
+						break
9486
+					}
9487
+				}
9488
+
9489
+				// 治疗小节
9490
+				for _, afterDislysis := range AssessmentAfterDislysis {
9491
+					if item.PatientId == afterDislysis.PatientId {
9492
+						monitor[key].AssessmentAfterDislysis = afterDislysis
9493
+						break
9494
+					}
9495
+				}
9496
+
9497
+				for _, it := range monitorlist {
9498
+					if item.PatientId == it.PatientId {
9499
+						monitor[key].MonitoringRecord = append(monitor[key].MonitoringRecord, it)
9500
+					}
9501
+				}
9502
+
9503
+				for _, it := range adviceList {
9504
+					if item.PatientId == it.PatientId {
9505
+						monitor[key].AdviceList = append(monitor[key].AdviceList, it)
9506
+					}
9507
+				}
9508
+
9509
+				for _, patient := range patients {
9510
+					if item.PatientId == patient.ID {
9511
+						monitor[key].MonitorPatients = patient
9512
+						break
9513
+					}
9514
+				}
9515
+
9516
+				for _, treatment := range treatments {
9517
+					if item.ModeId == treatment.ID {
9518
+						monitor[key].TreatmentMode = treatment
9519
+						break
9520
+					}
9521
+				}
9522
+
9523
+				for _, infor := range informationList {
9524
+					if item.PatientId == infor.PatientId {
9525
+						monitor[key].NewDeviceInformation = infor
9526
+						break
9527
+					}
9528
+				}
9529
+			}
9530
+		}
9531
+
9532
+	}
9533
+
9534
+	patients, err := service.GetAllpatientFourty(orgID)
9535
+
9536
+	var mds []*models.NewMonitorDialysisScheduleList
9537
+
9538
+	if pat_type == 0 {
9539
+		for _, item := range monitor {
9540
+			mds = append(mds, item)
9541
+		}
9542
+	}
9543
+
9544
+	//待医嘱核对
9545
+	if pat_type == 1 {
9546
+		for _, item := range monitor {
9547
+			if len(item.AdviceList) > 0 {
9548
+				mds = append(mds, item)
9549
+			}
9550
+		}
9551
+	}
9552
+	//待开小结
9553
+	if pat_type == 2 {
9554
+		for _, item := range monitor {
9555
+			if item.TreatmentSummaryForList == nil {
9556
+
9557
+				mds = append(mds, item)
9558
+
9559
+			}
9560
+
9561
+		}
9562
+	}
9563
+	//待下机
9564
+	if pat_type == 3 {
9565
+		for _, item := range monitor {
9566
+			if item.DialysisOrder != nil {
9567
+				if item.DialysisOrder.ID > 0 {
9568
+					mds = append(mds, item)
9569
+				}
9570
+			}
9571
+
9572
+		}
9573
+	}
9574
+
9575
+	//待消毒
9576
+	if pat_type == 4 {
9577
+		for _, item := range monitor {
9578
+			if item.NewDeviceInformation == nil {
9579
+				mds = append(mds, item)
9580
+			}
9581
+
9582
+		}
9583
+	}
9584
+	//待双人核对
9585
+	if pat_type == 5 {
9586
+		for _, item := range monitor {
9587
+			if item.DoubleCheck == nil {
9588
+
9589
+				mds = append(mds, item)
9590
+
9591
+			}
9592
+
9593
+		}
9594
+	}
9595
+
9596
+	//医嘱未执行
9597
+	if pat_type == 6 {
9598
+		for _, item := range monitor {
9599
+			if len(item.AdviceList) > 0 {
9600
+				mds = append(mds, item)
9601
+			}
9602
+		}
9603
+	}
9604
+	//患者未签名
9605
+	if pat_type == 7 {
9606
+		for _, item := range monitor {
9607
+			if item.DialysisOrder != nil {
9608
+				if item.DialysisOrder.ID > 0 {
9609
+					mds = append(mds, item)
9610
+				}
9611
+			}
9612
+
9613
+		}
9614
+	}
9615
+	//目标超滤于实际超滤不同
9616
+	if pat_type == 8 {
9617
+		for _, item := range monitor {
9618
+			if item.Prescription != nil && item.AssessmentAfterDislysis != nil {
9619
+				if item.Prescription.TargetUltrafiltration != item.AssessmentAfterDislysis.ActualUltrafiltration {
9620
+					mds = append(mds, item)
9621
+				}
9622
+			}
9623
+
9624
+		}
9625
+	}
9626
+	//血压少于5次
9627
+	if pat_type == 9 {
9628
+		for _, item := range monitor {
9629
+			if len(item.MonitoringRecord) < 5 {
9630
+				mds = append(mds, item)
9631
+			}
9632
+		}
9633
+	}
9634
+
9635
+	if pat_type == 10 {
9636
+		for _, item := range monitor {
9637
+			if len(item.MonitoringRecord) == 0 {
9638
+				mds = append(mds, item)
9639
+			}
9640
+		}
9641
+	}
9642
+
9643
+	if pat_type == 11 {
9644
+		for _, item := range monitor {
9645
+			if len(item.MonitoringRecord) > 0 {
9646
+				mds = append(mds, item)
9647
+			}
9648
+		}
9649
+	}
9650
+	if pat_type == 12 {
9651
+		for _, item := range monitor {
9652
+			if len(item.MonitoringRecord) > 0 {
9653
+				mds = append(mds, item)
9654
+			}
9655
+		}
9656
+	}
9657
+	if err == nil {
9658
+		c.ServeSuccessJSON(map[string]interface{}{
9659
+			"monitor":  mds,
9660
+			"patients": patients,
9661
+		})
9662
+	} else {
9663
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
9664
+	}
9665
+}

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go 查看文件

199
 
199
 
200
 	beego.Router("/m/api/checkmobileinformation", &DialysisAPIController{}, "Get:CheckMobileInformation")
200
 	beego.Router("/m/api/checkmobileinformation", &DialysisAPIController{}, "Get:CheckMobileInformation")
201
 
201
 
202
+	beego.Router("/m/api/getcontrolmonitorlist", &DialysisAPIController{}, "Get:GetControlMonitorList")
203
+
202
 }
204
 }

+ 12 - 6
controllers/new_mobile_api_controllers/new_common_api_controller.go 查看文件

875
 func (this *NewCommonApiController) GetMobileCartogramlist() {
875
 func (this *NewCommonApiController) GetMobileCartogramlist() {
876
 	adminInfo := this.GetMobileAdminUserInfo()
876
 	adminInfo := this.GetMobileAdminUserInfo()
877
 	orgid := adminInfo.Org.Id
877
 	orgid := adminInfo.Org.Id
878
-	//lapstor, _ := this.GetInt64("lapstor")
878
+	lapstor, _ := this.GetInt64("lapstor")
879
 	//fmt.Println("lapstor", lapstor)
879
 	//fmt.Println("lapstor", lapstor)
880
 	startime := this.GetString("startime")
880
 	startime := this.GetString("startime")
881
 
881
 
891
 	//统计总共
891
 	//统计总共
892
 	_, total, err := service.GetTotalPatientsControl(orgid, startimeStrUnix, endtimeStrsUnix)
892
 	_, total, err := service.GetTotalPatientsControl(orgid, startimeStrUnix, endtimeStrsUnix)
893
 
893
 
894
-	_, standtotal, err := service.GetStandControl(orgid, startimeStrUnix, endtimeStrsUnix)
894
+	//_, standtotal, err := service.GetStandControl(orgid, startimeStrUnix, endtimeStrsUnix)
895
+	//
896
+	//_, standtotalOne, err := service.GetStandControlOne(orgid, startimeStrUnix, endtimeStrsUnix)
895
 
897
 
896
-	_, standtotalOne, err := service.GetStandControlOne(orgid, startimeStrUnix, endtimeStrsUnix)
898
+	patients, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, 1, 10000)
899
+	control, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
900
+
901
+	infectiousControl, err := service.GetInfectiousControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
897
 
902
 
898
 	if err != nil {
903
 	if err != nil {
899
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
904
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
901
 	}
906
 	}
902
 
907
 
903
 	this.ServeSuccessJSON(map[string]interface{}{
908
 	this.ServeSuccessJSON(map[string]interface{}{
904
-		"total":         total,
905
-		"standtotal":    standtotal,
906
-		"standtotalOne": standtotalOne,
909
+		"patients":          patients,
910
+		"total":             total,
911
+		"control":           control,
912
+		"infectiousControl": infectiousControl,
907
 	})
913
 	})
908
 }
914
 }
909
 
915
 

+ 77 - 8
controllers/patient_api_controller.go 查看文件

367
 		Doctor:                       patient.Doctor,
367
 		Doctor:                       patient.Doctor,
368
 		RecordNumber:                 patient.RecordNumber,
368
 		RecordNumber:                 patient.RecordNumber,
369
 		PatientSource:                patient.PatientSource,
369
 		PatientSource:                patient.PatientSource,
370
+		PatientEndTime:               patient.PatientEndTime,
371
+		PatientStartTime:             patient.PatientStartTime,
372
+		InfectiousRemark:             patient.InfectiousRemark,
373
+		AllergicHistory:              patient.AllergicHistory,
374
+		PatientAddress:               patient.PatientAddress,
370
 	}
375
 	}
371
 
376
 
372
 	err = service.CreatePatientsNew(&patientsNew)
377
 	err = service.CreatePatientsNew(&patientsNew)
373
 	fmt.Print("创建失败", err)
378
 	fmt.Print("创建失败", err)
374
 
379
 
380
+	allergic := models.XtPatientAllergic{
381
+		UserOrgId:      adminUserInfo.CurrentOrgId,
382
+		PatientId:      patient.ID,
383
+		StartTime:      patient.PatientStartTime,
384
+		EndTime:        patient.PatientEndTime,
385
+		PatientSource:  patient.PatientSource,
386
+		PatientAddress: patient.PatientAddress,
387
+		Remake:         patient.Remark,
388
+		Status:         1,
389
+		Ctime:          time.Now().Unix(),
390
+	}
391
+
392
+	if len(patient.PatientAddress) > 0 {
393
+		service.CreateAllergic(allergic)
394
+	}
395
+
375
 	if len(record_date) > 0 {
396
 	if len(record_date) > 0 {
376
 		var recordTime int64
397
 		var recordTime int64
377
 		timeLayout := "2006-01-02"
398
 		timeLayout := "2006-01-02"
585
 		TreatmentPlan:             patient.TreatmentPlan,
606
 		TreatmentPlan:             patient.TreatmentPlan,
586
 		RecordNumber:              patient.RecordNumber,
607
 		RecordNumber:              patient.RecordNumber,
587
 		PatientSource:             patient.PatientSource,
608
 		PatientSource:             patient.PatientSource,
609
+		PatientStartTime:          patient.PatientStartTime,
610
+		PatientEndTime:            patient.PatientEndTime,
611
+		InfectiousRemark:          patient.InfectiousRemark,
612
+		AllergicHistory:           patient.AllergicHistory,
613
+		PatientAddress:            patient.PatientAddress,
588
 	}
614
 	}
589
 	//	//更新病人ID获取新表病人ID
615
 	//	//更新病人ID获取新表病人ID
590
 	err = service.UpdatepatientTwo(&patientsNew, id)
616
 	err = service.UpdatepatientTwo(&patientsNew, id)
591
 
617
 
618
+	allergic := models.XtPatientAllergic{
619
+		PatientId:      patient.ID,
620
+		UserOrgId:      adminUserInfo.CurrentOrgId,
621
+		StartTime:      patient.PatientStartTime,
622
+		EndTime:        patient.PatientEndTime,
623
+		PatientSource:  patient.PatientSource,
624
+		Status:         1,
625
+		Ctime:          time.Now().Unix(),
626
+		Mtime:          time.Now().Unix(),
627
+		Remake:         patient.Remark,
628
+		PatientAddress: patient.PatientAddress,
629
+	}
630
+	if len(patient.PatientAddress) > 0 {
631
+		service.CreateAllergic(allergic)
632
+	}
633
+
592
 	nowTimeUinx := time.Now()
634
 	nowTimeUinx := time.Now()
593
 	today := nowTimeUinx.Format("2006-01-02")
635
 	today := nowTimeUinx.Format("2006-01-02")
594
 
636
 
755
 
797
 
756
 	err = service.EditPatientLapseto(&patient, &lapseto)
798
 	err = service.EditPatientLapseto(&patient, &lapseto)
757
 
799
 
758
-	//if lapseto.LapsetoType == 3 || lapseto.LapsetoType == 2 {
759
-	//	timeStr := time.Now().Format("2006-01-02")
760
-	//	timeLayout := "2006-01-02 15:04:05"
761
-	//	timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
762
-	//	timenow := timeStringToTime.Unix()
763
-	//	service.UpdateScheduleByDeathTime(id, timenow)
764
-	//	service.UpdateScheduleItemByPatientId(id)
765
-	//}
800
+	if lapseto.LapsetoType == 3 || lapseto.LapsetoType == 2 {
801
+		timeStr := time.Now().Format("2006-01-02")
802
+		timeLayout := "2006-01-02 15:04:05"
803
+		timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
804
+		timenow := timeStringToTime.Unix()
805
+		service.UpdateScheduleByDeathTime(id, timenow)
806
+		service.UpdateScheduleItemByPatientId(id)
807
+	}
766
 
808
 
767
 	if err != nil {
809
 	if err != nil {
768
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeEditLapsetoFail)
810
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeEditLapsetoFail)
4931
 		patient.PatientStartTime = startTime
4973
 		patient.PatientStartTime = startTime
4932
 	}
4974
 	}
4933
 
4975
 
4976
+	if patientBody["patient_end_time"] != nil && reflect.TypeOf(patientBody["patient_end_time"]).String() == "string" {
4977
+		patient_end_time := patientBody["patient_end_time"].(string)
4978
+		var endTime int64
4979
+		if len(patient_end_time) > 0 {
4980
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", patient_end_time+" 00:00:00", loc)
4981
+
4982
+			endTime = theTime.Unix()
4983
+		}
4984
+		patient.PatientEndTime = endTime
4985
+	}
4986
+
4987
+	if patientBody["infectious_remark"] != nil && reflect.TypeOf(patientBody["infectious_remark"]).String() == "string" {
4988
+		record_number := patientBody["infectious_remark"].(string)
4989
+		patient.InfectiousRemark = record_number
4990
+	}
4991
+
4992
+	if patientBody["allergic_history"] != nil && reflect.TypeOf(patientBody["allergic_history"]).String() == "string" {
4993
+		allergic_history := patientBody["allergic_history"].(string)
4994
+		patient.AllergicHistory = allergic_history
4995
+	}
4996
+
4997
+	if patientBody["patient_address"] != nil && reflect.TypeOf(patientBody["patient_address"]).String() == "string" {
4998
+		patient_address := patientBody["patient_address"].(string)
4999
+		patient.PatientAddress = patient_address
5000
+	}
5001
+
4934
 	return
5002
 	return
5003
+
4935
 }
5004
 }
4936
 
5005
 
4937
 func (c *PatientApiController) GetPatientsByKeyWord() {
5006
 func (c *PatientApiController) GetPatientsByKeyWord() {

+ 22 - 9
controllers/patient_dataconfig_api_controller.go 查看文件

40
 
40
 
41
 	beego.Router("/api/patient/getcontextschedulelist", &PatientDataConfigAPIController{}, "Get:GetContextScheduleList")
41
 	beego.Router("/api/patient/getcontextschedulelist", &PatientDataConfigAPIController{}, "Get:GetContextScheduleList")
42
 
42
 
43
+	beego.Router("/api/patient/getpatientallagic", &PatientDataConfigAPIController{}, "Get:GetPatientAllagicList")
44
+
43
 }
45
 }
44
 
46
 
45
 type PatientDataConfigAPIController struct {
47
 type PatientDataConfigAPIController struct {
773
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
775
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
774
 
776
 
775
 	adminUserInfo := this.GetAdminUserInfo()
777
 	adminUserInfo := this.GetAdminUserInfo()
776
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
777
-	if getPatientErr != nil {
778
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
779
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
780
-		return
781
-	} else if patient == nil {
782
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
783
-		return
784
-	}
778
+	//patient, _ := service.GetPatientByIDOne(adminUserInfo.CurrentOrgId, patientID)
779
+	//if getPatientErr != nil {
780
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
781
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
782
+	//	return
783
+	//} else if patient == nil {
784
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
785
+	//	return
786
+	//}
785
 
787
 
786
 	now := time.Now().Unix()
788
 	now := time.Now().Unix()
787
 	record := models.PatientDiseaseCourse{
789
 	record := models.PatientDiseaseCourse{
1141
 		"devicenumber": devicenumber,
1143
 		"devicenumber": devicenumber,
1142
 	})
1144
 	})
1143
 }
1145
 }
1146
+
1147
+func (this *PatientDataConfigAPIController) GetPatientAllagicList() {
1148
+
1149
+	id, _ := this.GetInt64("id")
1150
+	fmt.Println("id2ooooooooooooooooooo", id)
1151
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1152
+	list, _ := service.GetPatientAllagicList(id, orgId)
1153
+	this.ServeSuccessJSON(map[string]interface{}{
1154
+		"list": list,
1155
+	})
1156
+}

+ 160 - 63
controllers/schedule_api_controller.go 查看文件

89
 
89
 
90
 	beego.Router("/api/schedule/changeschedule", &ScheduleApiController{}, "Put:ChangeScheduleTen")
90
 	beego.Router("/api/schedule/changeschedule", &ScheduleApiController{}, "Put:ChangeScheduleTen")
91
 
91
 
92
+	beego.Router("/api/schedule/getordernumber", &ScheduleApiController{}, "Get:GetNumberListById")
93
+
92
 }
94
 }
93
 func (c *ScheduleApiController) CoverSch() {
95
 func (c *ScheduleApiController) CoverSch() {
94
 	id_one, _ := c.GetInt64("id_one")
96
 	id_one, _ := c.GetInt64("id_one")
4932
 		return
4934
 		return
4933
 	} else {
4935
 	} else {
4934
 
4936
 
4935
-		//查询该床位今天是否存在排班
4936
-		sch, _ := service.GetScheduleByBedId(bed_id, schedule_type, adminINfo.CurrentOrgId, schedule.ScheduleDate)
4937
-		fmt.Println("schwowowoowowowowowo", sch.ID)
4938
-		if sch.ID == 0 {
4939
-			////删除排班
4940
-			//service.UpdateScheduleByScheduleId(id)
4941
-
4942
-			xtSchedule := models.XtSchedule{
4943
-				UserOrgId:           adminINfo.CurrentOrgId,
4944
-				PartitionId:         number.ZoneID,
4945
-				BedId:               bed_id,
4946
-				PatientId:           schedule.PatientId,
4947
-				ScheduleDate:        schedule.ScheduleDate,
4948
-				ScheduleType:        schedule.ScheduleType,
4949
-				ScheduleWeek:        schedule.ScheduleWeek,
4950
-				ModeId:              mode_id,
4951
-				Status:              1,
4952
-				CreatedTime:         time.Now().Unix(),
4953
-				UpdatedTime:         0,
4954
-				IsExport:            999999,
4955
-				DialysisMachineName: "",
4937
+		//如果床位未发生改变
4938
+		if bed_id == schedule.BedId {
4939
+
4940
+			//查询该床位今天是否存在排班
4941
+			sch, _ := service.GetScheduleByBedId(bed_id, schedule_type, adminINfo.CurrentOrgId, schedule.ScheduleDate)
4942
+			fmt.Println("schwowowoowowowowowo", sch.ID, sch.PatientId)
4943
+
4944
+			if sch.ID == 0 {
4945
+				////删除排班
4946
+				//service.UpdateScheduleByScheduleId(id)
4947
+
4948
+				//五四的床位
4949
+				xtSchedule := models.XtSchedule{
4950
+					UserOrgId:           adminINfo.CurrentOrgId,
4951
+					PartitionId:         number.ZoneID,
4952
+					BedId:               bed_id,
4953
+					PatientId:           schedule.PatientId,
4954
+					ScheduleDate:        schedule.ScheduleDate,
4955
+					ScheduleType:        schedule_type,
4956
+					ScheduleWeek:        schedule.ScheduleWeek,
4957
+					ModeId:              mode_id,
4958
+					Status:              1,
4959
+					CreatedTime:         time.Now().Unix(),
4960
+					UpdatedTime:         0,
4961
+					IsExport:            999999,
4962
+					DialysisMachineName: "",
4963
+				}
4964
+				//service.CreateNewSchedule(xtSchedule)
4965
+
4966
+				service.UpdateScheduleSixTy(id, xtSchedule)
4956
 			}
4967
 			}
4957
-			//service.CreateNewSchedule(xtSchedule)
4958
-			service.UpdateScheduleSixTy(id, xtSchedule)
4959
-		}
4960
 
4968
 
4961
-		//存在排班
4962
-		if sch.ID > 0 {
4963
-			//删除排班
4964
-			//service.UpdateScheduleByScheduleId(id)
4965
-			//查询该患者的透析模式对应的透析器灌流器
4966
-			//service.GetDialysisSolutionByMode(schedule.PatientId)
4967
-
4968
-			fmt.Println("bed_id2oo2o2o22o", bed_id)
4969
-			xtSchedule := models.XtSchedule{
4970
-				UserOrgId:           adminINfo.CurrentOrgId,
4971
-				PartitionId:         number.ZoneID,
4972
-				BedId:               bed_id,
4973
-				PatientId:           schedule.PatientId,
4974
-				ScheduleDate:        schedule.ScheduleDate,
4975
-				ScheduleType:        schedule_type,
4976
-				ScheduleWeek:        schedule.ScheduleWeek,
4977
-				ModeId:              mode_id,
4978
-				Status:              1,
4979
-				CreatedTime:         time.Now().Unix(),
4980
-				UpdatedTime:         time.Now().Unix(),
4981
-				IsExport:            8888,
4982
-				DialysisMachineName: "",
4969
+			if schedule_type != schedule.ScheduleType && sch.ID > 0 {
4970
+				//存在排班
4971
+				if sch.ID > 0 {
4972
+
4973
+					xtSchedule := models.XtSchedule{
4974
+						UserOrgId:           adminINfo.CurrentOrgId,
4975
+						PartitionId:         number.ZoneID,
4976
+						BedId:               sch.BedId,
4977
+						PatientId:           schedule.PatientId,
4978
+						ScheduleDate:        sch.ScheduleDate,
4979
+						ScheduleType:        sch.ScheduleType,
4980
+						ScheduleWeek:        sch.ScheduleWeek,
4981
+						ModeId:              sch.ModeId,
4982
+						Status:              1,
4983
+						CreatedTime:         time.Now().Unix(),
4984
+						UpdatedTime:         time.Now().Unix(),
4985
+						IsExport:            8888,
4986
+						DialysisMachineName: "",
4987
+					}
4988
+					fmt.Println("汪涵我我我哦", id)
4989
+
4990
+					//赵云的ID
4991
+					// 该床位存在的患者
4992
+					service.UpdateScheduleSixTy(id, xtSchedule)
4993
+
4994
+					//赵云的排班
4995
+					msch := models.XtSchedule{
4996
+						UserOrgId:    adminINfo.CurrentOrgId,
4997
+						PartitionId:  schedule.PartitionId,
4998
+						BedId:        schedule.BedId,
4999
+						PatientId:    sch.PatientId,
5000
+						ScheduleDate: schedule.ScheduleDate,
5001
+						ScheduleType: schedule.ScheduleType,
5002
+						ScheduleWeek: schedule.ScheduleWeek,
5003
+						ModeId:       schedule.ModeId,
5004
+						IsExport:     88888,
5005
+						CreatedTime:  time.Now().Unix(),
5006
+						UpdatedTime:  time.Now().Unix(),
5007
+					}
5008
+
5009
+					// 历史床位的患者
5010
+					service.UpdateScheduleSixTy(sch.ID, msch)
5011
+				}
4983
 			}
5012
 			}
4984
-			// 旧的id
4985
-			service.UpdateScheduleSixTy(sch.ID, xtSchedule)
4986
-
4987
-			fmt.Println("床位id", sch.BedId)
4988
-			msch := models.XtSchedule{
4989
-				UserOrgId:    adminINfo.CurrentOrgId,
4990
-				PartitionId:  sch.PartitionId,
4991
-				BedId:        sch.BedId,
4992
-				PatientId:    sch.PatientId,
4993
-				ScheduleDate: sch.ScheduleDate,
4994
-				ScheduleType: sch.ScheduleType,
4995
-				ScheduleWeek: sch.ScheduleWeek,
4996
-				ModeId:       sch.ModeId,
4997
-				IsExport:     88888,
4998
-				CreatedTime:  time.Now().Unix(),
4999
-				UpdatedTime:  time.Now().Unix(),
5013
+
5014
+		}
5015
+
5016
+		//如果床位发生改变
5017
+		if bed_id != schedule.BedId {
5018
+			//查询该床位今天是否存在排班
5019
+			sch, _ := service.GetScheduleByBedId(bed_id, schedule_type, adminINfo.CurrentOrgId, schedule.ScheduleDate)
5020
+			fmt.Println("schwowowoowowowowowo", sch.ID, sch.PatientId)
5021
+
5022
+			if sch.ID == 0 {
5023
+				////删除排班
5024
+				//service.UpdateScheduleByScheduleId(id)
5025
+
5026
+				//五四的床位
5027
+				xtSchedule := models.XtSchedule{
5028
+					UserOrgId:           adminINfo.CurrentOrgId,
5029
+					PartitionId:         number.ZoneID,
5030
+					BedId:               bed_id,
5031
+					PatientId:           schedule.PatientId,
5032
+					ScheduleDate:        schedule.ScheduleDate,
5033
+					ScheduleType:        schedule_type,
5034
+					ScheduleWeek:        schedule.ScheduleWeek,
5035
+					ModeId:              mode_id,
5036
+					Status:              1,
5037
+					CreatedTime:         time.Now().Unix(),
5038
+					UpdatedTime:         0,
5039
+					IsExport:            999999,
5040
+					DialysisMachineName: "",
5041
+				}
5042
+				//service.CreateNewSchedule(xtSchedule)
5043
+
5044
+				service.UpdateScheduleSixTy(id, xtSchedule)
5000
 			}
5045
 			}
5001
 
5046
 
5002
-			service.UpdateScheduleSixTy(id, msch)
5047
+			//存在排班
5048
+			if sch.ID > 0 {
5049
+
5050
+				xtSchedule := models.XtSchedule{
5051
+					UserOrgId:           adminINfo.CurrentOrgId,
5052
+					PartitionId:         number.ZoneID,
5053
+					BedId:               sch.BedId,
5054
+					PatientId:           schedule.PatientId,
5055
+					ScheduleDate:        sch.ScheduleDate,
5056
+					ScheduleType:        sch.ScheduleType,
5057
+					ScheduleWeek:        sch.ScheduleWeek,
5058
+					ModeId:              sch.ModeId,
5059
+					Status:              1,
5060
+					CreatedTime:         time.Now().Unix(),
5061
+					UpdatedTime:         time.Now().Unix(),
5062
+					IsExport:            8888,
5063
+					DialysisMachineName: "",
5064
+				}
5065
+				fmt.Println("idwoowowowowowowoowowowowo", id)
5066
+
5067
+				//赵云的ID
5068
+				// 该床位存在的患者
5069
+				service.UpdateScheduleSixTy(id, xtSchedule)
5070
+
5071
+				//赵云的排班
5072
+				msch := models.XtSchedule{
5073
+					UserOrgId:    adminINfo.CurrentOrgId,
5074
+					PartitionId:  schedule.PartitionId,
5075
+					BedId:        schedule.BedId,
5076
+					PatientId:    sch.PatientId,
5077
+					ScheduleDate: schedule.ScheduleDate,
5078
+					ScheduleType: schedule.ScheduleType,
5079
+					ScheduleWeek: schedule.ScheduleWeek,
5080
+					ModeId:       schedule.ModeId,
5081
+					IsExport:     88888,
5082
+					CreatedTime:  time.Now().Unix(),
5083
+					UpdatedTime:  time.Now().Unix(),
5084
+				}
5085
+
5086
+				// 历史床位的患者
5087
+				service.UpdateScheduleSixTy(sch.ID, msch)
5088
+			}
5003
 
5089
 
5004
 		}
5090
 		}
5005
 	}
5091
 	}
5010
 	})
5096
 	})
5011
 
5097
 
5012
 }
5098
 }
5099
+
5100
+func (c *ScheduleApiController) GetNumberListById() {
5101
+
5102
+	id, _ := c.GetInt64("id")
5103
+	orgId := c.GetAdminUserInfo().CurrentOrgId
5104
+	number, _ := service.GetNumberListById(id, orgId)
5105
+	c.ServeSuccessJSON(map[string]interface{}{
5106
+		"number": number,
5107
+	})
5108
+
5109
+}

+ 58 - 43
controllers/self_drug_api_congtroller.go 查看文件

3498
 func (this *SelfDrugApiController) GetSendGoodInformation() {
3498
 func (this *SelfDrugApiController) GetSendGoodInformation() {
3499
 
3499
 
3500
 	orgId := this.GetAdminUserInfo().CurrentOrgId
3500
 	orgId := this.GetAdminUserInfo().CurrentOrgId
3501
-	//获取入库数据
3502
-	list, _ := service.GetSendGoodInformation(orgId)
3501
+	fmt.Println("orgid", orgId)
3502
+	list, _ := service.GetWarehouseOutInfo(10489)
3503
+
3503
 	for _, it := range list {
3504
 	for _, it := range list {
3504
-		//查询是否有数据
3505
-		_, errcode := service.GetStockFlush(it.StorehouseId, it.GoodId, it.OrgId)
3506
-		//获取总退库数量
3507
-		var cancel_count int64
3508
-		var out_count int64
3509
-		var act_count int64
3510
-		//退库总数量
3511
-		cancellist, _ := service.GetAllCancelCount(it.StorehouseId, it.GoodId, it.OrgId)
3512
-		for _, item := range cancellist {
3513
-			cancel_count += item.Count
3514
-		}
3515
-		//出库总数量
3516
-		outlist, _ := service.GetAllStockOutCount(it.StorehouseId, it.GoodId, it.OrgId)
3517
-		for _, item := range outlist {
3518
-			out_count += item.Count
3519
-		}
3505
+		service.UpdateWarehosueOutInfo(it.ID, it.WarehouseOutTime)
3506
+	}
3520
 
3507
 
3521
-		//实际出库总数量
3522
-		actlist, _ := service.GetActStockOutCount(it.StorehouseId, it.GoodId, it.OrgId)
3523
-		for _, item := range actlist {
3524
-			act_count += item.Count
3525
-		}
3508
+	//获取入库数据
3509
+	//list, _ := service.GetSendGoodInformation(10265)
3510
+	//
3511
+	////project, _ := service.GetHisPrescriptionList(10265)
3512
+	//
3513
+	//for _, it := range list {
3514
+	//	service.UpdateGoodFlow(it.ID, it.PackingPrice)
3515
+	//}
3526
 
3516
 
3527
-		if errcode == gorm.ErrRecordNotFound {
3528
-			good := models.XtGoodStockCount{
3529
-				UserOrgId:        it.OrgId,
3530
-				GoodId:           it.GoodId,
3531
-				StorehouseId:     it.StorehouseId,
3532
-				Status:           1,
3533
-				Ctime:            time.Now().Unix(),
3534
-				Mtime:            0,
3535
-				StockInCount:     it.WarehousingCount,
3536
-				StockOutCount:    out_count - cancel_count,
3537
-				StockCancelCount: cancel_count,
3538
-				FlushCount:       it.StockCount,
3539
-				StockActOutCount: act_count,
3540
-			}
3541
-			service.CreateGoodCountSix(good)
3542
-		}
3543
-		if errcode == nil {
3544
-			service.UpdateGoodCount(it.WarehousingCount, it.StockCount, out_count, it.StorehouseId, it.GoodId, it.OrgId, cancel_count, act_count)
3545
-		}
3546
-	}
3517
+	//for _, it := range list {
3518
+	//	//查询是否有数据
3519
+	//	_, errcode := service.GetStockFlush(it.StorehouseId, it.GoodId, it.OrgId)
3520
+	//	//获取总退库数量
3521
+	//	var cancel_count int64
3522
+	//	var out_count int64
3523
+	//	var act_count int64
3524
+	//	//退库总数量
3525
+	//	cancellist, _ := service.GetAllCancelCount(it.StorehouseId, it.GoodId, it.OrgId)
3526
+	//	for _, item := range cancellist {
3527
+	//		cancel_count += item.Count
3528
+	//	}
3529
+	//	//出库总数量
3530
+	//	outlist, _ := service.GetAllStockOutCount(it.StorehouseId, it.GoodId, it.OrgId)
3531
+	//	for _, item := range outlist {
3532
+	//		out_count += item.Count
3533
+	//	}
3534
+	//
3535
+	//	//实际出库总数量
3536
+	//	actlist, _ := service.GetActStockOutCount(it.StorehouseId, it.GoodId, it.OrgId)
3537
+	//	for _, item := range actlist {
3538
+	//		act_count += item.Count
3539
+	//	}
3540
+	//
3541
+	//	if errcode == gorm.ErrRecordNotFound {
3542
+	//		good := models.XtGoodStockCount{
3543
+	//			UserOrgId:        it.OrgId,
3544
+	//			GoodId:           it.GoodId,
3545
+	//			StorehouseId:     it.StorehouseId,
3546
+	//			Status:           1,
3547
+	//			Ctime:            time.Now().Unix(),
3548
+	//			Mtime:            0,
3549
+	//			StockInCount:     it.WarehousingCount,
3550
+	//			StockOutCount:    out_count - cancel_count,
3551
+	//			StockCancelCount: cancel_count,
3552
+	//			FlushCount:       it.StockCount,
3553
+	//			StockActOutCount: act_count,
3554
+	//		}
3555
+	//		service.CreateGoodCountSix(good)
3556
+	//	}
3557
+	//	if errcode == nil {
3558
+	//		service.UpdateGoodCount(it.WarehousingCount, it.StockCount, out_count, it.StorehouseId, it.GoodId, it.OrgId, cancel_count, act_count)
3559
+	//	}
3560
+	//}
3547
 
3561
 
3548
 	this.ServeSuccessJSON(map[string]interface{}{
3562
 	this.ServeSuccessJSON(map[string]interface{}{
3549
 		"msg": "1",
3563
 		"msg": "1",
3910
 
3924
 
3911
 		//期中减少
3925
 		//期中减少
3912
 		outInfo, _ := service.FindeDrugWarehouseOutInfo(item.ID, item.OrgId, startTime, endTime)
3926
 		outInfo, _ := service.FindeDrugWarehouseOutInfo(item.ID, item.OrgId, startTime, endTime)
3927
+		fmt.Println("putInfo2o2o2oo2o2", outInfo)
3913
 		for _, it := range outInfo {
3928
 		for _, it := range outInfo {
3914
 			item.DrugWarehouseOutInfoStartEnd = append(item.DrugWarehouseOutInfoStartEnd, it)
3929
 			item.DrugWarehouseOutInfoStartEnd = append(item.DrugWarehouseOutInfoStartEnd, it)
3915
 		}
3930
 		}

+ 24 - 14
controllers/stock_in_api_controller.go 查看文件

3170
 	var err error
3170
 	var err error
3171
 	var total_price float64
3171
 	var total_price float64
3172
 	houseList, _ := service.GetAllStoreHouseList(adminUserInfo.CurrentOrgId)
3172
 	houseList, _ := service.GetAllStoreHouseList(adminUserInfo.CurrentOrgId)
3173
+	manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
3174
+	dealerList, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
3173
 	if types == 1 {
3175
 	if types == 1 {
3174
 		list, total, err = service.FindStockInDetailList(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3176
 		list, total, err = service.FindStockInDetailList(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3175
 		_, total_price = service.GetStockInDetailTotal(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3177
 		_, total_price = service.GetStockInDetailTotal(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3176
 
3178
 
3177
 		if err == nil {
3179
 		if err == nil {
3178
 			this.ServeSuccessJSON(map[string]interface{}{
3180
 			this.ServeSuccessJSON(map[string]interface{}{
3179
-				"list":        list,
3180
-				"total":       total,
3181
-				"total_price": total_price,
3182
-				"houseList":   houseList,
3181
+				"list":             list,
3182
+				"total":            total,
3183
+				"total_price":      total_price,
3184
+				"houseList":        houseList,
3185
+				"manufacturerList": manufacturerList,
3186
+				"dealerList":       dealerList,
3183
 			})
3187
 			})
3184
 		} else {
3188
 		} else {
3185
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3189
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3190
 		_, total_price = service.GetStockOutDetailTotal(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3194
 		_, total_price = service.GetStockOutDetailTotal(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3191
 		if err == nil {
3195
 		if err == nil {
3192
 			this.ServeSuccessJSON(map[string]interface{}{
3196
 			this.ServeSuccessJSON(map[string]interface{}{
3193
-				"list":        list1,
3194
-				"total":       total,
3195
-				"total_price": total_price,
3196
-				"houseList":   houseList,
3197
+				"list":             list1,
3198
+				"total":            total,
3199
+				"total_price":      total_price,
3200
+				"houseList":        houseList,
3201
+				"manufacturerList": manufacturerList,
3202
+				"dealerList":       dealerList,
3197
 			})
3203
 			})
3198
 		} else {
3204
 		} else {
3199
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3205
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3203
 
3209
 
3204
 		if err == nil {
3210
 		if err == nil {
3205
 			this.ServeSuccessJSON(map[string]interface{}{
3211
 			this.ServeSuccessJSON(map[string]interface{}{
3206
-				"list":  list2,
3207
-				"total": total,
3212
+				"list":             list2,
3213
+				"total":            total,
3214
+				"manufacturerList": manufacturerList,
3215
+				"dealerList":       dealerList,
3208
 			})
3216
 			})
3209
 		} else {
3217
 		} else {
3210
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3218
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3214
 		listGroup, err := service.FindeCancelGroup(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3222
 		listGroup, err := service.FindeCancelGroup(adminUserInfo.CurrentOrgId, startTime, endTime, keywords, manufacturer, order_type, dealer, storehouse_id)
3215
 		if err == nil {
3223
 		if err == nil {
3216
 			this.ServeSuccessJSON(map[string]interface{}{
3224
 			this.ServeSuccessJSON(map[string]interface{}{
3217
-				"list":      list3,
3218
-				"total":     total,
3219
-				"listgroup": listGroup,
3220
-				"houseList": houseList,
3225
+				"list":             list3,
3226
+				"total":            total,
3227
+				"listgroup":        listGroup,
3228
+				"houseList":        houseList,
3229
+				"manufacturerList": manufacturerList,
3230
+				"dealerList":       dealerList,
3221
 			})
3231
 			})
3222
 		} else {
3232
 		} else {
3223
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3233
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)

+ 14 - 0
models/device_models.go 查看文件

1488
 
1488
 
1489
 	return "xt_dialysis_registration"
1489
 	return "xt_dialysis_registration"
1490
 }
1490
 }
1491
+
1492
+type NewDeviceInformation struct {
1493
+	ID        int64 `gorm:"column:id" json:"id" form:"id"`
1494
+	Date      int64 `gorm:"column:date" json:"date" form:"date"`
1495
+	Class     int64 `gorm:"column:class" json:"class" form:"class"`
1496
+	Zone      int64 `gorm:"column:zone" json:"zone" form:"zone"`
1497
+	BedNumber int64 `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
1498
+	PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1499
+}
1500
+
1501
+func (NewDeviceInformation) TableName() string {
1502
+
1503
+	return "xt_device_information"
1504
+}

+ 38 - 0
models/new_monitor.go 查看文件

50
 	DeviceNumber  DeviceNumber `gorm:"ForeignKey:BedId" json:"device_number"`
50
 	DeviceNumber  DeviceNumber `gorm:"ForeignKey:BedId" json:"device_number"`
51
 	StartTime     int64        `gorm:"column:start_time" json:"start_time"`
51
 	StartTime     int64        `gorm:"column:start_time" json:"start_time"`
52
 	DialysisTotal int64        `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
52
 	DialysisTotal int64        `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
53
+	Url           string       `gorm:"column:url" json:"url" form:"url"`
53
 }
54
 }
54
 
55
 
55
 func (VMMonitorDialysisOrder) TableName() string {
56
 func (VMMonitorDialysisOrder) TableName() string {
117
 	Status                 int64   `gorm:"column:status" json:"status"`
118
 	Status                 int64   `gorm:"column:status" json:"status"`
118
 	AccumulatedBloodVolume float64 `gorm:"column:accumulated_blood_volume" json:"accumulated_blood_volume" form:"accumulated_blood_volume"`
119
 	AccumulatedBloodVolume float64 `gorm:"column:accumulated_blood_volume" json:"accumulated_blood_volume" form:"accumulated_blood_volume"`
119
 	UltrafiltrationVolume  float64 `gorm:"column:ultrafiltration_volume" json:"ultrafiltration_volume" form:"ultrafiltration_volume"`
120
 	UltrafiltrationVolume  float64 `gorm:"column:ultrafiltration_volume" json:"ultrafiltration_volume" form:"ultrafiltration_volume"`
121
+	VenousPressure         float64 `gorm:"column:venous_pressure" json:"venous_pressure" form:"venous_pressure"`
122
+	ArterialPressure       float64 `gorm:"column:arterial_pressure" json:"arterial_pressure" form:"arterial_pressure"`
123
+	BloodOxygenSaturation  string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
124
+	Symptom                string  `gorm:"column:symptom" json:"symptom" form:"symptom"`
125
+	Dispose                string  `gorm:"column:dispose" json:"dispose" form:"dispose"`
126
+	Result                 string  `gorm:"column:result" json:"result" form:"result"`
120
 }
127
 }
121
 
128
 
122
 func (VMMonitoringRecord) TableName() string {
129
 func (VMMonitoringRecord) TableName() string {
123
 	return "xt_monitoring_record"
130
 	return "xt_monitoring_record"
124
 }
131
 }
132
+
133
+type NewMonitorDialysisScheduleList struct {
134
+	ID           int64 `gorm:"column:id" json:"id"`
135
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
136
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id"`
137
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id"`
138
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id"`
139
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date"`
140
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type"`
141
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id"`
142
+	Status       int64 `gorm:"column:status" json:"status"`
143
+
144
+	MonitorPatients *VMMonitorPatients `gorm:"ForeignKey:PatientId" json:"patient"`
145
+	DeviceNumber    *DeviceNumber      `gorm:"ForeignKey:BedId" json:"device_number"`
146
+	DeviceZone      *DeviceZone        `gorm:"ForeignKey:PartitionId" json:"device_zone"`
147
+	TreatmentMode   *TreatmentMode     `gorm:"ForeignKey:ModeId" json:"treatment_mode"`
148
+
149
+	DialysisOrder            *VMMonitorDialysisOrder    `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
150
+	Prescription             *VMDialysisPrescription    `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
151
+	AssessmentBeforeDislysis *VMPredialysisEvaluation   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
152
+	AssessmentAfterDislysis  *VMAssessmentAfterDislysis `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_after_dislysis"`
153
+	MonitoringRecord         []*VMMonitoringRecord      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
154
+	AdviceList               []*VMDoctorAdviceForList   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"advice"`
155
+	DoubleCheck              *VmDoubleCheck             `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dobuleCheck"`
156
+	TreatmentSummaryForList  *VMTreatmentSummaryForList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"treatmentSummary"`
157
+	NewDeviceInformation     *NewDeviceInformation      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"treatmentSummary"`
158
+}
159
+
160
+func (NewMonitorDialysisScheduleList) TableName() string {
161
+	return "xt_schedule"
162
+}

+ 42 - 0
models/patient_models.go 查看文件

225
 	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
225
 	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
226
 	PatientSource            int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
226
 	PatientSource            int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
227
 	PatientStartTime         int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
227
 	PatientStartTime         int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
228
+	PatientEndTime           int64   `gorm:"column:patient_end_time" json:"patient_end_time" form:"patient_end_time"`
229
+	InfectiousRemark         string  `gorm:"column:infectious_remark" json:"infectious_remark" form:"infectious_remark"`
230
+	AllergicHistory          string  `gorm:"column:allergic_history" json:"allergic_history" form:"allergic_history"`
231
+	PatientAddress           string  `gorm:"column:patient_address" json:"patient_address" form:"patient_address"`
228
 }
232
 }
229
 
233
 
230
 func (Patients) TableName() string {
234
 func (Patients) TableName() string {
819
 	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
823
 	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
820
 	PatientSource                int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
824
 	PatientSource                int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
821
 	PatientStartTime             int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
825
 	PatientStartTime             int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
826
+	PatientEndTime               int64   `gorm:"column:patient_end_time" json:"patient_end_time" form:"patient_end_time"`
827
+	InfectiousRemark             string  `gorm:"column:infectious_remark" json:"infectious_remark" form:"infectious_remark"`
828
+	AllergicHistory              string  `gorm:"column:allergic_history" json:"allergic_history" form:"allergic_history"`
829
+	PatientAddress               string  `gorm:"column:patient_address" json:"patient_address" form:"patient_address"`
822
 }
830
 }
823
 
831
 
824
 func (XtPatientsNew) TableName() string {
832
 func (XtPatientsNew) TableName() string {
1978
 func (ConScheduleList) TableName() string {
1986
 func (ConScheduleList) TableName() string {
1979
 	return "xt_schedule"
1987
 	return "xt_schedule"
1980
 }
1988
 }
1989
+
1990
+type XtPatientAllergic struct {
1991
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
1992
+	PatientId      int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1993
+	UserOrgId      int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1994
+	StartTime      int64  `gorm:"column:start_time" json:"start_time" form:"start_time"`
1995
+	EndTime        int64  `gorm:"column:end_time" json:"end_time" form:"end_time"`
1996
+	PatientSource  int64  `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
1997
+	Status         int64  `gorm:"column:status" json:"status" form:"status"`
1998
+	Ctime          int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1999
+	Mtime          int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2000
+	Remake         string `gorm:"column:remake" json:"remake" form:"remake"`
2001
+	PatientAddress string `gorm:"column:patient_address" json:"patient_address" form:"patient_address"`
2002
+}
2003
+
2004
+func (XtPatientAllergic) TableName() string {
2005
+	return "xt_patient_allergic"
2006
+}
2007
+
2008
+type VmDoubleCheck struct {
2009
+	ID             int64 `gorm:"column:id" json:"id"`
2010
+	UserOrgId      int64 `gorm:"column:user_org_id" json:"user_org_id"`
2011
+	PatientId      int64 `gorm:"column:patient_id" json:"patient_id"`
2012
+	CheckDate      int64 `gorm:"column:check_date" json:"check_date"`
2013
+	Status         int64 `gorm:"column:status" json:"status"`
2014
+	Creater        int64 `gorm:"column:creater" json:"creater"`
2015
+	Modifier       int64 `gorm:"column:modifier" json:"modifier"`
2016
+	CheckTime      int64 `gorm:"column:check_time" json:"check_time"`
2017
+	FirstCheckTime int64 `gorm:"column:first_check_time" json:"first_check_time"`
2018
+}
2019
+
2020
+func (VmDoubleCheck) TableName() string {
2021
+	return "xt_double_check"
2022
+}

+ 2 - 2
service/common_service.go 查看文件

83
 	table := XTReadDB().Table("xt_inspection_reference as s")
83
 	table := XTReadDB().Table("xt_inspection_reference as s")
84
 	fmt.Println(table)
84
 	fmt.Println(table)
85
 	offset := (page - 1) * limit
85
 	offset := (page - 1) * limit
86
-	err = db.Order("x.sort asc,x.created_time desc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,x.range_value,x.range_type,s.unit,s.project_name,s.item_name,x.is_status").Count(&total).
87
-		Joins("left join xt_inspection_reference as s on s.item_id = x.inspection_minor and s.project_id = x.inspection_major").Where("s.org_id = ? and s.status = 1", orgid).Offset(offset).Limit(limit).Scan(&standard).Error
86
+	err = db.Order("x.sort asc,x.created_time desc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,x.range_value,x.range_type,s.unit,s.project_name,s.item_name,x.is_status").
87
+		Joins("left join xt_inspection_reference as s on s.item_id = x.inspection_minor and s.project_id = x.inspection_major").Where("s.org_id = ? and s.status = 1", orgid).Count(&total).Offset(offset).Limit(limit).Scan(&standard).Error
88
 	return standard, total, err
88
 	return standard, total, err
89
 }
89
 }
90
 
90
 

+ 1 - 1
service/drug_stock_service.go 查看文件

206
 	if orgid > 0 {
206
 	if orgid > 0 {
207
 		db = db.Where("x.org_id = ?", orgid)
207
 		db = db.Where("x.org_id = ?", orgid)
208
 	}
208
 	}
209
-	err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,sum(x.warehousing_count) as warehousing_count,x.price,x.total_price,x.manufacturer,x.remark,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,x.warehouseing_unit,x.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.batch_number").Preload("XtBaseDrug", "status = 1 and org_id = ?", orgid).Group("x.drug_id").Find(&info).Error
209
+	err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,sum(x.warehousing_count) as warehousing_count,x.price,x.total_price,x.manufacturer,x.remark,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,x.warehouseing_unit,x.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.batch_number,x.dealer,x.manufacturer").Preload("XtBaseDrug", "status = 1 and org_id = ?", orgid).Group("x.drug_id").Find(&info).Error
210
 
210
 
211
 	//err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,sum(x.warehousing_count) as warehousing_count,x.price,x.total_price,x.dealer,x.manufacturer,x.remark,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,x.warehouseing_unit,x.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.batch_number").Group("x.drug_id").Find(&DrugWarehouseInfo{}).Error
211
 	//err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,sum(x.warehousing_count) as warehousing_count,x.price,x.total_price,x.dealer,x.manufacturer,x.remark,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,x.warehouseing_unit,x.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.batch_number").Group("x.drug_id").Find(&DrugWarehouseInfo{}).Error
212
 	return info, err
212
 	return info, err

+ 4 - 4
service/gobal_config_service.go 查看文件

428
 	}
428
 	}
429
 
429
 
430
 	if manufacturerId > 0 {
430
 	if manufacturerId > 0 {
431
-		err = db.Select("x.id,x.max_unit as unit,x.drug_id,x.cancel_stock_id,x.count,x.price,x.total,x.product_date,x.expiry_date,x.ctime,x.org_id,x.order_number,x.type,x.dealer,x.manufacturer,x.retail_price,x.retail_total_price,x.number,x.storehouse_id,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater,s.dose,s.dose_unit,s.min_number,s.max_unit").Joins("left join xt_base_drug as s on s.id = x.drug_id and s.org_id = ? and s.status = 1", orgid).Joins("left join xt_drug_cancel_stock as t on t.id = x.cancel_stock_id and t.org_id = ? and t.status =1", orgid).Where("t.manufacturer = ?", manufacturerId).Order("x.ctime desc").Group("x.drug_id").Scan(&info).Error
431
+		err = db.Select("x.id,x.max_unit as unit,x.drug_id,x.cancel_stock_id,x.count,x.price,x.total,x.product_date,x.expiry_date,x.ctime,x.org_id,x.order_number,x.type,s.dealer,s.manufacturer,x.retail_price,x.retail_total_price,x.number,x.storehouse_id,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater,s.dose,s.dose_unit,s.min_number,s.max_unit").Joins("left join xt_base_drug as s on s.id = x.drug_id and s.org_id = ? and s.status = 1", orgid).Joins("left join xt_drug_cancel_stock as t on t.id = x.cancel_stock_id and t.org_id = ? and t.status =1", orgid).Where("t.manufacturer = ?", manufacturerId).Order("x.ctime desc").Group("x.drug_id").Scan(&info).Error
432
 	} else {
432
 	} else {
433
-		err = db.Select("x.id,x.max_unit as unit,x.drug_id,x.cancel_stock_id,x.count,x.price,x.total,x.product_date,x.expiry_date,x.ctime,x.org_id,x.order_number,x.type,x.dealer,x.manufacturer,x.retail_price,x.retail_total_price,x.number,x.storehouse_id,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater,s.dose,s.dose_unit,s.min_number,s.max_unit").Joins("left join xt_base_drug as s on s.id = x.drug_id and s.org_id = ? and s.status = 1", orgid).Joins("left join xt_drug_cancel_stock as t on t.id = x.cancel_stock_id and t.org_id = ? and t.status =1", orgid).Order("x.ctime desc").Group("x.drug_id").Scan(&info).Error
433
+		err = db.Select("x.id,x.max_unit as unit,x.drug_id,x.cancel_stock_id,x.count,x.price,x.total,x.product_date,x.expiry_date,x.ctime,x.org_id,x.order_number,x.type,s.dealer,s.manufacturer,x.retail_price,x.retail_total_price,x.number,x.storehouse_id,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater,s.dose,s.dose_unit,s.min_number,s.max_unit").Joins("left join xt_base_drug as s on s.id = x.drug_id and s.org_id = ? and s.status = 1", orgid).Joins("left join xt_drug_cancel_stock as t on t.id = x.cancel_stock_id and t.org_id = ? and t.status =1", orgid).Order("x.ctime desc").Group("x.drug_id").Scan(&info).Error
434
 	}
434
 	}
435
 
435
 
436
 	return info, err
436
 	return info, err
466
 	}
466
 	}
467
 
467
 
468
 	if manufacturerId > 0 {
468
 	if manufacturerId > 0 {
469
-		err = db.Select("x.id,x.max_unit as unit,x.drug_id,x.cancel_stock_id,x.count,x.price,x.total,x.product_date,x.expiry_date,x.ctime,x.org_id,x.order_number,x.type,x.dealer,x.manufacturer,x.retail_price,x.retail_total_price,x.number,x.storehouse_id,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater,s.dose,s.dose_unit,s.min_number,s.max_unit").Joins("left join xt_base_drug as s on s.id = x.drug_id and s.org_id = ? and s.status = 1", orgid).Joins("left join xt_drug_cancel_stock as t on t.id = x.cancel_stock_id and t.org_id = ? and t.status =1", orgid).Where("t.manufacturer = ?", manufacturerId).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&cancel).Error
469
+		err = db.Select("x.id,x.max_unit as unit,x.drug_id,x.cancel_stock_id,x.count,x.price,x.total,x.product_date,x.expiry_date,x.ctime,x.org_id,x.order_number,x.type,s.dealer,s.manufacturer,x.retail_price,x.retail_total_price,x.number,x.storehouse_id,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater,s.dose,s.dose_unit,s.min_number,s.max_unit").Joins("left join xt_base_drug as s on s.id = x.drug_id and s.org_id = ? and s.status = 1", orgid).Joins("left join xt_drug_cancel_stock as t on t.id = x.cancel_stock_id and t.org_id = ? and t.status =1", orgid).Where("t.manufacturer = ?", manufacturerId).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&cancel).Error
470
 	} else {
470
 	} else {
471
-		err = db.Select("x.id,x.max_unit as unit,x.drug_id,x.cancel_stock_id,x.count,x.price,x.total,x.product_date,x.expiry_date,x.ctime,x.org_id,x.order_number,x.type,x.dealer,x.manufacturer,x.retail_price,x.retail_total_price,x.number,x.storehouse_id,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater,s.dose,s.dose_unit,s.min_number,s.max_unit").Joins("left join xt_base_drug as s on s.id = x.drug_id and s.org_id = ? and s.status = 1", orgid).Joins("left join xt_drug_cancel_stock as t on t.id = x.cancel_stock_id and t.org_id = ? and t.status =1", orgid).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&cancel).Error
471
+		err = db.Select("x.id,x.max_unit as unit,x.drug_id,x.cancel_stock_id,x.count,x.price,x.total,x.product_date,x.expiry_date,x.ctime,x.org_id,x.order_number,x.type,s.dealer,s.manufacturer,x.retail_price,x.retail_total_price,x.number,x.storehouse_id,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater,s.dose,s.dose_unit,s.min_number,s.max_unit").Joins("left join xt_base_drug as s on s.id = x.drug_id and s.org_id = ? and s.status = 1", orgid).Joins("left join xt_drug_cancel_stock as t on t.id = x.cancel_stock_id and t.org_id = ? and t.status =1", orgid).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&cancel).Error
472
 	}
472
 	}
473
 
473
 
474
 	return cancel, total, err
474
 	return cancel, total, err

+ 2 - 2
service/manage_service.go 查看文件

768
 	}
768
 	}
769
 	offset := (page - 1) * limit
769
 	offset := (page - 1) * limit
770
 
770
 
771
-	err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Order("x.ctime desc").Offset(offset).Limit(limit).Scan(&infor).Error
771
+	err = db.Group("x.id").Select("x.id,x.date,x.class,x.zone,x.bed_number,x.patient_id,x.contagion,x.dialysis_mode,x.start_time,x.end_time,x.dialysis_hour,x.hyperfiltratio,x.weight_loss,x.warning_value,x.user_total,x.move,x.failure_stage,x.fault_description,x.code_information,x.disinfect_type,x.disinfectant_type,x.disinfection,x.machine_run,x.fluid_path,x.disinfectant,x.disinfection_status,x.disinfection_residue,x.long_time,x.disinfec_startime,x.disinfec_endtime,x.dialysis_checked,x.dialysis_name,x.norms,x.dialysis_concentration,x.germ_checked,x.germ_name,x.germ_number,x.clean,x.sign_name,x.equiment_id,x.bed,p.name,r.user_name").Count(&total).Joins("Left Join sgj_xt.xt_patients as p on p.id = x.patient_id").Joins("Left Join sgj_user_admin_role as r on r.admin_user_id = x.sign_name").Order("x.date desc").Offset(offset).Limit(limit).Scan(&infor).Error
772
 	if err != nil {
772
 	if err != nil {
773
 
773
 
774
 		return
774
 		return
1809
 
1809
 
1810
 func GetRegistNumber(sys_record_time int64, good_id int64, user_org_id int64) (infor []*models.WarehouseOutInfoNight, err error) {
1810
 func GetRegistNumber(sys_record_time int64, good_id int64, user_org_id int64) (infor []*models.WarehouseOutInfoNight, err error) {
1811
 
1811
 
1812
-	err = XTReadDB().Where("sys_record_time = ? and good_id = ? and org_id = ? and status =1", sys_record_time, good_id, user_org_id).Find(&infor).Error
1812
+	err = XTReadDB().Where("sys_record_time = ? and good_id = ? and org_id = ? and status =1 and is_sys=1", sys_record_time, good_id, user_org_id).Find(&infor).Error
1813
 
1813
 
1814
 	return infor, err
1814
 	return infor, err
1815
 }
1815
 }

+ 6 - 7
service/mobile_dialysis_service.go 查看文件

159
 	DialysisSolution         *models.DialysisSolution          `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
159
 	DialysisSolution         *models.DialysisSolution          `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"dialysis_solution"`
160
 	DoubleCheck              *models.DoubleCheck               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dobule_check"`
160
 	DoubleCheck              *models.DoubleCheck               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dobule_check"`
161
 	NewDeviceInformation     *NewDeviceInformation             `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"device_information"`
161
 	NewDeviceInformation     *NewDeviceInformation             `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"device_information"`
162
+	//VMMonitoringRecord       []models.VMMonitoringRecord       `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitor_record"`
162
 }
163
 }
163
 
164
 
164
 func (MDialysisScheduleVMForList) TableName() string {
165
 func (MDialysisScheduleVMForList) TableName() string {
275
 }
276
 }
276
 
277
 
277
 type MDialysisOrderVM struct {
278
 type MDialysisOrderVM struct {
278
-	ID           int64 `gorm:"column:id" json:"id"`
279
-	DialysisDate int64 `gorm:"column:dialysis_date" json:"dialysis_date"`
280
-	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
281
-	PatientId    int64 `gorm:"column:patient_id" json:"patient_id"`
282
-	// PrescriptionId int64  `gorm:"column:prescription_id" json:"prescription_id"`
283
-	Stage int64 `gorm:"column:stage" json:"stage"`
284
-	// Remark         string `gorm:"column:remark" json:"remark"`
279
+	ID                 int64                      `gorm:"column:id" json:"id"`
280
+	DialysisDate       int64                      `gorm:"column:dialysis_date" json:"dialysis_date"`
281
+	UserOrgId          int64                      `gorm:"column:user_org_id" json:"user_org_id"`
282
+	PatientId          int64                      `gorm:"column:patient_id" json:"patient_id"`
283
+	Stage              int64                      `gorm:"column:stage" json:"stage"`
285
 	BedID              int64                      `gorm:"column:bed_id" json:"bed_id"`
284
 	BedID              int64                      `gorm:"column:bed_id" json:"bed_id"`
286
 	StartNurse         int64                      `gorm:"column:start_nurse" json:"start_nurse"`
285
 	StartNurse         int64                      `gorm:"column:start_nurse" json:"start_nurse"`
287
 	FinishNurse        int64                      `gorm:"column:finish_nurse" json:"finish_nurse"`
286
 	FinishNurse        int64                      `gorm:"column:finish_nurse" json:"finish_nurse"`

+ 31 - 0
service/new_stock_service.go 查看文件

165
 	return err
165
 	return err
166
 }
166
 }
167
 
167
 
168
+func GetHisPrescriptionList(orgid int64) (project []*models.HisPrescriptionProject, err error) {
169
+
170
+	err = XTReadDB().Where("user_org_id = ? and status= 1 and record_date =1690819200", orgid).Find(&project).Error
171
+	return project, err
172
+}
173
+
174
+func UpdateGoodFlow(project_id int64, price float64) error {
175
+	flow := models.VmStockFlow{}
176
+
177
+	err := XTWriteDB().Model(&flow).Where("warehousing_id = ? and user_org_id =10265", project_id).Updates(map[string]interface{}{"price": price}).Error
178
+
179
+	err = XTWriteDB().Model(models.WarehouseOutInfo{}).Where("warehouse_info_id = ? and org_id =10265", project_id).Updates(map[string]interface{}{"price": price}).Error
180
+	return err
181
+}
182
+
168
 func GetSendGoodInformation(org_id int64) (info []*models.WarehousingInfo, err error) {
183
 func GetSendGoodInformation(org_id int64) (info []*models.WarehousingInfo, err error) {
169
 
184
 
170
 	err = XTReadDB().Where("org_id = ? and is_check = 1 and status = 1", org_id).Find(&info).Error
185
 	err = XTReadDB().Where("org_id = ? and is_check = 1 and status = 1", org_id).Find(&info).Error
556
 	err = XTWriteDB().Model(&stockFlow).Where("warehousing_detail_id = ? and good_id = ? and user_org_id = ? and patient_id = ? AND consumable_type = 7 and system_time = ?").Update(map[string]interface{}{"over_count": over_count}).Error
571
 	err = XTWriteDB().Model(&stockFlow).Where("warehousing_detail_id = ? and good_id = ? and user_org_id = ? and patient_id = ? AND consumable_type = 7 and system_time = ?").Update(map[string]interface{}{"over_count": over_count}).Error
557
 	return err
572
 	return err
558
 }
573
 }
574
+
575
+func GetWarehouseOutInfo(user_org_id int64) (info []*models.WarehouseOut, err error) {
576
+
577
+	err = XTReadDB().Where("org_id = ? and status =1", 10489).Find(&info).Error
578
+
579
+	return info, err
580
+}
581
+
582
+func UpdateWarehosueOutInfo(id int64, sys_record_time int64) (models.WarehouseOutInfo, error) {
583
+
584
+	info := models.WarehouseOutInfo{}
585
+
586
+	err := XTWriteDB().Model(&info).Where("warehouse_out_id = ? and org_id = ? ", id, 10489).Updates(map[string]interface{}{"sys_record_time": sys_record_time, "ctime": sys_record_time}).Error
587
+
588
+	return info, err
589
+}

+ 27 - 24
service/new_warehouse_service.go 查看文件

87
 			IsCheck:                 1,
87
 			IsCheck:                 1,
88
 			OverCount:               sum_count,
88
 			OverCount:               sum_count,
89
 			RegisterNumber:          warehouse.RegisterNumber,
89
 			RegisterNumber:          warehouse.RegisterNumber,
90
+			BuyPrice:                warehouse.PackingPrice,
90
 		}
91
 		}
91
 		warehouseOutInfo.Count = count
92
 		warehouseOutInfo.Count = count
92
 		if orgID == 9671 || orgID == 10265 {
93
 		if orgID == 9671 || orgID == 10265 {
93
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
94
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
95
+
96
+			fmt.Println("加个我我我哦我我我", goodsInfo.PackingPrice)
94
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
97
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
95
 		}
98
 		}
96
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
99
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
156
 				RegisterNumber:          warehouse.RegisterNumber,
159
 				RegisterNumber:          warehouse.RegisterNumber,
157
 			}
160
 			}
158
 			if orgID == 9671 || orgID == 10265 {
161
 			if orgID == 9671 || orgID == 10265 {
159
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
162
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
160
 				flow.Price = goodsInfo.PackingPrice
163
 				flow.Price = goodsInfo.PackingPrice
161
 				flow.BuyPrice = goodsInfo.BuyPrice
164
 				flow.BuyPrice = goodsInfo.BuyPrice
162
 			}
165
 			}
227
 				IsCheck:         1,
230
 				IsCheck:         1,
228
 			}
231
 			}
229
 			if orgID == 9671 || orgID == 10265 {
232
 			if orgID == 9671 || orgID == 10265 {
230
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
233
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
231
 				cancelStockInfo.Price = goodsInfo.PackingPrice
234
 				cancelStockInfo.Price = goodsInfo.PackingPrice
232
 			}
235
 			}
233
 			CreateCancelStockInfoOne(&cancelStockInfo)
236
 			CreateCancelStockInfoOne(&cancelStockInfo)
271
 				RegisterNumber:          warehouse.RegisterNumber,
274
 				RegisterNumber:          warehouse.RegisterNumber,
272
 			}
275
 			}
273
 			if orgID == 9671 || orgID == 10265 {
276
 			if orgID == 9671 || orgID == 10265 {
274
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
277
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
275
 				flow.Price = goodsInfo.PackingPrice
278
 				flow.Price = goodsInfo.PackingPrice
276
 				flow.BuyPrice = goodsInfo.BuyPrice
279
 				flow.BuyPrice = goodsInfo.BuyPrice
277
 			}
280
 			}
351
 		}
354
 		}
352
 		warehouseOutInfo.Count = stock_number
355
 		warehouseOutInfo.Count = stock_number
353
 		if orgID == 9671 || orgID == 10265 {
356
 		if orgID == 9671 || orgID == 10265 {
354
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
357
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
355
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
358
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
356
 		}
359
 		}
357
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
360
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
416
 				RegisterNumber:          warehouse.RegisterNumber,
419
 				RegisterNumber:          warehouse.RegisterNumber,
417
 			}
420
 			}
418
 			if orgID == 9671 || orgID == 10265 {
421
 			if orgID == 9671 || orgID == 10265 {
419
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
422
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
420
 				flow.Price = goodsInfo.PackingPrice
423
 				flow.Price = goodsInfo.PackingPrice
421
 				flow.BuyPrice = goodsInfo.BuyPrice
424
 				flow.BuyPrice = goodsInfo.BuyPrice
422
 			}
425
 			}
483
 				IsCheck:         1,
486
 				IsCheck:         1,
484
 			}
487
 			}
485
 			if orgID == 9671 || orgID == 10265 {
488
 			if orgID == 9671 || orgID == 10265 {
486
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
489
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
487
 				cancelStockInfo.Price = goodsInfo.PackingPrice
490
 				cancelStockInfo.Price = goodsInfo.PackingPrice
488
 			}
491
 			}
489
 			CreateCancelStockInfoOne(&cancelStockInfo)
492
 			CreateCancelStockInfoOne(&cancelStockInfo)
527
 				RegisterNumber:          warehouse.RegisterNumber,
530
 				RegisterNumber:          warehouse.RegisterNumber,
528
 			}
531
 			}
529
 			if orgID == 9671 || orgID == 10265 {
532
 			if orgID == 9671 || orgID == 10265 {
530
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
533
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
531
 				flow.Price = goodsInfo.PackingPrice
534
 				flow.Price = goodsInfo.PackingPrice
532
 				flow.BuyPrice = goodsInfo.BuyPrice
535
 				flow.BuyPrice = goodsInfo.BuyPrice
533
 			}
536
 			}
3420
 		}
3423
 		}
3421
 		warehouseOutInfo.Count = count
3424
 		warehouseOutInfo.Count = count
3422
 		if orgID == 9671 || orgID == 10265 {
3425
 		if orgID == 9671 || orgID == 10265 {
3423
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3426
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3424
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
3427
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
3425
 		}
3428
 		}
3426
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
3429
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
3490
 				RegisterNumber:          warehouse.RegisterNumber,
3493
 				RegisterNumber:          warehouse.RegisterNumber,
3491
 			}
3494
 			}
3492
 			if orgID == 9671 || orgID == 10265 {
3495
 			if orgID == 9671 || orgID == 10265 {
3493
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3496
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3494
 				flow.Price = goodsInfo.PackingPrice
3497
 				flow.Price = goodsInfo.PackingPrice
3495
 				flow.BuyPrice = goodsInfo.BuyPrice
3498
 				flow.BuyPrice = goodsInfo.BuyPrice
3496
 			}
3499
 			}
3565
 				IsCheck:         1,
3568
 				IsCheck:         1,
3566
 			}
3569
 			}
3567
 			if orgID == 9671 || orgID == 10265 {
3570
 			if orgID == 9671 || orgID == 10265 {
3568
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3571
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3569
 				cancelStockInfo.Price = goodsInfo.PackingPrice
3572
 				cancelStockInfo.Price = goodsInfo.PackingPrice
3570
 			}
3573
 			}
3571
 
3574
 
3613
 				RegisterNumber:          warehouse.RegisterNumber,
3616
 				RegisterNumber:          warehouse.RegisterNumber,
3614
 			}
3617
 			}
3615
 			if orgID == 9671 || orgID == 10265 {
3618
 			if orgID == 9671 || orgID == 10265 {
3616
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3619
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3617
 				flow.Price = goodsInfo.PackingPrice
3620
 				flow.Price = goodsInfo.PackingPrice
3618
 				flow.BuyPrice = goodsInfo.BuyPrice
3621
 				flow.BuyPrice = goodsInfo.BuyPrice
3619
 			}
3622
 			}
3709
 		}
3712
 		}
3710
 		warehouseOutInfo.Count = stock_number
3713
 		warehouseOutInfo.Count = stock_number
3711
 		if orgID == 9671 || orgID == 10265 {
3714
 		if orgID == 9671 || orgID == 10265 {
3712
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3715
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3713
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
3716
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
3714
 		}
3717
 		}
3715
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
3718
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
3781
 				RegisterNumber:          warehouse.RegisterNumber,
3784
 				RegisterNumber:          warehouse.RegisterNumber,
3782
 			}
3785
 			}
3783
 			if orgID == 9671 || orgID == 10265 {
3786
 			if orgID == 9671 || orgID == 10265 {
3784
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3787
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3785
 				flow.Price = goodsInfo.PackingPrice
3788
 				flow.Price = goodsInfo.PackingPrice
3786
 				flow.BuyPrice = goodsInfo.BuyPrice
3789
 				flow.BuyPrice = goodsInfo.BuyPrice
3787
 			}
3790
 			}
3851
 				IsCheck:         1,
3854
 				IsCheck:         1,
3852
 			}
3855
 			}
3853
 			if orgID == 9671 || orgID == 10265 {
3856
 			if orgID == 9671 || orgID == 10265 {
3854
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3857
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3855
 				cancelStockInfo.Price = goodsInfo.PackingPrice
3858
 				cancelStockInfo.Price = goodsInfo.PackingPrice
3856
 			}
3859
 			}
3857
 			err := tx.Create(&cancelStockInfo).Error
3860
 			err := tx.Create(&cancelStockInfo).Error
3898
 				RegisterNumber:          warehouse.RegisterNumber,
3901
 				RegisterNumber:          warehouse.RegisterNumber,
3899
 			}
3902
 			}
3900
 			if orgID == 9671 || orgID == 10265 {
3903
 			if orgID == 9671 || orgID == 10265 {
3901
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3904
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3902
 				flow.Price = goodsInfo.PackingPrice
3905
 				flow.Price = goodsInfo.PackingPrice
3903
 				flow.BuyPrice = goodsInfo.BuyPrice
3906
 				flow.BuyPrice = goodsInfo.BuyPrice
3904
 			}
3907
 			}
4003
 		}
4006
 		}
4004
 		warehouseOutInfo.Count = count
4007
 		warehouseOutInfo.Count = count
4005
 		if orgID == 9671 || orgID == 10265 {
4008
 		if orgID == 9671 || orgID == 10265 {
4006
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4009
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4007
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
4010
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
4008
 		}
4011
 		}
4009
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
4012
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
4074
 				RegisterNumber:          warehouse.RegisterNumber,
4077
 				RegisterNumber:          warehouse.RegisterNumber,
4075
 			}
4078
 			}
4076
 			if orgID == 9671 || orgID == 10265 {
4079
 			if orgID == 9671 || orgID == 10265 {
4077
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4080
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4078
 				flow.Price = goodsInfo.PackingPrice
4081
 				flow.Price = goodsInfo.PackingPrice
4079
 				flow.BuyPrice = goodsInfo.BuyPrice
4082
 				flow.BuyPrice = goodsInfo.BuyPrice
4080
 			}
4083
 			}
4150
 				IsCheck:         1,
4153
 				IsCheck:         1,
4151
 			}
4154
 			}
4152
 			if orgID == 9671 || orgID == 10265 {
4155
 			if orgID == 9671 || orgID == 10265 {
4153
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4156
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4154
 				cancelStockInfo.Price = goodsInfo.PackingPrice
4157
 				cancelStockInfo.Price = goodsInfo.PackingPrice
4155
 			}
4158
 			}
4156
 
4159
 
4198
 				RegisterNumber:          warehouse.RegisterNumber,
4201
 				RegisterNumber:          warehouse.RegisterNumber,
4199
 			}
4202
 			}
4200
 			if orgID == 9671 || orgID == 10265 {
4203
 			if orgID == 9671 || orgID == 10265 {
4201
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4204
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4202
 				flow.Price = goodsInfo.PackingPrice
4205
 				flow.Price = goodsInfo.PackingPrice
4203
 				flow.BuyPrice = goodsInfo.BuyPrice
4206
 				flow.BuyPrice = goodsInfo.BuyPrice
4204
 			}
4207
 			}
4294
 		}
4297
 		}
4295
 		warehouseOutInfo.Count = stock_number
4298
 		warehouseOutInfo.Count = stock_number
4296
 		if orgID == 9671 || orgID == 10265 {
4299
 		if orgID == 9671 || orgID == 10265 {
4297
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4300
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4298
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
4301
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
4299
 		}
4302
 		}
4300
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
4303
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
4365
 				RegisterNumber:          warehouse.RegisterNumber,
4368
 				RegisterNumber:          warehouse.RegisterNumber,
4366
 			}
4369
 			}
4367
 			if orgID == 9671 || orgID == 10265 {
4370
 			if orgID == 9671 || orgID == 10265 {
4368
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4371
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4369
 				flow.Price = goodsInfo.PackingPrice
4372
 				flow.Price = goodsInfo.PackingPrice
4370
 				flow.BuyPrice = goodsInfo.BuyPrice
4373
 				flow.BuyPrice = goodsInfo.BuyPrice
4371
 			}
4374
 			}
4437
 				IsCheck:         1,
4440
 				IsCheck:         1,
4438
 			}
4441
 			}
4439
 			if orgID == 9671 || orgID == 10265 {
4442
 			if orgID == 9671 || orgID == 10265 {
4440
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4443
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4441
 				cancelStockInfo.Price = goodsInfo.PackingPrice
4444
 				cancelStockInfo.Price = goodsInfo.PackingPrice
4442
 			}
4445
 			}
4443
 
4446
 
4485
 				RegisterNumber:          warehouse.RegisterNumber,
4488
 				RegisterNumber:          warehouse.RegisterNumber,
4486
 			}
4489
 			}
4487
 			if orgID == 9671 || orgID == 10265 {
4490
 			if orgID == 9671 || orgID == 10265 {
4488
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4491
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4489
 				flow.Price = goodsInfo.PackingPrice
4492
 				flow.Price = goodsInfo.PackingPrice
4490
 				flow.BuyPrice = goodsInfo.BuyPrice
4493
 				flow.BuyPrice = goodsInfo.BuyPrice
4491
 			}
4494
 			}

+ 117 - 3
service/patient_service.go 查看文件

153
 	return devices, err
153
 	return devices, err
154
 }
154
 }
155
 
155
 
156
+func GetMonitorByListSix(orgID int64, monitor_date int64) (monitor []models.VMMonitoringRecord, err error) {
157
+
158
+	err = readDb.Where("user_org_id = ? and monitor_date = ? and status =1", orgID, monitor_date).Find(&monitor).Error
159
+	return monitor, err
160
+}
161
+
156
 func GetAllDevicetByList(orgID int64) (devices []*models.MDeviceNumberForList, err error) {
162
 func GetAllDevicetByList(orgID int64) (devices []*models.MDeviceNumberForList, err error) {
157
 	redis := RedisClient()
163
 	redis := RedisClient()
158
 	defer redis.Close()
164
 	defer redis.Close()
760
 	return err
766
 	return err
761
 }
767
 }
762
 
768
 
769
+func CreateAllergic(allergic models.XtPatientAllergic) error {
770
+
771
+	err := XTWriteDB().Model(&allergic).Create(&allergic).Error
772
+
773
+	return err
774
+}
775
+
763
 func EditPatientLapseto(patient *models.Patients, lapseto *models.PatientLapseto) (err error) {
776
 func EditPatientLapseto(patient *models.Patients, lapseto *models.PatientLapseto) (err error) {
764
 	utx := writeDb.Begin()
777
 	utx := writeDb.Begin()
765
 	err = utx.Model(&models.Patients{}).Where("id=?", patient.ID).Update(map[string]interface{}{"lapseto": patient.Lapseto, "out_reason": patient.OutReason, "death_time": patient.DeathTime}).Error
778
 	err = utx.Model(&models.Patients{}).Where("id=?", patient.ID).Update(map[string]interface{}{"lapseto": patient.Lapseto, "out_reason": patient.OutReason, "death_time": patient.DeathTime}).Error
874
 func UpdatepatientTwo(patientsNew *models.XtPatientsNew, id int64) error {
887
 func UpdatepatientTwo(patientsNew *models.XtPatientsNew, id int64) error {
875
 
888
 
876
 	err := XTWriteDB().Model(&patientsNew).Where("blood_id = ?", id).Update(map[string]interface{}{"user_org_id": patientsNew.UserOrgId, "user_id": patientsNew.UserId, "avatar": patientsNew.Avatar, "patient_type": patientsNew.Avatar, "dialysis_no": patientsNew.DialysisNo, "admission_number": patientsNew.AdmissionNumber, "source": patientsNew.Source, "lapseto": patientsNew.Lapseto, "partition_id": patientsNew.PartitionId, "bed_id": patientsNew.BedId, "name": patientsNew.Name, "alias": patientsNew.Alias, "gender": patientsNew.Gender, "marital_status": patientsNew.MaritalStatus, "id_card_no": patientsNew.IdCardNo, "birthday": patientsNew.Birthday, "reimbursement_way_id": patientsNew.ReimbursementWayId, "health_care_type": patientsNew.HealthCareType, "health_care_no": patientsNew.HealthCareType, "health_care_due_date": patientsNew.HealthCareType, "height": patientsNew.Height, "blood_type": patientsNew.BloodType, "rh": patientsNew.Rh, "health_care_due_alert_date": patientsNew.HealthCareDueAlertDate, "education_level": patientsNew.EducationLevel, "profession": patientsNew.Profession, "phone": patientsNew.Phone, "home_telephone": patientsNew.HomeTelephone, "relative_phone": patientsNew.RelativePhone, "relative_relations": patientsNew.RelativeRelations, "home_address": patientsNew.HomeAddress, "work_unit": patientsNew.WorkUnit, "unit_address": patientsNew.UnitAddress, "children": patientsNew.Children, "receiving_date": patientsNew.ReceivingDate, "is_hospital_first_dialysis": patientsNew.IsHospitalFirstDialysis, "first_dialysis_date": patientsNew.FirstDialysisDate, "first_dialysis_hospital": patientsNew.FirstDialysisHospital, "predialysis_condition": patientsNew.PredialysisCondition, "pre_hospital_dialysis_frequency": patientsNew.PreHospitalDialysisFrequency, "pre_hospital_dialysis_times": patientsNew.PreHospitalDialysisFrequency, "hospital_first_dialysis_date": patientsNew.HospitalFirstDialysisDate, "induction_period": patientsNew.InductionPeriod, "initial_dialysis": patientsNew.InitialDialysis, "total_dialysis": patientsNew.TotalDialysis, "attending_doctor_id": patientsNew.AttendingDoctorId, "head_nurse_id": patientsNew.HeadNurseId, "evaluate": patientsNew.Evaluate, "diagnose": patientsNew.Diagnose, "remark": patientsNew.Remark, "registrars_id": patientsNew.RegistrarsId, "registrars": patientsNew.Registrars, "qr_code": patientsNew.QrCode, "binding_state": patientsNew.BindingState, "patient_complains": patientsNew.PatientComplains, "present_history": patientsNew.PresentHistory, "past_history": patientsNew.PastHistory, "temperature": patientsNew.Temperature,
889
 	err := XTWriteDB().Model(&patientsNew).Where("blood_id = ?", id).Update(map[string]interface{}{"user_org_id": patientsNew.UserOrgId, "user_id": patientsNew.UserId, "avatar": patientsNew.Avatar, "patient_type": patientsNew.Avatar, "dialysis_no": patientsNew.DialysisNo, "admission_number": patientsNew.AdmissionNumber, "source": patientsNew.Source, "lapseto": patientsNew.Lapseto, "partition_id": patientsNew.PartitionId, "bed_id": patientsNew.BedId, "name": patientsNew.Name, "alias": patientsNew.Alias, "gender": patientsNew.Gender, "marital_status": patientsNew.MaritalStatus, "id_card_no": patientsNew.IdCardNo, "birthday": patientsNew.Birthday, "reimbursement_way_id": patientsNew.ReimbursementWayId, "health_care_type": patientsNew.HealthCareType, "health_care_no": patientsNew.HealthCareType, "health_care_due_date": patientsNew.HealthCareType, "height": patientsNew.Height, "blood_type": patientsNew.BloodType, "rh": patientsNew.Rh, "health_care_due_alert_date": patientsNew.HealthCareDueAlertDate, "education_level": patientsNew.EducationLevel, "profession": patientsNew.Profession, "phone": patientsNew.Phone, "home_telephone": patientsNew.HomeTelephone, "relative_phone": patientsNew.RelativePhone, "relative_relations": patientsNew.RelativeRelations, "home_address": patientsNew.HomeAddress, "work_unit": patientsNew.WorkUnit, "unit_address": patientsNew.UnitAddress, "children": patientsNew.Children, "receiving_date": patientsNew.ReceivingDate, "is_hospital_first_dialysis": patientsNew.IsHospitalFirstDialysis, "first_dialysis_date": patientsNew.FirstDialysisDate, "first_dialysis_hospital": patientsNew.FirstDialysisHospital, "predialysis_condition": patientsNew.PredialysisCondition, "pre_hospital_dialysis_frequency": patientsNew.PreHospitalDialysisFrequency, "pre_hospital_dialysis_times": patientsNew.PreHospitalDialysisFrequency, "hospital_first_dialysis_date": patientsNew.HospitalFirstDialysisDate, "induction_period": patientsNew.InductionPeriod, "initial_dialysis": patientsNew.InitialDialysis, "total_dialysis": patientsNew.TotalDialysis, "attending_doctor_id": patientsNew.AttendingDoctorId, "head_nurse_id": patientsNew.HeadNurseId, "evaluate": patientsNew.Evaluate, "diagnose": patientsNew.Diagnose, "remark": patientsNew.Remark, "registrars_id": patientsNew.RegistrarsId, "registrars": patientsNew.Registrars, "qr_code": patientsNew.QrCode, "binding_state": patientsNew.BindingState, "patient_complains": patientsNew.PatientComplains, "present_history": patientsNew.PresentHistory, "past_history": patientsNew.PastHistory, "temperature": patientsNew.Temperature,
877
-		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber, "patient_start_time": patientsNew.PatientStartTime}).Error
890
+		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber, "patient_start_time": patientsNew.PatientStartTime, "patient_end_time": patientsNew.PatientEndTime, "infectious_remark": patientsNew.InfectiousRemark, "allergic_history": patientsNew.AllergicHistory, "patient_address": patientsNew.PatientAddress}).Error
878
 	return err
891
 	return err
879
 }
892
 }
880
 
893
 
2429
 	}
2442
 	}
2430
 }
2443
 }
2431
 
2444
 
2432
-func GetAllDialysisOrdersByListSeven(orgID int64, scheduleDate int64) (dialysisOrders []*MDialysisOrderVM, err error) {
2445
+func GetAllDialysisOrdersByListNight(orgID int64, scheduleDate int64, pay_tyep int64) (dialysisOrders []*models.VMMonitorDialysisOrder, err error) {
2446
+
2447
+	if pay_tyep == 0 {
2448
+		err = readDb.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Find(&dialysisOrders).Error
2449
+	}
2450
+	//待下机
2451
+	if pay_tyep == 3 {
2452
+		err = readDb.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ? and end_time = 0", orgID, scheduleDate).Find(&dialysisOrders).Error
2453
+	}
2454
+
2455
+	fmt.Println("pay_typeowowowoowwo", pay_tyep)
2456
+	if pay_tyep == 7 {
2457
+		err = readDb.Preload("DeviceNumber", "status = 1 AND org_id = ?'", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ?  and url = ''", orgID, scheduleDate).Find(&dialysisOrders).Error
2458
+	}
2433
 
2459
 
2434
-	err = readDb.Model(&MDialysisOrderVM{}).Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Find(&dialysisOrders).Error
2435
 	return dialysisOrders, err
2460
 	return dialysisOrders, err
2436
 }
2461
 }
2437
 
2462
 
2538
 	return dialysisOrders, err
2563
 	return dialysisOrders, err
2539
 }
2564
 }
2540
 
2565
 
2566
+func GetAllDialysisOrdersByListSeven(orgID int64, scheduleDate int64) (dialysisOrders []*MDialysisOrderVM, err error) {
2567
+
2568
+	err = readDb.Model(&MDialysisOrderVM{}).Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Where("status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).Find(&dialysisOrders).Error
2569
+
2570
+	return dialysisOrders, err
2571
+}
2572
+
2541
 func GetAllDialysisOrdersByListOne(orgID int64, scheduleDate int64) (dialysisOrders []*models.VMMonitorDialysisOrder, err error) {
2573
 func GetAllDialysisOrdersByListOne(orgID int64, scheduleDate int64) (dialysisOrders []*models.VMMonitorDialysisOrder, err error) {
2542
 	redis := RedisClient()
2574
 	redis := RedisClient()
2543
 
2575
 
2938
 
2970
 
2939
 	return schedule, total, err
2971
 	return schedule, total, err
2940
 }
2972
 }
2973
+
2974
+func GetPatientAllagicList(patient_id int64, user_org_id int64) (list []*models.XtPatientAllergic, err error) {
2975
+
2976
+	err = XTReadDB().Where("patient_id = ? and user_org_id =? and status= 1", patient_id, user_org_id).Find(&list).Error
2977
+
2978
+	return list, err
2979
+}
2980
+
2981
+func GetNewMonitorRecord(orgID int64, date int64, partition int64, patientId int64) ([]*models.NewMonitorDialysisScheduleList, error) {
2982
+	var mds []*models.NewMonitorDialysisScheduleList
2983
+
2984
+	db := readDb.Model(&models.NewMonitorDialysisScheduleList{})
2985
+	if date > 0 {
2986
+		db = db.Where("schedule_date = ?", date)
2987
+	}
2988
+	if partition > 0 {
2989
+		db = db.Where("partition_id = ?", partition)
2990
+	}
2991
+	if patientId > 0 {
2992
+
2993
+		db = db.Where("patient_id = ?", patientId)
2994
+	}
2995
+
2996
+	err = db.Where("status = 1 and user_org_id = ?", orgID).Find(&mds).Error
2997
+
2998
+	return mds, err
2999
+}
3000
+
3001
+func GetAdviceList(user_org_id int64, advice_date int64, pat_type int64) (advice []*models.VMDoctorAdviceForList, err error) {
3002
+
3003
+	if pat_type == 0 {
3004
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =7 and check_time = 0", user_org_id, advice_date).Find(&advice).Error
3005
+	}
3006
+	//待医嘱核对
3007
+	if pat_type == 1 {
3008
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and check_time = 0", user_org_id, advice_date).Find(&advice).Error
3009
+	}
3010
+	//待医嘱执行
3011
+	if pat_type == 6 {
3012
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and execution_state = 2", user_org_id, advice_date).Find(&advice).Error
3013
+
3014
+	}
3015
+	return advice, err
3016
+}
3017
+
3018
+func GetDobuleCheck(user_org_id int64, advice_date int64) (check []*models.VmDoubleCheck, err error) {
3019
+
3020
+	err = XTReadDB().Where("user_org_id = ? and check_date = ? and status = 1", user_org_id, advice_date).Find(&check).Error
3021
+	return check, err
3022
+}
3023
+
3024
+func GetTreatmentSummaryForList(user_org_id int64, advice_date int64) (summary []*models.VMTreatmentSummaryForList, err error) {
3025
+
3026
+	err = XTReadDB().Where("user_org_id =? and assessment_date = ? and status =1", user_org_id, advice_date).Find(&summary).Error
3027
+
3028
+	return summary, err
3029
+}
3030
+
3031
+func GetDialysisInformationList(user_org_id int64, advice_date int64) (information []*models.NewDeviceInformation, err error) {
3032
+
3033
+	err = UserReadDB().Where("user_org_id =? and date = ? and status =1", user_org_id, advice_date).Find(&information).Error
3034
+	return information, err
3035
+}
3036
+
3037
+func GetNewAllMonitorList(orgID int64, scheduleDate int64, pat_type int64) (monitor []*models.VMMonitoringRecord, err error) {
3038
+	if pat_type == 0 || pat_type == 9 {
3039
+		err = readDb.Model(&models.VMMonitoringRecord{}).Where("status = 1  AND user_org_id = ? AND  monitoring_date= ?", orgID, scheduleDate).Order("monitoring_date asc").Find(&monitor).Error
3040
+	}
3041
+
3042
+	if pat_type == 10 {
3043
+		err = readDb.Model(&models.VMMonitoringRecord{}).Where("status = 1  AND user_org_id = ? AND  monitoring_date= ? AND accumulated_blood_volume = 0", orgID, scheduleDate).Order("monitoring_date asc").Find(&monitor).Error
3044
+	}
3045
+
3046
+	if pat_type == 11 {
3047
+		err = readDb.Model(&models.VMMonitoringRecord{}).Where("status = 1  AND user_org_id = ? AND  monitoring_date= ? AND symptom <> ''", orgID, scheduleDate).Order("monitoring_date asc").Find(&monitor).Error
3048
+	}
3049
+
3050
+	if pat_type == 12 {
3051
+		err = readDb.Model(&models.VMMonitoringRecord{}).Where("status = 1  AND user_org_id = ? AND  monitoring_date= ? AND dispose <> ''", orgID, scheduleDate).Order("monitoring_date asc").Find(&monitor).Error
3052
+	}
3053
+	return monitor, err
3054
+}

+ 1 - 1
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go 查看文件

312
 	if endtime > 0 {
312
 	if endtime > 0 {
313
 		db = db.Where("x.sys_record_time<=?", endtime)
313
 		db = db.Where("x.sys_record_time<=?", endtime)
314
 	}
314
 	}
315
-	err = db.Select("x.patient_id,x.sys_record_time,x.good_id,sum(x.count) as count,x.ctime,t.good_name,t.specification_name,t.packing_unit,t.retail_price,t.packing_price,t.buy_price").Joins("left join xt_good_information as t on t.id = x.good_id").Group("x.good_id").Scan(&out).Error
315
+	err = db.Select("x.patient_id,x.sys_record_time,x.good_id,sum(x.count) as count,x.ctime,t.good_name,t.specification_name,t.packing_unit,t.retail_price,t.packing_price,t.buy_price,t.manufacturer,t.dealer").Joins("left join xt_good_information as t on t.id = x.good_id").Group("x.good_id").Scan(&out).Error
316
 	return out, err
316
 	return out, err
317
 }
317
 }
318
 
318
 

+ 7 - 0
service/schedule_service.go 查看文件

1718
 
1718
 
1719
 	return err
1719
 	return err
1720
 }
1720
 }
1721
+
1722
+func GetNumberListById(id int64, org_id int64) (number []*models.DeviceNumber, err error) {
1723
+
1724
+	err = XTReadDB().Where("zone_id = ? and org_id = ? and status= 1", id, org_id).Find(&number).Error
1725
+
1726
+	return number, err
1727
+}

+ 1 - 1
service/self_drug_service.go 查看文件

1115
 	if storehouse_id > 0 {
1115
 	if storehouse_id > 0 {
1116
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
1116
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
1117
 	}
1117
 	}
1118
-	err = db.Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.number,x.batch_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.drug_origin_place,x.expiry_date,x.product_date,x.min_count,x.storehouse_id,x.ctime,x.warehouse_info_id,t.dose,t.dose_unit,t.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.last_stock_max_number,x.last_stock_min_number,x.inventory_type,t.min_number,t.retail_price").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
1118
+	err = db.Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.number,x.batch_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.drug_origin_place,x.expiry_date,x.product_date,x.min_count,x.storehouse_id,x.ctime,x.warehouse_info_id,t.dose,t.dose_unit,t.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.last_stock_max_number,x.last_stock_min_number,x.inventory_type,t.min_number,t.retail_price").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Order("x.id desc").Scan(&list).Error
1119
 	return list, total, err
1119
 	return list, total, err
1120
 }
1120
 }
1121
 
1121