浏览代码

历史排班

28169 2 年前
父节点
当前提交
224326af3b

+ 6 - 6
controllers/base_api_controller.go 查看文件

@@ -82,7 +82,7 @@ func (this *BaseAuthAPIController) Prepare() {
82 82
 		userAdmin.ModifyTime = 1530786071
83 83
 		var subscibe models.ServeSubscibe
84 84
 		subscibe.ID = 11
85
-		subscibe.OrgId = 9671 //机构id
85
+		subscibe.OrgId = 10341 //机构id
86 86
 		subscibe.PeriodStart = 1547447814
87 87
 		subscibe.PeriodEnd = 1550039814
88 88
 		subscibe.State = 1
@@ -92,8 +92,8 @@ func (this *BaseAuthAPIController) Prepare() {
92 92
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93 93
 		subscibes[4] = &subscibe
94 94
 		var adminUserInfo service.AdminUserInfo
95
-		adminUserInfo.CurrentOrgId = 9671 //机构id小英9675或4
96
-		adminUserInfo.CurrentAppId = 3427 //4
95
+		adminUserInfo.CurrentOrgId = 10341 //机构id小英9675或4
96
+		adminUserInfo.CurrentAppId = 3295  //4
97 97
 		adminUserInfo.AdminUser = &userAdmin
98 98
 		adminUserInfo.Subscibes = subscibes
99 99
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -328,7 +328,7 @@ func (this *BaseServeAPIController) Prepare() {
328 328
 		userAdmin.ModifyTime = 1530786071
329 329
 		var subscibe models.ServeSubscibe
330 330
 		subscibe.ID = 11
331
-		subscibe.OrgId = 9671 //机构id小英9675或4
331
+		subscibe.OrgId = 10341 //机构id小英9675或4
332 332
 		subscibe.PeriodStart = 1538035409
333 333
 		subscibe.PeriodEnd = 1569571409
334 334
 		subscibe.State = 1
@@ -338,8 +338,8 @@ func (this *BaseServeAPIController) Prepare() {
338 338
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339 339
 		subscibes[4] = &subscibe
340 340
 		var adminUserInfo service.AdminUserInfo
341
-		adminUserInfo.CurrentOrgId = 9671 //机构id小英9675或4
342
-		adminUserInfo.CurrentAppId = 3427 //4
341
+		adminUserInfo.CurrentOrgId = 10341 //机构id小英9675或4
342
+		adminUserInfo.CurrentAppId = 3295  //4
343 343
 		adminUserInfo.AdminUser = &userAdmin
344 344
 		adminUserInfo.Subscibes = subscibes
345 345
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 1 - 0
controllers/dialysis_api_controller.go 查看文件

@@ -603,6 +603,7 @@ func (c *DialysisApiController) PostPrescription() {
603 603
 		}
604 604
 
605 605
 		err := service.AddSigleRecord(&prescription)
606
+
606 607
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
607 608
 		redis := service.RedisClient()
608 609
 		//清空key 值

+ 13 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

@@ -2804,9 +2804,12 @@ func (this *DialysisAPIController) StartDialysis() {
2804 2804
 
2805 2805
 			//针对肇庆三鹤血液透析中心
2806 2806
 
2807
-			if template.TemplateId == 43 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 {
2807
+			if template.TemplateId == 43 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10440 {
2808 2808
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
2809
+			}
2809 2810
 
2811
+			if adminUserInfo.Org.Id == 10469 {
2812
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 60 / float64(totalMin))
2810 2813
 			}
2811 2814
 
2812 2815
 			if template.TemplateId == 20 || template.TemplateId == 22 { //adminUserInfo.Org.Id == 9538
@@ -3690,12 +3693,18 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
3690 3693
 				record.UltrafiltrationRate = ultrafiltration_rate
3691 3694
 			}
3692 3695
 
3693
-			if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 9829 || adminInfo.Org.Id == 10440 || adminInfo.Org.Id == 10469 {
3696
+			if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 9829 || adminInfo.Org.Id == 10440 {
3694 3697
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3695 3698
 
3696 3699
 				record.UltrafiltrationRate = ultrafiltration_rate
3697 3700
 			}
3698 3701
 
3702
+			if adminInfo.Org.Id == 10469 {
3703
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 60 / 1000 / float64(totalMin) * 1000)
3704
+
3705
+				record.UltrafiltrationRate = ultrafiltration_rate
3706
+			}
3707
+
3699 3708
 			if adminInfo.Org.Id == 10471 {
3700 3709
 
3701 3710
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
@@ -5731,6 +5740,7 @@ func (c *DialysisAPIController) EditConsumables() {
5731 5740
 					count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
5732 5741
 
5733 5742
 					commdity_code := items["commdity_code"].(string)
5743
+
5734 5744
 					fmt.Println(commdity_code)
5735 5745
 
5736 5746
 					prepareGoods := &models.DialysisBeforePrepareGoods{
@@ -6196,6 +6206,7 @@ func (c *DialysisAPIController) EditConsumables() {
6196 6206
 						Creater:      adminInfo.AdminUser.Id,
6197 6207
 						Status:       1,
6198 6208
 						StorehouseId: houseConfig.StorehouseOutInfo,
6209
+						ProjectId:    it.ProjectId,
6199 6210
 					}
6200 6211
 					//删除准备表数据
6201 6212
 					service.DeleteDialysisBefor(adminInfo.Org.Id, patient_id, record_time, it.GoodId, it.GoodTypeId)

+ 119 - 48
controllers/self_drug_api_congtroller.go 查看文件

@@ -3664,70 +3664,141 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3664 3664
 		ids = append(ids, it.ID)
3665 3665
 	}
3666 3666
 	manufacturerList, _ := service.GetNewAllManufacturerList(orgId)
3667
-	list, total, err := service.GetGoodNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, ids, goodIds)
3668 3667
 
3669
-	for _, item := range list {
3668
+	if orgId == 10265 {
3669
+		list, total, err := service.GetGoodNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, ids, goodIds)
3670 3670
 
3671
-		//获取期初结余
3672
-		low, _ := service.GetStartLastFLow(item.ID, orgId, startTime)
3671
+		for _, item := range list {
3673 3672
 
3674
-		item.GoodStartFlowInfo = low
3673
+			//获取期初结余
3674
+			low, _ := service.GetStartLastFLow(item.ID, orgId, startTime)
3675 3675
 
3676
-		//获取期末结余
3677
-		flow, _ := service.GetEndLastFlow(item.ID, orgId, endTime)
3676
+			item.GoodStartFlowInfo = low
3678 3677
 
3679
-		item.GoodEndFlowInfo = flow
3678
+			//获取期末结余
3679
+			flow, _ := service.GetEndLastFlow(item.ID, orgId, endTime)
3680 3680
 
3681
-		//获取期间增加
3682
-		goodWarehouseInfoList, _ := service.GetAddGoodWarehouseInfoList(item.ID, orgId, startTime, endTime)
3683
-		for _, it := range goodWarehouseInfoList {
3684
-			item.WarehousingInfoOne = append(item.WarehousingInfoOne, it)
3685
-		}
3681
+			item.GoodEndFlowInfo = flow
3686 3682
 
3687
-		//获取本期增加
3688
-		WarehouseInfoFlowList, _ := service.GetAddStartFlow(item.ID, orgId, startTime, endTime)
3689
-		for _, it := range WarehouseInfoFlowList {
3690
-			item.StartFlowWarehouseInfo = append(item.StartFlowWarehouseInfo, it)
3691
-		}
3692
-		//获取本期减少
3693
-		reduceWarehouseInfoList, _ := service.GetReduceWarehouseInfoList(item.ID, orgId, startTime, endTime)
3694
-		for _, it := range reduceWarehouseInfoList {
3695
-			item.WarehouseOutInfoStart = append(item.WarehouseOutInfoStart, it)
3696
-		}
3683
+			//获取期间增加
3684
+			goodWarehouseInfoList, _ := service.GetAddGoodWarehouseInfoList(item.ID, orgId, startTime, endTime)
3685
+			for _, it := range goodWarehouseInfoList {
3686
+				item.WarehousingInfoOne = append(item.WarehousingInfoOne, it)
3687
+			}
3697 3688
 
3698
-		//获取期中减少退库
3699
-		lowInfo, _ := service.GetStartEndCancelFLowInfo(item.ID, orgId, startTime, endTime)
3700
-		for _, it := range lowInfo {
3701
-			item.StartEndCancelFLowInfo = append(item.StartEndCancelFLowInfo, it)
3689
+			//获取本期增加
3690
+			WarehouseInfoFlowList, _ := service.GetAddStartFlow(item.ID, orgId, startTime, endTime)
3691
+			for _, it := range WarehouseInfoFlowList {
3692
+				item.StartFlowWarehouseInfo = append(item.StartFlowWarehouseInfo, it)
3693
+			}
3694
+			//获取本期减少
3695
+			reduceWarehouseInfoList, _ := service.GetReduceWarehouseInfoList(item.ID, orgId, startTime, endTime)
3696
+			for _, it := range reduceWarehouseInfoList {
3697
+				item.WarehouseOutInfoStart = append(item.WarehouseOutInfoStart, it)
3698
+			}
3699
+
3700
+			//获取期中减少退库
3701
+			lowInfo, _ := service.GetStartEndCancelFLowInfo(item.ID, orgId, startTime, endTime)
3702
+			for _, it := range lowInfo {
3703
+				item.StartEndCancelFLowInfo = append(item.StartEndCancelFLowInfo, it)
3704
+			}
3705
+			//
3706
+			outInfo, _ := service.FindeWarehouseOutInfo(item.ID, orgId, startTime)
3707
+			for _, it := range outInfo {
3708
+				item.WarehouseOutInfoEnd = append(item.WarehouseOutInfoEnd, it)
3709
+			}
3710
+
3711
+			//期中盘盈
3712
+			profit, _ := service.FindeEndStokInventoryProfit(item.ID, orgId, startTime, endTime)
3713
+			for _, it := range profit {
3714
+				item.WareStartEndStockInventoryProfit = append(item.WareStartEndStockInventoryProfit, it)
3715
+			}
3716
+			//期中盘亏
3717
+			losses, _ := service.FindeEndStockInventoryLosses(item.ID, orgId, startTime, endTime)
3718
+			for _, it := range losses {
3719
+				item.WareStartEndStockInventoryLosses = append(item.WareStartEndStockInventoryLosses, it)
3720
+			}
3702 3721
 		}
3703
-		//
3704
-		outInfo, _ := service.FindeWarehouseOutInfo(item.ID, orgId, startTime)
3705
-		for _, it := range outInfo {
3706
-			item.WarehouseOutInfoEnd = append(item.WarehouseOutInfoEnd, it)
3722
+
3723
+		if err != nil {
3724
+			this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取患者信息失败")
3725
+			return
3707 3726
 		}
3708 3727
 
3709
-		//期中盘盈
3710
-		profit, _ := service.FindeEndStokInventoryProfit(item.ID, orgId, startTime, endTime)
3711
-		for _, it := range profit {
3712
-			item.WareStartEndStockInventoryProfit = append(item.WareStartEndStockInventoryProfit, it)
3728
+		this.ServeSuccessJSON(map[string]interface{}{
3729
+			"list":             list,
3730
+			"manufacturerList": manufacturerList,
3731
+			"total":            total,
3732
+		})
3733
+	}
3734
+
3735
+	if orgId != 10265 {
3736
+		list, total, err := service.GetGoodNewPurchaseStockQueryOne(good_type, keyword, page, limit, orgId, ids, goodIds)
3737
+
3738
+		for _, item := range list {
3739
+
3740
+			//获取期初结余
3741
+			low, _ := service.GetStartLastFLow(item.ID, orgId, startTime)
3742
+
3743
+			item.GoodStartFlowInfo = low
3744
+
3745
+			//获取期末结余
3746
+			flow, _ := service.GetEndLastFlow(item.ID, orgId, endTime)
3747
+
3748
+			item.GoodEndFlowInfo = flow
3749
+
3750
+			//获取期间增加
3751
+			goodWarehouseInfoList, _ := service.GetAddGoodWarehouseInfoList(item.ID, orgId, startTime, endTime)
3752
+			for _, it := range goodWarehouseInfoList {
3753
+				item.WarehousingInfoOne = append(item.WarehousingInfoOne, it)
3754
+			}
3755
+
3756
+			//获取本期增加
3757
+			WarehouseInfoFlowList, _ := service.GetAddStartFlow(item.ID, orgId, startTime, endTime)
3758
+			for _, it := range WarehouseInfoFlowList {
3759
+				item.StartFlowWarehouseInfo = append(item.StartFlowWarehouseInfo, it)
3760
+			}
3761
+			//获取本期减少
3762
+			reduceWarehouseInfoList, _ := service.GetReduceWarehouseInfoList(item.ID, orgId, startTime, endTime)
3763
+			for _, it := range reduceWarehouseInfoList {
3764
+				item.WarehouseOutInfoStart = append(item.WarehouseOutInfoStart, it)
3765
+			}
3766
+
3767
+			//获取期中减少退库
3768
+			lowInfo, _ := service.GetStartEndCancelFLowInfo(item.ID, orgId, startTime, endTime)
3769
+			for _, it := range lowInfo {
3770
+				item.StartEndCancelFLowInfo = append(item.StartEndCancelFLowInfo, it)
3771
+			}
3772
+			//
3773
+			outInfo, _ := service.FindeWarehouseOutInfo(item.ID, orgId, startTime)
3774
+			for _, it := range outInfo {
3775
+				item.WarehouseOutInfoEnd = append(item.WarehouseOutInfoEnd, it)
3776
+			}
3777
+
3778
+			//期中盘盈
3779
+			profit, _ := service.FindeEndStokInventoryProfit(item.ID, orgId, startTime, endTime)
3780
+			for _, it := range profit {
3781
+				item.WareStartEndStockInventoryProfit = append(item.WareStartEndStockInventoryProfit, it)
3782
+			}
3783
+			//期中盘亏
3784
+			losses, _ := service.FindeEndStockInventoryLosses(item.ID, orgId, startTime, endTime)
3785
+			for _, it := range losses {
3786
+				item.WareStartEndStockInventoryLosses = append(item.WareStartEndStockInventoryLosses, it)
3787
+			}
3713 3788
 		}
3714
-		//期中盘亏
3715
-		losses, _ := service.FindeEndStockInventoryLosses(item.ID, orgId, startTime, endTime)
3716
-		for _, it := range losses {
3717
-			item.WareStartEndStockInventoryLosses = append(item.WareStartEndStockInventoryLosses, it)
3789
+
3790
+		if err != nil {
3791
+			this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取患者信息失败")
3792
+			return
3718 3793
 		}
3719
-	}
3720 3794
 
3721
-	if err != nil {
3722
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取患者信息失败")
3723
-		return
3795
+		this.ServeSuccessJSON(map[string]interface{}{
3796
+			"list":             list,
3797
+			"manufacturerList": manufacturerList,
3798
+			"total":            total,
3799
+		})
3724 3800
 	}
3725 3801
 
3726
-	this.ServeSuccessJSON(map[string]interface{}{
3727
-		"list":             list,
3728
-		"manufacturerList": manufacturerList,
3729
-		"total":            total,
3730
-	})
3731 3802
 }
3732 3803
 
3733 3804
 func (this *SelfDrugApiController) GetPurchaseNewDrugQuery() {

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

@@ -94,7 +94,7 @@ func GetDialysisAdviceTemplateList(keywords string, limit int64, page int64, par
94 94
 	if orgID > 0 {
95 95
 		db = db.Where("xt_schedule.user_org_id  = ?", orgID)
96 96
 	}
97
-	fmt.Println("idArray23233223323232233232", len(idArray))
97
+
98 98
 	if len(idArray) >= 1 {
99 99
 		db = db.Where("xt_schedule.id in(?)", idArray)
100 100
 	}

+ 23 - 0
service/self_drug_service.go 查看文件

@@ -2599,6 +2599,29 @@ func GetGoodNewPurchaseStockQuery(good_type int64, keyword string, page int64, l
2599 2599
 	return goodinfo, total, err
2600 2600
 }
2601 2601
 
2602
+func GetGoodNewPurchaseStockQueryOne(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2603
+
2604
+	db := XTReadDB().Model(&goodinfo).Where("status = 1")
2605
+	offset := (page - 1) * limit
2606
+	likeKey := "%" + keyword + "%"
2607
+	if good_type > 0 {
2608
+		db = db.Where("good_type_id = ?", good_type)
2609
+	}
2610
+
2611
+	if orgid > 0 {
2612
+		db = db.Where("org_id = ?", orgid)
2613
+	}
2614
+	if len(ids) > 0 {
2615
+		db = db.Where("id in(?)", goodIds)
2616
+	}
2617
+	if len(keyword) > 0 {
2618
+		db = db.Where("good_name like ? or manufacturer in(?)", likeKey, ids)
2619
+	}
2620
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("ctime desc").Find(&goodinfo).Error
2621
+
2622
+	return goodinfo, total, err
2623
+}
2624
+
2602 2625
 func GetStartLastFLow(goodid int64, orgid int64, startime int64) (models.VmStockFlowTwenty, error) {
2603 2626
 
2604 2627
 	flwo := models.VmStockFlowTwenty{}

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

@@ -3999,7 +3999,7 @@ func GetHisProjectPrescriptionByPatientIdOne(id int64) (models.HisPrescriptionPr
3999 3999
 
4000 4000
 func GetAllAutoRecordByPatient(patientid int64, recorddate int64) (auto []*models.WarehouseOutInfoNight, err error) {
4001 4001
 
4002
-	err = XTReadDB().Select("count,warehouse_info_id,good_id,org_id,sys_record_time,patient_id,project_id,warehouse_info_id,warehouse_out_order_number,storehouse_id,price,dealer,manufacturer,good_type_id,product_date,expiry_date,number,license_number").Where(" patient_id = ? and sys_record_time = ?  and status = 1 and is_sys = 1 and count>0", patientid, recorddate).Find(&auto).Error
4002
+	err = XTReadDB().Select("count,warehouse_info_id,good_id,org_id,sys_record_time,patient_id,project_id,warehouse_info_id,warehouse_out_order_number,storehouse_id,price,dealer,manufacturer,good_type_id,product_date,expiry_date,number,license_number").Where(" patient_id = ? and sys_record_time = ?  and status = 1 and is_sys = 1 and count>0 and project_id >0", patientid, recorddate).Find(&auto).Error
4003 4003
 	return auto, err
4004 4004
 
4005 4005
 }
@@ -4012,9 +4012,9 @@ func ModefyWarehouseInfo(count int64, id int64) error {
4012 4012
 
4013 4013
 func DeleteAutoWarehouse(patient_id int64, record_time int64) error {
4014 4014
 
4015
-	err := XTWriteDB().Model(models.AutomaticReduceDetail{}).Where("patient_id = ? and record_time = ? and status = 1", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4016
-	err = XTWriteDB().Model(models.DialysisBeforePrepare{}).Where("patient_id = ? and record_date = ? and status = 1", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4017
-	err = XTWriteDB().Model(models.VmStockFlow{}).Where("patient_id = ? and system_time = ? and status = 1", patient_id, record_time).Updates(map[string]interface{}{"is_read": 1}).Error
4015
+	err := XTWriteDB().Model(models.AutomaticReduceDetail{}).Where("patient_id = ? and record_time = ? and status = 1 and project_id >0", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4016
+	err = XTWriteDB().Model(models.DialysisBeforePrepare{}).Where("patient_id = ? and record_date = ? and status = 1 and project_id >0", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4017
+	err = XTWriteDB().Model(models.VmStockFlow{}).Where("patient_id = ? and system_time = ? and status = 1 and project_id >0", patient_id, record_time).Updates(map[string]interface{}{"is_read": 1}).Error
4018 4018
 	//err = XTWriteDB().Model(models.WarehouseOutInfoNight{}).Where("patient_id = ? and sys_record_time = ? and status = 1", patient_id, record_time).Updates(map[string]interface{}{"status": 0}).Error
4019 4019
 
4020 4020
 	return err