Bläddra i källkod

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

csx 3 år sedan
förälder
incheckning
513f6a1840

+ 1 - 1
conf/app.conf Visa fil

1
 appname = 血透
1
 appname = 血透
2
 httpport = 9531
2
 httpport = 9531
3
-runmode = prod
3
+runmode = dev
4
 
4
 
5
 #
5
 #
6
 copyrequestbody = true
6
 copyrequestbody = true

+ 59 - 60
controllers/base_api_controller.go Visa fil

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
-	"XT_New/models"
6
 	"XT_New/service"
5
 	"XT_New/service"
7
 	"fmt"
6
 	"fmt"
8
 	"strconv"
7
 	"strconv"
70
 func (this *BaseAuthAPIController) Prepare() {
69
 func (this *BaseAuthAPIController) Prepare() {
71
 	this.BaseAPIController.Prepare()
70
 	this.BaseAPIController.Prepare()
72
 	if this.GetAdminUserInfo() == nil {
71
 	if this.GetAdminUserInfo() == nil {
73
-		var userAdmin models.AdminUser
74
-		userAdmin.Id = 1448
75
-		userAdmin.Mobile = "13318599895"
76
-
77
-		userAdmin.Id = 597
78
-		userAdmin.Mobile = "19874122664"
79
-		userAdmin.IsSuperAdmin = false
80
-		userAdmin.Status = 1
81
-		userAdmin.CreateTime = 1530786071
82
-		userAdmin.ModifyTime = 1530786071
83
-		var subscibe models.ServeSubscibe
84
-		subscibe.ID = 1
85
-		subscibe.OrgId = 9675
86
-		subscibe.PeriodStart = 1538035409
87
-		subscibe.PeriodEnd = 1569571409
88
-		subscibe.State = 1
89
-		subscibe.Status = 1
90
-		subscibe.CreatedTime = 1538035409
91
-		subscibe.UpdatedTime = 1538035409
92
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
-		subscibes[4] = &subscibe
94
-		var adminUserInfo service.AdminUserInfo
95
-		adminUserInfo.CurrentOrgId = 9675
96
-		adminUserInfo.CurrentAppId = 4
97
-		adminUserInfo.AdminUser = &userAdmin
98
-		adminUserInfo.Subscibes = subscibes
99
-		this.SetSession("admin_user_info", &adminUserInfo)
100
-
101
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
102
-		//this.StopRun()
72
+		//var userAdmin models.AdminUser
73
+		//userAdmin.Id = 1448
74
+		//userAdmin.Mobile = "13318599895"
75
+		//
76
+		//userAdmin.Id = 597
77
+		//userAdmin.Mobile = "19874122664"
78
+		//userAdmin.IsSuperAdmin = false
79
+		//userAdmin.Status = 1
80
+		//userAdmin.CreateTime = 1530786071
81
+		//userAdmin.ModifyTime = 1530786071
82
+		//var subscibe models.ServeSubscibe
83
+		//subscibe.ID = 1
84
+		//subscibe.OrgId = 9675
85
+		//subscibe.PeriodStart = 1538035409
86
+		//subscibe.PeriodEnd = 1569571409
87
+		//subscibe.State = 1
88
+		//subscibe.Status = 1
89
+		//subscibe.CreatedTime = 1538035409
90
+		//subscibe.UpdatedTime = 1538035409
91
+		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
+		//subscibes[4] = &subscibe
93
+		//var adminUserInfo service.AdminUserInfo
94
+		//adminUserInfo.CurrentOrgId = 9675
95
+		//adminUserInfo.CurrentAppId = 4
96
+		//adminUserInfo.AdminUser = &userAdmin
97
+		//adminUserInfo.Subscibes = subscibes
98
+		//this.SetSession("admin_user_info", &adminUserInfo)
99
+
100
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
101
+		this.StopRun()
103
 
102
 
104
 	}
103
 	}
105
 
104
 
316
 func (this *BaseServeAPIController) Prepare() {
315
 func (this *BaseServeAPIController) Prepare() {
317
 	this.BaseAPIController.Prepare()
316
 	this.BaseAPIController.Prepare()
318
 	if this.GetAdminUserInfo() == nil {
317
 	if this.GetAdminUserInfo() == nil {
319
-		var userAdmin models.AdminUser
320
-		userAdmin.Id = 1448
321
-		userAdmin.Mobile = "13318599895"
322
-
323
-		userAdmin.Id = 597
324
-		userAdmin.Mobile = "19874122664"
325
-		userAdmin.IsSuperAdmin = false
326
-		userAdmin.Status = 1
327
-		userAdmin.CreateTime = 1530786071
328
-		userAdmin.ModifyTime = 1530786071
329
-		var subscibe models.ServeSubscibe
330
-		subscibe.ID = 1
331
-		subscibe.OrgId = 9675
332
-		subscibe.PeriodStart = 1538035409
333
-		subscibe.PeriodEnd = 1569571409
334
-		subscibe.State = 1
335
-		subscibe.Status = 1
336
-		subscibe.CreatedTime = 1538035409
337
-		subscibe.UpdatedTime = 1538035409
338
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
-		subscibes[4] = &subscibe
340
-		var adminUserInfo service.AdminUserInfo
341
-		adminUserInfo.CurrentOrgId = 9675
342
-		adminUserInfo.CurrentAppId = 4
343
-		adminUserInfo.AdminUser = &userAdmin
344
-		adminUserInfo.Subscibes = subscibes
345
-		this.SetSession("admin_user_info", &adminUserInfo)
346
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
347
-		//this.StopRun()
318
+		//var userAdmin models.AdminUser
319
+		//userAdmin.Id = 1448
320
+		//userAdmin.Mobile = "13318599895"
321
+		//
322
+		//userAdmin.Id = 597
323
+		//userAdmin.Mobile = "19874122664"
324
+		//userAdmin.IsSuperAdmin = false
325
+		//userAdmin.Status = 1
326
+		//userAdmin.CreateTime = 1530786071
327
+		//userAdmin.ModifyTime = 1530786071
328
+		//var subscibe models.ServeSubscibe
329
+		//subscibe.ID = 1
330
+		//subscibe.OrgId = 9675
331
+		//subscibe.PeriodStart = 1538035409
332
+		//subscibe.PeriodEnd = 1569571409
333
+		//subscibe.State = 1
334
+		//subscibe.Status = 1
335
+		//subscibe.CreatedTime = 1538035409
336
+		//subscibe.UpdatedTime = 1538035409
337
+		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
+		//subscibes[4] = &subscibe
339
+		//var adminUserInfo service.AdminUserInfo
340
+		//adminUserInfo.CurrentOrgId = 9675
341
+		//adminUserInfo.CurrentAppId = 4
342
+		//adminUserInfo.AdminUser = &userAdmin
343
+		//adminUserInfo.Subscibes = subscibes
344
+		//this.SetSession("admin_user_info", &adminUserInfo)
345
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
346
+		this.StopRun()
348
 	}
347
 	}
349
 
348
 
350
 	//if adminUserInfo.AppRole != nil {
349
 	//if adminUserInfo.AppRole != nil {

+ 2 - 1
controllers/dialysis_api_controller.go Visa fil

3200
 
3200
 
3201
 			if template.TemplateId == 6 && adminInfo.CurrentOrgId == 10234 {
3201
 			if template.TemplateId == 6 && adminInfo.CurrentOrgId == 10234 {
3202
 
3202
 
3203
-				ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration) / float64(totalMin) * 60 * 1000)
3203
+				dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
3204
+				ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration + dehydration) / float64(totalMin) * 60 * 1000)
3204
 
3205
 
3205
 				record.UltrafiltrationRate = ultrafiltration_rate
3206
 				record.UltrafiltrationRate = ultrafiltration_rate
3206
 			}
3207
 			}

+ 3 - 2
controllers/dialysis_record_api_controller.go Visa fil

739
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
739
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
740
 		return
740
 		return
741
 	}
741
 	}
742
-	fmt.Println("hhaaaaaaa888888888323232323232333232322333323232", adminUserInfo.CurrentOrgId)
742
+
743
 	dialysisRecord = &models.DialysisOrder{
743
 	dialysisRecord = &models.DialysisOrder{
744
 		DialysisDate:           recordDate.Unix(),
744
 		DialysisDate:           recordDate.Unix(),
745
 		UserOrgId:              adminUserInfo.CurrentOrgId,
745
 		UserOrgId:              adminUserInfo.CurrentOrgId,
800
 
800
 
801
 				if template.TemplateId == 6 && adminUserInfo.CurrentOrgId == 10234 {
801
 				if template.TemplateId == 6 && adminUserInfo.CurrentOrgId == 10234 {
802
 					if evaluation.ID > 0 {
802
 					if evaluation.ID > 0 {
803
-						ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration) / float64(totalMin) * 60 * 1000)
803
+						dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
804
+						ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration + dehydration) / float64(totalMin) * 60 * 1000)
804
 					}
805
 					}
805
 				}
806
 				}
806
 
807
 

+ 1 - 1
controllers/gobal_config_api_controller.go Visa fil

1854
 	adminUserInfo := c.GetAdminUserInfo()
1854
 	adminUserInfo := c.GetAdminUserInfo()
1855
 
1855
 
1856
 	list, total, err := service.GetAllBaseDurgListCount(page, limit, keyword, drug_type, startTime, endTime, adminUserInfo.CurrentOrgId)
1856
 	list, total, err := service.GetAllBaseDurgListCount(page, limit, keyword, drug_type, startTime, endTime, adminUserInfo.CurrentOrgId)
1857
-	fmt.Println("total232323232323232232323", total)
1857
+
1858
 	manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
1858
 	manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
1859
 	if err != nil {
1859
 	if err != nil {
1860
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1860
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)

+ 13 - 8
controllers/mobile_api_controllers/check_weight_api_controller.go Visa fil

269
 		afterevaluation.DiastolicBloodPressure = diastolic_blood_pressure // 舒张压
269
 		afterevaluation.DiastolicBloodPressure = diastolic_blood_pressure // 舒张压
270
 		afterevaluation.PulseFrequency = pulse_frequency                  // 脉率
270
 		afterevaluation.PulseFrequency = pulse_frequency                  // 脉率
271
 
271
 
272
-		afterevaluation.LeaveOfficeMethod = assessmentAfterDislysis.LeaveOfficeMethod //离科方式
273
-		afterevaluation.Lapse = assessmentAfterDislysis.Lapse                         //转归
274
-		afterevaluation.Consciousness = assessmentAfterDislysis.Consciousness         //意识
275
-		afterevaluation.Fallrisk = assessmentAfterDislysis.Fallrisk                   //跌倒风险
272
+		if adminUserInfo.Org.Id == 10138 {
273
+			afterevaluation.LeaveOfficeMethod = assessmentAfterDislysis.LeaveOfficeMethod //离科方式
274
+			afterevaluation.Lapse = assessmentAfterDislysis.Lapse                         //转归
275
+			afterevaluation.Consciousness = assessmentAfterDislysis.Consciousness         //意识
276
+			afterevaluation.Fallrisk = assessmentAfterDislysis.Fallrisk                   //跌倒风险
277
+		}
276
 
278
 
277
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
279
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
278
 		if err == nil {
280
 		if err == nil {
704
 		afterevaluation.WeightAfter = weight_after
706
 		afterevaluation.WeightAfter = weight_after
705
 		afterevaluation.WeightLoss = weight_loss
707
 		afterevaluation.WeightLoss = weight_loss
706
 
708
 
707
-		afterevaluation.LeaveOfficeMethod = assessmentAfterDislysis.LeaveOfficeMethod //离科方式
708
-		afterevaluation.Lapse = assessmentAfterDislysis.Lapse                         //转归
709
-		afterevaluation.Consciousness = assessmentAfterDislysis.Consciousness         //意识
710
-		afterevaluation.Fallrisk = assessmentAfterDislysis.Fallrisk
709
+		if adminUserInfo.Org.Id == 10138 {
710
+			afterevaluation.LeaveOfficeMethod = assessmentAfterDislysis.LeaveOfficeMethod //离科方式
711
+			afterevaluation.Lapse = assessmentAfterDislysis.Lapse                         //转归
712
+			afterevaluation.Consciousness = assessmentAfterDislysis.Consciousness         //意识
713
+			afterevaluation.Fallrisk = assessmentAfterDislysis.Fallrisk
714
+		}
715
+
711
 		// if (adminUserInfo.Org.Id == 9538){
716
 		// if (adminUserInfo.Org.Id == 9538){
712
 		// 	afterevaluation.ActualUltrafiltration = weight_loss * 1000  //中能建的计量单位是毫升(ml)
717
 		// 	afterevaluation.ActualUltrafiltration = weight_loss * 1000  //中能建的计量单位是毫升(ml)
713
 		// } else {
718
 		// } else {

+ 6 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Visa fil

1493
 		tempassessmentAfterDislysis.ActualDisplacement = endmonitorRecords.DisplacementQuantity
1493
 		tempassessmentAfterDislysis.ActualDisplacement = endmonitorRecords.DisplacementQuantity
1494
 
1494
 
1495
 	}
1495
 	}
1496
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 9671 {
1496
+	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 {
1497
 		evaluation, _ := service.MobileGetPredialysisEvaluation(adminUserInfo.Org.Id, id, recordDate.Unix())
1497
 		evaluation, _ := service.MobileGetPredialysisEvaluation(adminUserInfo.Org.Id, id, recordDate.Unix())
1498
 		if evaluation.SystolicBloodPressure == 0 {
1498
 		if evaluation.SystolicBloodPressure == 0 {
1499
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
1499
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
1542
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume / 1000
1542
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume / 1000
1543
 	}
1543
 	}
1544
 
1544
 
1545
+	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10233 {
1546
+
1547
+		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume / 1000
1548
+	}
1549
+
1545
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10060 {
1550
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10060 {
1546
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1551
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1547
 	}
1552
 	}

+ 2 - 1
controllers/schedule_api_controller.go Visa fil

2369
 	orgId := this.GetAdminUserInfo().CurrentOrgId
2369
 	orgId := this.GetAdminUserInfo().CurrentOrgId
2370
 	if week_type > 0 {
2370
 	if week_type > 0 {
2371
 		list, err := service.GetWeekDayScheduleByIdThee(orgId, targetDay.Unix(), week_time, zone)
2371
 		list, err := service.GetWeekDayScheduleByIdThee(orgId, targetDay.Unix(), week_time, zone)
2372
+
2372
 		if err != nil {
2373
 		if err != nil {
2373
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2374
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2374
 			return
2375
 			return
2383
 	if week_type == 0 {
2384
 	if week_type == 0 {
2384
 		startDate, _ := utils.ParseTimeStringToTime("2006-01-02", startTime)
2385
 		startDate, _ := utils.ParseTimeStringToTime("2006-01-02", startTime)
2385
 		list, err := service.GetWeekDayScheduleByIdTwo(orgId, targetDay.Unix(), week_time, startDate.Unix(), zone)
2386
 		list, err := service.GetWeekDayScheduleByIdTwo(orgId, targetDay.Unix(), week_time, startDate.Unix(), zone)
2386
-		fmt.Println("e23332232323232323322323", err)
2387
+
2387
 		if err != nil {
2388
 		if err != nil {
2388
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2389
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2389
 			return
2390
 			return

+ 1 - 0
controllers/self_drug_api_congtroller.go Visa fil

1453
 
1453
 
1454
 	limit, _ := this.GetInt64("limit")
1454
 	limit, _ := this.GetInt64("limit")
1455
 	page, _ := this.GetInt64("page")
1455
 	page, _ := this.GetInt64("page")
1456
+
1456
 	list, total, err := service.GetDrugDamageList(startTime, endTime, orgId, keyword, limit, page)
1457
 	list, total, err := service.GetDrugDamageList(startTime, endTime, orgId, keyword, limit, page)
1457
 
1458
 
1458
 	damagelist, _ := service.GetDrugDamageByOrgId(orgId)
1459
 	damagelist, _ := service.GetDrugDamageByOrgId(orgId)

+ 12 - 0
controllers/stock_in_api_controller.go Visa fil

128
 	beego.Router("/api/stock/getgoodwarehouselist", &StockManagerApiController{}, "Get:GetGoodWarehouseList")
128
 	beego.Router("/api/stock/getgoodwarehouselist", &StockManagerApiController{}, "Get:GetGoodWarehouseList")
129
 	beego.Router("/api/stock/proofinventory", &StockManagerApiController{}, "Get:ProofInventory")
129
 	beego.Router("/api/stock/proofinventory", &StockManagerApiController{}, "Get:ProofInventory")
130
 	beego.Router("/api/stock/getwarehousetotal", &StockManagerApiController{}, "Get:GetWarehouseTotal")
130
 	beego.Router("/api/stock/getwarehousetotal", &StockManagerApiController{}, "Get:GetWarehouseTotal")
131
+	beego.Router("/api/stock/getgoodinventorywarehouselist", &StockManagerApiController{}, "Get:GetGoodInventoryWarehouseList")
131
 
132
 
132
 }
133
 }
133
 
134
 
6146
 		"list": list,
6147
 		"list": list,
6147
 	})
6148
 	})
6148
 }
6149
 }
6150
+
6151
+func (this *StockManagerApiController) GetGoodInventoryWarehouseList() {
6152
+
6153
+	id, _ := this.GetInt64("id")
6154
+	list, _ := service.GetGoodInventoryWarehouseList(id)
6155
+	orgId := this.GetAdminUserInfo().CurrentOrgId
6156
+	fmt.Println(orgId)
6157
+	this.ServeSuccessJSON(map[string]interface{}{
6158
+		"list": list,
6159
+	})
6160
+}

+ 8 - 7
models/schedule_models.go Visa fil

132
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
132
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
133
 	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
133
 	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
134
 
134
 
135
-	Patient              string                 `gorm:"-" json:"patient" form:"patient"`
136
-	DeviceZone           DeviceZone             `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
137
-	DeviceNumber         DeviceNumber           `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
138
-	DialysisPrescription DialysisSolution       `json:"prescription" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
139
-	DoctorAdvice         []*DoctorAdvice        `json:"doctoradvice" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
140
-	HisDoctorAdviceInfo  []*HisDoctorAdviceInfo `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
141
-	//DialysisSolution     []*DialysisSolution    `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
135
+	Patient                    string                     `gorm:"-" json:"patient" form:"patient"`
136
+	DeviceZone                 DeviceZone                 `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
137
+	DeviceNumber               DeviceNumber               `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
138
+	DialysisPrescription       DialysisSolution           `json:"prescription" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
139
+	DoctorAdvice               []*DoctorAdvice            `json:"doctoradvice" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
140
+	HisDoctorAdviceInfo        []*HisDoctorAdviceInfo     `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
141
+	Solution                   []*DialysisSolution        `json:"solution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
142
 	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
142
 	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
143
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate"`
143
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate"`
144
 }
144
 }
197
 	HisDoctorAdviceInfo        []*HisDoctorAdviceInfo     `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
197
 	HisDoctorAdviceInfo        []*HisDoctorAdviceInfo     `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
198
 	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
198
 	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
199
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
199
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
200
+	Solution                   []*DialysisSolution        `json:"solution" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
200
 }
201
 }
201
 
202
 
202
 func (VmSchedulesRemind) TableName() string {
203
 func (VmSchedulesRemind) TableName() string {

+ 43 - 0
models/self_drug_models.go Visa fil

767
 	return "xt_drug_damage"
767
 	return "xt_drug_damage"
768
 }
768
 }
769
 
769
 
770
+type VmXtDrugInventory struct {
771
+	ID                 int64      `gorm:"column:id" json:"id" form:"id"`
772
+	DrugName           string     `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
773
+	SpecificationName  string     `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
774
+	WarehousingUnit    string     `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
775
+	Count              int64      `gorm:"column:count" json:"count" form:"count"`
776
+	LastPrice          float64    `gorm:"column:last_price" json:"last_price" form:"last_price"`
777
+	RetailPrice        float64    `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
778
+	NewPrice           float64    `gorm:"column:new_price" json:"new_price" form:"new_price"`
779
+	Manufacturer       string     `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
780
+	Dealer             string     `gorm:"column:dealer" json:"dealer" form:"dealer"`
781
+	Remark             string     `gorm:"column:remark" json:"remark" form:"remark"`
782
+	DrugId             int64      `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
783
+	UserOrgId          int64      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
784
+	Ctime              int64      `gorm:"column:ctime" json:"ctime" form:"ctime"`
785
+	Mtime              int64      `gorm:"column:mtime" json:"mtime" form:"mtime"`
786
+	Status             int64      `gorm:"column:status" json:"status" form:"status"`
787
+	WarehousingOrder   string     `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
788
+	LicenseNumber      string     `gorm:"column:license_number" json:"license_number" form:"license_number"`
789
+	StartTime          int64      `gorm:"column:start_time" json:"start_time" form:"start_time"`
790
+	Creater            int64      `gorm:"column:creater" json:"creater" form:"creater"`
791
+	Checker            int64      `gorm:"column:checker" json:"checker" form:"checker"`
792
+	CheckerStatus      int64      `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
793
+	CheckerTime        int64      `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
794
+	ExpiryDate         int64      `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
795
+	ProductDate        int64      `gorm:"column:product_date" json:"product_date" form:"product_date"`
796
+	Number             string     `gorm:"column:number" json:"number" form:"number"`
797
+	BatchNumber        string     `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
798
+	Total              string     `gorm:"column:total" json:"total" form:"total"`
799
+	DrugOriginPlace    string     `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
800
+	WarehouseInfoId    int64      `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
801
+	ProofCount         int64      `gorm:"column:proof_count" json:"proof_count" form:"proof_count"`
802
+	StockMaxNumber     int64      `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
803
+	StockMinNumber     int64      `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
804
+	MinCount           int64      `gorm:"column:min_count" json:"min_count" form:"min_count"`
805
+	MinUnit            string     `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
806
+	LastStockMaxNumber int64      `gorm:"column:last_stock_max_number" json:"last_stock_max_number" form:"last_stock_max_number"`
807
+	LastStockMinNumber int64      `gorm:"column:last_stock_min_number" json:"last_stock_min_number" form:"last_stock_min_number"`
808
+	InventoryType      int64      `gorm:"column:inventory_type" json:"inventory_type" form:"inventory_type"`
809
+	Type               int64      `gorm:"column:type" json:"type" form:"type"`
810
+	XtBaseDrug         XtBaseDrug `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" `
811
+}
812
+
770
 type XtDrugInventory struct {
813
 type XtDrugInventory struct {
771
 	ID                 int64   `gorm:"column:id" json:"id" form:"id"`
814
 	ID                 int64   `gorm:"column:id" json:"id" form:"id"`
772
 	DrugName           string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
815
 	DrugName           string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`

+ 8 - 2
service/schedule_service.go Visa fil

608
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("XtAssessmentBeforeDislysis", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
608
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("XtAssessmentBeforeDislysis", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
609
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
609
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
610
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
610
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
611
-		return db.Where("status =1").Group("mode_id").Order("id asc")
611
+		return db.Where("status =1").Order("id asc")
612
+	}).Preload("Solution", func(db *gorm.DB) *gorm.DB {
613
+		return db.Where("status =1").Group("patient_id,mode_id").Order("id desc")
612
 	}).Find(&list).Error
614
 	}).Find(&list).Error
613
 
615
 
614
 	return list, err
616
 	return list, err
633
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("XtAssessmentBeforeDislysis", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
635
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("XtAssessmentBeforeDislysis", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
634
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
636
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
635
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
637
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
636
-		return db.Where("status =1").Group("mode_id").Order("id asc")
638
+		return db.Where("status =1").Order("id asc")
639
+	}).Preload("Solution", func(db *gorm.DB) *gorm.DB {
640
+		return db.Where("status =1").Group("patient_id,mode_id").Order("id desc")
637
 	}).Find(&list).Error
641
 	}).Find(&list).Error
638
 
642
 
639
 	return list, err
643
 	return list, err
820
 			return db.Where("status = 1").Order("id asc")
824
 			return db.Where("status = 1").Order("id asc")
821
 		}).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
825
 		}).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
822
 		return db.Where("status = 1").Order("id asc")
826
 		return db.Where("status = 1").Order("id asc")
827
+	}).Preload("Solution", func(db *gorm.DB) *gorm.DB {
828
+		return db.Where("status = 1").Group("patient_id,mode_id").Order("id desc")
823
 	}).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
829
 	}).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
824
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
830
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
825
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Joins("JOIN xt_patients as p ON p.id = s.patient_id").
831
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Joins("JOIN xt_patients as p ON p.id = s.patient_id").

+ 6 - 3
service/self_drug_service.go Visa fil

883
 	table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
883
 	table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
884
 	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
884
 	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
885
 	fmt.Println(table, tab)
885
 	fmt.Println(table, tab)
886
+	//if len(keyword) > 0 {
887
+	//	db = db.Where("x.warehousing_order = ? or r.user_name like ?", keyword, likeKey)
888
+	//}
886
 	if len(keyword) > 0 {
889
 	if len(keyword) > 0 {
887
-		db = db.Where("x.warehousing_order = ? or r.user_name like ?", keyword, likeKey)
890
+		db = db.Where("x.drug_name like ?", likeKey)
888
 	}
891
 	}
889
 	if orgId > 0 {
892
 	if orgId > 0 {
890
 		db = db.Where("x.user_org_id = ?", orgId)
893
 		db = db.Where("x.user_org_id = ?", orgId)
1121
 	return err
1124
 	return err
1122
 }
1125
 }
1123
 
1126
 
1124
-func GetDamageByDrugId(drugid int64, warhousingorder string, drugtype int64) (drug []*models.XtDrugInventory, err error) {
1127
+func GetDamageByDrugId(drugid int64, warhousingorder string, drugtype int64) (drug []*models.VmXtDrugInventory, err error) {
1125
 
1128
 
1126
 	db := XTReadDB().Table("xt_drug_inventory").Where("status = 1 and inventory_type = 11 ")
1129
 	db := XTReadDB().Table("xt_drug_inventory").Where("status = 1 and inventory_type = 11 ")
1127
 
1130
 
1135
 		db = db.Where("type = ?", drugtype)
1138
 		db = db.Where("type = ?", drugtype)
1136
 	}
1139
 	}
1137
 
1140
 
1138
-	err = db.Find(&drug).Error
1141
+	err = db.Preload("XtBaseDrug", "status = 1").Find(&drug).Error
1139
 	return drug, err
1142
 	return drug, err
1140
 }
1143
 }

+ 6 - 0
service/stock_service.go Visa fil

4771
 	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"stock_max_number": info.StockMaxNumber, "stock_min_number": info.StockMinNumber}).Error
4771
 	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"stock_max_number": info.StockMaxNumber, "stock_min_number": info.StockMinNumber}).Error
4772
 	return err
4772
 	return err
4773
 }
4773
 }
4774
+
4775
+func GetGoodInventoryWarehouseList(id int64) (info []*models.WarehousingInfo, err error) {
4776
+
4777
+	err = XTReadDB().Model(&info).Where("good_id = ? and status = 1", id).Preload("GoodInfo", "status = 1").Find(&info).Error
4778
+	return info, err
4779
+}