Pārlūkot izejas kodu

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

csx 3 gadus atpakaļ
vecāks
revīzija
513f6a1840

+ 1 - 1
conf/app.conf Parādīt failu

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

+ 59 - 60
controllers/base_api_controller.go Parādīt failu

@@ -2,7 +2,6 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
-	"XT_New/models"
6 5
 	"XT_New/service"
7 6
 	"fmt"
8 7
 	"strconv"
@@ -70,36 +69,36 @@ type BaseAuthAPIController struct {
70 69
 func (this *BaseAuthAPIController) Prepare() {
71 70
 	this.BaseAPIController.Prepare()
72 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,35 +315,35 @@ type BaseServeAPIController struct {
316 315
 func (this *BaseServeAPIController) Prepare() {
317 316
 	this.BaseAPIController.Prepare()
318 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 349
 	//if adminUserInfo.AppRole != nil {

+ 2 - 1
controllers/dialysis_api_controller.go Parādīt failu

@@ -3200,7 +3200,8 @@ func (this *DialysisApiController) GetTodayMonitor() {
3200 3200
 
3201 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 3206
 				record.UltrafiltrationRate = ultrafiltration_rate
3206 3207
 			}

+ 3 - 2
controllers/dialysis_record_api_controller.go Parādīt failu

@@ -739,7 +739,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
739 739
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
740 740
 		return
741 741
 	}
742
-	fmt.Println("hhaaaaaaa888888888323232323232333232322333323232", adminUserInfo.CurrentOrgId)
742
+
743 743
 	dialysisRecord = &models.DialysisOrder{
744 744
 		DialysisDate:           recordDate.Unix(),
745 745
 		UserOrgId:              adminUserInfo.CurrentOrgId,
@@ -800,7 +800,8 @@ func (this *DialysisRecordAPIController) StartDialysis() {
800 800
 
801 801
 				if template.TemplateId == 6 && adminUserInfo.CurrentOrgId == 10234 {
802 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 Parādīt failu

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

+ 13 - 8
controllers/mobile_api_controllers/check_weight_api_controller.go Parādīt failu

@@ -269,10 +269,12 @@ func (c *CheckWeightApiController) SaveBloodPressure() {
269 269
 		afterevaluation.DiastolicBloodPressure = diastolic_blood_pressure // 舒张压
270 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 279
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
278 280
 		if err == nil {
@@ -704,10 +706,13 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
704 706
 		afterevaluation.WeightAfter = weight_after
705 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 716
 		// if (adminUserInfo.Org.Id == 9538){
712 717
 		// 	afterevaluation.ActualUltrafiltration = weight_loss * 1000  //中能建的计量单位是毫升(ml)
713 718
 		// } else {

+ 6 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Parādīt failu

@@ -1493,7 +1493,7 @@ func (c *DialysisAPIController) Finish() {
1493 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 1497
 		evaluation, _ := service.MobileGetPredialysisEvaluation(adminUserInfo.Org.Id, id, recordDate.Unix())
1498 1498
 		if evaluation.SystolicBloodPressure == 0 {
1499 1499
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
@@ -1542,6 +1542,11 @@ func (c *DialysisAPIController) Finish() {
1542 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 1550
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10060 {
1546 1551
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1547 1552
 	}

+ 2 - 1
controllers/schedule_api_controller.go Parādīt failu

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

+ 1 - 0
controllers/self_drug_api_congtroller.go Parādīt failu

@@ -1453,6 +1453,7 @@ func (this *SelfDrugApiController) GetDrugDamageList() {
1453 1453
 
1454 1454
 	limit, _ := this.GetInt64("limit")
1455 1455
 	page, _ := this.GetInt64("page")
1456
+
1456 1457
 	list, total, err := service.GetDrugDamageList(startTime, endTime, orgId, keyword, limit, page)
1457 1458
 
1458 1459
 	damagelist, _ := service.GetDrugDamageByOrgId(orgId)

+ 12 - 0
controllers/stock_in_api_controller.go Parādīt failu

@@ -128,6 +128,7 @@ func StockManagerApiRegistRouters() {
128 128
 	beego.Router("/api/stock/getgoodwarehouselist", &StockManagerApiController{}, "Get:GetGoodWarehouseList")
129 129
 	beego.Router("/api/stock/proofinventory", &StockManagerApiController{}, "Get:ProofInventory")
130 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,3 +6147,14 @@ func (this *StockManagerApiController) GetWarehouseTotal() {
6146 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 Parādīt failu

@@ -132,13 +132,13 @@ type WeekSchedule struct {
132 132
 	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
133 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 142
 	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId"`
143 143
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId,AssessmentDate;AssociationForeignKey:PatientId,ScheduleDate"`
144 144
 }
@@ -197,6 +197,7 @@ type VmSchedulesRemind struct {
197 197
 	HisDoctorAdviceInfo        []*HisDoctorAdviceInfo     `json:"hisdoctoradviceinfo" gorm:"foreignkey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
198 198
 	DialysisSolution           DialysisSolution           `json:"dialysissolution" gorm:"foreignkey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
199 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 203
 func (VmSchedulesRemind) TableName() string {

+ 43 - 0
models/self_drug_models.go Parādīt failu

@@ -767,6 +767,49 @@ func (XtDrugDamage) TableName() string {
767 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 813
 type XtDrugInventory struct {
771 814
 	ID                 int64   `gorm:"column:id" json:"id" form:"id"`
772 815
 	DrugName           string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`

+ 8 - 2
service/schedule_service.go Parādīt failu

@@ -608,7 +608,9 @@ func GetWeekDayScheduleByIdThee(orgid int64, scheduleDate int64, scheduleType in
608 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 609
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
610 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 614
 	}).Find(&list).Error
613 615
 
614 616
 	return list, err
@@ -633,7 +635,9 @@ func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int
633 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 636
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
635 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 641
 	}).Find(&list).Error
638 642
 
639 643
 	return list, err
@@ -820,6 +824,8 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
820 824
 			return db.Where("status = 1").Order("id asc")
821 825
 		}).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
822 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 829
 	}).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
824 830
 		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
825 831
 	}).Preload("HisDoctorAdviceInfo", "status = 1").Joins("JOIN xt_patients as p ON p.id = s.patient_id").

+ 6 - 3
service/self_drug_service.go Parādīt failu

@@ -883,8 +883,11 @@ func GetDrugDamageList(startime int64, endtime int64, orgId int64, keyword strin
883 883
 	table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
884 884
 	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
885 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 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 892
 	if orgId > 0 {
890 893
 		db = db.Where("x.user_org_id = ?", orgId)
@@ -1121,7 +1124,7 @@ func CreateDrugWarehouseOutInfo(info models.DrugWarehouseOutInfo) error {
1121 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 1129
 	db := XTReadDB().Table("xt_drug_inventory").Where("status = 1 and inventory_type = 11 ")
1127 1130
 
@@ -1135,6 +1138,6 @@ func GetDamageByDrugId(drugid int64, warhousingorder string, drugtype int64) (dr
1135 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 1142
 	return drug, err
1140 1143
 }

+ 6 - 0
service/stock_service.go Parādīt failu

@@ -4771,3 +4771,9 @@ func ModifyDrugWarehouseInfo(info *models.DrugWarehouseInfo, id int64) error {
4771 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 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
+}