Browse Source

耗材参数

XMLWAN 4 years ago
parent
commit
cd82358e39

+ 4 - 4
controllers/base_api_controller.go View File

@@ -71,7 +71,7 @@ func (this *BaseAuthAPIController) Prepare() {
71 71
 	if this.GetAdminUserInfo() == nil {
72 72
 		var userAdmin models.AdminUser
73 73
 		userAdmin.Id = 1448
74
-		userAdmin.Mobile = "13318599895"
74
+		userAdmin.Mobile = "13318464649"
75 75
 
76 76
 		//userAdmin.Id = 597
77 77
 		//userAdmin.Mobile = "19874122664"
@@ -91,7 +91,7 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 4
94
+		adminUserInfo.CurrentOrgId = 7957
95 95
 		adminUserInfo.CurrentAppId = 8642
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
@@ -317,7 +317,7 @@ func (this *BaseServeAPIController) Prepare() {
317 317
 	if this.GetAdminUserInfo() == nil {
318 318
 		var userAdmin models.AdminUser
319 319
 		userAdmin.Id = 1448
320
-		userAdmin.Mobile = "13318599895"
320
+		userAdmin.Mobile = "13318464649"
321 321
 
322 322
 		//userAdmin.Id = 597
323 323
 		//userAdmin.Mobile = "19874122664"
@@ -337,7 +337,7 @@ func (this *BaseServeAPIController) Prepare() {
337 337
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
338 338
 		subscibes[4] = &subscibe
339 339
 		var adminUserInfo service.AdminUserInfo
340
-		adminUserInfo.CurrentOrgId = 4
340
+		adminUserInfo.CurrentOrgId = 7957
341 341
 		adminUserInfo.CurrentAppId = 8642
342 342
 		adminUserInfo.AdminUser = &userAdmin
343 343
 		adminUserInfo.Subscibes = subscibes

+ 6 - 2
controllers/dialysis_api_controller.go View File

@@ -246,6 +246,7 @@ func (c *DialysisApiController) PostPrescription() {
246 246
 	blood := c.GetString("blood")
247 247
 	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
248 248
 	dialysis_irrigation := c.GetString("dialysis_irrigation")
249
+	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
249 250
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
250 251
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
251 252
 
@@ -327,6 +328,7 @@ func (c *DialysisApiController) PostPrescription() {
327 328
 		Blood:                      blood,
328 329
 		DialysisDialyszers:         dialysis_dialyszers,
329 330
 		DialysisIrrigation:         dialysis_irrigation,
331
+		AntioxidantCommodityName:   antioxidant_commodity_name,
330 332
 	}
331 333
 
332 334
 	if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -495,6 +497,7 @@ func (c *DialysisApiController) PostSoulution() {
495 497
 	blood := c.GetString("blood")
496 498
 	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
497 499
 	dialysis_irrigation := c.GetString("dialysis_irrigation")
500
+	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
498 501
 	var prescription_doctor int64
499 502
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
500 503
 
@@ -587,6 +590,7 @@ func (c *DialysisApiController) PostSoulution() {
587 590
 		Blood:                     blood,
588 591
 		DialysisIrrigation:        dialysis_irrigation,
589 592
 		DialysisDialyszers:        dialysis_dialyszers,
593
+		AntioxidantCommodityName:  antioxidant_commodity_name,
590 594
 	}
591 595
 
592 596
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
@@ -2902,7 +2906,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
2902 2906
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2903 2907
 
2904 2908
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2905
-			if template.TemplateId == 6 { //adminInfo.CurrentOrgId == 9538
2909
+			if template.TemplateId == 6 || template.TemplateId == 32 { //adminInfo.CurrentOrgId == 9538
2906 2910
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2907 2911
 				record.UltrafiltrationRate = ultrafiltration_rate
2908 2912
 			}
@@ -2929,7 +2933,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
2929 2933
 		}
2930 2934
 	}
2931 2935
 
2932
-	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 {
2936
+	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 {
2933 2937
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
2934 2938
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
2935 2939
 			record.UltrafiltrationVolume = ultrafiltration_volume

+ 18 - 16
controllers/dialysis_record_api_controller.go View File

@@ -11,10 +11,10 @@ import (
11 11
 	"XT_New/enums"
12 12
 	"XT_New/service"
13 13
 	"XT_New/utils"
14
-	"net/http"
15
-	"net/url"
16 14
 	"fmt"
17 15
 	"github.com/astaxie/beego"
16
+	"net/http"
17
+	"net/url"
18 18
 )
19 19
 
20 20
 func DialysisRecordAPIControllerRegistRouter() {
@@ -548,7 +548,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
548 548
 	schedual_type, _ := this.GetInt64("schedual_type")
549 549
 
550 550
 	washpipe_nurse, _ := this.GetInt64("washpipe_nurse")
551
-
551
+	change_nurse, _ := this.GetInt64("change_nurse")
552 552
 	bedID, _ := this.GetInt64("bed")
553 553
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
554 554
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -720,6 +720,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
720 720
 		Modifier:      adminUserInfo.AdminUser.Id,
721 721
 		SchedualType:  schedual_type,
722 722
 		WashpipeNurse: washpipe_nurse,
723
+		ChangeNurse:   change_nurse,
723 724
 	}
724 725
 
725 726
 	createErr := service.MobileCreateDialysisOrder(adminUserInfo.CurrentOrgId, patientID, dialysisRecord)
@@ -743,7 +744,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
743 744
 			if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
744 745
 
745 746
 				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
746
-				if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 {
747
+				if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 {
747 748
 					ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
748 749
 				}
749 750
 				// 只针对方济医院
@@ -779,16 +780,16 @@ func (this *DialysisRecordAPIController) StartDialysis() {
779 780
 			}
780 781
 		}
781 782
 
782
-		go func (){
783
+		go func() {
783 784
 			ssoDomain := beego.AppConfig.String("call_domain")
784 785
 			api := ssoDomain + "/index/uppatient"
785 786
 			values := make(url.Values)
786
-			values.Set("org_id",  strconv.FormatInt(adminUserInfo.CurrentOrgId,10))
787
-			values.Set("admin_user_id", strconv.FormatInt(nurseID,10))
788
-			values.Set("patient_id",  strconv.FormatInt(patientID,10))
789
-			values.Set("up_time",  strconv.FormatInt(startDate.Unix(),10))
787
+			values.Set("org_id", strconv.FormatInt(adminUserInfo.CurrentOrgId, 10))
788
+			values.Set("admin_user_id", strconv.FormatInt(nurseID, 10))
789
+			values.Set("patient_id", strconv.FormatInt(patientID, 10))
790
+			values.Set("up_time", strconv.FormatInt(startDate.Unix(), 10))
790 791
 			http.PostForm(api, values)
791
-		} ()
792
+		}()
792 793
 
793 794
 		this.ServeSuccessJSON(map[string]interface{}{
794 795
 			"dialysis_order": dialysisRecord,
@@ -1010,15 +1011,15 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1010 1011
 		return
1011 1012
 	}
1012 1013
 
1013
-	go func (){
1014
+	go func() {
1014 1015
 		ssoDomain := beego.AppConfig.String("call_domain")
1015 1016
 		api := ssoDomain + "/index/downpatient"
1016 1017
 		values := make(url.Values)
1017
-		values.Set("org_id",  strconv.FormatInt(adminUserInfo.CurrentOrgId,10))
1018
-		values.Set("admin_user_id", strconv.FormatInt(nurseID,10))
1019
-		values.Set("patient_id",  strconv.FormatInt(patientID,10))
1018
+		values.Set("org_id", strconv.FormatInt(adminUserInfo.CurrentOrgId, 10))
1019
+		values.Set("admin_user_id", strconv.FormatInt(nurseID, 10))
1020
+		values.Set("patient_id", strconv.FormatInt(patientID, 10))
1020 1021
 		http.PostForm(api, values)
1021
-	} ()
1022
+	}()
1022 1023
 
1023 1024
 	updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id)
1024 1025
 	if updateErr != nil {
@@ -1049,7 +1050,7 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1049 1050
 	washpipe_nurse, _ := this.GetInt64("washpipe_nurse")
1050 1051
 
1051 1052
 	schedual_type, _ := this.GetInt64("schedual_type")
1052
-
1053
+	change_nurse, _ := this.GetInt64("change_nurse")
1053 1054
 	if record_id == 0 {
1054 1055
 		this.ErrorLog("id:%v", record_id)
1055 1056
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -1178,6 +1179,7 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1178 1179
 		Modifier:      adminUserInfo.AdminUser.Id,
1179 1180
 		SchedualType:  schedual_type,
1180 1181
 		WashpipeNurse: washpipe_nurse,
1182
+		ChangeNurse:   change_nurse,
1181 1183
 	}
1182 1184
 
1183 1185
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)

+ 183 - 0
controllers/gobal_config_api_controller.go View File

@@ -72,6 +72,13 @@ func GobalConfigRegistRouters() {
72 72
 	beego.Router("/api/passdetail/export", &GobalConfigApiController{}, "get:GetPassExportData")
73 73
 	beego.Router("/api/consumedetail/export", &GobalConfigApiController{}, "get:GetExportData")
74 74
 
75
+	beego.Router("/api/drugstock/getdrugindetail", &GobalConfigApiController{}, "get:GetDrugInDetail")
76
+
77
+	beego.Router("/api/drugstock/getdrugcancelorder", &GobalConfigApiController{}, "get:GetDrugCancelOrder")
78
+
79
+	beego.Router("/api/drugstock/getdrugoutdetail", &GobalConfigApiController{}, "get:GetDrugOutDetail")
80
+
81
+	beego.Router("/api/drugstock/getdrugcanceldetail", &GobalConfigApiController{}, "get:GetDrugCancelDetail")
75 82
 }
76 83
 
77 84
 //provinces, _ := service.GetDistrictsByUpid(0)21
@@ -1406,3 +1413,179 @@ func (c *GobalConfigApiController) GetExportData() {
1406 1413
 	})
1407 1414
 
1408 1415
 }
1416
+
1417
+func (c *GobalConfigApiController) GetDrugInDetail() {
1418
+
1419
+	start_time := c.GetString("start_time")
1420
+	end_time := c.GetString("end_time")
1421
+	timeLayout := "2006-01-02"
1422
+	loc, _ := time.LoadLocation("Local")
1423
+	var startTime int64
1424
+	if len(start_time) > 0 {
1425
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1426
+		if err != nil {
1427
+			fmt.Println(err)
1428
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1429
+			return
1430
+		}
1431
+		startTime = theTime.Unix()
1432
+	}
1433
+	var endTime int64
1434
+	if len(end_time) > 0 {
1435
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1436
+		if err != nil {
1437
+			utils.ErrorLog(err.Error())
1438
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1439
+			return
1440
+		}
1441
+		endTime = theTime.Unix()
1442
+	}
1443
+	adminInfo := c.GetAdminUserInfo()
1444
+	order_type, _ := c.GetInt64("order_type")
1445
+	manufacturer_id, _ := c.GetInt64("manufacturer_id")
1446
+	keyword := c.GetString("keyword")
1447
+	page, _ := c.GetInt64("page")
1448
+	limit, _ := c.GetInt64("limit")
1449
+
1450
+	detail, total, err := service.GetDrugInOrderDetail(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit)
1451
+
1452
+	if err != nil {
1453
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1454
+		return
1455
+	}
1456
+	c.ServeSuccessJSON(map[string]interface{}{
1457
+		"detail": detail,
1458
+		"total":  total,
1459
+	})
1460
+}
1461
+
1462
+func (c *GobalConfigApiController) GetDrugCancelOrder() {
1463
+
1464
+	start_time := c.GetString("start_time")
1465
+	end_time := c.GetString("end_time")
1466
+	timeLayout := "2006-01-02"
1467
+	loc, _ := time.LoadLocation("Local")
1468
+	var startTime int64
1469
+	if len(start_time) > 0 {
1470
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1471
+		if err != nil {
1472
+			fmt.Println(err)
1473
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1474
+			return
1475
+		}
1476
+		startTime = theTime.Unix()
1477
+	}
1478
+	var endTime int64
1479
+	if len(end_time) > 0 {
1480
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1481
+		if err != nil {
1482
+			utils.ErrorLog(err.Error())
1483
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1484
+			return
1485
+		}
1486
+		endTime = theTime.Unix()
1487
+	}
1488
+	adminInfo := c.GetAdminUserInfo()
1489
+	order_type, _ := c.GetInt64("order_type")
1490
+	manufacturer_id, _ := c.GetInt64("manufacturer_id")
1491
+	keyword := c.GetString("keyword")
1492
+	limit, _ := c.GetInt64("limit")
1493
+	page, _ := c.GetInt64("page")
1494
+
1495
+	order, total, err := service.GetDrugReturnOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, limit, page)
1496
+	if err != nil {
1497
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1498
+		return
1499
+	}
1500
+	c.ServeSuccessJSON(map[string]interface{}{
1501
+		"order": order,
1502
+		"total": total,
1503
+	})
1504
+}
1505
+
1506
+func (c *GobalConfigApiController) GetDrugOutDetail() {
1507
+
1508
+	start_time := c.GetString("start_time")
1509
+	end_time := c.GetString("end_time")
1510
+	timeLayout := "2006-01-02"
1511
+	loc, _ := time.LoadLocation("Local")
1512
+	var startTime int64
1513
+	if len(start_time) > 0 {
1514
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1515
+		if err != nil {
1516
+			fmt.Println(err)
1517
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1518
+			return
1519
+		}
1520
+		startTime = theTime.Unix()
1521
+	}
1522
+	var endTime int64
1523
+	if len(end_time) > 0 {
1524
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1525
+		if err != nil {
1526
+			utils.ErrorLog(err.Error())
1527
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1528
+			return
1529
+		}
1530
+		endTime = theTime.Unix()
1531
+	}
1532
+	adminInfo := c.GetAdminUserInfo()
1533
+	order_type, _ := c.GetInt64("order_type")
1534
+	manufacturer_id, _ := c.GetInt64("manufacturer_id")
1535
+	keyword := c.GetString("keyword")
1536
+	limit, _ := c.GetInt64("limit")
1537
+	page, _ := c.GetInt64("page")
1538
+
1539
+	order, total, err := service.GetDrugOutOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit)
1540
+	if err != nil {
1541
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1542
+		return
1543
+	}
1544
+	c.ServeSuccessJSON(map[string]interface{}{
1545
+		"order": order,
1546
+		"total": total,
1547
+	})
1548
+}
1549
+
1550
+func (c *GobalConfigApiController) GetDrugCancelDetail() {
1551
+
1552
+	start_time := c.GetString("start_time")
1553
+	end_time := c.GetString("end_time")
1554
+	timeLayout := "2006-01-02"
1555
+	loc, _ := time.LoadLocation("Local")
1556
+	var startTime int64
1557
+	if len(start_time) > 0 {
1558
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1559
+		if err != nil {
1560
+			fmt.Println(err)
1561
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1562
+			return
1563
+		}
1564
+		startTime = theTime.Unix()
1565
+	}
1566
+	var endTime int64
1567
+	if len(end_time) > 0 {
1568
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1569
+		if err != nil {
1570
+			utils.ErrorLog(err.Error())
1571
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1572
+			return
1573
+		}
1574
+		endTime = theTime.Unix()
1575
+	}
1576
+	adminInfo := c.GetAdminUserInfo()
1577
+	order_type, _ := c.GetInt64("order_type")
1578
+	manufacturer_id, _ := c.GetInt64("manufacturer_id")
1579
+	keyword := c.GetString("keyword")
1580
+	limit, _ := c.GetInt64("limit")
1581
+	page, _ := c.GetInt64("page")
1582
+	order, total, err := service.GetDrugCancelOrder(startTime, endTime, adminInfo.CurrentOrgId, order_type, manufacturer_id, keyword, page, limit)
1583
+	if err != nil {
1584
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1585
+		return
1586
+	}
1587
+	c.ServeSuccessJSON(map[string]interface{}{
1588
+		"order": order,
1589
+		"total": total,
1590
+	})
1591
+}

+ 17 - 16
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -619,26 +619,28 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
619 619
 			}
620 620
 
621 621
 			if lastPredialysisEvaluation != nil {
622
-				evaluation.BloodAccessPartId = lastPredialysisEvaluation.BloodAccessPartId           //血管通路部位
623
-				evaluation.BloodAccessPartOperaId = lastPredialysisEvaluation.BloodAccessPartOperaId //血管通路
624
-				evaluation.AdditionalWeight = lastPredialysisEvaluation.AdditionalWeight             //衣物重
625
-				evaluation.Temperature = lastPredialysisEvaluation.Temperature                       //温度
626
-				evaluation.BreathingRate = lastPredialysisEvaluation.BreathingRate                   //呼吸
627
-				evaluation.Catheter = lastPredialysisEvaluation.Catheter                             //导管
628
-				evaluation.InternalFistula = lastPredialysisEvaluation.InternalFistula               //内瘘
629
-				evaluation.PulseFrequency = lastPredialysisEvaluation.PulseFrequency                 //脉搏
630
-				evaluation.Complication = lastPredialysisEvaluation.Complication                     //并发症
631
-				evaluation.LastPostDialysis = lastPredialysisEvaluation.LastPostDialysis             //前次透析后症状
632
-				evaluation.DialysisInterphase = lastPredialysisEvaluation.DialysisInterphase         //透析期间
633
-				evaluation.SymptomBeforeDialysis = lastPredialysisEvaluation.SymptomBeforeDialysis   //透析前症状
634
-				evaluation.PunctureNeedle = lastPredialysisEvaluation.PunctureNeedle                 //穿刺针
635
-				evaluation.PunctureWay = lastPredialysisEvaluation.PunctureWay                       //穿刺方法
622
+				evaluation.BloodAccessPartId = lastPredialysisEvaluation.BloodAccessPartId
623
+				evaluation.BloodAccessPartOperaId = lastPredialysisEvaluation.BloodAccessPartOperaId
624
+				evaluation.AdditionalWeight = lastPredialysisEvaluation.AdditionalWeight
625
+				evaluation.Temperature = lastPredialysisEvaluation.Temperature
626
+				evaluation.BreathingRate = lastPredialysisEvaluation.BreathingRate
627
+				evaluation.Catheter = lastPredialysisEvaluation.Catheter
628
+				evaluation.InternalFistula = lastPredialysisEvaluation.InternalFistula
629
+				evaluation.PulseFrequency = lastPredialysisEvaluation.PulseFrequency
630
+				evaluation.Complication = lastPredialysisEvaluation.Complication
631
+				evaluation.LastPostDialysis = lastPredialysisEvaluation.LastPostDialysis
632
+				evaluation.DialysisInterphase = lastPredialysisEvaluation.DialysisInterphase
633
+				evaluation.SymptomBeforeDialysis = lastPredialysisEvaluation.SymptomBeforeDialysis
634
+				evaluation.PunctureNeedle = lastPredialysisEvaluation.PunctureNeedle
635
+				evaluation.PunctureWay = lastPredialysisEvaluation.PunctureWay
636 636
 
637 637
 				evaluation.InternalFistulaSkin = lastPredialysisEvaluation.InternalFistulaSkin //血透通路皮肤情况
638 638
 				evaluation.CatheterBend = lastPredialysisEvaluation.CatheterBend               //导管打折
639 639
 				evaluation.IsHemorrhage = lastPredialysisEvaluation.IsHemorrhage               //出血
640 640
 				evaluation.IsInfect = lastPredialysisEvaluation.IsInfect                       //感染
641 641
 				evaluation.Exposed = lastPredialysisEvaluation.Exposed                         // 外漏
642
+				evaluation.DialysisCount = lastPredialysisEvaluation.DialysisCount             //呼吸频次
643
+				evaluation.Phinholing = lastPredialysisEvaluation.Phinholing
642 644
 
643 645
 			}
644 646
 		} else {
@@ -736,9 +738,8 @@ func (c *CheckWeightApiController) GetPatientList() {
736 738
 	adminUserInfo := c.GetMobileAdminUserInfo()
737 739
 
738 740
 	patientList, total, error := service.GetPatientListByUpdateTime(adminUserInfo.Org.Id, int64(syncTime))
739
-	if len(patientList) > 0 {
740 741
 	need_update := 0
741
-	if syncTime ==  0 {
742
+	if syncTime == 0 {
742 743
 		need_update = 1
743 744
 	}
744 745
 	if error != nil {

+ 27 - 20
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -13,10 +13,10 @@ import (
13 13
 	"XT_New/models"
14 14
 	"XT_New/service"
15 15
 	"XT_New/utils"
16
+	"github.com/astaxie/beego"
16 17
 	"math"
17 18
 	"net/http"
18 19
 	"net/url"
19
-	"github.com/astaxie/beego"
20 20
 )
21 21
 
22 22
 // type DialysisTestAPIController struct {
@@ -1064,6 +1064,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1064 1064
 	blood := c.GetString("blood")
1065 1065
 	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
1066 1066
 	dialysis_irrigation := c.GetString("dialysis_irrigation")
1067
+	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
1067 1068
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1068 1069
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1069 1070
 	//
@@ -1149,6 +1150,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1149 1150
 		Blood:                      blood,
1150 1151
 		DialysisDialyszers:         dialysis_dialyszers,
1151 1152
 		DialysisIrrigation:         dialysis_irrigation,
1153
+		AntioxidantCommodityName:   antioxidant_commodity_name,
1152 1154
 	}
1153 1155
 
1154 1156
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -1448,15 +1450,15 @@ func (c *DialysisAPIController) Finish() {
1448 1450
 		dialysisOrder.FinishModifier = adminUserInfo.AdminUser.Id
1449 1451
 		dialysisOrder.EndTime = endDate.Unix()
1450 1452
 
1451
-		go func (){
1453
+		go func() {
1452 1454
 			ssoDomain := beego.AppConfig.String("call_domain")
1453 1455
 			api := ssoDomain + "/index/downpatient"
1454 1456
 			values := make(url.Values)
1455
-			values.Set("org_id",  strconv.FormatInt(adminUserInfo.AdminUser.Id,10))
1456
-			values.Set("admin_user_id", strconv.FormatInt(nurseID,10))
1457
-			values.Set("patient_id",  strconv.FormatInt(id,10))
1457
+			values.Set("org_id", strconv.FormatInt(adminUserInfo.AdminUser.Id, 10))
1458
+			values.Set("admin_user_id", strconv.FormatInt(nurseID, 10))
1459
+			values.Set("patient_id", strconv.FormatInt(id, 10))
1458 1460
 			http.PostForm(api, values)
1459
-		} ()
1461
+		}()
1460 1462
 
1461 1463
 		if err == nil {
1462 1464
 			c.ServeSuccessJSON(map[string]interface{}{
@@ -1515,7 +1517,7 @@ func (this *DialysisAPIController) StartDialysis() {
1515 1517
 	bedID, _ := this.GetInt64("bed")
1516 1518
 	start_time := this.GetString("start_time")
1517 1519
 	washpipe_nurse, _ := this.GetInt64("washpipe_nurse")
1518
-
1520
+	change_nurse, _ := this.GetInt64("change_nurse")
1519 1521
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
1520 1522
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1521 1523
 		return
@@ -1683,6 +1685,7 @@ func (this *DialysisAPIController) StartDialysis() {
1683 1685
 		Modifier:      adminUserInfo.AdminUser.Id,
1684 1686
 		SchedualType:  schedual_type,
1685 1687
 		WashpipeNurse: washpipe_nurse,
1688
+		ChangeNurse:   change_nurse,
1686 1689
 	}
1687 1690
 
1688 1691
 	createErr := service.MobileCreateDialysisOrder(adminUserInfo.Org.Id, patientID, dialysisRecord)
@@ -1700,7 +1703,7 @@ func (this *DialysisAPIController) StartDialysis() {
1700 1703
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
1701 1704
 
1702 1705
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
1703
-			if template.TemplateId == 6 { //adminUserInfo.Org.Id == 9538
1706
+			if template.TemplateId == 6 || template.TemplateId == 32 { //adminUserInfo.Org.Id == 9538
1704 1707
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
1705 1708
 			}
1706 1709
 
@@ -1733,7 +1736,7 @@ func (this *DialysisAPIController) StartDialysis() {
1733 1736
 	}
1734 1737
 
1735 1738
 	//只针对广慈医院
1736
-	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 {
1739
+	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 {
1737 1740
 		// 查询病人是否有透前评估数据
1738 1741
 		befor, errcode := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
1739 1742
 		//如果有数据就插入
@@ -1755,16 +1758,16 @@ func (this *DialysisAPIController) StartDialysis() {
1755 1758
 		}
1756 1759
 	}
1757 1760
 
1758
-	go func (){
1761
+	go func() {
1759 1762
 		ssoDomain := beego.AppConfig.String("call_domain")
1760 1763
 		api := ssoDomain + "/index/uppatient"
1761 1764
 		values := make(url.Values)
1762
-		values.Set("org_id",  strconv.FormatInt(adminUserInfo.Org.Id,10))
1763
-		values.Set("admin_user_id", strconv.FormatInt(nurseID,10))
1764
-		values.Set("patient_id",  strconv.FormatInt(patientID,10))
1765
-		values.Set("up_time",  strconv.FormatInt(startDate.Unix(),10))
1765
+		values.Set("org_id", strconv.FormatInt(adminUserInfo.Org.Id, 10))
1766
+		values.Set("admin_user_id", strconv.FormatInt(nurseID, 10))
1767
+		values.Set("patient_id", strconv.FormatInt(patientID, 10))
1768
+		values.Set("up_time", strconv.FormatInt(startDate.Unix(), 10))
1766 1769
 		http.PostForm(api, values)
1767
-	} ()
1770
+	}()
1768 1771
 
1769 1772
 	if createErr != nil {
1770 1773
 		this.ErrorLog("上机失败:%v", createErr)
@@ -1864,6 +1867,7 @@ func (c *DialysisAPIController) PostSolution() {
1864 1867
 	blood := c.GetString("blood")
1865 1868
 	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
1866 1869
 	dialysis_irrigation := c.GetString("dialysis_irrigation")
1870
+	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
1867 1871
 	if mode_id > 0 {
1868 1872
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1869 1873
 	}
@@ -1950,6 +1954,7 @@ func (c *DialysisAPIController) PostSolution() {
1950 1954
 		Blood:                     blood,
1951 1955
 		DialysisDialyszers:        dialysis_dialyszers,
1952 1956
 		DialysisIrrigation:        dialysis_irrigation,
1957
+		AntioxidantCommodityName:  antioxidant_commodity_name,
1953 1958
 	}
1954 1959
 
1955 1960
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -2120,7 +2125,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2120 2125
 			fmt.Println("4444444445555")
2121 2126
 
2122 2127
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2123
-			if template.TemplateId == 6 {
2128
+			if template.TemplateId == 6 || template.TemplateId == 32 {
2124 2129
 				fmt.Println("12222222")
2125 2130
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2126 2131
 				record.UltrafiltrationRate = ultrafiltration_rate
@@ -2148,7 +2153,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2148 2153
 		}
2149 2154
 	}
2150 2155
 
2151
-	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 { //adminInfo.Org.Id == 9538
2156
+	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 { //adminInfo.Org.Id == 9538
2152 2157
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
2153 2158
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
2154 2159
 			record.UltrafiltrationVolume = ultrafiltration_volume
@@ -2169,7 +2174,7 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
2169 2174
 	start_time := this.GetString("start_time")
2170 2175
 	schedual_type, _ := this.GetInt64("schedual_type")
2171 2176
 	washpipe_nurse, _ := this.GetInt64("washpipe_nurse")
2172
-
2177
+	change_nurse, _ := this.GetInt64("change_nurse")
2173 2178
 	if record_id == 0 {
2174 2179
 		this.ErrorLog("id:%v", record_id)
2175 2180
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -2298,6 +2303,7 @@ func (this *DialysisAPIController) ModifyStartDialysisOrder() {
2298 2303
 		Modifier:      adminUserInfo.AdminUser.Id,
2299 2304
 		WashpipeNurse: washpipe_nurse,
2300 2305
 		SchedualType:  schedual_type,
2306
+		ChangeNurse:   change_nurse,
2301 2307
 	}
2302 2308
 
2303 2309
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)
@@ -4046,10 +4052,11 @@ func (c *DialysisAPIController) GetDialysisGoodsStatistics() {
4046 4052
 
4047 4053
 	adminUser := c.GetMobileAdminUserInfo()
4048 4054
 	outInfo, err := service.MobileGetGoodsStatistics(adminUser.Org.Id, theStartTime, theEndtTime)
4049
-
4055
+	stockCount, err := service.GetOutStockTotalCountOne(theStartTime, theEndtTime, adminUser.Org.Id)
4050 4056
 	if err == nil {
4051 4057
 		c.ServeSuccessJSON(map[string]interface{}{
4052
-			"stock_out": outInfo,
4058
+			"stock_out":  outInfo,
4059
+			"stockCount": stockCount,
4053 4060
 		})
4054 4061
 		return
4055 4062
 

+ 82 - 82
controllers/patient_api_controller.go View File

@@ -254,29 +254,29 @@ func (c *PatientApiController) CreatePatient() {
254 254
 	//获取老表的最后一条数据
255 255
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
256 256
 	patientsNew := models.XtPatientsNew{
257
-		UserOrgId:          adminUserInfo.CurrentOrgId,
258
-		UserId:             0,
259
-		Avatar:             patients.Avatar,
260
-		PatientType:        patients.PatientType,
261
-		DialysisNo:         patients.DialysisNo,
262
-		AdmissionNumber:    patients.AdmissionNumber,
263
-		Source:             patients.Source,
264
-		Lapseto:            patients.Lapseto,
265
-		PartitionId:        patients.PartitionId,
266
-		BedId:              patients.BedId,
267
-		Name:               patients.Name,
268
-		Alias:              patients.Alias,
269
-		Gender:             patients.Gender,
270
-		MaritalStatus:      patients.MaritalStatus,
271
-		IdCardNo:           patients.IdCardNo,
272
-		Birthday:           patients.Birthday,
273
-		ReimbursementWayId: patients.ReimbursementWayId,
274
-		HealthCareType:     patients.HealthCareType,
275
-		HealthCareNo:       patients.HealthCareNo,
276
-		HealthCareDueDate:  patients.HealthCareDueDate,
277
-		Height:             patients.Height,
278
-		BloodType:          patients.BloodType,
279
-		Rh:                 patients.Rh,
257
+		UserOrgId:                    adminUserInfo.CurrentOrgId,
258
+		UserId:                       0,
259
+		Avatar:                       patients.Avatar,
260
+		PatientType:                  patients.PatientType,
261
+		DialysisNo:                   patients.DialysisNo,
262
+		AdmissionNumber:              patients.AdmissionNumber,
263
+		Source:                       patients.Source,
264
+		Lapseto:                      patients.Lapseto,
265
+		PartitionId:                  patients.PartitionId,
266
+		BedId:                        patients.BedId,
267
+		Name:                         patients.Name,
268
+		Alias:                        patients.Alias,
269
+		Gender:                       patients.Gender,
270
+		MaritalStatus:                patients.MaritalStatus,
271
+		IdCardNo:                     patients.IdCardNo,
272
+		Birthday:                     patients.Birthday,
273
+		ReimbursementWayId:           patients.ReimbursementWayId,
274
+		HealthCareType:               patients.HealthCareType,
275
+		HealthCareNo:                 patients.HealthCareNo,
276
+		HealthCareDueDate:            patients.HealthCareDueDate,
277
+		Height:                       patients.Height,
278
+		BloodType:                    patients.BloodType,
279
+		Rh:                           patients.Rh,
280 280
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
281 281
 		EducationLevel:               patients.EducationLevel,
282 282
 		Profession:                   patients.Profession,
@@ -322,28 +322,28 @@ func (c *PatientApiController) CreatePatient() {
322 322
 		Nation:                       patients.Nation,
323 323
 		NativePlace:                  patients.NativePlace,
324 324
 		Age:                          patients.Age,
325
-		InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
326
-		IsInfectious:             patients.IsInfectious,
327
-		RemindCycle:              patients.RemindCycle,
328
-		ResponseResult:           patients.ResponseResult,
329
-		IsOpenRemind:             patients.IsOpenRemind,
330
-		FirstTreatmentDate:       patients.FirstTreatmentDate,
331
-		DialysisAge:              patients.DialysisAge,
332
-		ExpenseKind:              patients.ExpenseKind,
333
-		TellPhone:                patients.TellPhone,
334
-		ContactName:              patients.ContactName,
335
-		BloodPatients:            1,
336
-		SlowPatients:             0,
337
-		MemberPatients:           0,
338
-		EcommerPatients:          "",
339
-		BloodId:                  patients.ID,
340
-		SlowId:                   0,
341
-		MemberId:                 0,
342
-		MemberFistdate:           0,
343
-		MemberPatienttype:        0,
344
-		MemberTreatement:         0,
345
-		EquitmentId:              "",
346
-		UserSysBeforeCount:       patient.UserSysBeforeCount,
325
+		InfectiousNextRecordTime:     patients.InfectiousNextRecordTime,
326
+		IsInfectious:                 patients.IsInfectious,
327
+		RemindCycle:                  patients.RemindCycle,
328
+		ResponseResult:               patients.ResponseResult,
329
+		IsOpenRemind:                 patients.IsOpenRemind,
330
+		FirstTreatmentDate:           patients.FirstTreatmentDate,
331
+		DialysisAge:                  patients.DialysisAge,
332
+		ExpenseKind:                  patients.ExpenseKind,
333
+		TellPhone:                    patients.TellPhone,
334
+		ContactName:                  patients.ContactName,
335
+		BloodPatients:                1,
336
+		SlowPatients:                 0,
337
+		MemberPatients:               0,
338
+		EcommerPatients:              "",
339
+		BloodId:                      patients.ID,
340
+		SlowId:                       0,
341
+		MemberId:                     0,
342
+		MemberFistdate:               0,
343
+		MemberPatienttype:            0,
344
+		MemberTreatement:             0,
345
+		EquitmentId:                  "",
346
+		UserSysBeforeCount:           patient.UserSysBeforeCount,
347 347
 	}
348 348
 
349 349
 	err = service.CreatePatientsNew(&patientsNew)
@@ -481,28 +481,28 @@ func (c *PatientApiController) EditPatient() {
481 481
 		return
482 482
 	}
483 483
 	patientsNew := models.XtPatientsNew{
484
-		UserOrgId:          patient.UserOrgId,
485
-		UserId:             patient.UserId,
486
-		Avatar:             patient.Avatar,
487
-		PatientType:        patient.PatientType,
488
-		DialysisNo:         patient.DialysisNo,
489
-		AdmissionNumber:    patient.AdmissionNumber,
490
-		Source:             patient.Source,
491
-		PartitionId:        patient.PartitionId,
492
-		BedId:              patient.BedId,
493
-		Name:               patient.Name,
494
-		Alias:              patient.Alias,
495
-		Gender:             patient.Gender,
496
-		MaritalStatus:      patient.MaritalStatus,
497
-		IdCardNo:           patient.IdCardNo,
498
-		Birthday:           patient.Birthday,
499
-		ReimbursementWayId: patient.ReimbursementWayId,
500
-		HealthCareType:     patient.HealthCareType,
501
-		HealthCareNo:       patient.HealthCareNo,
502
-		HealthCareDueDate:  patient.HealthCareDueDate,
503
-		Height:             patient.Height,
504
-		BloodType:          patient.BloodType,
505
-		Rh:                 patient.Rh,
484
+		UserOrgId:                 patient.UserOrgId,
485
+		UserId:                    patient.UserId,
486
+		Avatar:                    patient.Avatar,
487
+		PatientType:               patient.PatientType,
488
+		DialysisNo:                patient.DialysisNo,
489
+		AdmissionNumber:           patient.AdmissionNumber,
490
+		Source:                    patient.Source,
491
+		PartitionId:               patient.PartitionId,
492
+		BedId:                     patient.BedId,
493
+		Name:                      patient.Name,
494
+		Alias:                     patient.Alias,
495
+		Gender:                    patient.Gender,
496
+		MaritalStatus:             patient.MaritalStatus,
497
+		IdCardNo:                  patient.IdCardNo,
498
+		Birthday:                  patient.Birthday,
499
+		ReimbursementWayId:        patient.ReimbursementWayId,
500
+		HealthCareType:            patient.HealthCareType,
501
+		HealthCareNo:              patient.HealthCareNo,
502
+		HealthCareDueDate:         patient.HealthCareDueDate,
503
+		Height:                    patient.Height,
504
+		BloodType:                 patient.BloodType,
505
+		Rh:                        patient.Rh,
506 506
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
507 507
 		EducationLevel:            patient.EducationLevel,
508 508
 		Profession:                patient.Profession,
@@ -544,19 +544,19 @@ func (c *PatientApiController) EditPatient() {
544 544
 		Nation:                    patient.Nation,
545 545
 		NativePlace:               patient.NativePlace,
546 546
 		Age:                       patient.Age,
547
-		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
548
-		IsInfectious:             patient.IsInfectious,
549
-		RemindCycle:              patient.RemindCycle,
550
-		ResponseResult:           patient.ResponseResult,
551
-		IsOpenRemind:             patient.IsOpenRemind,
552
-		FirstTreatmentDate:       patient.FirstTreatmentDate,
553
-		DialysisAge:              patient.DialysisAge,
554
-		ExpenseKind:              patient.ExpenseKind,
555
-		TellPhone:                patient.TellPhone,
556
-		ContactName:              patient.ContactName,
557
-		UpdatedTime:              time.Now().Unix(),
558
-		BloodPatients:            1,
559
-		Lapseto:                  patient.Lapseto,
547
+		InfectiousNextRecordTime:  patient.InfectiousNextRecordTime,
548
+		IsInfectious:              patient.IsInfectious,
549
+		RemindCycle:               patient.RemindCycle,
550
+		ResponseResult:            patient.ResponseResult,
551
+		IsOpenRemind:              patient.IsOpenRemind,
552
+		FirstTreatmentDate:        patient.FirstTreatmentDate,
553
+		DialysisAge:               patient.DialysisAge,
554
+		ExpenseKind:               patient.ExpenseKind,
555
+		TellPhone:                 patient.TellPhone,
556
+		ContactName:               patient.ContactName,
557
+		UpdatedTime:               time.Now().Unix(),
558
+		BloodPatients:             1,
559
+		Lapseto:                   patient.Lapseto,
560 560
 	}
561 561
 	//	//更新病人ID获取新表病人ID
562 562
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -659,8 +659,8 @@ func (c *PatientApiController) EditLapseto() {
659 659
 		return
660 660
 	}
661 661
 	lapsetoType := int64(patientBody["lapseto_type"].(float64))
662
-	if lapsetoType <= 0 || lapsetoType >= 3 {
663
-		utils.ErrorLog("lapsetoType <= 0 || lapsetoType >= 3")
662
+	if lapsetoType <= 0 || lapsetoType > 3 {
663
+		utils.ErrorLog("lapsetoType <= 0 || lapsetoType > 3")
664 664
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
665 665
 		return
666 666
 	}

+ 4 - 3
controllers/print_data_api_controller.go View File

@@ -91,13 +91,14 @@ func (this *PrintDataAPIController) StockRecordPrintData() {
91 91
 	}
92 92
 
93 93
 	list, err := service.FindPrintStockGoodInfoByType(types, startTime, endTime, adminUserInfo.CurrentOrgId)
94
-
94
+	stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, adminUserInfo.CurrentOrgId)
95 95
 	if err != nil {
96 96
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
97 97
 	} else {
98 98
 		this.ServeSuccessJSON(map[string]interface{}{
99
-			"list": list,
100
-			"type": types,
99
+			"list":       list,
100
+			"type":       types,
101
+			"stockTotal": stockTotal,
101 102
 		})
102 103
 	}
103 104
 }

+ 58 - 0
controllers/schedule_api_controller.go View File

@@ -40,6 +40,10 @@ func ScheduleApiRegistRouters() {
40 40
 
41 41
 	beego.Router("/api/schedule_template/cancel", &ScheduleApiController{}, "post:CancelScheduleTemplate")
42 42
 	beego.Router("/api/schedule/getnextscheduleweekday", &ScheduleApiController{}, "Get:GetNextWeekDaySchedule")
43
+
44
+	beego.Router("/api/schedule/getthreeweeklist", &ScheduleApiController{}, "Get:GetThreeWeekList")
45
+
46
+	beego.Router("/api/schedule/getallzones", &ScheduleApiController{}, "Get:GetAllZones")
43 47
 }
44 48
 
45 49
 func (c *ScheduleApiController) GetWeekPanels() {
@@ -1915,3 +1919,57 @@ func (this *ScheduleApiController) GetNextWeekDaySchedule() {
1915 1919
 		"schedule": schedule,
1916 1920
 	})
1917 1921
 }
1922
+
1923
+func (this *ScheduleApiController) GetThreeWeekList() {
1924
+	start_time := this.GetString("start_time")
1925
+	end_time := this.GetString("end_time")
1926
+	partition_id, _ := this.GetInt64("partition_id")
1927
+	schedule_type, _ := this.GetInt64("schedule_type")
1928
+	fmt.Println(partition_id, schedule_type)
1929
+	timeLayout := "2006-01-02"
1930
+	loc, _ := time.LoadLocation("Local")
1931
+
1932
+	var theStartTIme int64
1933
+	if len(start_time) > 0 {
1934
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1935
+		if err != nil {
1936
+			utils.ErrorLog(err.Error())
1937
+		}
1938
+		theStartTIme = theTime.Unix()
1939
+	}
1940
+	var theEndtTIme int64
1941
+	if len(end_time) > 0 {
1942
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
1943
+		if err != nil {
1944
+			utils.ErrorLog(err.Error())
1945
+		}
1946
+		theEndtTIme = theTime.Unix()
1947
+	}
1948
+
1949
+	adminUserInfo := this.GetAdminUserInfo()
1950
+	orgId := adminUserInfo.CurrentOrgId
1951
+	partitions, _ := service.GetSchedulePartitionPanel(orgId)
1952
+	list, err := service.GetThreeWeekList(theStartTIme, theEndtTIme, orgId, schedule_type, partition_id)
1953
+	if err != nil {
1954
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1955
+		return
1956
+	}
1957
+	this.ServeSuccessJSON(map[string]interface{}{
1958
+		"list":       list,
1959
+		"partitions": partitions,
1960
+	})
1961
+}
1962
+
1963
+func (this *ScheduleApiController) GetAllZones() {
1964
+
1965
+	adminUserInfo := this.GetAdminUserInfo()
1966
+	orgId := adminUserInfo.CurrentOrgId
1967
+	zones, err := service.GetAllZoneOne(orgId)
1968
+	if err != nil {
1969
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1970
+		return
1971
+	}
1972
+	this.ServeSuccessJSON(map[string]interface{}{
1973
+		"zones": zones,
1974
+	})
1975
+}

+ 32 - 0
controllers/self_drug_api_congtroller.go View File

@@ -51,6 +51,7 @@ func SelfDrugRouters() {
51 51
 	beego.Router("/api/drug/deleteDrugNamebyid", &SelfDrugApiController{}, "Get:DeleteDrugNameById")
52 52
 	beego.Router("/api/drug/getpatientdetail", &SelfDrugApiController{}, "Get:GetPatientDetail")
53 53
 	//beego.Router("/api/drug/getpatientdetail",&SelfDrugApiController{},"Get:ToPatientDetail")
54
+	beego.Router("/api/drug/getselfstockquery", &SelfDrugApiController{}, "Get:GetSelfStockQuery")
54 55
 }
55 56
 
56 57
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -881,3 +882,34 @@ func (this *SelfDrugApiController) GetPatientDetail() {
881 882
 //    "patient": patient,
882 883
 //  })
883 884
 //}
885
+
886
+func (this *SelfDrugApiController) GetSelfStockQuery() {
887
+
888
+	adminUserInfo := this.GetAdminUserInfo()
889
+	orgId := adminUserInfo.CurrentOrgId
890
+	type_name, _ := this.GetInt64("type_name")
891
+	keywords := this.GetString("keywords")
892
+	timeLayout := "2006-01-02"
893
+	loc, _ := time.LoadLocation("Local")
894
+	start_time := this.GetString("start_time")
895
+	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
896
+	startUnix := theTime.Unix()
897
+	end_time := this.GetString("end_time")
898
+	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
899
+	endTimeUnix := endTimes.Unix()
900
+	page, _ := this.GetInt64("page")
901
+	limit, _ := this.GetInt64("limit")
902
+	//统计入库数量
903
+	stockQuery, total, err := service.GetSelfStockQuery(type_name, keywords, startUnix, endTimeUnix, orgId, limit, page)
904
+	//统计出库数量
905
+	stockOutQuery, err := service.GetSelfOutStockQuery(startUnix, endTimeUnix, orgId)
906
+	if err != nil {
907
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
908
+		return
909
+	}
910
+	this.ServeSuccessJSON(map[string]interface{}{
911
+		"stockQuery":    stockQuery,
912
+		"total":         total,
913
+		"stockOutQuery": stockOutQuery,
914
+	})
915
+}

+ 11 - 0
models/device_models.go View File

@@ -881,3 +881,14 @@ func (VmDeviceInformation) TableName() string {
881 881
 
882 882
 	return "xt_device_information"
883 883
 }
884
+
885
+type VmSchedule struct {
886
+	ScheduleDate int64  `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
887
+	ScheduleType int64  `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
888
+	ScheduleWeek int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
889
+	BedId        int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
890
+	Partition    int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
891
+	Name         string `gorm:"column:name" json:"name" form:"name"`
892
+	Number       string `gorm:"column:number" json:"number" form:"number"`
893
+	ZoneName     string `gorm:"column:name" json:"zon_name" form:"name"`
894
+}

+ 1 - 0
models/dialysis.go View File

@@ -736,6 +736,7 @@ type DialysisOrder struct {
736 736
 	SchedualType   int64         `gorm:"column:schedual_type" json:"schedual_type"`
737 737
 	UserAdminRole  UserAdminRole `json:"role" gorm:"foreignkey:AdminUserId;AssociationForeignKey:StartNurse;"`
738 738
 	WashpipeNurse  int64         `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
739
+	ChangeNurse    int64         `gorm:"column:change_nurse" json:"change_nurse" form:"change_nurse"`
739 740
 }
740 741
 
741 742
 func (DialysisOrder) TableName() string {

+ 10 - 7
models/patient_models.go View File

@@ -227,6 +227,7 @@ type DialysisPrescription struct {
227 227
 	Blood                      string        `gorm:"column:blood" json:"blood"`
228 228
 	DialysisDialyszers         string        `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
229 229
 	DialysisIrrigation         string        `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
230
+	AntioxidantCommodityName   string        `gorm:"column:antioxidant_commodity_name" json:"antioxidant_commodity_name" form:"antioxidant_commodity_name"`
230 231
 }
231 232
 
232 233
 func (DialysisPrescription) TableName() string {
@@ -234,13 +235,15 @@ func (DialysisPrescription) TableName() string {
234 235
 }
235 236
 
236 237
 type DialysisPrescriptionList struct {
237
-	ID                         int64  `gorm:"column:id" json:"id"`
238
-	UserOrgId                  int64  `gorm:"column:user_org_id" json:"user_org_id"`
239
-	PatientId                  int64  `gorm:"column:patient_id" json:"patient_id"`
240
-	RecordDate                 int64  `gorm:"column:record_date" json:"record_date"`
241
-	RecordId                   int64  `gorm:"column:record_id" json:"record_id"`
242
-	Creater                    int64  `gorm:"column:creater" json:"creater"`
243
-	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus" form:"dialyzer_perfusion_apparatus"`
238
+	ID                         int64   `gorm:"column:id" json:"id"`
239
+	UserOrgId                  int64   `gorm:"column:user_org_id" json:"user_org_id"`
240
+	PatientId                  int64   `gorm:"column:patient_id" json:"patient_id"`
241
+	RecordDate                 int64   `gorm:"column:record_date" json:"record_date"`
242
+	RecordId                   int64   `gorm:"column:record_id" json:"record_id"`
243
+	Creater                    int64   `gorm:"column:creater" json:"creater"`
244
+	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus" form:"dialyzer_perfusion_apparatus"`
245
+	TargetUltrafiltration      float64 `gorm:"column:target_ultrafiltration" json:"target_ultrafiltration"`
246
+	BloodAccess                int64   `gorm:"column:blood_access" json:"blood_access"`
244 247
 }
245 248
 
246 249
 func (DialysisPrescriptionList) TableName() string {

+ 122 - 0
models/self_drug_models.go View File

@@ -410,3 +410,125 @@ type XtDrugStockConfig struct {
410 410
 func (XtDrugStockConfig) TableName() string {
411 411
 	return "xt_drug_stock_config"
412 412
 }
413
+
414
+type XtSelfOutStockOne struct {
415
+	DrugName   string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
416
+	DrugNameId int64  `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
417
+	DrugSpec   string `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
418
+	Count      int64
419
+	drug_type  int64 `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
420
+}
421
+
422
+type BloodDrugWarehouseInfo struct {
423
+	ID               int64   `gorm:"column:id" json:"id" form:"id"`
424
+	WarehousingId    int64   `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
425
+	DrugId           int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
426
+	Number           string  `gorm:"column:number" json:"number" form:"number"`
427
+	ProductDate      int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
428
+	ExpiryDate       int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
429
+	WarehousingCount int64   `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
430
+	Price            float64 `gorm:"column:price" json:"price" form:"price"`
431
+	TotalPrice       float64 `gorm:"column:total_price" json:"total_price" form:"total_price"`
432
+	Dealer           int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
433
+	Manufacturer     int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
434
+	Remark           string  `gorm:"column:remark" json:"remark" form:"remark"`
435
+	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
436
+	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
437
+	Status           int64   `gorm:"column:status" json:"status" form:"status"`
438
+	OrgId            int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
439
+	IsReturn         int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
440
+	WarehousingOrder string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
441
+	Type             int64   `gorm:"column:type" json:"type" form:"type"`
442
+	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
443
+	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
444
+	DrugType         int64   `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
445
+	DrugName         string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
446
+	DrugSpec         string  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
447
+	Creater          int64   `gorm:"column:creater" json:"creater" form:"creater"`
448
+	MinUnit          string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
449
+}
450
+
451
+type BloodDrugCancelStockInfo struct {
452
+	ID               int64   `gorm:"column:id" json:"id" form:"id"`
453
+	DrugId           int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
454
+	CancelStockId    int64   `gorm:"column:cancel_stock_id" json:"cancel_stock_id" form:"cancel_stock_id"`
455
+	Count            int64   `gorm:"column:count" json:"count" form:"count"`
456
+	Price            float64 `gorm:"column:price" json:"price" form:"price"`
457
+	Total            float64 `gorm:"column:total" json:"total" form:"total"`
458
+	ProductDate      int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
459
+	ExpiryDate       int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
460
+	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
461
+	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
462
+	Status           int64   `gorm:"column:status" json:"status" form:"status"`
463
+	OrgId            int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
464
+	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`
465
+	Type             int64   `gorm:"column:type" json:"type" form:"type"`
466
+	Dealer           int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
467
+	Manufacturer     int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
468
+	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
469
+	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
470
+	Number           string  `gorm:"column:number" json:"number" form:"number"`
471
+	DrugType         int64   `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
472
+	DrugName         string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
473
+	DrugSpec         string  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
474
+	Creater          int64   `gorm:"column:creater" json:"creater" form:"creater"`
475
+	MinUnit          string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
476
+}
477
+
478
+type BloodDrugSalesReturnInfo struct {
479
+	ID               int64   `gorm:"column:id" json:"id" form:"id"`
480
+	DrugId           int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
481
+	SalesReturnId    int64   `gorm:"column:sales_return_id" json:"sales_return_id" form:"sales_return_id"`
482
+	Count            int64   `gorm:"column:count" json:"count" form:"count"`
483
+	Price            float64 `gorm:"column:price" json:"price" form:"price"`
484
+	Total            float64 `gorm:"column:total" json:"total" form:"total"`
485
+	ProductDate      int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
486
+	ExpiryDate       int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
487
+	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
488
+	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
489
+	Status           int64   `gorm:"column:status" json:"status" form:"status"`
490
+	OrgId            int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
491
+	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`
492
+	Type             int64   `gorm:"column:type" json:"type" form:"type"`
493
+	Dealer           int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
494
+	Manufacturer     int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
495
+	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
496
+	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
497
+	Number           string  `gorm:"column:number" json:"number" form:"number"`
498
+	DrugType         int64   `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
499
+	DrugName         string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
500
+	DrugSpec         string  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
501
+	Creater          int64   `gorm:"column:creater" json:"creater" form:"creater"`
502
+	MinUnit          string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
503
+}
504
+
505
+type BloodDrugWarehouseOutInfo struct {
506
+	ID                      int64   `gorm:"column:id" json:"id" form:"id"`
507
+	WarehouseOutId          int64   `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
508
+	DrugId                  int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
509
+	WarehousingOutTarget    int64   `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
510
+	Count                   int64   `gorm:"column:count" json:"count" form:"count"`
511
+	Price                   float64 `gorm:"column:price" json:"price" form:"price"`
512
+	TotalPrice              float64 `gorm:"column:total_price" json:"total_price" form:"total_price"`
513
+	ProductDate             int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
514
+	ExpiryDate              int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
515
+	Mtime                   int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
516
+	Ctime                   int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
517
+	Status                  int64   `gorm:"column:status" json:"status" form:"status"`
518
+	OrgId                   int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
519
+	Remark                  string  `gorm:"column:remark" json:"remark" form:"remark"`
520
+	IsCancel                int64   `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
521
+	WarehouseOutOrderNumber string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
522
+	Type                    int64   `gorm:"column:type" json:"type" form:"type"`
523
+	Dealer                  int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
524
+	Manufacturer            int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
525
+	IsSys                   int64   `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
526
+	SysRecordTime           int64   `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
527
+	RetailPrice             float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
528
+	RetailTotalPrice        float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
529
+	DrugType                int64   `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
530
+	DrugName                string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
531
+	DrugSpec                string  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
532
+	Creater                 int64   `gorm:"column:creater" json:"creater" form:"creater"`
533
+	MinUnit                 string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
534
+}

+ 1 - 1
service/dialysis_service.go View File

@@ -637,7 +637,7 @@ func GetDialysisScheduals(orgID int64, scheduleDate int64) ([]*MDialysisSchedule
637 637
 		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
638 638
 		Preload("TreatmentSummary", "status = 1 AND user_org_id = ? AND assessment_date = ? ", orgID, scheduleDate).
639 639
 		Preload("Advices", "status = 1 AND user_org_id = ? AND advice_date = ? ", orgID, scheduleDate).
640
-
640
+		Preload("AssessmentAfterDislysis", "status = 1 AND user_org_id = ? and assessment_date = ?", orgID, scheduleDate).
641 641
 		// Preload("DialysisOrder.MonitoringRecords", "status = 1 AND user_org_id = ?", orgID).
642 642
 		Where("status = 1 AND user_org_id = ?", orgID)
643 643
 	if scheduleDate != 0 {

+ 1 - 1
service/doctor_schedule_service.go View File

@@ -592,7 +592,7 @@ func GetPatientSchedule(startime int64, zoneid int64, classtype int64, orgid int
592 592
 		db = db.Where("s.schedule_type = ?", classtype)
593 593
 	}
594 594
 	err = db.Preload("DeviceZone", " status= 1").Preload("DeviceNumber", "status= 1").
595
-		Preload("DialysisOrder", "status =1").Joins("JOIN xt_patients as p ON p.id = s.patient_id").Where("s.user_org_id = ? and s.schedule_date = ? and s.status =1", orgid, startime).
595
+		Preload("DialysisOrder", "status =1").Joins("JOIN xt_patients as p ON p.id = s.patient_id and p.lapseto = 1 and p.user_org_id =?", orgid).Where("s.user_org_id = ? and s.schedule_date = ? and s.status =1", orgid, startime).
596 596
 		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id,p.name as patient").Find(&schedule).Error
597 597
 	return schedule, err
598 598
 }

+ 141 - 0
service/gobal_config_service.go View File

@@ -2,6 +2,7 @@ package service
2 2
 
3 3
 import (
4 4
 	"XT_New/models"
5
+	"fmt"
5 6
 	"github.com/jinzhu/gorm"
6 7
 )
7 8
 
@@ -213,3 +214,143 @@ func GetExportHisOrderList(user_org_id int64, start_time int64, end_time int64)
213 214
 	err = db.Order("ctime desc").Find(&order).Error
214 215
 	return
215 216
 }
217
+
218
+func GetDrugInOrderDetail(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, page int64, limit int64) (drugInfo []*models.BloodDrugWarehouseInfo, total int64, err error) {
219
+
220
+	likeKey := "%" + keyword + "%"
221
+	offset := (page - 1) * limit
222
+
223
+	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1")
224
+	dbOne := XTReadDB().Table("xt_base_drug as t").Where("t.status =1")
225
+	dbTwo := XTReadDB().Table("xt_drug_warehouse as s").Where("s.status = 1")
226
+	fmt.Print(dbOne, dbTwo)
227
+	if startime > 0 {
228
+		db = db.Where("x.ctime >=?", startime)
229
+	}
230
+	if endtime > 0 {
231
+		db = db.Where("x.ctime <=?", endtime)
232
+	}
233
+	if orgid > 0 {
234
+		db = db.Where("x.org_id =?", orgid)
235
+	}
236
+	if orderType > 0 {
237
+		db = db.Where("x.type = ?", orderType)
238
+	}
239
+
240
+	if len(keyword) > 0 {
241
+
242
+		db = db.Where("x.warehousing_order like ? or t.drug_spec like ? or s.creater like ?", likeKey, likeKey, likeKey)
243
+
244
+	}
245
+
246
+	if manufacturerId > 0 {
247
+		err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,x.warehousing_count,x.price,x.total_price,x.dealer,t.manufacturer,x.remark,x.ctime,x.org_id,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,t.drug_type,t.drug_name,t.drug_spec,t.min_unit,s.creater").Joins("left join xt_base_drug as t on t.id = x.drug_id and t.org_id = ? and t.status =1", orgid).Where("t.manufacturer = ?", manufacturerId).Joins("left join xt_drug_warehouse as s on s.id = x.warehousing_id and s.org_id = ? and s.status =1", orgid).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&drugInfo).Error
248
+	} else {
249
+		err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,x.warehousing_count,x.price,x.total_price,x.dealer,t.manufacturer,x.remark,x.ctime,x.org_id,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,t.drug_type,t.drug_name,t.drug_spec,t.min_unit,s.creater").Joins("left join xt_base_drug as t on t.id = x.drug_id and t.org_id = ? and t.status =1", orgid).Joins("left join xt_drug_warehouse as s on s.id = x.warehousing_id and s.org_id = ? and s.status =1", orgid).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&drugInfo).Error
250
+	}
251
+
252
+	return drugInfo, total, err
253
+}
254
+
255
+func GetDrugReturnOrder(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, limit int64, page int64) (returninfo []*models.BloodDrugSalesReturnInfo, total int64, err error) {
256
+
257
+	likeKey := "%" + keyword + "%"
258
+	offset := (page - 1) * limit
259
+	db := XTReadDB().Table("xt_drug_sales_return_info as x").Where("x.status =1")
260
+	dbOne := XTReadDB().Table("xt_base_drug as s").Where("s.status =1")
261
+	dbTwo := XTReadDB().Table("xt_drug_sales_return as r").Where("r.status = 1")
262
+	fmt.Print(dbOne, dbTwo)
263
+	if startime > 0 {
264
+		db = db.Where("x.ctime >= ?", startime)
265
+	}
266
+	if endtime > 0 {
267
+		db = db.Where("x.ctime <=?", endtime)
268
+	}
269
+	if orgid > 0 {
270
+		db = db.Where("x.org_id = ?", orgid)
271
+	}
272
+	if orderType > 0 {
273
+		db = db.Where("x.type = ?", orderType)
274
+	}
275
+
276
+	if len(keyword) > 0 {
277
+
278
+		db = db.Where("x.order_number like ? or s.drug_spec like ? or r.creater like ?", likeKey, likeKey, likeKey)
279
+	}
280
+
281
+	if manufacturerId > 0 {
282
+		err = db.Select("x.id,x.drug_id,x.sales_return_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,s.drug_name,s.drug_spec,s.drug_type,s.min_unit,r.creater").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_sales_return as r on r.id = x.sales_return_id and r.org_id = ? and r.status =1", orgid).Where("r.manufacturer = ?", manufacturerId).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&returninfo).Error
283
+	} else {
284
+		err = db.Select("x.id,x.drug_id,x.sales_return_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,s.drug_name,s.drug_spec,s.drug_type,s.min_unit,r.creater").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_sales_return as r on r.id = x.sales_return_id and r.org_id = ? and r.status =1", orgid).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&returninfo).Error
285
+	}
286
+
287
+	return returninfo, total, err
288
+}
289
+
290
+func GetDrugOutOrder(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, page int64, limit int64) (outinfo []*models.BloodDrugWarehouseOutInfo, total int64, err error) {
291
+
292
+	likeKey := "%" + keyword + "%"
293
+	offset := (page - 1) * limit
294
+	db := XTReadDB().Table("xt_drug_warehouse_out_info as x").Where("x.status =1")
295
+	dbOne := XTReadDB().Table("xt_base_drug as b").Where("b.status =1")
296
+	dbTwo := XTReadDB().Table("xt_drug_warehouse_out as t").Where("t.status = 1")
297
+	fmt.Print(dbOne, dbTwo)
298
+	if startime > 0 {
299
+		db = db.Where("x.ctime >=?", startime)
300
+	}
301
+	if endtime > 0 {
302
+		db = db.Where("x.ctime <=?", endtime)
303
+	}
304
+
305
+	if orgid > 0 {
306
+		db = db.Where("x.org_id = ?", orgid)
307
+	}
308
+	if orderType > 0 {
309
+		db = db.Where("x.type = ?", orderType)
310
+	}
311
+
312
+	if len(keyword) > 0 {
313
+		db = db.Where("x.warehouse_out_order_number like ? or b.drug_spec like ? or t.creater like ?", likeKey, likeKey, likeKey)
314
+	}
315
+
316
+	if manufacturerId > 0 {
317
+		err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.warehousing_out_target,x.count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,x.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,b.drug_name,b.drug_spec,b.drug_type,b.min_unit,t.creater").Joins("left join xt_base_drug as b on b.id = x.drug_id and b.org_id = ? and b.status =1", orgid).Joins("left join xt_drug_warehouse_out as t on t.id = x.warehouse_out_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(&outinfo).Error
318
+	} else {
319
+		err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.warehousing_out_target,x.count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,x.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,b.drug_name,b.drug_spec,b.drug_type,b.min_unit,t.creater").Joins("left join xt_base_drug as b on b.id = x.drug_id and b.org_id = ? and b.status =1", orgid).Joins("left join xt_drug_warehouse_out as t on t.id = x.warehouse_out_id and t.org_id = ? and t.status  =1", orgid).Order("x.ctime desc").Count(&total).Offset(offset).Limit(limit).Scan(&outinfo).Error
320
+	}
321
+
322
+	return outinfo, total, err
323
+}
324
+
325
+func GetDrugCancelOrder(startime int64, endtime int64, orgid int64, orderType int64, manufacturerId int64, keyword string, page int64, limit int64) (cancel []*models.BloodDrugCancelStockInfo, total int64, err error) {
326
+
327
+	likeKey := "%" + keyword + "%"
328
+	offset := (page - 1) * limit
329
+	db := XTReadDB().Table("xt_drug_cancel_stock_info as x").Where("x.status =1")
330
+	dbOne := XTReadDB().Table("xt_base_drug as s").Where("s.status =1")
331
+	dbTwo := XTReadDB().Table("xt_drug_cancel_stock as t").Where("t.status = 1")
332
+	fmt.Print(dbOne, dbTwo)
333
+	if startime > 0 {
334
+		db = db.Where("x.ctime >= ?", startime)
335
+	}
336
+	if endtime > 0 {
337
+		db = db.Where("x.ctime<=?", endtime)
338
+	}
339
+	if orgid > 0 {
340
+		db = db.Where("x.org_id = ?", orgid)
341
+	}
342
+	if orderType > 0 {
343
+		db = db.Where("x.type = ? ", orderType)
344
+	}
345
+	if len(keyword) > 0 {
346
+		db = db.Where("x.order_number like ? or s.drug_spec like ? or t.creater like ?", likeKey, likeKey, likeKey)
347
+	}
348
+
349
+	if manufacturerId > 0 {
350
+		err = db.Select("x.id,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,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater").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
351
+	} else {
352
+		err = db.Select("x.id,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,s.drug_name,s.drug_type,s.drug_spec,s.min_unit,t.creater").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
353
+	}
354
+
355
+	return cancel, total, err
356
+}

+ 1 - 1
service/mobile_dialysis_service.go View File

@@ -1126,7 +1126,7 @@ func BatchUpdateMonitors(monitors []*models.MonitoringRecord) error {
1126 1126
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
1127 1127
 	tx := writeDb.Begin()
1128 1128
 	updateTime := time.Now().Unix()
1129
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse}).Error
1129
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse}).Error
1130 1130
 	if err != nil {
1131 1131
 		tx.Rollback()
1132 1132
 		return err

+ 2 - 2
service/patient_service.go View File

@@ -1193,8 +1193,8 @@ func GetAllWaitRemindPatient(org_id int64, page int64, limit int64) (total int64
1193 1193
 	var totals Total
1194 1194
 
1195 1195
 	offset := (page - 1) * limit
1196
-	err = readDb.Raw("select *  from xt_patients where user_org_id = ? AND infectious_next_record_time > 0 AND status = 1  AND date_sub(DATE_FORMAT(date(from_unixtime(`xt_patients`.`infectious_next_record_time`)),'%Y-%m-%d'), interval 7 day) <= now() Order by infectious_next_record_time", org_id).Offset(offset).Limit(limit).Scan(&patient).Error
1197
-	readDb.Raw("select Count(id) as count  from xt_patients where user_org_id = ? AND infectious_next_record_time > 0 AND status = 1  AND date_sub(DATE_FORMAT(date(from_unixtime(`xt_patients`.`infectious_next_record_time`)),'%Y-%m-%d'), interval 7 day) <= now() Order by infectious_next_record_time", org_id).Scan(&totals)
1196
+	err = readDb.Raw("select *  from xt_patients where user_org_id = ? AND lapseto = 1 AND infectious_next_record_time > 0 AND status = 1  AND date_sub(DATE_FORMAT(date(from_unixtime(`xt_patients`.`infectious_next_record_time`)),'%Y-%m-%d'), interval 7 day) <= now() Order by infectious_next_record_time", org_id).Offset(offset).Limit(limit).Scan(&patient).Error
1197
+	readDb.Raw("select Count(id) as count  from xt_patients where user_org_id = ? AND lapseto = 1 AND infectious_next_record_time > 0 AND status = 1  AND date_sub(DATE_FORMAT(date(from_unixtime(`xt_patients`.`infectious_next_record_time`)),'%Y-%m-%d'), interval 7 day) <= now() Order by infectious_next_record_time", org_id).Scan(&totals)
1198 1198
 
1199 1199
 	return totals.Count, patient, err
1200 1200
 }

+ 1 - 1
service/patientmanage_service.go View File

@@ -1167,7 +1167,7 @@ func DeleteGroup(id int64) error {
1167 1167
 
1168 1168
 func GetAllZoneOne(orgid int64) (zone []*models.DeviceZone, err error) {
1169 1169
 
1170
-	err = XTReadDB().Model(&zone).Where("org_id = ?", orgid).Find(&zone).Error
1170
+	err = XTReadDB().Model(&zone).Where("org_id = ? and status =1", orgid).Find(&zone).Error
1171 1171
 	return zone, err
1172 1172
 }
1173 1173
 

+ 8 - 1
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go View File

@@ -42,7 +42,7 @@ func GetSchedules(orgID int64, schIDs []string) ([]*ScheduleVM, error) {
42 42
 				Where("user_org_id = ? AND advice_type = 2 AND status = 1", orgID).
43 43
 				Order("start_time asc, groupno desc, advice_order desc, id asc")
44 44
 		}).
45
-		Where("user_org_id = ? AND status = 1 AND id in (?)", orgID, schIDs).
45
+		Where("user_org_id = ? AND status = 1 AND id in (?)", orgID, schIDs).Order("schedule_date desc").
46 46
 		Find(&schedules).
47 47
 		Error
48 48
 	if err != nil {
@@ -186,3 +186,10 @@ func GetDialysisOrderCount(orgID int64, patient_id int64, recordDate int64) (cou
186 186
 	err = p_service.XTReadDB().Model(&models.DialysisOrder{}).Where("dialysis_date <= ? AND status = 1 AND stage = 2 AND user_org_id = ? AND patient_id = ?", recordDate, orgID, patient_id).Count(&count).Error
187 187
 	return
188 188
 }
189
+
190
+func GetOutStockTotalCountTwo(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
191
+
192
+	err = p_service.XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.record_time,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and `status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error
193
+
194
+	return autoMatic, err
195
+}

+ 23 - 0
service/schedule_service.go View File

@@ -662,3 +662,26 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
662 662
 		Find(&schedules).Error
663 663
 	return schedules, err
664 664
 }
665
+
666
+func GetThreeWeekList(startime int64, endtime int64, orgid int64, scheduletype int64, partionid int64) (schedule []*models.VmSchedule, err error) {
667
+
668
+	db := XTReadDB().Table("xt_schedule as x").Where("x.status =1")
669
+	if startime > 0 {
670
+		db = db.Where("x.schedule_date >=?", startime)
671
+	}
672
+	if endtime > 0 {
673
+		db = db.Where("x.schedule_date <=?", endtime)
674
+	}
675
+	if orgid > 0 {
676
+		db = db.Where("x.user_org_id = ?", orgid)
677
+	}
678
+	if scheduletype > 0 {
679
+		db = db.Where("x.schedule_type = ?", scheduletype)
680
+	}
681
+	if partionid > 0 {
682
+		db = db.Where("x.partition_id = ?", partionid)
683
+	}
684
+	err = db.Select("x.schedule_date,x.schedule_type,x.schedule_week,x.bed_id,x.partition_id,t.name,n.number,z.name").Joins("left join xt_patients as t on t.id = x.patient_id and t.user_org_id = ? and t.status = 1", orgid).Joins("left join xt_device_zone as z on z.id = x.partition_id and z.org_id = ? and z.status =1", orgid).Joins("left join xt_device_number as n on n.id = x.bed_id and n.org_id = ? and n.status =1", orgid).Scan(&schedule).Error
685
+
686
+	return schedule, err
687
+}

+ 44 - 0
service/self_drug_service.go View File

@@ -752,3 +752,47 @@ func UpdatedSelfOutSatock(id int64, stock *models.XtSelfOutStock) error {
752 752
 	err := XTWriteDB().Model(&stock).Where("id = ?", id).Updates(map[string]interface{}{"drug_name": stock.DrugName, "drug_name_id": stock.DrugNameId, "drug_spec": stock.DrugSpec, "outstore_number": stock.OutstoreNumber, "admin_user_id": stock.AdminUserId, "storck_time": stock.StorckTime, "patient_id": stock.PatientId, "stock_out_number": stock.StockOutNumber, "exit_mode": stock.ExitMode, "medic_id": stock.MedicId, "updated_time": time.Now().Unix()}).Error
753 753
 	return err
754 754
 }
755
+
756
+func GetSelfStockQuery(typename int64, keywords string, startime int64, endtime int64, orgid int64, limit int64, page int64) (selfoutstock []*models.XtSelfOutStockOne, total int64, err error) {
757
+	offset := (page - 1) * limit
758
+	db := XTReadDB().Table("xt_self_stock as x").Where("x.status = 1")
759
+	likeKey := "%" + keywords + "%"
760
+	if len(keywords) > 0 {
761
+		db = db.Where("x.drug_name like ? ", likeKey)
762
+	}
763
+
764
+	if startime > 0 {
765
+		db = db.Where("x.storck_time >=?", startime)
766
+	}
767
+	if endtime > 0 {
768
+		db = db.Where("x.storck_time<=?", endtime)
769
+	}
770
+
771
+	if orgid > 0 {
772
+		db = db.Where("x.user_org_id = ?", orgid)
773
+	}
774
+
775
+	if typename > 0 {
776
+		err = db.Select("x.drug_name,x.drug_name_id,x.drug_spec,Sum(store_number) as count,b.drug_type").Joins("left join xt_base_drug as b on b.id = x.drug_name_id and b.org_id = ? and b.status =1 ", orgid).Where("b.drug_type = ?", typename).Group("x.drug_name_id").Count(&total).Offset(offset).Limit(limit).Scan(&selfoutstock).Error
777
+	} else {
778
+		err = db.Select("x.drug_name,x.drug_name_id,x.drug_spec,Sum(store_number) as count,b.drug_type").Joins("left join xt_base_drug as b on b.id = x.drug_name_id and b.org_id = ? and b.status =1", orgid).Group("x.drug_name_id").Count(&total).Offset(offset).Limit(limit).Scan(&selfoutstock).Error
779
+	}
780
+
781
+	return selfoutstock, total, err
782
+}
783
+
784
+func GetSelfOutStockQuery(startTime int64, endTime int64, orgid int64) (selfoutstock []*models.XtSelfOutStockOne, err error) {
785
+
786
+	db := XTReadDB().Table("xt_self_out_stock as x").Where("x.status = 1")
787
+	if startTime > 0 {
788
+		db = db.Where("x.storck_time >?", startTime)
789
+	}
790
+	if endTime > 0 {
791
+		db = db.Where("x.storck_time<=?", endTime)
792
+	}
793
+	if orgid > 0 {
794
+		db = db.Where("x.user_org_id = ?", orgid)
795
+	}
796
+	err = db.Select("x.drug_name_id,Sum(x.outstore_number) as count").Group("x.drug_name_id").Scan(&selfoutstock).Error
797
+	return selfoutstock, err
798
+}

+ 6 - 0
service/stock_service.go View File

@@ -2163,3 +2163,9 @@ func GetOutStockTotalCount(wareouttime int64, orgid int64) (autoMatic []*models.
2163 2163
 	return autoMatic, err
2164 2164
 
2165 2165
 }
2166
+
2167
+func GetOutStockTotalCountOne(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
2168
+	err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and `status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error
2169
+
2170
+	return autoMatic, err
2171
+}