浏览代码

耗材参数

XMLWAN 4 年前
父节点
当前提交
4949635a85

+ 95 - 34
controllers/dialysis_api_controller.go 查看文件

@@ -244,6 +244,8 @@ func (c *DialysisApiController) PostPrescription() {
244 244
 	//fmt.Println("下机前推注鱼精蛋白",push_the_protamine)
245 245
 	// var prescription_doctor int64
246 246
 	blood := c.GetString("blood")
247
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
248
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
247 249
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
248 250
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
249 251
 
@@ -322,7 +324,9 @@ func (c *DialysisApiController) PostPrescription() {
322 324
 		PreImpulse:                 preImpules,
323 325
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
324 326
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
325
-		Blood: blood,
327
+		Blood:                      blood,
328
+		DialysisDialyszers:         dialysis_dialyszers,
329
+		DialysisIrrigation:         dialysis_irrigation,
326 330
 	}
327 331
 
328 332
 	if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -489,6 +493,8 @@ func (c *DialysisApiController) PostSoulution() {
489 493
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
490 494
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
491 495
 	blood := c.GetString("blood")
496
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
497
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
492 498
 	var prescription_doctor int64
493 499
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
494 500
 
@@ -578,7 +584,9 @@ func (c *DialysisApiController) PostSoulution() {
578 584
 
579 585
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
580 586
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
581
-		Blood: blood,
587
+		Blood:                     blood,
588
+		DialysisIrrigation:        dialysis_irrigation,
589
+		DialysisDialyszers:        dialysis_dialyszers,
582 590
 	}
583 591
 
584 592
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
@@ -1140,6 +1148,11 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1140 1148
 	urine_volume, _ := c.GetFloat("urine_volume", 0)
1141 1149
 	special_treatment := c.GetString("special_treatment")
1142 1150
 	catheter_maintenance := c.GetString("catheter_maintenance")
1151
+	thrombusType := c.GetString("thromubus_type")
1152
+	thrombusInt, _ := strconv.ParseInt(thrombusType, 10, 64)
1153
+	thrombus_a := c.GetString("thromubus_a")
1154
+	thrombus_av := c.GetString("thrombus_av")
1155
+	thrombus_v := c.GetString("thromubus_v")
1143 1156
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1144 1157
 		DialysisCount:                  dialysis_count,
1145 1158
 		EmergencyTreatment:             emergency_treatment,
@@ -1197,6 +1210,10 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1197 1210
 		UrineVolume:                    urine_volume,
1198 1211
 		SpecialTreatment:               special_treatment,
1199 1212
 		CatheterMaintenance:            catheter_maintenance,
1213
+		ThromubusType:                  thrombusInt,
1214
+		ThrombusAv:                     thrombus_av,
1215
+		ThromubusA:                     thrombus_a,
1216
+		ThromubusV:                     thrombus_v,
1200 1217
 	}
1201 1218
 
1202 1219
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -1547,9 +1564,11 @@ func (c *DialysisApiController) GetDeviceList() {
1547 1564
 func (c *DialysisApiController) GetAllDeviceZone() {
1548 1565
 	adminUserInfo := c.GetAdminUserInfo()
1549 1566
 	err, zone := service.GetAllDeviceZone(adminUserInfo.CurrentOrgId)
1567
+	dics, _, err := service.GetDrugWayDics(adminUserInfo.CurrentOrgId)
1550 1568
 	if err == nil {
1551 1569
 		c.ServeSuccessJSON(map[string]interface{}{
1552 1570
 			"zone": zone,
1571
+			"dics": dics,
1553 1572
 		})
1554 1573
 	}
1555 1574
 
@@ -2295,6 +2314,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
2295 2314
 	dialysisway, err := service.FindDialysisWay(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
2296 2315
 	//获取临时医嘱
2297 2316
 	doctorAdvice, _ := service.FindDoctorOrder(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
2317
+	config, err := service.GetHisDoctorConfig(adminUserInfo.CurrentOrgId)
2298 2318
 
2299 2319
 	//获取医嘱内容
2300 2320
 	doctor, err := service.FindDoctor(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
@@ -2347,38 +2367,79 @@ func (c *DialysisApiController) GetDialysisOrder() {
2347 2367
 	firstMonthDate := firstmonth.Unix()
2348 2368
 	//获取当前月份的病人透析次数
2349 2369
 	dialysiscount, err := service.GetDialysisCountByPatientId(firstMonthDate, xttime, patientInfo.ID, adminUserInfo.CurrentOrgId)
2350
-	c.ServeSuccessJSON(map[string]interface{}{
2351
-		"xtdate":                    xtdate,
2352
-		"users":                     adminUser,
2353
-		"patientInfo":               patientInfo,
2354
-		"PredialysisEvaluation":     PredialysisEvaluation,
2355
-		"AssessmentAfterDislysis":   AssessmentAfterDislysis,
2356
-		"dialysisPrescription":      dialysisPrescription,
2357
-		"advices":                   DoctorAdvice,
2358
-		"monitors":                  Record,
2359
-		"summary":                   TreatmentSummary,
2360
-		"receiverTreatmentAccess":   receiverTreatmentAccess,
2361
-		"dialysisOrder":             dialysisOrder,
2362
-		"operators":                 operators,
2363
-		"org_template_info":         templateInfo,
2364
-		"check":                     check,
2365
-		"schedule":                  schedule,
2366
-		"dialysisway":               dialysisway,
2367
-		"order":                     order,
2368
-		"doctorAdvice":              doctorAdvice,
2369
-		"doctor":                    doctor,
2370
-		"nurse":                     nurse,
2371
-		"doctorAdevieInfo":          doctorAdevieInfo,
2372
-		"total":                     total,
2373
-		"startNuse":                 startNuse,
2374
-		"DoctorName":                DoctorName,
2375
-		"assessmentAfterDislysis":   assessmentAfterDislysis,
2376
-		"predialysName":             predialysName,
2377
-		"FinishNuse":                FinishNuse,
2378
-		"lastPredialysisEvaluation": lastPredialysisEvaluation,
2379
-		"dialysiscount":             dialysiscount,
2380
-		"last_order":                lastOrder,
2381
-	})
2370
+
2371
+	//获取his数据
2372
+	hisAdvice, err := service.GetHisDoctorPatientById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
2373
+	if config.IsOpen == 1 {
2374
+		c.ServeSuccessJSON(map[string]interface{}{
2375
+			"xtdate":                    xtdate,
2376
+			"users":                     adminUser,
2377
+			"patientInfo":               patientInfo,
2378
+			"PredialysisEvaluation":     PredialysisEvaluation,
2379
+			"AssessmentAfterDislysis":   AssessmentAfterDislysis,
2380
+			"dialysisPrescription":      dialysisPrescription,
2381
+			"advices":                   hisAdvice,
2382
+			"monitors":                  Record,
2383
+			"summary":                   TreatmentSummary,
2384
+			"receiverTreatmentAccess":   receiverTreatmentAccess,
2385
+			"dialysisOrder":             dialysisOrder,
2386
+			"operators":                 operators,
2387
+			"org_template_info":         templateInfo,
2388
+			"check":                     check,
2389
+			"schedule":                  schedule,
2390
+			"dialysisway":               dialysisway,
2391
+			"order":                     order,
2392
+			"doctorAdvice":              doctorAdvice,
2393
+			"doctor":                    doctor,
2394
+			"nurse":                     nurse,
2395
+			"doctorAdevieInfo":          doctorAdevieInfo,
2396
+			"total":                     total,
2397
+			"startNuse":                 startNuse,
2398
+			"DoctorName":                DoctorName,
2399
+			"assessmentAfterDislysis":   assessmentAfterDislysis,
2400
+			"predialysName":             predialysName,
2401
+			"FinishNuse":                FinishNuse,
2402
+			"lastPredialysisEvaluation": lastPredialysisEvaluation,
2403
+			"dialysiscount":             dialysiscount,
2404
+			"last_order":                lastOrder,
2405
+		})
2406
+
2407
+	}
2408
+	if config.IsOpen == 0 || config.IsOpen == 2 {
2409
+		c.ServeSuccessJSON(map[string]interface{}{
2410
+			"xtdate":                    xtdate,
2411
+			"users":                     adminUser,
2412
+			"patientInfo":               patientInfo,
2413
+			"PredialysisEvaluation":     PredialysisEvaluation,
2414
+			"AssessmentAfterDislysis":   AssessmentAfterDislysis,
2415
+			"dialysisPrescription":      dialysisPrescription,
2416
+			"advices":                   DoctorAdvice,
2417
+			"monitors":                  Record,
2418
+			"summary":                   TreatmentSummary,
2419
+			"receiverTreatmentAccess":   receiverTreatmentAccess,
2420
+			"dialysisOrder":             dialysisOrder,
2421
+			"operators":                 operators,
2422
+			"org_template_info":         templateInfo,
2423
+			"check":                     check,
2424
+			"schedule":                  schedule,
2425
+			"dialysisway":               dialysisway,
2426
+			"order":                     order,
2427
+			"doctorAdvice":              doctorAdvice,
2428
+			"doctor":                    doctor,
2429
+			"nurse":                     nurse,
2430
+			"doctorAdevieInfo":          doctorAdevieInfo,
2431
+			"total":                     total,
2432
+			"startNuse":                 startNuse,
2433
+			"DoctorName":                DoctorName,
2434
+			"assessmentAfterDislysis":   assessmentAfterDislysis,
2435
+			"predialysName":             predialysName,
2436
+			"FinishNuse":                FinishNuse,
2437
+			"lastPredialysisEvaluation": lastPredialysisEvaluation,
2438
+			"dialysiscount":             dialysiscount,
2439
+			"last_order":                lastOrder,
2440
+		})
2441
+
2442
+	}
2382 2443
 
2383 2444
 }
2384 2445
 

+ 7 - 0
controllers/dialysis_record_api_controller.go 查看文件

@@ -267,6 +267,11 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
267 267
 
268 268
 	_, is_open_config := service.FindXTHisRecordByOrgId(adminInfo.CurrentOrgId)
269 269
 
270
+	//获取耗材类型
271
+	stockType, _ := service.GetStockType(adminInfo.CurrentOrgId)
272
+
273
+	prepare, _ := service.GetDialyStockOut(adminInfo.CurrentOrgId, date.Unix(), patientID)
274
+
270 275
 	var his_advices []*models.HisDoctorAdviceInfo
271 276
 	if is_open_config.IsOpen == 1 {
272 277
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.CurrentOrgId, patientID, date.Unix())
@@ -298,6 +303,8 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
298 303
 		"system_prescribe":            systemDialysisPrescribe,
299 304
 		"his_advices":                 his_advices,
300 305
 		"is_open_config":              is_open_config,
306
+		"stockType":                   stockType,
307
+		"prepare":                     prepare,
301 308
 	}
302 309
 	this.ServeSuccessJSON(returnData)
303 310
 

+ 3 - 2
controllers/doctors_api_controller.go 查看文件

@@ -33,6 +33,7 @@ func (c *DoctorsApiController) ScheduleAdvices() {
33 33
 	schedualDate := c.GetString("date")
34 34
 	adviceType, _ := c.GetInt("advice_type")
35 35
 	patientType, _ := c.GetInt("patient_type")
36
+	delivery_way := c.GetString("delivery_way")
36 37
 
37 38
 	if adviceType != 1 && adviceType != 3 && adviceType != 2 {
38 39
 		adviceType = 0
@@ -52,8 +53,8 @@ func (c *DoctorsApiController) ScheduleAdvices() {
52 53
 	adminUserInfo := c.GetAdminUserInfo()
53 54
 	orgID := adminUserInfo.CurrentOrgId
54 55
 
55
-	scheduals, err := service.MobileGetScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id)
56
-	hisAdvices, _ := service.GetHisDoctorAdvices(orgID, date.Unix())
56
+	scheduals, err := service.MobileGetScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way)
57
+	hisAdvices, _ := service.GetHisDoctorAdvices(orgID, date.Unix(), delivery_way)
57 58
 	config, _ := service.GetHisDoctorConfig(orgID)
58 59
 	adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
59 60
 	if err != nil {

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

@@ -1417,7 +1417,7 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
1417 1417
 					sys_record_time := int64(items["sys_record_time"].(float64))
1418 1418
 
1419 1419
 					warehouseOutInfo := &models.DrugWarehouseOutInfo{
1420
-						ID: id,
1420
+						ID:                      id,
1421 1421
 						WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1422 1422
 						WarehouseOutId:          warehouseOut.ID,
1423 1423
 						DrugId:                  drug_id,
@@ -1866,9 +1866,34 @@ func (c *StockDrugApiController) GetDrugQueryInfo() {
1866 1866
 	page, _ := c.GetInt64("page", -1)
1867 1867
 	limit, _ := c.GetInt64("limit", -1)
1868 1868
 	keyword := c.GetString("keyword")
1869
+	drug_category, _ := c.GetInt64("drug_category")
1870
+	start_time := c.GetString("start_time")
1871
+	end_time := c.GetString("end_time")
1872
+	timeLayout := "2006-01-02"
1873
+	loc, _ := time.LoadLocation("Local")
1869 1874
 
1875
+	var startTime int64
1876
+	if len(start_time) > 0 {
1877
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1878
+		if err != nil {
1879
+			fmt.Println(err)
1880
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1881
+			return
1882
+		}
1883
+		startTime = theTime.Unix()
1884
+	}
1885
+	var endTime int64
1886
+	if len(end_time) > 0 {
1887
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1888
+		if err != nil {
1889
+			utils.ErrorLog(err.Error())
1890
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1891
+			return
1892
+		}
1893
+		endTime = theTime.Unix()
1894
+	}
1870 1895
 	adminUserInfo := c.GetAdminUserInfo()
1871
-	list, total, err := service.FindAllDrugStockInfo(adminUserInfo.CurrentOrgId, page, limit, keyword)
1896
+	list, total, err := service.FindAllDrugStockInfo(adminUserInfo.CurrentOrgId, page, limit, keyword, drug_category, startTime, endTime)
1872 1897
 	if err == nil {
1873 1898
 		c.ServeSuccessJSON(map[string]interface{}{
1874 1899
 			"list":  list,

文件差异内容过多而无法显示
+ 34 - 857
controllers/his_api_controller.go


+ 36 - 30
controllers/mobile_api_controllers/check_weight_api_controller.go 查看文件

@@ -13,7 +13,7 @@ import (
13 13
 	"net/http"
14 14
 	"net/url"
15 15
 	"strconv"
16
-	_"strings"
16
+	_ "strings"
17 17
 
18 18
 	// "fmt"
19 19
 	_ "reflect"
@@ -619,20 +619,26 @@ 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
+
637
+				evaluation.InternalFistulaSkin = lastPredialysisEvaluation.InternalFistulaSkin //血透通路皮肤情况
638
+				evaluation.CatheterBend = lastPredialysisEvaluation.CatheterBend               //导管打折
639
+				evaluation.IsHemorrhage = lastPredialysisEvaluation.IsHemorrhage               //出血
640
+				evaluation.IsInfect = lastPredialysisEvaluation.IsInfect                       //感染
641
+				evaluation.Exposed = lastPredialysisEvaluation.Exposed                         // 外漏
636 642
 
637 643
 			}
638 644
 		} else {
@@ -696,41 +702,41 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
696 702
 	}
697 703
 }
698 704
 
699
-func (c *CheckWeightApiController) SetSyncTime(){
705
+func (c *CheckWeightApiController) SetSyncTime() {
700 706
 	sn := c.GetString("sn")
701
-	if len(sn)  > 0 {
707
+	if len(sn) > 0 {
702 708
 		redis := service.RedisClient()
703 709
 		defer redis.Close()
704
-		redis.Set(sn, 0,0)
710
+		redis.Set(sn, 0, 0)
705 711
 	}
706 712
 	serviceTime := time.Now().Unix()
707 713
 	c.ServeSuccessJSON(map[string]interface{}{
708
-		"status": 	1,
714
+		"status":      1,
709 715
 		"servicetime": serviceTime,
710 716
 	})
711 717
 }
712 718
 
713 719
 func (c *CheckWeightApiController) GetPatientList() {
714
-	ftype,_ := c.GetInt64("type",0)
720
+	ftype, _ := c.GetInt64("type", 0)
715 721
 	sn := c.GetString("sn")
716 722
 	syncTime := int64(0)
717 723
 
718 724
 	redis := service.RedisClient()
719 725
 	defer redis.Close()
720
-	if len(sn)  > 0 {
726
+	if len(sn) > 0 {
721 727
 		syncTimeStr, _ := redis.Get(sn).Result()
722
-		syncTime,_ = strconv.ParseInt(syncTimeStr, 10, 64)
728
+		syncTime, _ = strconv.ParseInt(syncTimeStr, 10, 64)
723 729
 	}
724 730
 
725 731
 	if ftype == 1 {
726 732
 		timeNow := time.Now().Unix()
727
-		redis.Set(sn, timeNow,0)
733
+		redis.Set(sn, timeNow, 0)
728 734
 	}
729 735
 
730 736
 	adminUserInfo := c.GetMobileAdminUserInfo()
731 737
 	need_update := 0
732 738
 	patientList, total, error := service.GetPatientListByUpdateTime(adminUserInfo.Org.Id, int64(syncTime))
733
-	if len(patientList)  > 0 {
739
+	if len(patientList) > 0 {
734 740
 		need_update = 1
735 741
 	}
736 742
 	if error != nil {
@@ -740,7 +746,7 @@ func (c *CheckWeightApiController) GetPatientList() {
740 746
 	}
741 747
 	serviceTime := time.Now().Unix()
742 748
 	c.ServeSuccessJSON(map[string]interface{}{
743
-		"need_update" : need_update,
749
+		"need_update": need_update,
744 750
 		"patientlist": patientList,
745 751
 		"total":       total,
746 752
 		"servicetime": serviceTime,
@@ -779,7 +785,7 @@ func (c *CheckWeightApiController) GetPatientListForSchedules() {
779 785
 }
780 786
 
781 787
 func (c *CheckWeightApiController) GetPatientListForSchedulesFind() {
782
-	patient_name := c.GetString("patient_name")                   //脉率
788
+	patient_name := c.GetString("patient_name") //脉率
783 789
 	thisTime := time.Now()
784 790
 	scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
785 791
 	timeLayout := "2006-01-02 15:04:05"
@@ -810,8 +816,8 @@ func (c *CheckWeightApiController) GetPatientListForSchedulesFind() {
810 816
 			"servicetime": serviceTime,
811 817
 		})
812 818
 	} else {
813
-		patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime,patient_name)
814
-		patientSchedule := make([]map[string]interface{},0)
819
+		patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime, patient_name)
820
+		patientSchedule := make([]map[string]interface{}, 0)
815 821
 		for _, item := range patientList {
816 822
 			if item.Patient.ID > 0 {
817 823
 				patientTemp := make(map[string]interface{})
@@ -922,12 +928,12 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
922 928
 		}
923 929
 
924 930
 		// 排队叫号的签到
925
-		go func (){
931
+		go func() {
926 932
 			ssoDomain := beego.AppConfig.String("call_domain")
927 933
 			api := ssoDomain + "/index/patientsign/" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + "/" + strconv.FormatInt(id, 10)
928 934
 			values := make(url.Values)
929 935
 			http.PostForm(api, values)
930
-		} ()
936
+		}()
931 937
 	} else {
932 938
 		nextSchedule, _ := service.GetNextSchedule(adminUserInfo.Org.Id, endTime, id)
933 939
 		if len(nextSchedule) <= 0 {

+ 27 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

@@ -248,7 +248,7 @@ func (this *DialysisAPIController) DialysisRecord() {
248 248
 	}
249 249
 
250 250
 	schedual, getSchedualErr := service.MobileGetSchedualDetail(adminInfo.Org.Id, patientID, date.Unix())
251
-	// this.TraceLog("==================================%+v", schedual)
251
+
252 252
 	if getSchedualErr != nil {
253 253
 		this.ErrorLog("获取患者排班信息失败:%v", getSchedualErr)
254 254
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -369,6 +369,9 @@ func (this *DialysisAPIController) DialysisRecord() {
369 369
 
370 370
 	_, is_open_config := service.FindXTHisRecordByOrgId(adminInfo.Org.Id)
371 371
 
372
+	stockType, _ := service.GetStockType(adminInfo.Org.Id)
373
+
374
+	prepare, _ := service.GetDialyStockOut(adminInfo.Org.Id, date.Unix(), patientID)
372 375
 	var his_advices []*models.HisDoctorAdviceInfo
373 376
 	if is_open_config.IsOpen == 1 {
374 377
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
@@ -421,6 +424,8 @@ func (this *DialysisAPIController) DialysisRecord() {
421 424
 		"system_prescription":            systemDialysisPrescribe,
422 425
 		"his_advices":                    his_advices,
423 426
 		"is_open_config":                 is_open_config,
427
+		"stockType":                      stockType,
428
+		"prepare":                        prepare,
424 429
 	}
425 430
 	this.ServeSuccessJSON(returnData)
426 431
 }
@@ -1054,6 +1059,8 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1054 1059
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
1055 1060
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
1056 1061
 	blood := c.GetString("blood")
1062
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
1063
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
1057 1064
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1058 1065
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1059 1066
 	//
@@ -1137,6 +1144,8 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1137 1144
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
1138 1145
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
1139 1146
 		Blood:                      blood,
1147
+		DialysisDialyszers:         dialysis_dialyszers,
1148
+		DialysisIrrigation:         dialysis_irrigation,
1140 1149
 	}
1141 1150
 
1142 1151
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -1829,6 +1838,8 @@ func (c *DialysisAPIController) PostSolution() {
1829 1838
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
1830 1839
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
1831 1840
 	blood := c.GetString("blood")
1841
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
1842
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
1832 1843
 	if mode_id > 0 {
1833 1844
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1834 1845
 	}
@@ -1913,6 +1924,8 @@ func (c *DialysisAPIController) PostSolution() {
1913 1924
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
1914 1925
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
1915 1926
 		Blood:                     blood,
1927
+		DialysisDialyszers:        dialysis_dialyszers,
1928
+		DialysisIrrigation:        dialysis_irrigation,
1916 1929
 	}
1917 1930
 
1918 1931
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -2981,7 +2994,8 @@ func (c *DialysisAPIController) CreateConsumables() {
2981 2994
 				}
2982 2995
 
2983 2996
 				count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
2984
-
2997
+				//commdity_code := items["commdity_code"].(string)
2998
+				//fmt.Println("新建22222222222222",commdity_code)
2985 2999
 				adminUser := c.GetMobileAdminUserInfo()
2986 3000
 				prepare := &models.DialysisBeforePrepare{
2987 3001
 					UserOrgId:  adminUser.Org.Id,
@@ -2994,6 +3008,7 @@ func (c *DialysisAPIController) CreateConsumables() {
2994 3008
 					Mtime:      time.Now().Unix(),
2995 3009
 					Creater:    adminUser.AdminUser.Id,
2996 3010
 					Modifier:   0,
3011
+					//CommdityCode:commdity_code,
2997 3012
 				}
2998 3013
 				record_count := service.FindDialysisBeforePrepare(prepare.PatientId, prepare.GoodId, prepare.GoodTypeId, adminUser.Org.Id, record_time)
2999 3014
 				if record_count == 0 {
@@ -3072,6 +3087,8 @@ func (c *DialysisAPIController) CreateConsumables() {
3072 3087
 				}
3073 3088
 				ctime := int64(items["ctime"].(float64))
3074 3089
 
3090
+				//commdity_code := items["commdity_code"].(string)
3091
+				//fmt.Println("commdityecode22222222222222222222",commdity_code)
3075 3092
 				prepare := &models.DialysisBeforePrepare{
3076 3093
 					ID:         id,
3077 3094
 					UserOrgId:  adminUser.Org.Id,
@@ -3085,6 +3102,7 @@ func (c *DialysisAPIController) CreateConsumables() {
3085 3102
 					Creater:    creater,
3086 3103
 					Modifier:   adminUser.AdminUser.Id,
3087 3104
 					Status:     1,
3105
+					//CommdityCode: commdity_code,
3088 3106
 				}
3089 3107
 				updateBeforePrepares = append(updateBeforePrepares, prepare)
3090 3108
 
@@ -3381,7 +3399,8 @@ func (c *DialysisAPIController) EditConsumables() {
3381 3399
 						return
3382 3400
 					}
3383 3401
 					ctime := int64(items["ctime"].(float64))
3384
-
3402
+					//commdity_code := items["commdity_code"].(string)
3403
+					//fmt.Println("commdityecode22222222222222222222",commdity_code)
3385 3404
 					adminUser := c.GetMobileAdminUserInfo()
3386 3405
 					prepare := &models.DialysisBeforePrepare{
3387 3406
 						ID:         id,
@@ -3396,6 +3415,7 @@ func (c *DialysisAPIController) EditConsumables() {
3396 3415
 						Creater:    creater,
3397 3416
 						Modifier:   adminUser.AdminUser.Id,
3398 3417
 						Status:     1,
3418
+						//CommdityCode: commdity_code,
3399 3419
 					}
3400 3420
 					beforePrepares = append(beforePrepares, prepare)
3401 3421
 
@@ -3432,7 +3452,8 @@ func (c *DialysisAPIController) EditConsumables() {
3432 3452
 					}
3433 3453
 
3434 3454
 					count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
3435
-
3455
+					//commdity_code := items["commdity_code"].(string)
3456
+					//fmt.Println("commdityecode22222222222222222222",commdity_code)
3436 3457
 					adminUser := c.GetMobileAdminUserInfo()
3437 3458
 					prepare := &models.DialysisBeforePrepare{
3438 3459
 						UserOrgId:  adminUser.Org.Id,
@@ -3445,6 +3466,7 @@ func (c *DialysisAPIController) EditConsumables() {
3445 3466
 						Mtime:      time.Now().Unix(),
3446 3467
 						Creater:    adminUser.AdminUser.Id,
3447 3468
 						Modifier:   0,
3469
+						//CommdityCode:commdity_code,
3448 3470
 					}
3449 3471
 					newBeforePrepares = append(newBeforePrepares, prepare)
3450 3472
 
@@ -4258,6 +4280,7 @@ func (c *DialysisAPIController) CreateOtherStockOutInfo() {
4258 4280
 						GoodTypeId:              item.GoodTypeId,
4259 4281
 						Count:                   item.Count,
4260 4282
 					}
4283
+
4261 4284
 					service.AddSigleAutoReduceRecordInfo(details)
4262 4285
 				}
4263 4286
 			}

+ 3 - 3
controllers/mobile_api_controllers/doctor_advice_api_controller.go 查看文件

@@ -19,7 +19,7 @@ func (this *DoctorAdviceAPIController) ScheduleAdvices() {
19 19
 	schedualDate := this.GetString("date")
20 20
 	adviceType, _ := this.GetInt("advice_type")
21 21
 	patientType, _ := this.GetInt("patient_type")
22
-
22
+	delivery_way := this.GetString("delivery_way")
23 23
 	if adviceType != 1 && adviceType != 3 && adviceType != 2 {
24 24
 		adviceType = 0
25 25
 	}
@@ -38,10 +38,10 @@ func (this *DoctorAdviceAPIController) ScheduleAdvices() {
38 38
 	adminInfo := this.GetMobileAdminUserInfo()
39 39
 	orgID := adminInfo.Org.Id
40 40
 
41
-	scheduals, err := service.MobileGetScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminInfo.AdminUser.Id)
41
+	scheduals, err := service.MobileGetScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminInfo.AdminUser.Id, delivery_way)
42 42
 	//获取his医嘱数据
43 43
 	fmt.Println("date.un222222", date.Unix())
44
-	hisAdvices, _ := service.GetHisDoctorAdvices(orgID, date.Unix())
44
+	hisAdvices, _ := service.GetHisDoctorAdvices(orgID, date.Unix(), delivery_way)
45 45
 	config, _ := service.GetHisDoctorConfig(orgID)
46 46
 	adminUser, _ := service.GetAllAdminUsers(orgID, adminInfo.App.Id)
47 47
 	if err != nil {

+ 72 - 19
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

@@ -2363,6 +2363,27 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2363 2363
 		evaluation.CatheterMaintenance = catheter_maintenance
2364 2364
 	}
2365 2365
 
2366
+	if dataBody["thromubus_type"] != nil && reflect.TypeOf(dataBody["thromubus_type"]).String() == "float64" {
2367
+
2368
+		thromubusType := int64(dataBody["thromubus_type"].(float64))
2369
+
2370
+		evaluation.ThromubusType = thromubusType
2371
+	}
2372
+
2373
+	if dataBody["thrombus_av"] != nil && reflect.TypeOf(dataBody["thrombus_av"]).String() == "string" {
2374
+		thrombus_av := dataBody["thrombus_av"].(string)
2375
+		evaluation.ThrombusAv = thrombus_av
2376
+	}
2377
+
2378
+	if dataBody["thromubus_a"] != nil && reflect.TypeOf(dataBody["thromubus_a"]).String() == "string" {
2379
+		thromubus_a := dataBody["thromubus_a"].(string)
2380
+		evaluation.ThromubusA = thromubus_a
2381
+	}
2382
+
2383
+	if dataBody["thromubus_v"] != nil && reflect.TypeOf(dataBody["thromubus_v"]).String() == "string" {
2384
+		thromubus_v := dataBody["thromubus_v"].(string)
2385
+		evaluation.ThromubusV = thromubus_v
2386
+	}
2366 2387
 	return
2367 2388
 }
2368 2389
 
@@ -2686,6 +2707,7 @@ func (c *PatientApiController) GetRecords() {
2686 2707
 func (c *PatientApiController) GetPatientMonitor() {
2687 2708
 	partition, _ := c.GetInt64("partition")
2688 2709
 	monitorDate := c.GetString("date")
2710
+	patient_id, _ := c.GetInt64("patient_id")
2689 2711
 
2690 2712
 	timeLayout := "2006-01-02"
2691 2713
 	loc, _ := time.LoadLocation("Local")
@@ -2700,10 +2722,16 @@ func (c *PatientApiController) GetPatientMonitor() {
2700 2722
 	}
2701 2723
 	adminInfo := c.GetMobileAdminUserInfo()
2702 2724
 	orgID := adminInfo.Org.Id
2703
-	monitor, err := service.GetMonitorRecord(orgID, theStartTime, partition)
2725
+	monitor, err := service.GetMonitorRecord(orgID, theStartTime, partition, patient_id)
2726
+	//获取患者的透析次数
2727
+	count, err := service.GetDialysisCount(orgID, partition)
2728
+
2729
+	patients, err := service.GetAllpatient(orgID)
2704 2730
 	if err == nil {
2705 2731
 		c.ServeSuccessJSON(map[string]interface{}{
2706
-			"monitor": monitor,
2732
+			"monitor":      monitor,
2733
+			"patientCount": count,
2734
+			"patients":     patients,
2707 2735
 		})
2708 2736
 	} else {
2709 2737
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -2904,23 +2932,48 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
2904 2932
 	check, _ := service.FindDoubleCheckById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2905 2933
 
2906 2934
 	dialysiscount, err := service.GetDialysisCountByPatientId(firstMonthDate, xttime, patientInfo.ID, adminUserInfo.Org.Id)
2907
-	c.ServeSuccessJSON(map[string]interface{}{
2908
-		"users":                   adminUser,
2909
-		"patientInfo":             patientInfo,
2910
-		"PredialysisEvaluation":   PredialysisEvaluation,
2911
-		"AssessmentAfterDislysis": AssessmentAfterDislysis,
2912
-		"dialysisPrescription":    dialysisPrescription,
2913
-		"advices":                 DoctorAdvice,
2914
-		"monitors":                Record,
2915
-		"summary":                 TreatmentSummary,
2916
-		"receiverTreatmentAccess": receiverTreatmentAccess,
2917
-		"dialysisOrder":           dialysisOrder,
2918
-		"operators":               operators,
2919
-		"org_template_info":       templateInfo,
2920
-		"check":                   check,
2921
-		"dialysiscount":           dialysiscount,
2922
-		"last_order":              last_order,
2923
-	})
2935
+
2936
+	config, err := service.GetHisDoctorConfig(adminUserInfo.Org.Id)
2937
+	hisAdvice, err := service.GetHisDoctorPatientById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2938
+	if config.IsOpen == 1 {
2939
+		c.ServeSuccessJSON(map[string]interface{}{
2940
+			"users":                   adminUser,
2941
+			"patientInfo":             patientInfo,
2942
+			"PredialysisEvaluation":   PredialysisEvaluation,
2943
+			"AssessmentAfterDislysis": AssessmentAfterDislysis,
2944
+			"dialysisPrescription":    dialysisPrescription,
2945
+			"advices":                 hisAdvice,
2946
+			"monitors":                Record,
2947
+			"summary":                 TreatmentSummary,
2948
+			"receiverTreatmentAccess": receiverTreatmentAccess,
2949
+			"dialysisOrder":           dialysisOrder,
2950
+			"operators":               operators,
2951
+			"org_template_info":       templateInfo,
2952
+			"check":                   check,
2953
+			"dialysiscount":           dialysiscount,
2954
+			"last_order":              last_order,
2955
+		})
2956
+	}
2957
+
2958
+	if config.IsOpen == 0 || config.IsOpen == 2 {
2959
+		c.ServeSuccessJSON(map[string]interface{}{
2960
+			"users":                   adminUser,
2961
+			"patientInfo":             patientInfo,
2962
+			"PredialysisEvaluation":   PredialysisEvaluation,
2963
+			"AssessmentAfterDislysis": AssessmentAfterDislysis,
2964
+			"dialysisPrescription":    dialysisPrescription,
2965
+			"advices":                 DoctorAdvice,
2966
+			"monitors":                Record,
2967
+			"summary":                 TreatmentSummary,
2968
+			"receiverTreatmentAccess": receiverTreatmentAccess,
2969
+			"dialysisOrder":           dialysisOrder,
2970
+			"operators":               operators,
2971
+			"org_template_info":       templateInfo,
2972
+			"check":                   check,
2973
+			"dialysiscount":           dialysiscount,
2974
+			"last_order":              last_order,
2975
+		})
2976
+	}
2924 2977
 
2925 2978
 }
2926 2979
 

+ 15 - 1
controllers/stock_in_api_controller.go 查看文件

@@ -65,6 +65,8 @@ func StockManagerApiRegistRouters() {
65 65
 	beego.Router("/api/warehouseout/user", &StockManagerApiController{}, "get:GetUserDetailInfo")
66 66
 
67 67
 	beego.Router("/api/warehouseout/postsearchstock", &StockManagerApiController{}, "Get:PostSearchStock")
68
+
69
+	beego.Router("/api/warehouseout/getoutstocktotalcount", &StockManagerApiController{}, "Get:GetOutStockTotalCount")
68 70
 }
69 71
 
70 72
 func (c *StockManagerApiController) CreateWarehouse() {
@@ -1965,7 +1967,6 @@ func (this *StockManagerApiController) GetUserDetailInfo() {
1965 1967
 func (this *StockManagerApiController) PostSearchStock() {
1966 1968
 
1967 1969
 	keyword := this.GetString("keyword")
1968
-	fmt.Println("keyword2222222222222", keyword)
1969 1970
 	adminUserInfo := this.GetAdminUserInfo()
1970 1971
 	orgId := adminUserInfo.CurrentOrgId
1971 1972
 	stock, err := service.PostSearchStock(keyword, orgId)
@@ -1976,3 +1977,16 @@ func (this *StockManagerApiController) PostSearchStock() {
1976 1977
 		"stock": stock,
1977 1978
 	})
1978 1979
 }
1980
+
1981
+func (this *StockManagerApiController) GetOutStockTotalCount() {
1982
+
1983
+	warehouseOutTime, _ := this.GetInt64("warehouse_out_time")
1984
+	adminUserInfo := this.GetAdminUserInfo()
1985
+	stockCount, err := service.GetOutStockTotalCount(warehouseOutTime, adminUserInfo.CurrentOrgId)
1986
+	if err != nil {
1987
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeleteFail)
1988
+	}
1989
+	this.ServeSuccessJSON(map[string]interface{}{
1990
+		"stockCount": stockCount,
1991
+	})
1992
+}

+ 34 - 12
models/dialysis.go 查看文件

@@ -276,6 +276,10 @@ type PredialysisEvaluation struct {
276 276
 	Edema                          string  `gorm:"column:edema" json:"edema" form:"edema"`
277 277
 	SpecialTreatment               string  `gorm:"column:special_treatment" json:"special_treatment" form:"special_treatment"`
278 278
 	CatheterMaintenance            string  `gorm:"column:catheter_maintenance" json:"catheter_maintenance" form:"catheter_maintenance"`
279
+	ThromubusType                  int64   `gorm:"column:thromubus_type" json:"thromubus_type" form:"thromubus_type"`
280
+	ThrombusAv                     string  `gorm:"column:thrombus_av" json:"thrombus_av" form:"thrombus_av"`
281
+	ThromubusA                     string  `gorm:"column:thromubus_a" json:"thromubus_a" form:"thromubus_a"`
282
+	ThromubusV                     string  `gorm:"column:thromubus_v" json:"thromubus_v" form:"thromubus_v"`
279 283
 }
280 284
 
281 285
 func (PredialysisEvaluation) TableName() string {
@@ -940,18 +944,19 @@ type UserAdminRoles struct {
940 944
 }
941 945
 
942 946
 type DialysisBeforePrepare struct {
943
-	ID         int64 `gorm:"column:id" json:"id" form:"id"`
944
-	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
945
-	PatientId  int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
946
-	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
947
-	GoodId     int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
948
-	GoodTypeId int64 `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
949
-	Count      int64 `gorm:"column:count" json:"count" form:"count"`
950
-	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
951
-	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
952
-	Creater    int64 `gorm:"column:creater" json:"creater" form:"creater"`
953
-	Modifier   int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
954
-	Status     int64 `gorm:"column:status" json:"status" form:"status"`
947
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
948
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
949
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
950
+	RecordDate   int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
951
+	GoodId       int64  `gorm:"column:good_id" json:"good_id" form:"good_id"`
952
+	GoodTypeId   int64  `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
953
+	Count        int64  `gorm:"column:count" json:"count" form:"count"`
954
+	Ctime        int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
955
+	Mtime        int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
956
+	Creater      int64  `gorm:"column:creater" json:"creater" form:"creater"`
957
+	Modifier     int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
958
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
959
+	CommdityCode string `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
955 960
 }
956 961
 
957 962
 func (DialysisBeforePrepare) TableName() string {
@@ -977,3 +982,20 @@ type QueueCallConfig struct {
977 982
 func (QueueCallConfig) TableName() string {
978 983
 	return "xt_queue_call_config"
979 984
 }
985
+
986
+type XtDialysisBeforePrepare struct {
987
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
988
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
989
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
990
+	RecordDate        int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
991
+	GoodId            int64  `gorm:"column:good_id" json:"good_id" form:"good_id"`
992
+	GoodTypeId        int64  `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
993
+	Count             int64  `gorm:"column:count" json:"count" form:"count"`
994
+	Ctime             int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
995
+	Mtime             int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
996
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
997
+	Modifier          int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
998
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
999
+	CommdityCode      string `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
1000
+	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
1001
+}

+ 5 - 0
models/dialysis_parameter_models.go 查看文件

@@ -148,3 +148,8 @@ type PredialysisEvaluationParameter struct {
148 148
 func (PredialysisEvaluationParameter) TableName() string {
149 149
 	return "xt_assessment_before_dislysis"
150 150
 }
151
+
152
+type NewXtAutomaticReduceDetail struct {
153
+	GoodId int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
154
+	Count  int64 `gorm:"column:count" json:"count" form:"count"`
155
+}

+ 1 - 0
models/good_models.go 查看文件

@@ -68,6 +68,7 @@ type GoodInfo struct {
68 68
 	Agent                  string    `gorm:"column:agent" json:"agent" form:"agent"`
69 69
 	GoodNumber             string    `gorm:"column:good_number" json:"good_number" form:"good_number"`
70 70
 	GoodsType              GoodsType `gorm:"ForeignKey:ID;AssociationForeignKey:GoodTypeId" json:"type"`
71
+	CommdityCode           string    `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
71 72
 }
72 73
 
73 74
 func (GoodInfo) TableName() string {

+ 7 - 6
models/new_monitor.go 查看文件

@@ -20,7 +20,7 @@ type NewVMMonitorDialysisSchedule struct {
20 20
 	Prescription             VMDialysisPrescription    `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
21 21
 	AssessmentBeforeDislysis VMPredialysisEvaluation   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
22 22
 	AssessmentAfterDislysis  VMAssessmentAfterDislysis `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_after_dislysis"`
23
-	MonitoringRecord         []VMMonitoringRecord      `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
23
+	MonitoringRecord         []VMMonitoringRecord      `gorm:"ForeignKey:PatientId,MonitoringDate;AssociationForeignKey:PatientId,ScheduleDate" json:"monitoring_record"`
24 24
 }
25 25
 
26 26
 func (NewVMMonitorDialysisSchedule) TableName() string {
@@ -28,11 +28,12 @@ func (NewVMMonitorDialysisSchedule) TableName() string {
28 28
 }
29 29
 
30 30
 type VMMonitorPatients struct {
31
-	ID         int64  `gorm:"column:id" json:"id" form:"id"`
32
-	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
33
-	Name       string `gorm:"column:name" json:"name" form:"name"`
34
-	Status     int64  `gorm:"column:status" json:"status" form:"status"`
35
-	DialysisNo string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
31
+	ID                 int64  `gorm:"column:id" json:"id" form:"id"`
32
+	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
33
+	Name               string `gorm:"column:name" json:"name" form:"name"`
34
+	Status             int64  `gorm:"column:status" json:"status" form:"status"`
35
+	DialysisNo         string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
36
+	UserSysBeforeCount int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
36 37
 }
37 38
 
38 39
 func (VMMonitorPatients) TableName() string {

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

@@ -225,6 +225,8 @@ type DialysisPrescription struct {
225 225
 	AnticoagulantStopTimeMin   int64         `gorm:"column:anticoagulant_stop_time_min" json:"anticoagulant_stop_time_min" form:"anticoagulant_stop_time_min"`
226 226
 	AnticoagulantStopTimeHour  int64         `gorm:"column:anticoagulant_stop_time_hour" json:"anticoagulant_stop_time_hour" form:"anticoagulant_stop_time_hour"`
227 227
 	Blood                      string        `gorm:"column:blood" json:"blood"`
228
+	DialysisDialyszers         string        `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
229
+	DialysisIrrigation         string        `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
228 230
 }
229 231
 
230 232
 func (DialysisPrescription) TableName() string {

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

@@ -1055,11 +1055,11 @@ func CreateDialysisBeforePrepare(beforePrepares []*models.DialysisBeforePrepare)
1055 1055
 	if len(beforePrepares) > 0 {
1056 1056
 		utx := writeDb.Begin()
1057 1057
 		if len(beforePrepares) > 0 {
1058
-			thisSQL := "INSERT INTO dialysis_before_prepare (user_org_id, patient_id, record_date, good_id, good_type_id,count,ctime,mtime,creater,modifier,status) VALUES "
1058
+			thisSQL := "INSERT INTO dialysis_before_prepare (user_org_id, patient_id, record_date, good_id, good_type_id,count,ctime,mtime,creater,modifier,status,commdity_code) VALUES "
1059 1059
 			insertParams := make([]string, 0)
1060 1060
 			insertData := make([]interface{}, 0)
1061 1061
 			for _, prepare := range beforePrepares {
1062
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
1062
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?)")
1063 1063
 				insertData = append(insertData, prepare.UserOrgId)
1064 1064
 				insertData = append(insertData, prepare.PatientId)
1065 1065
 				insertData = append(insertData, prepare.RecordDate)
@@ -1071,7 +1071,7 @@ func CreateDialysisBeforePrepare(beforePrepares []*models.DialysisBeforePrepare)
1071 1071
 				insertData = append(insertData, prepare.Creater)
1072 1072
 				insertData = append(insertData, prepare.Modifier)
1073 1073
 				insertData = append(insertData, 1)
1074
-
1074
+				insertData = append(insertData, prepare.CommdityCode)
1075 1075
 			}
1076 1076
 			thisSQL += strings.Join(insertParams, ", ")
1077 1077
 			err = utx.Exec(thisSQL, insertData...).Error
@@ -1094,7 +1094,7 @@ func UpdateDialysisBeforePrepare(info *models.DialysisBeforePrepare) (err error)
1094 1094
 func UpdateDialysisBeforePrepareTwo(info *models.DialysisBeforePrepare) (err error) {
1095 1095
 	err = writeDb.Model(&models.DialysisBeforePrepare{}).
1096 1096
 		Where("status = 1 AND good_id = ? AND good_type_id = ? AND patient_id = ? AND user_org_id = ? AND record_date = ?", info.GoodId, info.GoodTypeId, info.PatientId, info.UserOrgId, info.RecordDate).
1097
-		Updates(map[string]interface{}{"count": info.Count, "updated_time": time.Now().Unix(), "modifier": info.Modifier}).Error
1097
+		Updates(map[string]interface{}{"count": info.Count, "updated_time": time.Now().Unix(), "modifier": info.Modifier, "commdity_code": info.CommdityCode}).Error
1098 1098
 
1099 1099
 	return err
1100 1100
 }

+ 49 - 10
service/drug_stock_service.go 查看文件

@@ -90,17 +90,56 @@ func (DrugStockInfo) TableName() string {
90 90
 	return "xt_base_drug"
91 91
 }
92 92
 
93
-func FindAllDrugStockInfo(orgId int64, page int64, limit int64, keyword string) (list []*DrugStockInfo, total int64, err error) {
93
+func FindAllDrugStockInfo(orgId int64, page int64, limit int64, keyword string, drugCategory int64, startTime int64, endTime int64) (list []*DrugStockInfo, total int64, err error) {
94 94
 	db := readDb.Model(&DrugStockInfo{})
95
-	db = db.Where("xt_base_drug.org_id = ? AND xt_base_drug.status = 1", orgId)
96
-	db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
97
-		return db.Where("org_id = ? AND status = 1", orgId)
98
-	})
99
-	db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
100
-	db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
101
-		return db.Where("org_id = ? AND status = 1", orgId)
102
-	})
103
-	db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
95
+	if drugCategory > 0 {
96
+		db = db.Where("xt_base_drug.org_id = ? AND xt_base_drug.status = 1 AND xt_base_drug.drug_category = ?", orgId, drugCategory)
97
+	} else {
98
+		db = db.Where("xt_base_drug.org_id = ? AND xt_base_drug.status = 1", orgId)
99
+	}
100
+
101
+	if startTime > 0 {
102
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
103
+			return db.Where("org_id = ? AND status = 1 and ctime >=?", orgId, startTime)
104
+		})
105
+		db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1 and ctime>=?", orgId, startTime)
106
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
107
+			return db.Where("org_id = ? AND status = 1 and sys_record_time>=?", orgId, startTime)
108
+		})
109
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1 and ctime>=?", orgId, startTime)
110
+	} else {
111
+
112
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
113
+			return db.Where("org_id = ? AND status = 1", orgId)
114
+		})
115
+		db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
116
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
117
+			return db.Where("org_id = ? AND status = 1", orgId)
118
+		})
119
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
120
+	}
121
+
122
+	if endTime > 0 {
123
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
124
+			return db.Where("org_id = ? AND status = 1 and ctime>=? and ctime <=?", orgId, startTime, endTime)
125
+		})
126
+		db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1 and ctime>=? and ctime<=?", orgId, startTime, endTime)
127
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
128
+			return db.Where("org_id = ? AND status = 1 and sys_record_time<=?", orgId, endTime)
129
+		})
130
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1 and ctime >=? and ctime<=?", orgId, startTime, endTime)
131
+	} else {
132
+
133
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
134
+			return db.Where("org_id = ? AND status = 1", orgId)
135
+		})
136
+		db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
137
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
138
+			return db.Where("org_id = ? AND status = 1", orgId)
139
+		})
140
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
141
+	}
142
+
104 143
 	if len(keyword) > 0 {
105 144
 		likeKey := "%" + keyword + "%"
106 145
 		db = db.Where("xt_base_drug.drug_name LIKE ? OR xt_base_drug.drug_spec LIKE ?", likeKey, likeKey)

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

@@ -901,7 +901,7 @@ func GetTimeLastData(equitid int64, orgId int64) (models.DeviceInformation, erro
901 901
 }
902 902
 
903 903
 func GetAllpatient(orgid int64) (patients []*models.Patients, err error) {
904
-	err = XTReadDB().Where("user_org_id = ?", orgid).Find(&patients).Error
904
+	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&patients).Error
905 905
 	return patients, err
906 906
 }
907 907
 

+ 67 - 21
service/mobile_dialysis_service.go 查看文件

@@ -777,7 +777,7 @@ func (MDoctorAdviceVM) TableName() string {
777 777
 	return "xt_doctor_advice"
778 778
 }
779 779
 
780
-func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64) ([]*MScheduleDoctorAdviceVM, error) {
780
+func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64, deliverWay string) ([]*MScheduleDoctorAdviceVM, error) {
781 781
 	var vms []*MScheduleDoctorAdviceVM
782 782
 	adviceWhere := ""
783 783
 	fmt.Println("advicetype", adviceType)
@@ -826,13 +826,26 @@ func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType
826 826
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
827 827
 		}
828 828
 
829
-	} else if adviceType == 2 {
829
+	} else if adviceType == 2 && len(deliverWay) > 0 {
830 830
 		if patientType == 0 {
831
-			adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 2 AND record_date = ?  "
831
+			adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 2 AND record_date = ? and delivery_way = ?"
832
+			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, deliverWay)
833
+
834
+		} else if patientType == 1 {
835
+			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 AND advice_doctor = ?  and delivery_way = ? "
836
+			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, adminUserId, deliverWay)
837
+		} else if patientType == 2 {
838
+			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2  AND execution_staff = 0 and delivery_way = ?"
839
+			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, deliverWay)
840
+		}
841
+
842
+	} else if adviceType == 2 && len(deliverWay) <= 0 {
843
+		if patientType == 0 {
844
+			adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 2 AND record_date = ?"
832 845
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
833 846
 
834 847
 		} else if patientType == 1 {
835
-			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 AND advice_doctor = ? "
848
+			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 AND advice_doctor = ?"
836 849
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, adminUserId)
837 850
 		} else if patientType == 2 {
838 851
 			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2  AND execution_staff = 0"
@@ -860,26 +873,43 @@ func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType
860 873
 	return vms, err
861 874
 }
862 875
 
863
-func GetHisDoctorAdvices(orgID int64, scheduleDate int64) ([]*HisMScheduleDoctorAdviceVM, error) {
876
+func GetHisDoctorAdvices(orgID int64, scheduleDate int64, deliverWay string) ([]*HisMScheduleDoctorAdviceVM, error) {
864 877
 
865 878
 	var vms []*HisMScheduleDoctorAdviceVM
866
-
867
-	db := readDb.
868
-		Table("xt_schedule").
869
-		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
870
-		Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
871
-			return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
872
-		}).
873
-		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
874
-		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
875
-		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
876
-		Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).
877
-		Where("status = 1 AND user_org_id = ?", orgID)
878
-	if scheduleDate != 0 {
879
-		db = db.Where("schedule_date = ?", scheduleDate)
879
+	if len(deliverWay) > 0 {
880
+		db := readDb.
881
+			Table("xt_schedule").
882
+			Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
883
+			Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
884
+				return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
885
+			}).
886
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
887
+			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
888
+			Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
889
+			Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ?", orgID, scheduleDate, deliverWay).
890
+			Where("status = 1 AND user_org_id = ?", orgID)
891
+		if scheduleDate != 0 {
892
+			db = db.Where("schedule_date = ?", scheduleDate)
893
+		}
894
+		err = db.Find(&vms).Error
895
+	} else {
896
+		db := readDb.
897
+			Table("xt_schedule").
898
+			Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
899
+			Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
900
+				return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
901
+			}).
902
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
903
+			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
904
+			Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
905
+			Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).
906
+			Where("status = 1 AND user_org_id = ?", orgID)
907
+		if scheduleDate != 0 {
908
+			db = db.Where("schedule_date = ?", scheduleDate)
909
+		}
910
+		err = db.Find(&vms).Error
880 911
 	}
881 912
 
882
-	err := db.Find(&vms).Error
883 913
 	return vms, err
884 914
 }
885 915
 
@@ -1499,7 +1529,7 @@ func MobileGetDialysisGoods(orgID int64, scheduleDate int64, schedule_type int64
1499 1529
 			return db.Preload("VMGoodInfo", "status = 1 AND org_id = ?", orgID).Preload("GoodsType", "status = 1 AND (org_id = ? OR org_id = 0) ", orgID).Where("status = 1 AND user_org_id = ? AND record_date = ?  AND count > 0 ", orgID, scheduleDate)
1500 1530
 		}).
1501 1531
 		Preload("AutomaticReduceDetail", func(db *gorm.DB) *gorm.DB {
1502
-			return db.Preload("VMGoodInfo", "status = 1 AND org_id = ? ", orgID).Preload("GoodsType", "status = 1 AND (org_id = ? OR org_id = 0)  ", orgID).Where("status = 1 AND org_id = ? AND count > 0 AND record_time >= ? AND record_time <= ?  ", orgID, scheduleDate, end_time)
1532
+			return db.Preload("VMGoodInfo", "status = 1 AND org_id = ? ", orgID).Preload("GoodsType", "status = 1 AND (org_id = ? OR org_id = 0)  ", orgID).Where("status = 1 AND org_id = ? AND count > 0 AND record_time >= ? AND record_time <= ?  ", orgID, scheduleDate, end_time).Group("patient_id,good_id")
1503 1533
 		}).Where("sch.status = 1 AND sch.user_org_id = ?", orgID)
1504 1534
 	if scheduleDate != 0 {
1505 1535
 		db = db.Where("schedule_date = ?", scheduleDate)
@@ -1680,3 +1710,19 @@ func GetHisDoctorConfig(orgid int64) (models.XtHisConfig, error) {
1680 1710
 	err := XTReadDB().Model(&config).Where("user_org_id = ? and status =1", orgid).Find(&config).Error
1681 1711
 	return config, err
1682 1712
 }
1713
+
1714
+func GetHisDoctorPatientById(orgid int64, patientid int64, recordtime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
1715
+
1716
+	db := XTReadDB().Table("his_doctor_advice_info as x").Where("x.status = 1")
1717
+	if orgid > 0 {
1718
+		db = db.Where("x.user_org_id = ?", orgid)
1719
+	}
1720
+	if patientid > 0 {
1721
+		db = db.Where("x.patient_id =?", patientid)
1722
+	}
1723
+	if recordtime > 0 {
1724
+		db = db.Where("x.advice_date = ?", recordtime)
1725
+	}
1726
+	err = db.Select("x.id,x.user_org_id,x.patient_id,x.his_patient_id,x.advice_type,x.advice_date,x.start_time,x.advice_name,x.advice_desc,x.reminder_date,x.single_dose,x.single_dose_unit,x.single_dose_unit,x.prescribing_number_unit,x.prescribing_number,x.delivery_way,x.execution_frequency,x.advice_doctor,x.status,x.advice_affirm,x.remark,x.stop_time,x.stop_reason,x.stop_doctor,x.stop_state,x.parent_id,x.execution_time,x.execution_staff,x.checker,x.record_date,x.dialysis_order_id,x.check_time,x.check_state,x.drug_spec,x.drug_spec_unit,x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.template_id,x.modifier,x.drug_id,x.price,x.prescription_id,x.med_list_codg,x.feedetl_sn,x.day").Find(&advice).Error
1727
+	return advice, err
1728
+}

+ 66 - 23
service/patient_service.go 查看文件

@@ -82,9 +82,9 @@ func GetAllPatientList(orgID int64) (patients []*models.Patients, total int64, e
82 82
 
83 83
 func GetPatientListByUpdateTime(orgID int64, syncTime int64) (patients []*models.PatientListForFaceList, total int64, err error) {
84 84
 	db := readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=?  AND  status=1  AND  avatar <> 'https://images.shengws.com/201809182128222.png' AND avatar <> 'https://images.shengws.com/201809182128111.png' AND avatar <> ''", orgID)
85
-	
86
-		db = db.Where("updated_time >= ?", syncTime)
87
-	
85
+
86
+	db = db.Where("updated_time >= ?", syncTime)
87
+
88 88
 	err = db.Count(&total).Find(&patients).Error
89 89
 	return
90 90
 }
@@ -1013,28 +1013,58 @@ func GetPatientScheduleList(orgID int64, patientID int64, page int64, limit int6
1013 1013
 	return
1014 1014
 }
1015 1015
 
1016
-func GetMonitorRecord(orgID int64, date int64, partition int64) ([]*models.NewVMMonitorDialysisSchedule, error) {
1016
+func GetMonitorRecord(orgID int64, date int64, partition int64, patientId int64) ([]*models.NewVMMonitorDialysisSchedule, error) {
1017 1017
 	var mds []*models.NewVMMonitorDialysisSchedule
1018
-	db := readDb.
1019
-		Model(&models.NewVMMonitorDialysisSchedule{}).
1020
-		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
1021
-		Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
1022
-		Preload("TreatmentMode", "status = 1").
1023
-		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, date).
1024
-		Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ?", orgID, date).
1025
-		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ? ", orgID, date).
1026
-		Preload("MonitoringRecord", "status = 1 AND  user_org_id = ? AND monitoring_date = ?", orgID, date).
1027
-		Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, date).
1028
-		Preload("DialysisOrder.DeviceNumber", "status = 1 AND  org_id = ?", orgID).
1029
-		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
1030
-		Where("status = 1 AND user_org_id = ?", orgID)
1031
-	if date != 0 {
1032
-		db = db.Where("schedule_date = ? ", date)
1033
-	}
1034
-	if partition != 0 {
1035
-		db = db.Where("partition_id = ? ", partition)
1018
+
1019
+	if patientId == 0 {
1020
+		db := readDb.
1021
+			Model(&models.NewVMMonitorDialysisSchedule{}).
1022
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
1023
+			Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
1024
+			Preload("TreatmentMode", "status = 1").
1025
+			Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, date).
1026
+			Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ?", orgID, date).
1027
+			Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND assessment_date = ? ", orgID, date).
1028
+			Preload("MonitoringRecord", "status = 1 AND  user_org_id = ? AND monitoring_date = ?", orgID, date).
1029
+			Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, date).
1030
+			Preload("DialysisOrder.DeviceNumber", "status = 1 AND  org_id = ?", orgID).
1031
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
1032
+			Where("status = 1 AND user_org_id = ?", orgID)
1033
+		if date != 0 {
1034
+			db = db.Where("schedule_date = ? ", date)
1035
+		}
1036
+		if partition != 0 {
1037
+			db = db.Where("partition_id = ? ", partition)
1038
+		}
1039
+		err := db.Find(&mds).Error
1040
+		fmt.Println("err", err)
1041
+	}
1042
+
1043
+	if patientId > 0 {
1044
+		db := readDb.Table("xt_schedule as x").Where("x.status = 1")
1045
+		db = db.
1046
+			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
1047
+			Preload("TreatmentMode", "status = 1").
1048
+			Preload("Prescription", "status = 1 AND user_org_id = ? AND patient_id = ?", orgID, patientId).
1049
+			Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ? AND patient_id = ?", orgID, patientId).
1050
+			Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ? AND patient_id = ? ", orgID, patientId).
1051
+			Preload("MonitoringRecord", "status = 1 AND  user_org_id = ?  AND patient_id = ?", orgID, patientId).
1052
+			Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND patient_id = ?", orgID, patientId).
1053
+			Preload("DialysisOrder.DeviceNumber", "status = 1 AND  org_id = ?", orgID).
1054
+			Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID).
1055
+			Where("status = 1 AND user_org_id = ?", orgID)
1056
+		if partition != 0 {
1057
+			db = db.Where("partition_id = ? ", partition)
1058
+		}
1059
+
1060
+		db = db.Where("schedule_date <= ? ", time.Now().Unix())
1061
+
1062
+		db = db.Where("patient_id = ?", patientId)
1063
+		db = db.Order("schedule_date desc")
1064
+		err := db.Find(&mds).Error
1065
+		fmt.Println("err", err)
1036 1066
 	}
1037
-	err := db.Find(&mds).Error
1067
+
1038 1068
 	return mds, err
1039 1069
 }
1040 1070
 
@@ -1424,3 +1454,16 @@ func CreateHisGroupAdvice(orgId int64, advices []*models.HisGroupAdvice, groupNo
1424 1454
 	tx.Commit()
1425 1455
 	return
1426 1456
 }
1457
+
1458
+func GetDialysisCount(orgid int64, partitionid int64) (order []*models.BloodDialysisOrderCount, err error) {
1459
+
1460
+	db := XTReadDB().Table("xt_dialysis_order as o")
1461
+	if partitionid == 0 {
1462
+		db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule as x on x.patient_id = o.patient_id where o.status =1 and o.user_org_id = ? and  x.schedule_date = o.dialysis_date and x.status = 1", orgid).Group("o.patient_id").Scan(&order)
1463
+	}
1464
+
1465
+	if partitionid > 0 {
1466
+		db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule as x on x.patient_id = o.patient_id where o.status =1  and o.user_org_id = ? and x.partition_id = ? and  x.schedule_date = o.dialysis_date and x.status = 1", orgid, partitionid).Group("o.patient_id").Scan(&order)
1467
+	}
1468
+	return order, err
1469
+}

+ 72 - 7
service/stock_service.go 查看文件

@@ -1155,11 +1155,20 @@ func FindAllStockInfo(orgId int64, page int64, limit int64, keyword string, star
1155 1155
 
1156 1156
 	db := readDb.Model(&models.StockInfo{})
1157 1157
 	if startime > 0 {
1158
+
1158 1159
 		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
1159 1160
 			return db.Where("org_id = ? AND status = 1 and sys_record_time>=?", orgId, startime)
1160 1161
 		})
1161 1162
 	}
1163
+
1164
+	if startime == 0 || endtime == 0 {
1165
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
1166
+			return db.Where("org_id = ? AND status = 1", orgId)
1167
+		})
1168
+	}
1169
+
1162 1170
 	if endtime > 0 {
1171
+
1163 1172
 		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
1164 1173
 			return db.Where("org_id = ? AND status = 1 and sys_record_time<=?", orgId, endtime)
1165 1174
 		})
@@ -1167,19 +1176,36 @@ func FindAllStockInfo(orgId int64, page int64, limit int64, keyword string, star
1167 1176
 
1168 1177
 	db = db.Where("xt_good_information.org_id = ? AND xt_good_information.status = 1", orgId)
1169 1178
 	db = db.Group("xt_good_information.id")
1170
-	db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1171
-		return db.Where("org_id = ? AND status = 1", orgId)
1172
-	})
1179
+	if startime == 0 || endtime == 0 {
1180
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1181
+			return db.Where("org_id = ? AND status = 1", orgId)
1182
+		})
1183
+	}
1184
+
1185
+	if startime > 0 {
1186
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1187
+			return db.Where("org_id = ? AND status = 1 and ctime >= ?", orgId, startime)
1188
+		})
1189
+	}
1190
+
1191
+	if endtime > 0 {
1192
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1193
+			return db.Where("org_id = ? AND status = 1 and ctime>=? and ctime <= ?", orgId, startime, endtime)
1194
+		})
1195
+	}
1173 1196
 
1174 1197
 	db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
1175 1198
 
1176 1199
 	if startime == 0 || endtime == 0 {
1177
-		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
1178
-			return db.Where("org_id = ? AND status = 1", orgId)
1179
-		})
1200
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
1201
+	}
1202
+	if startime > 0 {
1203
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1 and ctime >=?", orgId, startime)
1204
+	}
1205
+	if endtime > 0 {
1206
+		db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1 and ctime >=? and ctime<=?", orgId, startime, endtime)
1180 1207
 	}
1181 1208
 
1182
-	db = db.Preload("QueryCancelStockInfo", "org_id = ? AND status = 1", orgId)
1183 1209
 	db = db.Preload("GoodsType", "org_id = ? AND status = 1", orgId)
1184 1210
 
1185 1211
 	if len(keyword) > 0 {
@@ -2098,3 +2124,42 @@ func GetStockType(orgid int64) (goodstype []*models.GoodsTypeOne, err error) {
2098 2124
 		Preload("GoodInfo", "org_id = ? and status = 1", orgid).Find(&goodstype).Error
2099 2125
 	return goodstype, err
2100 2126
 }
2127
+
2128
+func GetDialyStockOut(orgid int64, recordtime int64, patientId int64) (prepare []*models.XtDialysisBeforePrepare, err error) {
2129
+
2130
+	db := XTReadDB().Table("dialysis_before_prepare as x").Where("x.status = 1")
2131
+	if orgid > 0 {
2132
+		db = db.Where("x.user_org_id = ?", orgid)
2133
+	}
2134
+	if recordtime > 0 {
2135
+		db = db.Where("x.record_date = ?", recordtime)
2136
+	}
2137
+	if patientId > 0 {
2138
+		db = db.Where("x.patient_id = ?", patientId)
2139
+	}
2140
+	err = db.Select("x.id,x.user_org_id,x.patient_id,x.record_date,x.good_id,x.good_type_id,x.count,x.commdity_code,t.specification_name").Joins("left join xt_good_information as t on t.id = x.good_id and t.org_id = ? and t.status = 1", orgid).Scan(&prepare).Error
2141
+	return prepare, err
2142
+}
2143
+
2144
+func GetAutoReduceRecordInfoById(orgid int64, recordtime int64, goodid int64, goodtypeid int64) (*models.XtAutomaticReduceDetail, error) {
2145
+
2146
+	detail := models.XtAutomaticReduceDetail{}
2147
+	err := XTReadDB().Model(&detail).Where("org_id = ? and record_time = ? and good_id = ? and good_type_id = ? and status =1", orgid, recordtime, goodid, goodtypeid).Find(&detail).Error
2148
+	if err == gorm.ErrRecordNotFound {
2149
+		return nil, err
2150
+	}
2151
+
2152
+	if err != nil {
2153
+		return nil, err
2154
+	}
2155
+
2156
+	return &detail, nil
2157
+}
2158
+
2159
+func GetOutStockTotalCount(wareouttime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
2160
+
2161
+	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 `status` = 1)  as b GROUP BY good_id", orgid, wareouttime).Scan(&autoMatic).Error
2162
+
2163
+	return autoMatic, err
2164
+
2165
+}