浏览代码

历史排班

28169 1年前
父节点
当前提交
a40869570a

+ 11 - 10
controllers/dialysis_api_controller.go 查看文件

2536
 		if dialysisFinish.ID == 0 {
2536
 		if dialysisFinish.ID == 0 {
2537
 			service.CreateDialysisFinish(finish)
2537
 			service.CreateDialysisFinish(finish)
2538
 		}
2538
 		}
2539
-		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 {
2539
+
2540
+		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 {
2540
 			var dewater_amount float64
2541
 			var dewater_amount float64
2541
 			dewater_amount = 0
2542
 			dewater_amount = 0
2542
 			if dry_weight > 0 {
2543
 			if dry_weight > 0 {
2543
 				dewater_amount = weight_before - dry_weight - additional_weight
2544
 				dewater_amount = weight_before - dry_weight - additional_weight
2544
 
2545
 
2545
-				if adminUserInfo.CurrentOrgId != 10551 && adminUserInfo.CurrentOrgId != 10579 && adminUserInfo.CurrentOrgId != 10580 && adminUserInfo.CurrentOrgId != 10585 {
2546
+				if adminUserInfo.CurrentOrgId != 10551 && adminUserInfo.CurrentOrgId != 10579 && adminUserInfo.CurrentOrgId != 10580 && adminUserInfo.CurrentOrgId != 10585 && adminUserInfo.CurrentOrgId != 10344 {
2546
 					dewater_amount = dewater_amount * 1000
2547
 					dewater_amount = dewater_amount * 1000
2547
 				}
2548
 				}
2548
 
2549
 
2586
 			// 插入透析处方
2587
 			// 插入透析处方
2587
 			if dialysisPrescribe == nil && dialysisSolution != nil {
2588
 			if dialysisPrescribe == nil && dialysisSolution != nil {
2588
 				var newprescribe models.DialysisPrescription
2589
 				var newprescribe models.DialysisPrescription
2589
-				newprescribe.UserOrgId = dialysisSolution.UserOrgId
2590
-				newprescribe.PatientId = dialysisSolution.PatientId
2590
+				newprescribe.UserOrgId = adminUserInfo.CurrentOrgId
2591
+				newprescribe.PatientId = patient
2591
 				newprescribe.Anticoagulant = dialysisSolution.Anticoagulant
2592
 				newprescribe.Anticoagulant = dialysisSolution.Anticoagulant
2592
 				newprescribe.AnticoagulantShouji = dialysisSolution.AnticoagulantShouji
2593
 				newprescribe.AnticoagulantShouji = dialysisSolution.AnticoagulantShouji
2593
 				newprescribe.AnticoagulantWeichi = dialysisSolution.AnticoagulantWeichi
2594
 				newprescribe.AnticoagulantWeichi = dialysisSolution.AnticoagulantWeichi
2659
 			if dialysisPrescribe == nil && dialysisSolution == nil {
2660
 			if dialysisPrescribe == nil && dialysisSolution == nil {
2660
 				if lastDialysisPrescribe != nil {
2661
 				if lastDialysisPrescribe != nil {
2661
 					var newprescribe models.DialysisPrescription
2662
 					var newprescribe models.DialysisPrescription
2662
-					newprescribe.UserOrgId = lastDialysisPrescribe.UserOrgId
2663
-					newprescribe.PatientId = lastDialysisPrescribe.PatientId
2663
+					newprescribe.UserOrgId = adminUserInfo.CurrentOrgId
2664
+					newprescribe.PatientId = patient
2664
 					newprescribe.Anticoagulant = lastDialysisPrescribe.Anticoagulant
2665
 					newprescribe.Anticoagulant = lastDialysisPrescribe.Anticoagulant
2665
 					newprescribe.AnticoagulantShouji = lastDialysisPrescribe.AnticoagulantShouji
2666
 					newprescribe.AnticoagulantShouji = lastDialysisPrescribe.AnticoagulantShouji
2666
 					newprescribe.AnticoagulantWeichi = lastDialysisPrescribe.AnticoagulantWeichi
2667
 					newprescribe.AnticoagulantWeichi = lastDialysisPrescribe.AnticoagulantWeichi
2889
 		// 插入透析处方
2890
 		// 插入透析处方
2890
 		if dialysisPrescribe == nil && dialysisSolution != nil {
2891
 		if dialysisPrescribe == nil && dialysisSolution != nil {
2891
 			var newprescribe models.DialysisPrescription
2892
 			var newprescribe models.DialysisPrescription
2892
-			newprescribe.UserOrgId = dialysisSolution.UserOrgId
2893
-			newprescribe.PatientId = dialysisSolution.PatientId
2893
+			newprescribe.UserOrgId = adminUserInfo.CurrentOrgId
2894
+			newprescribe.PatientId = patient
2894
 			newprescribe.Anticoagulant = dialysisSolution.Anticoagulant
2895
 			newprescribe.Anticoagulant = dialysisSolution.Anticoagulant
2895
 			newprescribe.AnticoagulantShouji = dialysisSolution.AnticoagulantShouji
2896
 			newprescribe.AnticoagulantShouji = dialysisSolution.AnticoagulantShouji
2896
 			newprescribe.AnticoagulantWeichi = dialysisSolution.AnticoagulantWeichi
2897
 			newprescribe.AnticoagulantWeichi = dialysisSolution.AnticoagulantWeichi
2961
 		if dialysisPrescribe == nil && dialysisSolution == nil {
2962
 		if dialysisPrescribe == nil && dialysisSolution == nil {
2962
 			if lastDialysisPrescribe != nil {
2963
 			if lastDialysisPrescribe != nil {
2963
 				var newprescribe models.DialysisPrescription
2964
 				var newprescribe models.DialysisPrescription
2964
-				newprescribe.UserOrgId = lastDialysisPrescribe.UserOrgId
2965
-				newprescribe.PatientId = lastDialysisPrescribe.PatientId
2965
+				newprescribe.UserOrgId = adminUserInfo.CurrentOrgId
2966
+				newprescribe.PatientId = patient
2966
 				newprescribe.Anticoagulant = lastDialysisPrescribe.Anticoagulant
2967
 				newprescribe.Anticoagulant = lastDialysisPrescribe.Anticoagulant
2967
 				newprescribe.AnticoagulantShouji = lastDialysisPrescribe.AnticoagulantShouji
2968
 				newprescribe.AnticoagulantShouji = lastDialysisPrescribe.AnticoagulantShouji
2968
 				newprescribe.AnticoagulantWeichi = lastDialysisPrescribe.AnticoagulantWeichi
2969
 				newprescribe.AnticoagulantWeichi = lastDialysisPrescribe.AnticoagulantWeichi

+ 1 - 1
controllers/self_drug_api_congtroller.go 查看文件

3917
 
3917
 
3918
 		//获取期末结余
3918
 		//获取期末结余
3919
 		endFlow, _ := service.GetDrugEndFlow(item.ID, orgId, endTime)
3919
 		endFlow, _ := service.GetDrugEndFlow(item.ID, orgId, endTime)
3920
-
3920
+		fmt.Println("endFlow2222222222222222", endFlow)
3921
 		item.DrugEndFlow = endFlow
3921
 		item.DrugEndFlow = endFlow
3922
 		//获取期初结余入库数量
3922
 		//获取期初结余入库数量
3923
 		//startDrugInfo, _ := service.GetDrugWarehouseInfoStart(item.ID, orgId, startTime)
3923
 		//startDrugInfo, _ := service.GetDrugWarehouseInfoStart(item.ID, orgId, startTime)

+ 7 - 1
service/patient_service.go 查看文件

75
 
75
 
76
 	}
76
 	}
77
 	if lapseto != 2 && lapseto != 3 {
77
 	if lapseto != 2 && lapseto != 3 {
78
-		err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
78
+		if orgID != 10579 {
79
+			err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
80
+		}
81
+
82
+		if orgID == 10579 {
83
+			err = db.Order("p.dialysis_no asc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
84
+		}
79
 
85
 
80
 	}
86
 	}
81
 
87
 

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

2841
 func GetStartLastFLowTwenty(goodid int64, orgid int64, startime int64) (models.VmStockFlowTwenty, error) {
2841
 func GetStartLastFLowTwenty(goodid int64, orgid int64, startime int64) (models.VmStockFlowTwenty, error) {
2842
 
2842
 
2843
 	flwo := models.VmStockFlowTwenty{}
2843
 	flwo := models.VmStockFlowTwenty{}
2844
-	err := XTReadDB().Where("good_id = ? and user_org_id = ? and status = 1 and ctime < ?", goodid, orgid, startime).Last(&flwo).Error
2844
+	err := XTReadDB().Where("good_id = ? and user_org_id = ? and status = 1 and ctime < ?", goodid, orgid, startime).Order("ctime desc").Last(&flwo).Error
2845
 	return flwo, err
2845
 	return flwo, err
2846
 }
2846
 }
2847
 
2847
 
2848
 func GetEndLastFlow(goodid int64, orgid int64, endtime int64, storehouse_id int64) (models.VmStockFlowTwenty, error) {
2848
 func GetEndLastFlow(goodid int64, orgid int64, endtime int64, storehouse_id int64) (models.VmStockFlowTwenty, error) {
2849
 	flwo := models.VmStockFlowTwenty{}
2849
 	flwo := models.VmStockFlowTwenty{}
2850
-	err := XTReadDB().Where("good_id = ? and user_org_id = ? and status = 1 and ctime <= ? and storehouse_id= ?", goodid, orgid, endtime, storehouse_id).Last(&flwo).Error
2850
+	err := XTReadDB().Where("good_id = ? and user_org_id = ? and status = 1 and ctime <= ? and storehouse_id= ?", goodid, orgid, endtime, storehouse_id).Order("ctime desc").Last(&flwo).Error
2851
 	return flwo, err
2851
 	return flwo, err
2852
 }
2852
 }
2853
 
2853
 
2884
 func GetDrugStartFlow(drug_id int64, user_org_id int64, startime int64) (models.DrugFlowTwenty, error) {
2884
 func GetDrugStartFlow(drug_id int64, user_org_id int64, startime int64) (models.DrugFlowTwenty, error) {
2885
 
2885
 
2886
 	flow := models.DrugFlowTwenty{}
2886
 	flow := models.DrugFlowTwenty{}
2887
-	err := XTReadDB().Where("drug_id = ? and user_org_id = ? and ctime<? and status = 1", drug_id, user_org_id, startime).Last(&flow).Error
2887
+	err := XTReadDB().Where("drug_id = ? and user_org_id = ? and ctime<? and status = 1", drug_id, user_org_id, startime).Order("ctime desc").Last(&flow).Error
2888
 	return flow, err
2888
 	return flow, err
2889
 }
2889
 }
2890
 
2890
 
2891
 func GetDrugEndFlow(drug_id int64, user_org_id int64, endtime int64) (models.DrugFlowTwenty, error) {
2891
 func GetDrugEndFlow(drug_id int64, user_org_id int64, endtime int64) (models.DrugFlowTwenty, error) {
2892
 
2892
 
2893
 	flow := models.DrugFlowTwenty{}
2893
 	flow := models.DrugFlowTwenty{}
2894
-	err := XTReadDB().Where("drug_id = ? and user_org_id = ? and ctime<=? and status = 1", drug_id, user_org_id, endtime).Last(&flow).Error
2894
+	err := XTReadDB().Where("drug_id = ? and user_org_id = ? and ctime<=? and status = 1", drug_id, user_org_id, endtime).Order("ctime desc").Last(&flow).Error
2895
 	return flow, err
2895
 	return flow, err
2896
 }
2896
 }
2897
 
2897
 

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

2077
 
2077
 
2078
 func GetAutoDrugList(user_org_id int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2078
 func GetAutoDrugList(user_org_id int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2079
 
2079
 
2080
-	err = XTReadDB().Where("user_org_id =? and status =1 and advice_date = 1698681600 and drug_id =239", user_org_id).Find(&advice).Error
2080
+	err = XTReadDB().Where("user_org_id =? and status =1 and advice_date = 1700582400 and drug_id =239", user_org_id).Find(&advice).Error
2081
 
2081
 
2082
 	return advice, err
2082
 	return advice, err
2083
 }
2083
 }