28169 11 meses atrás
pai
commit
7d906c3949

+ 4 - 4
controllers/base_api_controller.go Ver arquivo

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10164 //机构id
86
+		subscibe.OrgId = 10653 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10653 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 12123 //4
97
 		adminUserInfo.CurrentAppId = 12123 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10164 //机构id小英9675或4
332
+		subscibe.OrgId = 10653 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10653 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 12123 //4
343
 		adminUserInfo.CurrentAppId = 12123 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 20 - 15
controllers/drug_stock_api_contorller.go Ver arquivo

3787
 	orgId := c.GetAdminUserInfo().CurrentOrgId
3787
 	orgId := c.GetAdminUserInfo().CurrentOrgId
3788
 	warehousingOutInfoList, _ := service.GetDrugWarehouseOutListById(warehouse_out_id, orgId)
3788
 	warehousingOutInfoList, _ := service.GetDrugWarehouseOutListById(warehouse_out_id, orgId)
3789
 	drugWarehouseOut, _ := service.GetDrugWarehouseOutByLastId(warehouse_out_id)
3789
 	drugWarehouseOut, _ := service.GetDrugWarehouseOutByLastId(warehouse_out_id)
3790
-	storeHouseConfig, _ := service.GetAllStoreHouseConfig(orgId)
3791
 
3790
 
3792
 	for _, it := range warehousingOutInfoList {
3791
 	for _, it := range warehousingOutInfoList {
3793
 		var total_count int64
3792
 		var total_count int64
3850
 			out_count_one = it.Count
3849
 			out_count_one = it.Count
3851
 		}
3850
 		}
3852
 
3851
 
3853
-		service.AddDrugCount(it.DrugId, it.OrgId, storeHouseConfig.DrugStorehouseOut, out_count_one)
3852
+		service.AddDrugCount(it.DrugId, it.OrgId, it.StorehouseId, out_count_one)
3854
 
3853
 
3855
 	}
3854
 	}
3856
 	warehousingOutInfoListThree, _ := service.GetDrugWarehouseOutListById(warehouse_out_id, orgId)
3855
 	warehousingOutInfoListThree, _ := service.GetDrugWarehouseOutListById(warehouse_out_id, orgId)
3861
 		service.AutoDrugDeliverInfoFourtyOne(orgId, it.Count, &drugWarehouseOut, &drup, it, it.CountUnit)
3860
 		service.AutoDrugDeliverInfoFourtyOne(orgId, it.Count, &drugWarehouseOut, &drup, it, it.CountUnit)
3862
 
3861
 
3863
 		//查询剩余库存
3862
 		//查询剩余库存
3864
-		stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, it.OrgId, it.DrugId)
3863
+		stockInfo, _ := service.GetDrugAllStockInfo(it.StorehouseId, it.OrgId, it.DrugId)
3865
 		var sum_count int64
3864
 		var sum_count int64
3866
 		for _, its := range stockInfo {
3865
 		for _, its := range stockInfo {
3867
 			if its.MaxUnit == medical.MaxUnit {
3866
 			if its.MaxUnit == medical.MaxUnit {
3869
 			}
3868
 			}
3870
 			sum_count += its.StockMaxNumber + its.StockMinNumber
3869
 			sum_count += its.StockMaxNumber + its.StockMinNumber
3871
 		}
3870
 		}
3872
-		//更新基础库库存
3873
-		service.UpdateBaseDrugSumTwo(it.DrugId, sum_count, it.OrgId)
3874
-
3875
-		service.UpdateDrugStockCount(it.DrugId, it.OrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
3871
+		service.UpdateDrugStockCount(it.DrugId, it.OrgId, it.StorehouseId, sum_count)
3876
 
3872
 
3873
+		storeHouseConfig, _ := service.GetAllStoreHouseConfig(orgId)
3874
+		stockInfoOne, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, it.OrgId, it.DrugId)
3875
+		var sum_count_one int64
3876
+		for _, its := range stockInfoOne {
3877
+			if its.MaxUnit == medical.MaxUnit {
3878
+				its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
3879
+			}
3880
+			sum_count_one += its.StockMaxNumber + its.StockMinNumber
3881
+		}
3882
+		//更新基础库库存
3883
+		service.UpdateBaseDrugSumTwo(it.DrugId, sum_count_one, it.OrgId)
3877
 	}
3884
 	}
3878
 
3885
 
3879
 	out := models.DrugWarehouseOut{
3886
 	out := models.DrugWarehouseOut{
3994
 			out_count = item.Count
4001
 			out_count = item.Count
3995
 		}
4002
 		}
3996
 		//增加出库数量
4003
 		//增加出库数量
3997
-		service.ReduceDrugCount(item.DrugId, item.OrgId, storeHouseConfig.DrugStorehouseOut, out_count)
4004
+		service.ReduceDrugCount(item.DrugId, item.OrgId, item.StorehouseId, out_count)
3998
 
4005
 
3999
 		//查询该药品剩余库存
4006
 		//查询该药品剩余库存
4000
-		infolist, _ := service.FindDrugWarehouseInfoFlushCountByStorehouse(item.DrugId, item.OrgId, storeHouseConfig.DrugStorehouseOut)
4007
+		infolist, _ := service.FindDrugWarehouseInfoFlushCountByStorehouse(item.DrugId, item.OrgId, item.StorehouseId)
4001
 		var over_count int64
4008
 		var over_count int64
4002
 		for _, its := range infolist {
4009
 		for _, its := range infolist {
4003
 			baseDrug, _ := service.GetBaseDrugMedical(its.DrugId)
4010
 			baseDrug, _ := service.GetBaseDrugMedical(its.DrugId)
4004
-			fmt.Println("ITS", its.MaxUnit)
4005
-			fmt.Println("itwowoowow", baseDrug.MaxUnit)
4011
+
4006
 			if its.MaxUnit == baseDrug.MaxUnit {
4012
 			if its.MaxUnit == baseDrug.MaxUnit {
4007
 				its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
4013
 				its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
4008
 			}
4014
 			}
4009
-			fmt.Println("its.StockMaxNumber", its.StockMaxNumber)
4010
-			fmt.Println("its.StockMinNumber", its.StockMinNumber)
4015
+
4011
 			over_count += its.StockMaxNumber + its.StockMinNumber
4016
 			over_count += its.StockMaxNumber + its.StockMinNumber
4012
 		}
4017
 		}
4013
-		fmt.Println("over_coutnwowowowowo", over_count)
4014
-		service.UpdateDrugStockCount(item.DrugId, item.OrgId, storeHouseConfig.DrugStorehouseOut, over_count)
4018
+
4019
+		service.UpdateDrugStockCount(item.DrugId, item.OrgId, item.StorehouseId, over_count)
4015
 
4020
 
4016
 	}
4021
 	}
4017
 	c.ServeSuccessJSON(map[string]interface{}{
4022
 	c.ServeSuccessJSON(map[string]interface{}{

+ 47 - 3
controllers/his_api_controller.go Ver arquivo

1696
 
1696
 
1697
 	//获取所有科室信息
1697
 	//获取所有科室信息
1698
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
1698
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
1699
+
1700
+	beforThrity, _ := service.GetAssessmentBeforThrity(admin.CurrentOrgId, patient_id, recordDateTime)
1701
+
1702
+	LastCaseHistory, _ := service.GetLastHisPatientCaseHistory(admin.CurrentOrgId, patient_id)
1699
 	c.ServeSuccessJSON(map[string]interface{}{
1703
 	c.ServeSuccessJSON(map[string]interface{}{
1700
 		"his_info":     his_patient_info,
1704
 		"his_info":     his_patient_info,
1701
 		"xt_info":      xt_patient_info,
1705
 		"xt_info":      xt_patient_info,
1712
 		"count":              count,
1716
 		"count":              count,
1713
 		"drugStockConfig":    drugStockConfig,
1717
 		"drugStockConfig":    drugStockConfig,
1714
 		"last_info":          lastPatientPrescriptionInfo,
1718
 		"last_info":          lastPatientPrescriptionInfo,
1719
+		"befor":              beforThrity,
1720
+		"LastCaseHistory":    LastCaseHistory,
1715
 	})
1721
 	})
1716
 	return
1722
 	return
1717
 
1723
 
3423
 
3429
 
3424
 										}
3430
 										}
3425
 
3431
 
3432
+										fmt.Println("药品名称----------------------", drug.DrugName)
3433
+										fmt.Println("药品名称----------------------", drug.IsUse)
3434
+										fmt.Println("is_user_total-------------------------", is_user_total)
3435
+										fmt.Println("no_user_total-------------------------", no_user_total)
3436
+
3426
 										if is_user_total != no_user_total {
3437
 										if is_user_total != no_user_total {
3427
 											//出库
3438
 											//出库
3428
 											if drug.IsUse == 2 {
3439
 											if drug.IsUse == 2 {
3543
 													history_count += prescribingNumberSevenTy
3554
 													history_count += prescribingNumberSevenTy
3544
 												}
3555
 												}
3545
 
3556
 
3546
-												//fmt.Println("local_count0000000000000000000000000000000000000000000", local_count)
3547
-												//
3548
-												//fmt.Println("history_count999999999999999999999999999999999999999", history_count)
3557
+												fmt.Println("drug_nam,e---------------", drug.DrugName)
3558
+												fmt.Println("local_count0000000000000000000000000000000000000000000", local_count)
3559
+												fmt.Println("history_count999999999999999999999999999999999999999", history_count)
3549
 
3560
 
3550
 												//如果当前出库数量大于历史出库数量则需要出库
3561
 												//如果当前出库数量大于历史出库数量则需要出库
3551
 												if local_count > history_count {
3562
 												if local_count > history_count {
3570
 													service.NewHisDrugAutoCancelInfo(s.UserOrgId, creater, newadviceInfo, cha_count, drug, tx)
3581
 													service.NewHisDrugAutoCancelInfo(s.UserOrgId, creater, newadviceInfo, cha_count, drug, tx)
3571
 												}
3582
 												}
3572
 
3583
 
3584
+												if local_count == history_count {
3585
+													if is_user_total == 0 {
3586
+														service.NewHisDrugsDelivery(s.UserOrgId, creater, newadviceInfo, tx)
3587
+													}
3588
+
3589
+												}
3573
 											}
3590
 											}
3574
 
3591
 
3575
 											//更新字典里面的库存
3592
 											//更新字典里面的库存
3877
 
3894
 
3878
 											}
3895
 											}
3879
 
3896
 
3897
+											if nowCount == historyCount {
3898
+												if historyCount == 0 {
3899
+													recordDateStr := time.Now().Format("2006-01-02")
3900
+													recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
3901
+													nowtime := recordDate.Unix()
3902
+													lastOut, _ := service.FindNewLastPrescriptionWarehouseOut(adminInfo.CurrentOrgId, nowtime, tx)
3903
+													goodObj, _ := service.GetNewGoodInformationByGoodIdThirty(p.ProjectId, tx)
3904
+													houseConfig, _ := service.GetNewAllStoreHouseConfig(p.UserOrgId, tx)
3905
+													creater := c.GetAdminUserInfo().AdminUser.Id
3906
+													dialyPrepareOne := models.DialysisBeforePrepare{
3907
+														GoodTypeId:   goodObj.GoodTypeId,
3908
+														GoodId:       p.ProjectId,
3909
+														PatientId:    p.PatientId,
3910
+														RecordDate:   p.RecordDate,
3911
+														UserOrgId:    adminInfo.CurrentOrgId,
3912
+														Count:        nowCount,
3913
+														Ctime:        time.Now().Unix(),
3914
+														Creater:      creater,
3915
+														Status:       1,
3916
+														StorehouseId: houseConfig.StorehouseOutInfo,
3917
+														ProjectId:    p.ID,
3918
+													}
3919
+													//出库
3920
+													service.ConsumableNewHisPrescriptionDelivery(adminInfo.CurrentOrgId, p.PatientId, p.RecordDate, &dialyPrepareOne, &lastOut, creater, tx)
3921
+												}
3922
+											}
3923
+
3880
 											//lastHisProject, _ := service.GetLastHisProject(p.PatientId, p.UserOrgId, p.RecordDate, tx, p.ProjectId)
3924
 											//lastHisProject, _ := service.GetLastHisProject(p.PatientId, p.UserOrgId, p.RecordDate, tx, p.ProjectId)
3881
 											////查询历史出库数据
3925
 											////查询历史出库数据
3882
 											//flowGood, _ := service.GetStockFlowIsBatchNumberSeventy(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID)
3926
 											//flowGood, _ := service.GetStockFlowIsBatchNumberSeventy(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID)

+ 9 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Ver arquivo

1379
 	channels, _ := c.GetInt64("channel", 0)
1379
 	channels, _ := c.GetInt64("channel", 0)
1380
 	return_blood, _ := c.GetInt64("return_blood", 0)
1380
 	return_blood, _ := c.GetInt64("return_blood", 0)
1381
 	rehydration_volume, _ := c.GetInt64("rehydration_volume", 0)
1381
 	rehydration_volume, _ := c.GetInt64("rehydration_volume", 0)
1382
-	dialysis_during, _ := c.GetInt64("dialysis_during", 0)
1382
+	//dialysis_during, _ := c.GetInt64("dialysis_during", 0)
1383
+	dialysis_during, _ := c.GetFloat("dialysis_during")
1383
 	stroke_volume, _ := c.GetInt64("stroke_volume", 0)
1384
 	stroke_volume, _ := c.GetInt64("stroke_volume", 0)
1384
 	blood_flow, _ := c.GetInt64("blood_flow", 0)
1385
 	blood_flow, _ := c.GetInt64("blood_flow", 0)
1385
 	//sealing_fluid_dispose, _ := c.GetInt64("sealing_fluid_dispose", 0)
1386
 	//sealing_fluid_dispose, _ := c.GetInt64("sealing_fluid_dispose", 0)
2739
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
2740
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
2740
 	}
2741
 	}
2741
 
2742
 
2743
+	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10617 {
2744
+		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
2745
+	}
2746
+
2742
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 9829 {
2747
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 9829 {
2743
 		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
2748
 		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
2744
 		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
2749
 		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
3604
 			record.DialysateTemperature = 36.5
3609
 			record.DialysateTemperature = 36.5
3605
 		}
3610
 		}
3606
 
3611
 
3607
-		err := service.CreateMonitor(&record)
3612
+		if adminUserInfo.Org.Id != 10683 {
3613
+			err = service.CreateMonitor(&record)
3614
+		}
3608
 
3615
 
3609
 		//记录日志
3616
 		//记录日志
3610
 		byterequest, _ := json.Marshal(record)
3617
 		byterequest, _ := json.Marshal(record)

+ 2 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Ver arquivo

2998
 
2998
 
2999
 	if len(inspection) > 0 {
2999
 	if len(inspection) > 0 {
3000
 		for _, item := range inspection {
3000
 		for _, item := range inspection {
3001
+			lastInspection, _ := service.GetLastInspectionProject(item.PatientId, org_id, item.ProjectId)
3002
+			item.InspectDate = lastInspection.InspectDate
3001
 			inspecList, _ := service.GetInspectionByProjectId(item.PatientId, org_id, item.ProjectId)
3003
 			inspecList, _ := service.GetInspectionByProjectId(item.PatientId, org_id, item.ProjectId)
3002
 			item.Count = int64(len(inspecList))
3004
 			item.Count = int64(len(inspecList))
3003
 		}
3005
 		}

+ 1 - 1
controllers/self_drug_api_congtroller.go Ver arquivo

4093
 
4093
 
4094
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4094
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4095
 	list, _ := service.GetDrugFlowDetailById(drug_id, orgId)
4095
 	list, _ := service.GetDrugFlowDetailById(drug_id, orgId)
4096
-	fmt.Println("list====================", list)
4096
+
4097
 	drugMedical, _ := service.GetBaseDrugMedical(drug_id)
4097
 	drugMedical, _ := service.GetBaseDrugMedical(drug_id)
4098
 
4098
 
4099
 	for index, _ := range list {
4099
 	for index, _ := range list {

+ 1 - 1
models/dialysis.go Ver arquivo

631
 	CvcV                            float64 `gorm:"column:cvc_v" json:"cvc_v" form:"cvc_v"`
631
 	CvcV                            float64 `gorm:"column:cvc_v" json:"cvc_v" form:"cvc_v"`
632
 	ReturnBlood                     int64   `gorm:"column:return_blood" json:"return_blood" form:"return_blood"`
632
 	ReturnBlood                     int64   `gorm:"column:return_blood" json:"return_blood" form:"return_blood"`
633
 	RehydrationVolume               int64   `gorm:"column:rehydration_volume" json:"rehydration_volume" form:"rehydration_volume"`
633
 	RehydrationVolume               int64   `gorm:"column:rehydration_volume" json:"rehydration_volume" form:"rehydration_volume"`
634
-	DialysisDuring                  int64   `gorm:"column:dialysis_during" json:"dialysis_during" form:"dialysis_during"`
634
+	DialysisDuring                  float64 `gorm:"column:dialysis_during" json:"dialysis_during" form:"dialysis_during"`
635
 	StrokeVolume                    int64   `gorm:"column:stroke_volume" json:"stroke_volume" form:"stroke_volume"`
635
 	StrokeVolume                    int64   `gorm:"column:stroke_volume" json:"stroke_volume" form:"stroke_volume"`
636
 	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
636
 	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
637
 	BloodFlow                       int64   `gorm:"column:blood_flow" json:"blood_flow" form:"blood_flow"`
637
 	BloodFlow                       int64   `gorm:"column:blood_flow" json:"blood_flow" form:"blood_flow"`

+ 1 - 1
service/gobal_config_service.go Ver arquivo

314
 	}
314
 	}
315
 
315
 
316
 	if len(keyword) > 0 {
316
 	if len(keyword) > 0 {
317
-		db = db.Joins("left join sgj_xt.xt_drug_warehouse as o on o.id = x.warehousing_id  left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = o.creater").Group("s.id")
317
+		db = db.Joins("left join sgj_xt.xt_drug_warehouse as o on o.id = x.warehousing_id  left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = o.creater")
318
 		db = db.Where("x.warehousing_order like ? or t.drug_name like ? or r.user_name like ? ", likeKey, likeKey, likeKey)
318
 		db = db.Where("x.warehousing_order like ? or t.drug_name like ? or r.user_name like ? ", likeKey, likeKey, likeKey)
319
 
319
 
320
 	}
320
 	}

+ 8 - 0
service/his_service.go Ver arquivo

339
 	return
339
 	return
340
 }
340
 }
341
 
341
 
342
+func GetLastHisPatientCaseHistory(org_id int64, patient_id int64) (models.HisPatientCaseHistory, error) {
343
+
344
+	patientCaseHistory := models.HisPatientCaseHistory{}
345
+	err := readDb.Where("user_org_id =? and status= 1 and patient_id = ?", org_id, patient_id).Last(&patientCaseHistory).Error
346
+
347
+	return patientCaseHistory, err
348
+}
349
+
342
 func GetHisPatientCaseHistoryList(org_id int64, patient_id int64) (caseHistorys []*models.HisPatientCaseHistory, err error) {
350
 func GetHisPatientCaseHistoryList(org_id int64, patient_id int64) (caseHistorys []*models.HisPatientCaseHistory, err error) {
343
 	db := readDb.Model(&models.HisPatientCaseHistory{}).Where("user_org_id = ? AND status = 1  AND his_patient_id = ?", org_id, patient_id)
351
 	db := readDb.Model(&models.HisPatientCaseHistory{}).Where("user_org_id = ? AND status = 1  AND his_patient_id = ?", org_id, patient_id)
344
 	err = db.Find(&caseHistorys).Error
352
 	err = db.Find(&caseHistorys).Error

+ 10 - 1
service/inspection_service.go Ver arquivo

368
 	return inspection, err
368
 	return inspection, err
369
 }
369
 }
370
 
370
 
371
+func GetLastInspectionProject(patient_id int64, org_id int64, project_id int64) (models.XtInspection, error) {
372
+
373
+	inspection := models.XtInspection{}
374
+
375
+	err := XTReadDB().Where("patient_id = ? and org_id = ? and project_id = ? and status=1", patient_id, org_id, project_id).Last(&inspection).Error
376
+
377
+	return inspection, err
378
+}
379
+
371
 func GetInspectionByProjectId(patient_id int64, org_id int64, project_id int64) (inspection []*models.NewInspection, err error) {
380
 func GetInspectionByProjectId(patient_id int64, org_id int64, project_id int64) (inspection []*models.NewInspection, err error) {
372
 
381
 
373
 	db := XTReadDB().Table("xt_inspection").Where("status =1")
382
 	db := XTReadDB().Table("xt_inspection").Where("status =1")
382
 		db = db.Where("project_id = ?", project_id)
391
 		db = db.Where("project_id = ?", project_id)
383
 	}
392
 	}
384
 
393
 
385
-	err = db.Order("inspect_date desc").Group("inspect_date").Scan(&inspection).Error
394
+	err = db.Order("id asc").Group("inspect_date").Scan(&inspection).Error
386
 	return inspection, err
395
 	return inspection, err
387
 
396
 
388
 }
397
 }

+ 1 - 1
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Ver arquivo

378
 	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
378
 	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
379
 	ReturnBlood                     int64   `gorm:"column:return_blood" json:"return_blood" form:"return_blood"`
379
 	ReturnBlood                     int64   `gorm:"column:return_blood" json:"return_blood" form:"return_blood"`
380
 	RehydrationVolume               int64   `gorm:"column:rehydration_volume" json:"rehydration_volume" form:"rehydration_volume"`
380
 	RehydrationVolume               int64   `gorm:"column:rehydration_volume" json:"rehydration_volume" form:"rehydration_volume"`
381
-	DialysisDuring                  int64   `gorm:"column:dialysis_during" json:"dialysis_during" form:"dialysis_during"`
381
+	DialysisDuring                  float64 `gorm:"column:dialysis_during" json:"dialysis_during" form:"dialysis_during"`
382
 	StrokeVolume                    int64   `gorm:"column:stroke_volume" json:"stroke_volume" form:"stroke_volume"`
382
 	StrokeVolume                    int64   `gorm:"column:stroke_volume" json:"stroke_volume" form:"stroke_volume"`
383
 	BloodFlow                       int64   `gorm:"column:blood_flow" json:"blood_flow" form:"blood_flow"`
383
 	BloodFlow                       int64   `gorm:"column:blood_flow" json:"blood_flow" form:"blood_flow"`
384
 	SealingFluidDispose             string  `gorm:"column:sealing_fluid_dispose" json:"sealing_fluid_dispose" form:"sealing_fluid_dispose"`
384
 	SealingFluidDispose             string  `gorm:"column:sealing_fluid_dispose" json:"sealing_fluid_dispose" form:"sealing_fluid_dispose"`

+ 1 - 1
service/secondary_service.go Ver arquivo

1153
 
1153
 
1154
 func GetStockFlowOrderList(good_id int64, user_org_id int64) (list []*models.VmStockFlow, err error) {
1154
 func GetStockFlowOrderList(good_id int64, user_org_id int64) (list []*models.VmStockFlow, err error) {
1155
 
1155
 
1156
-	err = XTReadDB().Where("good_id = ? and user_org_id =?  and status=1 and ctime>=1711900800", good_id, user_org_id).Order("id asc").Find(&list).Error
1156
+	err = XTReadDB().Where("good_id = ? and user_org_id =?  and status=1", good_id, user_org_id).Order("id asc").Find(&list).Error
1157
 	return list, err
1157
 	return list, err
1158
 }
1158
 }
1159
 
1159
 

+ 3 - 2
service/user_service.go Ver arquivo

4
 	"XT_New/models"
4
 	"XT_New/models"
5
 
5
 
6
 	"fmt"
6
 	"fmt"
7
-	"github.com/jinzhu/gorm"
8
 	"time"
7
 	"time"
8
+
9
+	"github.com/jinzhu/gorm"
9
 )
10
 )
10
 
11
 
11
 func GetAdminUserByUserID(userID int64) (*models.AdminUser, error) {
12
 func GetAdminUserByUserID(userID int64) (*models.AdminUser, error) {
217
 
218
 
218
 func GetDrugFlowDetailById(drug_id int64, org_id int64) (flow []*models.DrugFlow, err error) {
219
 func GetDrugFlowDetailById(drug_id int64, org_id int64) (flow []*models.DrugFlow, err error) {
219
 
220
 
220
-	err = XTReadDB().Model(&flow).Where("drug_id = ? and status =1 and user_org_id =?", drug_id, org_id).Order("id asc").Find(&flow).Error
221
+	err = XTReadDB().Model(&flow).Where("drug_id = ? and status =1 and user_org_id =?", drug_id, org_id).Order("ctime asc").Find(&flow).Error
221
 
222
 
222
 	return flow, err
223
 	return flow, err
223
 }
224
 }