Browse Source

历史排班

28169 10 months ago
parent
commit
19968668bf

+ 5 - 5
controllers/base_api_controller.go View File

73
 		var userAdmin models.AdminUser
73
 		var userAdmin models.AdminUser
74
 		userAdmin.Id = 16919
74
 		userAdmin.Id = 16919
75
 		userAdmin.Mobile = "15717313968"
75
 		userAdmin.Mobile = "15717313968"
76
-		userAdmin.Id = 16919 //4,809
76
+		userAdmin.Id = 10612 //4,809
77
 		userAdmin.Mobile = "12222222222"
77
 		userAdmin.Mobile = "12222222222"
78
 		userAdmin.IsSuperAdmin = true
78
 		userAdmin.IsSuperAdmin = true
79
 		userAdmin.Status = 1
79
 		userAdmin.Status = 1
81
 		userAdmin.ModifyTime = 1530786071
81
 		userAdmin.ModifyTime = 1530786071
82
 		var subscibe models.ServeSubscibe
82
 		var subscibe models.ServeSubscibe
83
 		subscibe.ID = 11
83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10612 //机构id 10344
84
+		subscibe.OrgId = 10460 //机构id 10344
85
 		subscibe.PeriodStart = 1547447814
85
 		subscibe.PeriodStart = 1547447814
86
 		subscibe.PeriodEnd = 1550039814
86
 		subscibe.PeriodEnd = 1550039814
87
 		subscibe.State = 1
87
 		subscibe.State = 1
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
 		subscibes[4] = &subscibe
92
 		subscibes[4] = &subscibe
93
 		var adminUserInfo service.AdminUserInfo
93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10612 //机构id小英9675或4
94
+		adminUserInfo.CurrentOrgId = 10460 //机构id小英9675或4
95
 		adminUserInfo.CurrentAppId = 17282 //4
95
 		adminUserInfo.CurrentAppId = 17282 //4
96
 		adminUserInfo.AdminUser = &userAdmin
96
 		adminUserInfo.AdminUser = &userAdmin
97
 		adminUserInfo.Subscibes = subscibes
97
 		adminUserInfo.Subscibes = subscibes
326
 		userAdmin.ModifyTime = 1530786071
326
 		userAdmin.ModifyTime = 1530786071
327
 		var subscibe models.ServeSubscibe
327
 		var subscibe models.ServeSubscibe
328
 		subscibe.ID = 11
328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10612 //机构id小英10344或4
329
+		subscibe.OrgId = 10460 //机构id小英10344或4
330
 		subscibe.PeriodStart = 1538035409
330
 		subscibe.PeriodStart = 1538035409
331
 		subscibe.PeriodEnd = 1569571409
331
 		subscibe.PeriodEnd = 1569571409
332
 		subscibe.State = 1
332
 		subscibe.State = 1
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
 		subscibes[4] = &subscibe
337
 		subscibes[4] = &subscibe
338
 		var adminUserInfo service.AdminUserInfo
338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10612 //机构id小英9675或4
339
+		adminUserInfo.CurrentOrgId = 10460 //机构id小英9675或4
340
 		adminUserInfo.CurrentAppId = 17282 //4
340
 		adminUserInfo.CurrentAppId = 17282 //4
341
 		adminUserInfo.AdminUser = &userAdmin
341
 		adminUserInfo.AdminUser = &userAdmin
342
 		adminUserInfo.Subscibes = subscibes
342
 		adminUserInfo.Subscibes = subscibes

+ 1 - 0
controllers/dialysis_api_controller.go View File

2149
 	assessment.AccumulatedBloodVolume = data.AccumulatedBloodVolume
2149
 	assessment.AccumulatedBloodVolume = data.AccumulatedBloodVolume
2150
 	assessment.TransfusionVolume = data.TransfusionVolume
2150
 	assessment.TransfusionVolume = data.TransfusionVolume
2151
 	assessment.Condenser = data.Condenser
2151
 	assessment.Condenser = data.Condenser
2152
+	assessment.LastAfterWeight = data.LastAfterWeight
2152
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
2153
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
2153
 
2154
 
2154
 	if assessment.ID > 0 {
2155
 	if assessment.ID > 0 {

+ 12 - 2
controllers/doctor_schedule_api_controller.go View File

38
 	beego.Router("/api/schedule/changeoption", &DoctorScheduleApiController{}, "Get:ChangeOption")
38
 	beego.Router("/api/schedule/changeoption", &DoctorScheduleApiController{}, "Get:ChangeOption")
39
 	beego.Router("/api/schedule/getchartlist", &DoctorScheduleApiController{}, "Get:GetChartlist")
39
 	beego.Router("/api/schedule/getchartlist", &DoctorScheduleApiController{}, "Get:GetChartlist")
40
 
40
 
41
+	beego.Router("/api/deletestaffschedulebyid", &DoctorScheduleApiController{}, "Get:DeleteStaffScheduleById")
42
+
41
 }
43
 }
42
 
44
 
43
 func (this *DoctorScheduleApiController) SaveDoctorSchedules() {
45
 func (this *DoctorScheduleApiController) SaveDoctorSchedules() {
335
 func (this *DoctorScheduleApiController) GetStaffScheduleList() {
337
 func (this *DoctorScheduleApiController) GetStaffScheduleList() {
336
 
338
 
337
 	start_time, _ := this.GetInt64("start_time")
339
 	start_time, _ := this.GetInt64("start_time")
338
-	fmt.Println("start_time", start_time)
339
 	end_time, _ := this.GetInt64("end_time")
340
 	end_time, _ := this.GetInt64("end_time")
340
-	fmt.Println("end_time", end_time)
341
 	orgId := this.GetAdminUserInfo().CurrentOrgId
341
 	orgId := this.GetAdminUserInfo().CurrentOrgId
342
 	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
342
 	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
343
 	if err != nil {
343
 	if err != nil {
656
 		"workDaylist": workDaylist,
656
 		"workDaylist": workDaylist,
657
 	})
657
 	})
658
 }
658
 }
659
+
660
+func (this *DoctorScheduleApiController) DeleteStaffScheduleById() {
661
+
662
+	id, _ := this.GetInt64("id")
663
+	orgId := this.GetAdminUserInfo().CurrentOrgId
664
+	service.DeleteStaffScheduleById(id, orgId)
665
+	this.ServeSuccessJSON(map[string]interface{}{
666
+		"msg": "ok",
667
+	})
668
+}

+ 8 - 8
controllers/inspection_api_controller.go View File

152
 	referenceMap := make(map[string]*models.InspectionReferenceMap, 0)
152
 	referenceMap := make(map[string]*models.InspectionReferenceMap, 0)
153
 
153
 
154
 	for _, reference := range references {
154
 	for _, reference := range references {
155
-		if _, exist := referenceMap[reference.Project]; !exist {
156
-			referenceMap[reference.Project] = new(models.InspectionReferenceMap)
157
-			referenceMap[reference.Project].Project = reference.Project
158
-			referenceMap[reference.Project].ProjectId = reference.ProjectId
159
-			referenceMap[reference.Project].ProjectName = reference.ProjectName
155
+		if _, exist := referenceMap[reference.ProjectName]; !exist {
156
+			referenceMap[reference.ProjectName] = new(models.InspectionReferenceMap)
157
+			referenceMap[reference.ProjectName].Project = reference.Project
158
+			referenceMap[reference.ProjectName].ProjectId = reference.ProjectId
159
+			referenceMap[reference.ProjectName].ProjectName = reference.ProjectName
160
 			if _, cexit := countsMap[reference.ProjectId]; cexit {
160
 			if _, cexit := countsMap[reference.ProjectId]; cexit {
161
-				referenceMap[reference.Project].Count = countsMap[reference.ProjectId]
161
+				referenceMap[reference.ProjectName].Count = countsMap[reference.ProjectId]
162
 			}
162
 			}
163
-			referenceMap[reference.Project].InspectionReference = make([]models.InspectionReference, 0)
163
+			referenceMap[reference.ProjectName].InspectionReference = make([]models.InspectionReference, 0)
164
 		}
164
 		}
165
-		referenceMap[reference.Project].InspectionReference = append(referenceMap[reference.Project].InspectionReference, *reference)
165
+		referenceMap[reference.ProjectName].InspectionReference = append(referenceMap[reference.ProjectName].InspectionReference, *reference)
166
 
166
 
167
 	}
167
 	}
168
 
168
 

+ 34 - 2
controllers/mobile_api_controllers/check_weight_api_controller.go View File

545
 					lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
545
 					lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
546
 					newprescribe.Remark = lastDialysisPrescription.Remark
546
 					newprescribe.Remark = lastDialysisPrescription.Remark
547
 				}
547
 				}
548
-				err := service.AddSigleRecord(&newprescribe)
549
-
548
+				//err := service.AddSigleRecord(&newprescribe)
549
+				var err error
550
+				if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10599 {
551
+					prescriptionTwenty, _ := service.GetLastDialysisPrescriptionTwenty(newprescribe.PatientId, newprescribe.RecordDate, newprescribe.UserOrgId)
552
+					if prescriptionTwenty.ID == 0 {
553
+						//插入透析处方
554
+						service.AddSigleRecord(&newprescribe)
555
+					} else {
556
+						//插入透析处方
557
+						service.UpdateAddSigleRecord(prescriptionTwenty.ID, newprescribe.TargetUltrafiltration)
558
+					}
559
+				} else {
560
+					//插入透析处方
561
+					err = service.AddSigleRecord(&newprescribe)
562
+				}
550
 				//记录日志
563
 				//记录日志
551
 				byterequest, _ := json.Marshal(newprescribe)
564
 				byterequest, _ := json.Marshal(newprescribe)
552
 				prescriptionLog := models.XtDialysisPrescriptionLog{
565
 				prescriptionLog := models.XtDialysisPrescriptionLog{
1246
 	switch sc["mode"] {
1259
 	switch sc["mode"] {
1247
 	case 1:
1260
 	case 1:
1248
 		sc["mode"] = "HD"
1261
 		sc["mode"] = "HD"
1262
+		break
1249
 	case 2:
1263
 	case 2:
1250
 		sc["mode"] = "HDF"
1264
 		sc["mode"] = "HDF"
1265
+		break
1251
 	case 3:
1266
 	case 3:
1252
 		sc["mode"] = "HD+HP"
1267
 		sc["mode"] = "HD+HP"
1268
+		break
1253
 	case 4:
1269
 	case 4:
1254
 		sc["mode"] = "HP"
1270
 		sc["mode"] = "HP"
1271
+		break
1255
 	case 5:
1272
 	case 5:
1256
 		sc["mode"] = "HF"
1273
 		sc["mode"] = "HF"
1274
+		break
1257
 	case 6:
1275
 	case 6:
1258
 		sc["mode"] = "SCUF"
1276
 		sc["mode"] = "SCUF"
1277
+		break
1259
 	case 7:
1278
 	case 7:
1260
 		sc["mode"] = "IUF"
1279
 		sc["mode"] = "IUF"
1280
+		break
1261
 	case 8:
1281
 	case 8:
1262
 		sc["mode"] = "HFHD"
1282
 		sc["mode"] = "HFHD"
1283
+		break
1263
 	case 9:
1284
 	case 9:
1264
 		sc["mode"] = "HFHD+HP"
1285
 		sc["mode"] = "HFHD+HP"
1286
+		break
1265
 	case 10:
1287
 	case 10:
1266
 		sc["mode"] = "PHF"
1288
 		sc["mode"] = "PHF"
1289
+		break
1267
 	case 11:
1290
 	case 11:
1268
 		sc["mode"] = "HFR"
1291
 		sc["mode"] = "HFR"
1292
+		break
1269
 	case 12:
1293
 	case 12:
1270
 		sc["mode"] = "HDF+HP"
1294
 		sc["mode"] = "HDF+HP"
1295
+		break
1271
 	case 13:
1296
 	case 13:
1272
 		sc["mode"] = "CRRT"
1297
 		sc["mode"] = "CRRT"
1298
+		break
1273
 	case 14:
1299
 	case 14:
1274
 		sc["mode"] = "腹水回输"
1300
 		sc["mode"] = "腹水回输"
1301
+		break
1275
 	case 15:
1302
 	case 15:
1276
 		sc["mode"] = "HD前置换"
1303
 		sc["mode"] = "HD前置换"
1304
+		break
1277
 	case 16:
1305
 	case 16:
1278
 		sc["mode"] = "HD后置换"
1306
 		sc["mode"] = "HD后置换"
1307
+		break
1279
 	case 17:
1308
 	case 17:
1280
 		sc["mode"] = "HDF前置换"
1309
 		sc["mode"] = "HDF前置换"
1310
+		break
1281
 	case 18:
1311
 	case 18:
1282
 		sc["mode"] = "HDF后置换"
1312
 		sc["mode"] = "HDF后置换"
1313
+		break
1283
 	default:
1314
 	default:
1284
 		sc["mode"] = "HD"
1315
 		sc["mode"] = "HD"
1316
+		break
1285
 	}
1317
 	}
1286
 
1318
 
1287
 	// 获取患者透前干体重或者获取患者透前体重
1319
 	// 获取患者透前干体重或者获取患者透前体重

+ 18 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go View File

602
 	}
602
 	}
603
 
603
 
604
 	lastDialysisPrescription, _ := service.GetLastDialysisPrescription(patientID, adminInfo.Org.Id)
604
 	lastDialysisPrescription, _ := service.GetLastDialysisPrescription(patientID, adminInfo.Org.Id)
605
+
606
+	lastAssesmentBeforDialysis, _ := service.GetLastAssessmentBeforDialysis(patientID, adminInfo.Org.Id)
607
+
608
+	dryWeightList, _ := service.GetPatientDryList(patientID, adminInfo.Org.Id)
605
 	returnData := map[string]interface{}{
609
 	returnData := map[string]interface{}{
606
 		"patient":                        patient,
610
 		"patient":                        patient,
607
 		"schedual":                       schedual,
611
 		"schedual":                       schedual,
637
 		"lastOrder":                      lastOrder,
641
 		"lastOrder":                      lastOrder,
638
 		"remind_lists":                   remind_lists,
642
 		"remind_lists":                   remind_lists,
639
 		"lastDialysisPrescription":       lastDialysisPrescription,
643
 		"lastDialysisPrescription":       lastDialysisPrescription,
644
+		"lastAssesmentBeforDialysis":     lastAssesmentBeforDialysis,
645
+		"dryWeightList":                  dryWeightList,
640
 	}
646
 	}
641
 
647
 
642
 	this.ServeSuccessJSON(returnData)
648
 	this.ServeSuccessJSON(returnData)
1390
 	pip_coagulation := c.GetString("pip_coagulation")
1396
 	pip_coagulation := c.GetString("pip_coagulation")
1391
 	accumulated_blood_volume := c.GetString("accumulated_blood_volume")
1397
 	accumulated_blood_volume := c.GetString("accumulated_blood_volume")
1392
 	transfusion_volume := c.GetString("transfusion_volume")
1398
 	transfusion_volume := c.GetString("transfusion_volume")
1393
-
1399
+	last_after_weight := c.GetString("last_after_weight")
1394
 	if id <= 0 {
1400
 	if id <= 0 {
1395
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1401
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1396
 		return
1402
 		return
1499
 		PipCoagulation:               pip_coagulation,
1505
 		PipCoagulation:               pip_coagulation,
1500
 		AccumulatedBloodVolume:       accumulated_blood_volume,
1506
 		AccumulatedBloodVolume:       accumulated_blood_volume,
1501
 		TransfusionVolume:            transfusion_volume,
1507
 		TransfusionVolume:            transfusion_volume,
1508
+		LastAfterWeight:              last_after_weight,
1502
 	}
1509
 	}
1503
 
1510
 
1504
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1511
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
8300
 	//	})
8307
 	//	})
8301
 	//	return
8308
 	//	return
8302
 	//}
8309
 	//}
8303
-	if org_id == 9538 || org_id == 10101 {
8310
+	if org_id == 9538 || org_id == 10101 || org_id == 10353 {
8304
 		list, _ := service.GetPatientDialysisRecordList(id, startdateunix, enddateunix)
8311
 		list, _ := service.GetPatientDialysisRecordList(id, startdateunix, enddateunix)
8305
 		c.ServeSuccessJSON(map[string]interface{}{
8312
 		c.ServeSuccessJSON(map[string]interface{}{
8306
 			"list": list,
8313
 			"list": list,
10473
 	})
10480
 	})
10474
 
10481
 
10475
 }
10482
 }
10483
+
10484
+func (c *DialysisAPIController) GetLastAcceptRecrods() {
10485
+
10486
+	patient_id, _ := c.GetInt64("patient_id")
10487
+	recrods, _ := service.GetLastAcceptRecrods(patient_id)
10488
+	c.ServeSuccessJSON(map[string]interface{}{
10489
+		"recrods": recrods,
10490
+	})
10491
+}

+ 2 - 2
controllers/mobile_api_controllers/dialysis_api_controller_extend.go View File

684
 			}
684
 			}
685
 
685
 
686
 			service.CreateScheduleLog(scheduleLog)
686
 			service.CreateScheduleLog(scheduleLog)
687
-
687
+			service.UpdateRepeatSchStatus(adminUserInfo.Org.Id, scheduleDate.Unix())
688
 			redis := service.RedisClient()
688
 			redis := service.RedisClient()
689
 			timeStr := time.Now().Format("2006-01-02")
689
 			timeStr := time.Now().Format("2006-01-02")
690
 			key := "scheduals_" + timeStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
690
 			key := "scheduals_" + timeStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
763
 						AdminUserId: adminUserInfo.AdminUser.Id,
763
 						AdminUserId: adminUserInfo.AdminUser.Id,
764
 					}
764
 					}
765
 					service.CreateScheduleLog(scheduleLog)
765
 					service.CreateScheduleLog(scheduleLog)
766
+					service.UpdateRepeatSchStatus(adminUserInfo.Org.Id, scheduleDate.Unix())
766
 
767
 
767
 					redis := service.RedisClient()
768
 					redis := service.RedisClient()
768
-
769
 					timeStr := time.Now().Format("2006-01-02")
769
 					timeStr := time.Now().Format("2006-01-02")
770
 					key := "scheduals_" + timeStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
770
 					key := "scheduals_" + timeStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
771
 					redis.Set(key, "", time.Second)
771
 					redis.Set(key, "", time.Second)

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go View File

206
 
206
 
207
 	beego.Router("/m/api/getadvicelistnoexecution", &DialysisAPIController{}, "Get:GetAdviceListNoExecution")
207
 	beego.Router("/m/api/getadvicelistnoexecution", &DialysisAPIController{}, "Get:GetAdviceListNoExecution")
208
 
208
 
209
+	beego.Router("/m/api/getlastacceptrecrods", &DialysisAPIController{}, "Get:GetLastAcceptRecrods")
210
+
209
 }
211
 }

+ 3 - 1
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go View File

932
 
932
 
933
 	redis := service.RedisClient()
933
 	redis := service.RedisClient()
934
 	err = service.CreateScheduleTwo(&schedule)
934
 	err = service.CreateScheduleTwo(&schedule)
935
+	service.UpdateRepeatSchStatus(adminUserInfo.Org.Id, schedule.ScheduleDate)
935
 	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
936
 	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
936
 	redis.Set(key, "", time.Second)
937
 	redis.Set(key, "", time.Second)
937
 	defer redis.Close()
938
 	defer redis.Close()
1205
 			Module:      4,
1206
 			Module:      4,
1206
 			AdminUserId: c.GetMobileAdminUserInfo().AdminUser.Id,
1207
 			AdminUserId: c.GetMobileAdminUserInfo().AdminUser.Id,
1207
 		}
1208
 		}
1208
-
1209
+		service.UpdateRepeatSchStatus(org_id, schedule_date)
1209
 		service.CreateScheduleLog(scheduleLog)
1210
 		service.CreateScheduleLog(scheduleLog)
1210
 		if err == nil {
1211
 		if err == nil {
1211
 			c.ServeSuccessJSON(map[string]interface{}{
1212
 			c.ServeSuccessJSON(map[string]interface{}{
1246
 		}
1247
 		}
1247
 		var err error
1248
 		var err error
1248
 		err = service.CreateSchedule(&xtSchedule, id)
1249
 		err = service.CreateSchedule(&xtSchedule, id)
1250
+		service.UpdateRepeatSchStatus(org_id, schedule_date)
1249
 		//记录日志
1251
 		//记录日志
1250
 		byterequest, _ := json.Marshal(schedule)
1252
 		byterequest, _ := json.Marshal(schedule)
1251
 		scheduleLog := models.XtScheduleLog{
1253
 		scheduleLog := models.XtScheduleLog{

+ 120 - 0
controllers/self_drug_api_congtroller.go View File

120
 
120
 
121
 	//康允新版本
121
 	//康允新版本
122
 	beego.Router("/api/stock/getpurchaseDrugQueryList", &SelfDrugApiController{}, "Get:GetPurchaseDrugQueryList")
122
 	beego.Router("/api/stock/getpurchaseDrugQueryList", &SelfDrugApiController{}, "Get:GetPurchaseDrugQueryList")
123
+
124
+	beego.Router("/api/stock/getpurchasestockquerylist", &SelfDrugApiController{}, "Get:GetPurchaseStockQueryList")
123
 }
125
 }
124
 
126
 
125
 func (this *SelfDrugApiController) GetCurrentPatient() {
127
 func (this *SelfDrugApiController) GetCurrentPatient() {
4255
 		"drugTypeList":     drugTypeList,
4257
 		"drugTypeList":     drugTypeList,
4256
 	})
4258
 	})
4257
 }
4259
 }
4260
+
4261
+func (this *SelfDrugApiController) GetPurchaseStockQueryList() {
4262
+
4263
+	good_type, _ := this.GetInt64("good_type")
4264
+
4265
+	keyword := this.GetString("keyword")
4266
+
4267
+	page, _ := this.GetInt64("page")
4268
+
4269
+	limit, _ := this.GetInt64("limit")
4270
+
4271
+	start_time := this.GetString("start_time")
4272
+	end_time := this.GetString("end_time")
4273
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4274
+	timeLayout := "2006-01-02"
4275
+	loc, _ := time.LoadLocation("Local")
4276
+	var startTime int64
4277
+
4278
+	if len(start_time) > 0 {
4279
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
4280
+		if err != nil {
4281
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4282
+			return
4283
+		}
4284
+		startTime = theTime.Unix()
4285
+	}
4286
+
4287
+	var endTime int64
4288
+	if len(end_time) > 0 {
4289
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
4290
+		if err != nil {
4291
+			utils.ErrorLog(err.Error())
4292
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4293
+			return
4294
+		}
4295
+		endTime = theTime.Unix()
4296
+	}
4297
+	var ids []int64
4298
+	var goodIds []int64
4299
+	infoList, _ := service.GetGoodWarehouseInfoByOrgIdTwo(orgId)
4300
+	for _, it := range infoList {
4301
+		goodIds = append(goodIds, it.GoodId)
4302
+	}
4303
+
4304
+	manufacturers, _ := service.GetManufacturerListByKeyword(orgId, keyword)
4305
+	for _, it := range manufacturers {
4306
+		ids = append(ids, it.ID)
4307
+	}
4308
+	manufacturerList, _ := service.GetNewAllManufacturerList(orgId)
4309
+
4310
+	list, total, err := service.GetPurchaseStockQueryList(good_type, keyword, page, limit, orgId, ids, goodIds)
4311
+	storeConfig, _ := service.GetAllStoreHouseConfig(orgId)
4312
+	for _, item := range list {
4313
+
4314
+		//获取期初结余
4315
+		low, _ := service.GetStartLastFLow(item.ID, orgId, startTime, storeConfig.StorehouseOutInfo)
4316
+
4317
+		item.GoodStartFlowInfo = low
4318
+
4319
+		//获取期末结余
4320
+		flow, _ := service.GetEndLastFlow(item.ID, orgId, endTime, storeConfig.StorehouseOutInfo)
4321
+
4322
+		item.GoodEndFlowInfo = flow
4323
+
4324
+		//获取期间增加
4325
+		goodWarehouseInfoList, _ := service.GetAddGoodWarehouseInfoList(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
4326
+
4327
+		for _, it := range goodWarehouseInfoList {
4328
+			item.WarehousingInfoOne = append(item.WarehousingInfoOne, it)
4329
+		}
4330
+
4331
+		//获取本期增加
4332
+		WarehouseInfoFlowList, _ := service.GetAddStartFlow(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
4333
+
4334
+		for _, it := range WarehouseInfoFlowList {
4335
+			item.StartFlowWarehouseInfo = append(item.StartFlowWarehouseInfo, it)
4336
+		}
4337
+		//获取本期减少
4338
+		reduceWarehouseInfoList, _ := service.GetReduceWarehouseInfoList(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
4339
+		for _, it := range reduceWarehouseInfoList {
4340
+			item.WarehouseOutInfoStart = append(item.WarehouseOutInfoStart, it)
4341
+		}
4342
+
4343
+		//获取期中减少退库
4344
+		lowInfo, _ := service.GetStartEndCancelFLowInfo(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
4345
+		for _, it := range lowInfo {
4346
+			item.StartEndCancelFLowInfo = append(item.StartEndCancelFLowInfo, it)
4347
+		}
4348
+		//
4349
+		outInfo, _ := service.FindeWarehouseOutInfo(item.ID, orgId, startTime, storeConfig.StorehouseOutInfo)
4350
+		for _, it := range outInfo {
4351
+			item.WarehouseOutInfoEnd = append(item.WarehouseOutInfoEnd, it)
4352
+		}
4353
+
4354
+		//期中盘盈
4355
+		profit, _ := service.FindeEndStokInventoryProfit(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
4356
+		for _, it := range profit {
4357
+			item.WareStartEndStockInventoryProfit = append(item.WareStartEndStockInventoryProfit, it)
4358
+		}
4359
+		//期中盘亏
4360
+		losses, _ := service.FindeEndStockInventoryLosses(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
4361
+		for _, it := range losses {
4362
+			item.WareStartEndStockInventoryLosses = append(item.WareStartEndStockInventoryLosses, it)
4363
+		}
4364
+	}
4365
+
4366
+	if err != nil {
4367
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取患者信息失败")
4368
+		return
4369
+	}
4370
+
4371
+	this.ServeSuccessJSON(map[string]interface{}{
4372
+		"list":             list,
4373
+		"manufacturerList": manufacturerList,
4374
+		"total":            total,
4375
+	})
4376
+
4377
+}

+ 1 - 0
models/dialysis.go View File

657
 	AccumulatedBloodVolume          string  `gorm:"column:accumulated_blood_volume" json:"accumulated_blood_volume" form:"accumulated_blood_volume"`
657
 	AccumulatedBloodVolume          string  `gorm:"column:accumulated_blood_volume" json:"accumulated_blood_volume" form:"accumulated_blood_volume"`
658
 	TransfusionVolume               string  `gorm:"column:transfusion_volume" json:"transfusion_volume" form:"transfusion_volume"`
658
 	TransfusionVolume               string  `gorm:"column:transfusion_volume" json:"transfusion_volume" form:"transfusion_volume"`
659
 	Condenser                       string  `gorm:"column:condenser" json:"condenser" form:"condenser"`
659
 	Condenser                       string  `gorm:"column:condenser" json:"condenser" form:"condenser"`
660
+	LastAfterWeight                 string  `gorm:"column:last_after_weight" json:"last_after_weight" form:"last_after_weight"`
660
 }
661
 }
661
 
662
 
662
 func (AssessmentAfterDislysis) TableName() string {
663
 func (AssessmentAfterDislysis) TableName() string {

+ 1 - 0
models/drug_stock.go View File

456
 	XtDrugWarehouseOutInfo    XtDrugWarehouseOutInfo `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseOutDetailId"json:"xt_drug_warehouse_out_info" `
456
 	XtDrugWarehouseOutInfo    XtDrugWarehouseOutInfo `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseOutDetailId"json:"xt_drug_warehouse_out_info" `
457
 	OrderId                   int64                  `gorm:"column:order_id" json:"order_id" form:"order_id"`
457
 	OrderId                   int64                  `gorm:"column:order_id" json:"order_id" form:"order_id"`
458
 	FlushOverCount            int64                  `gorm:"column:flush_over_count" json:"flush_over_count" form:"flush_over_count"`
458
 	FlushOverCount            int64                  `gorm:"column:flush_over_count" json:"flush_over_count" form:"flush_over_count"`
459
+	Remark                    string                 `gorm:"column:remark" json:"remark" form:"remark"`
459
 }
460
 }
460
 
461
 
461
 func (DrugFlow) TableName() string {
462
 func (DrugFlow) TableName() string {

+ 1 - 0
models/stock_models.go View File

678
 	IsCheck                   int64           `gorm:"column:is_check" json:"is_check" form:"is_check"`
678
 	IsCheck                   int64           `gorm:"column:is_check" json:"is_check" form:"is_check"`
679
 	OverCount                 int64           `gorm:"column:over_count" json:"over_count" form:"over_count"`
679
 	OverCount                 int64           `gorm:"column:over_count" json:"over_count" form:"over_count"`
680
 	OrderId                   int64           `gorm:"column:order_id" json:"order_id" form:"order_id"`
680
 	OrderId                   int64           `gorm:"column:order_id" json:"order_id" form:"order_id"`
681
+	Remark                    string          `gorm:"column:remark" json:"remark" form:"remark"`
681
 }
682
 }
682
 
683
 
683
 func (VmStockFlow) TableName() string {
684
 func (VmStockFlow) TableName() string {

+ 6 - 0
service/dialysis_parameter_service.go View File

332
 	return evaluation, err
332
 	return evaluation, err
333
 }
333
 }
334
 
334
 
335
+func GetPatientDryList(patientid int64, orgid int64) (dryweight []*models.SgjPatientDryweight, err error) {
336
+
337
+	err = XTReadDB().Where("patient_id =? and user_org_id =? and status=1", patientid, orgid).Order("ctime desc").Limit(6).Find(&dryweight).Error
338
+	return dryweight, err
339
+}
340
+
335
 func GetDialysisPrescriptionList(patientid int64, orgid int64, startime int64) (models.DialysisPrescriptionParameter, error) {
341
 func GetDialysisPrescriptionList(patientid int64, orgid int64, startime int64) (models.DialysisPrescriptionParameter, error) {
336
 	prescription := models.DialysisPrescriptionParameter{}
342
 	prescription := models.DialysisPrescriptionParameter{}
337
 	err := XTReadDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ?", patientid, orgid, startime).Find(&prescription).Error
343
 	err := XTReadDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ?", patientid, orgid, startime).Find(&prescription).Error

+ 1 - 1
service/dialysis_service.go View File

224
 
224
 
225
 func UpdateAddSigleRecord(id int64, target_ultrafiltration float64) error {
225
 func UpdateAddSigleRecord(id int64, target_ultrafiltration float64) error {
226
 
226
 
227
-	err := XTWriteDB().Model(&models.DialysisPrescription{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"target_ultrafiltration": target_ultrafiltration}).Error
227
+	err := XTWriteDB().Model(&models.DialysisPrescription{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"target_ultrafiltration": target_ultrafiltration, "prescription_water": target_ultrafiltration}).Error
228
 	return err
228
 	return err
229
 }
229
 }
230
 
230
 

+ 8 - 0
service/doctor_schedule_service.go View File

818
 
818
 
819
 	return schedule, err
819
 	return schedule, err
820
 }
820
 }
821
+
822
+func DeleteStaffScheduleById(id int64, user_org_id int64) (err error) {
823
+
824
+	schedule := models.StaffSchedule{}
825
+
826
+	err = XTWriteDB().Model(&schedule).Where("id = ? and user_org_id =? and status=1", id, user_org_id).Updates(map[string]interface{}{"status": 0}).Error
827
+	return err
828
+}

+ 7 - 0
service/patient_service.go View File

3397
 	err := XTReadDB().Where("patient_id = ? and dialysis_date = ? and status = 1", patient_id, recordDate).Last(&order).Error
3397
 	err := XTReadDB().Where("patient_id = ? and dialysis_date = ? and status = 1", patient_id, recordDate).Last(&order).Error
3398
 	return order, err
3398
 	return order, err
3399
 }
3399
 }
3400
+
3401
+func GetLastAcceptRecrods(patient_id int64) (models.ReceiveTreatmentAsses, error) {
3402
+
3403
+	treatmentAsses := models.ReceiveTreatmentAsses{}
3404
+	err := XTReadDB().Where("patient_id = ? and status= 1 and admission_number!=''", patient_id).Last(&treatmentAsses).Error
3405
+	return treatmentAsses, err
3406
+}

+ 2 - 2
service/pharmacy_service.go View File

891
 
891
 
892
 func GetHisPatientNoMedical(user_org_id int64, patient_id int64, startime int64, end_time int64) (advice []*models.HisDoctorAdviceInfo, err error) {
892
 func GetHisPatientNoMedical(user_org_id int64, patient_id int64, startime int64, end_time int64) (advice []*models.HisDoctorAdviceInfo, err error) {
893
 
893
 
894
-	err = XTReadDB().Where("user_org_id =? and patient_id = ? and advice_date>=? and advice_date<=? and is_medicine =0", user_org_id, patient_id, startime, end_time).Find(&advice).Error
894
+	err = XTReadDB().Where("user_org_id =? and patient_id = ? and advice_date>=? and advice_date<=? and is_medicine =0 and status=1", user_org_id, patient_id, startime, end_time).Find(&advice).Error
895
 	return advice, err
895
 	return advice, err
896
 }
896
 }
897
 
897
 
909
 
909
 
910
 func GetDocAdviceList(user_org_id int64, patient_id int64, startime int64, end_time int64) (advice []*models.DoctorAdvice, err error) {
910
 func GetDocAdviceList(user_org_id int64, patient_id int64, startime int64, end_time int64) (advice []*models.DoctorAdvice, err error) {
911
 
911
 
912
-	err = XTReadDB().Where("user_org_id =? and patient_id = ? and advice_date>=? and advice_date<=? and is_medicine =0", user_org_id, patient_id, startime, end_time).Find(&advice).Error
912
+	err = XTReadDB().Where("user_org_id =? and patient_id = ? and advice_date>=? and advice_date<=? and is_medicine =0 and status=1", user_org_id, patient_id, startime, end_time).Find(&advice).Error
913
 	return advice, err
913
 	return advice, err
914
 
914
 
915
 }
915
 }

+ 23 - 0
service/self_drug_service.go View File

2989
 	err := XTWriteDB().Model(&models.XtDrugStockCount{}).Where("drug_id =? and storehouse_id =? and status=1 and user_org_id =?", drugId, storehouseId, user_org_id).Update(map[string]interface{}{"sum_act_out_count": over_count}).Error
2989
 	err := XTWriteDB().Model(&models.XtDrugStockCount{}).Where("drug_id =? and storehouse_id =? and status=1 and user_org_id =?", drugId, storehouseId, user_org_id).Update(map[string]interface{}{"sum_act_out_count": over_count}).Error
2990
 	return err
2990
 	return err
2991
 }
2991
 }
2992
+
2993
+func GetPurchaseStockQueryList(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2994
+
2995
+	db := XTReadDB().Model(&goodinfo).Where("status = 1")
2996
+	offset := (page - 1) * limit
2997
+	likeKey := "%" + keyword + "%"
2998
+	if good_type > 0 {
2999
+		db = db.Where("good_type_id = ?", good_type)
3000
+	}
3001
+
3002
+	if orgid > 0 {
3003
+		db = db.Where("org_id = ?", orgid)
3004
+	}
3005
+	if len(ids) > 0 {
3006
+		db = db.Where("id in(?)", goodIds)
3007
+	}
3008
+	if len(keyword) > 0 {
3009
+		db = db.Where("good_name like ? or manufacturer in(?)", likeKey, ids)
3010
+	}
3011
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("good_number desc").Find(&goodinfo).Error
3012
+
3013
+	return goodinfo, total, err
3014
+}

+ 4 - 0
service/warhouse_service.go View File

5586
 			IsCheck:                 1,
5586
 			IsCheck:                 1,
5587
 			OverCount:               sum_count,
5587
 			OverCount:               sum_count,
5588
 			RegisterNumber:          goods.RegisterNumber,
5588
 			RegisterNumber:          goods.RegisterNumber,
5589
+			Remark:                  goods.Remark,
5589
 		}
5590
 		}
5590
 		//创建出库流水
5591
 		//创建出库流水
5591
 		errflow := CreateStockFlowOne(stockFlow)
5592
 		errflow := CreateStockFlowOne(stockFlow)
5734
 			IsCheck:                 1,
5735
 			IsCheck:                 1,
5735
 			OverCount:               sum_count,
5736
 			OverCount:               sum_count,
5736
 			RegisterNumber:          goods.RegisterNumber,
5737
 			RegisterNumber:          goods.RegisterNumber,
5738
+			Remark:                  goods.Remark,
5737
 		}
5739
 		}
5738
 		//创建出库流水
5740
 		//创建出库流水
5739
 		errflow := CreateStockFlowOne(stockFlow)
5741
 		errflow := CreateStockFlowOne(stockFlow)
6011
 			WarehousingId:           warehouse.ID,
6013
 			WarehousingId:           warehouse.ID,
6012
 			SystemTime:              advice.SysRecordTime,
6014
 			SystemTime:              advice.SysRecordTime,
6013
 			PatientId:               advice.PatientId,
6015
 			PatientId:               advice.PatientId,
6016
+			Remark:                  advice.Remark,
6014
 		}
6017
 		}
6015
 		if warehouse.RetailPrice == 0 {
6018
 		if warehouse.RetailPrice == 0 {
6016
 			drugflow.Price = advice.Price
6019
 			drugflow.Price = advice.Price
6081
 			WarehousingDetailId:     warehouse.ID,
6084
 			WarehousingDetailId:     warehouse.ID,
6082
 			SystemTime:              advice.SysRecordTime,
6085
 			SystemTime:              advice.SysRecordTime,
6083
 			PatientId:               advice.PatientId,
6086
 			PatientId:               advice.PatientId,
6087
+			Remark:                  advice.Remark,
6084
 		}
6088
 		}
6085
 
6089
 
6086
 		CreateDrugFlowOne(drugflow)
6090
 		CreateDrugFlowOne(drugflow)