28169 5 mesi fa
parent
commit
41d9966792

BIN
XT_New.exe Vedi File


+ 4 - 4
controllers/base_api_controller.go Vedi File

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 = 10028 //机构id
86
+		subscibe.OrgId = 10721 //机构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 = 10028 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10721 //机构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 = 10028 //机构id小英9675或4
332
+		subscibe.OrgId = 10721 //机构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 = 10028 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10721 //机构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

+ 3 - 1
controllers/drug_stock_api_contorller.go Vedi File

3391
 		}
3391
 		}
3392
 		//查询该仓库是否有默认数据
3392
 		//查询该仓库是否有默认数据
3393
 		drugStockCount, _ := service.GetNewDrugStockCount(item.StorehouseId, item.DrugId, item.OrgId, tx)
3393
 		drugStockCount, _ := service.GetNewDrugStockCount(item.StorehouseId, item.DrugId, item.OrgId, tx)
3394
-		fmt.Println("errcode======================", drugStockCount.ID)
3394
+
3395
 		if drugStockCount.ID == 0 {
3395
 		if drugStockCount.ID == 0 {
3396
 			drugStock := models.XtDrugStockCount{
3396
 			drugStock := models.XtDrugStockCount{
3397
 				UserOrgId:      item.OrgId,
3397
 				UserOrgId:      item.OrgId,
3420
 		"list": list,
3420
 		"list": list,
3421
 	})
3421
 	})
3422
 
3422
 
3423
+	return
3424
+
3423
 }
3425
 }
3424
 
3426
 
3425
 func (c *StockDrugApiController) ReturnCheckWarehouseingInfo() {
3427
 func (c *StockDrugApiController) ReturnCheckWarehouseingInfo() {

+ 120 - 32
controllers/patient_api_controller.go Vedi File

14
 	"XT_New/models"
14
 	"XT_New/models"
15
 	"XT_New/service"
15
 	"XT_New/service"
16
 	"XT_New/utils"
16
 	"XT_New/utils"
17
+	"github.com/astaxie/beego/config"
17
 	"github.com/jinzhu/gorm"
18
 	"github.com/jinzhu/gorm"
18
 	"github.com/mozillazg/go-pinyin"
19
 	"github.com/mozillazg/go-pinyin"
19
 
20
 
8661
 
8662
 
8662
 	lastBefor, _ := service.GetPatientLastBefor(patient_id, startTime, endTime, orgId)
8663
 	lastBefor, _ := service.GetPatientLastBefor(patient_id, startTime, endTime, orgId)
8663
 
8664
 
8664
-	this.ServeSuccessJSON(map[string]interface{}{
8665
-		"prescription":                         prescription,
8666
-		"berfor":                               berfor,
8667
-		"monitorList":                          monitorList,
8668
-		"dryweightList":                        dryweightList,
8669
-		"inpectionList":                        inpectionList,
8670
-		"dialysisOrder":                        dialysisOrder,
8671
-		"patient":                              patient,
8672
-		"longAdvice":                           longAdvice,
8673
-		"groupPrescriptionList":                groupPrescriptionList,
8674
-		"after":                                after,
8675
-		"max_blood_flow_volume":                monitor.BloodFlowVolume,
8676
-		"max_befor_systolic_blood_pressure":    maxBeforSystolicBloodPressure.SystolicBloodPressure,
8677
-		"min_befor_systolic_blood_pressure":    minBeforSystolicBloodPressure.SystolicBloodPressure,
8678
-		"max_befor_diastolic_blood_pressure":   maxBeforDiastolicBloodPressure.DiastolicBloodPressure,
8679
-		"min_befor_diastolic_blood_pressure":   minBeforDiastolicBloodPressure.DiastolicBloodPressure,
8680
-		"max_after_systolic_blood_pressure":    maxAfterSystolicBloodPressure.SystolicBloodPressure,
8681
-		"min_after_systolic_blood_pressure":    minAfterSystolicBloodPressure.SystolicBloodPressure,
8682
-		"max_after_diastolic_blood_pressure":   maxAfterDiastolicBloodPressure.DiastolicBloodPressure,
8683
-		"min_after_diastolic_blood_pressure":   minAfterDiastolicBloodPressure.DiastolicBloodPressure,
8684
-		"max_monitor_systolic_blood_pressure":  maxMonitorSystolicBloodPressure.SystolicBloodPressure,
8685
-		"min_monitor_systolic_blood_pressure":  minMonitorSystolicBloodPressure.SystolicBloodPressure,
8686
-		"max_monitor_diastolic_blood_pressure": maxMonitorDiastolicBloodPressure.DiastolicBloodPressure,
8687
-		"min_monitor_diastolic_blood_pressure": minMonitorDiastolicBloodPressure.DiastolicBloodPressure,
8688
-		"lastDryWeight":                        lastDryWeight,
8689
-		"patientVascularAccess":                patientVascularAccess,
8690
-		"lastBefor":                            lastBefor,
8691
-	})
8665
+	_, configs := service.FindXTHisRecordByOrgId(orgId)
8666
+
8667
+	//血透
8668
+	if configs.IsOpen != 1 {
8669
+		this.ServeSuccessJSON(map[string]interface{}{
8670
+			"prescription":                         prescription,
8671
+			"berfor":                               berfor,
8672
+			"monitorList":                          monitorList,
8673
+			"dryweightList":                        dryweightList,
8674
+			"inpectionList":                        inpectionList,
8675
+			"dialysisOrder":                        dialysisOrder,
8676
+			"patient":                              patient,
8677
+			"longAdvice":                           longAdvice,
8678
+			"groupPrescriptionList":                groupPrescriptionList,
8679
+			"after":                                after,
8680
+			"max_blood_flow_volume":                monitor.BloodFlowVolume,
8681
+			"max_befor_systolic_blood_pressure":    maxBeforSystolicBloodPressure.SystolicBloodPressure,
8682
+			"min_befor_systolic_blood_pressure":    minBeforSystolicBloodPressure.SystolicBloodPressure,
8683
+			"max_befor_diastolic_blood_pressure":   maxBeforDiastolicBloodPressure.DiastolicBloodPressure,
8684
+			"min_befor_diastolic_blood_pressure":   minBeforDiastolicBloodPressure.DiastolicBloodPressure,
8685
+			"max_after_systolic_blood_pressure":    maxAfterSystolicBloodPressure.SystolicBloodPressure,
8686
+			"min_after_systolic_blood_pressure":    minAfterSystolicBloodPressure.SystolicBloodPressure,
8687
+			"max_after_diastolic_blood_pressure":   maxAfterDiastolicBloodPressure.DiastolicBloodPressure,
8688
+			"min_after_diastolic_blood_pressure":   minAfterDiastolicBloodPressure.DiastolicBloodPressure,
8689
+			"max_monitor_systolic_blood_pressure":  maxMonitorSystolicBloodPressure.SystolicBloodPressure,
8690
+			"min_monitor_systolic_blood_pressure":  minMonitorSystolicBloodPressure.SystolicBloodPressure,
8691
+			"max_monitor_diastolic_blood_pressure": maxMonitorDiastolicBloodPressure.DiastolicBloodPressure,
8692
+			"min_monitor_diastolic_blood_pressure": minMonitorDiastolicBloodPressure.DiastolicBloodPressure,
8693
+			"lastDryWeight":                        lastDryWeight,
8694
+			"patientVascularAccess":                patientVascularAccess,
8695
+			"lastBefor":                            lastBefor,
8696
+		})
8697
+	}
8698
+
8699
+	//his
8700
+	if configs.IsOpen == 1 {
8701
+
8702
+		hisadvice, _ := service.GetHisPrecriptionadviceList(orgId, patient_id, startTime, endTime)
8703
+		if len(hisadvice) > 0 {
8704
+			if len(hisadvice) > 0 {
8705
+				for _, item := range hisadvice {
8706
+					baseDrug, _ := service.GetBasedrugByIdOne(item.DrugId, orgId)
8707
+					item.StartTime = item.CreatedTime
8708
+					item.AdviceDesc = baseDrug.Dose + baseDrug.DoseUnit + "*" + config.ToString(baseDrug.MinNumber) + baseDrug.MinUnit + "/" + baseDrug.MaxUnit
8709
+				}
8710
+			}
8711
+		}
8712
+		this.ServeSuccessJSON(map[string]interface{}{
8713
+			"prescription":                         prescription,
8714
+			"berfor":                               berfor,
8715
+			"monitorList":                          monitorList,
8716
+			"dryweightList":                        dryweightList,
8717
+			"inpectionList":                        inpectionList,
8718
+			"dialysisOrder":                        dialysisOrder,
8719
+			"patient":                              patient,
8720
+			"longAdvice":                           hisadvice,
8721
+			"groupPrescriptionList":                groupPrescriptionList,
8722
+			"after":                                after,
8723
+			"max_blood_flow_volume":                monitor.BloodFlowVolume,
8724
+			"max_befor_systolic_blood_pressure":    maxBeforSystolicBloodPressure.SystolicBloodPressure,
8725
+			"min_befor_systolic_blood_pressure":    minBeforSystolicBloodPressure.SystolicBloodPressure,
8726
+			"max_befor_diastolic_blood_pressure":   maxBeforDiastolicBloodPressure.DiastolicBloodPressure,
8727
+			"min_befor_diastolic_blood_pressure":   minBeforDiastolicBloodPressure.DiastolicBloodPressure,
8728
+			"max_after_systolic_blood_pressure":    maxAfterSystolicBloodPressure.SystolicBloodPressure,
8729
+			"min_after_systolic_blood_pressure":    minAfterSystolicBloodPressure.SystolicBloodPressure,
8730
+			"max_after_diastolic_blood_pressure":   maxAfterDiastolicBloodPressure.DiastolicBloodPressure,
8731
+			"min_after_diastolic_blood_pressure":   minAfterDiastolicBloodPressure.DiastolicBloodPressure,
8732
+			"max_monitor_systolic_blood_pressure":  maxMonitorSystolicBloodPressure.SystolicBloodPressure,
8733
+			"min_monitor_systolic_blood_pressure":  minMonitorSystolicBloodPressure.SystolicBloodPressure,
8734
+			"max_monitor_diastolic_blood_pressure": maxMonitorDiastolicBloodPressure.DiastolicBloodPressure,
8735
+			"min_monitor_diastolic_blood_pressure": minMonitorDiastolicBloodPressure.DiastolicBloodPressure,
8736
+			"lastDryWeight":                        lastDryWeight,
8737
+			"patientVascularAccess":                patientVascularAccess,
8738
+			"lastBefor":                            lastBefor,
8739
+		})
8740
+	}
8692
 
8741
 
8693
 }
8742
 }
8694
 
8743
 
8888
 		endTime = theTime.Unix()
8937
 		endTime = theTime.Unix()
8889
 	}
8938
 	}
8890
 
8939
 
8891
-	advicelist, _ := service.GetPatientAdviceList(patient_id, orgId, startTime, endTime, advice_type)
8940
+	_, configs := service.FindXTHisRecordByOrgId(orgId)
8941
+
8942
+	if configs.IsOpen == 1 {
8943
+
8944
+		if advice_type == 1 {
8945
+			hisLongadvicelist, _ := service.GetHisPrecriptionadviceList(orgId, patient_id, startTime, endTime)
8946
+			if len(hisLongadvicelist) > 0 {
8947
+				for _, item := range hisLongadvicelist {
8948
+					item.StartTime = item.CreatedTime
8949
+					baseDrug, _ := service.GetBasedrugByIdOne(item.DrugId, orgId)
8950
+					item.AdviceDesc = baseDrug.Dose + baseDrug.DoseUnit + "*" + config.ToString(baseDrug.MinNumber) + baseDrug.MinUnit + "/" + baseDrug.MaxUnit
8951
+				}
8952
+			}
8953
+			this.ServeSuccessJSON(map[string]interface{}{
8954
+				"advicelist": hisLongadvicelist,
8955
+			})
8956
+			return
8957
+		} else {
8958
+			fmt.Println("hhhhhh")
8959
+			advicelist, _ := service.GetHisadviceList(orgId, patient_id, startTime, endTime)
8960
+			if len(advicelist) > 0 {
8961
+				for _, item := range advicelist {
8962
+					item.StartTime = item.CreatedTime
8963
+					baseDrug, _ := service.GetBasedrugByIdOne(item.DrugId, orgId)
8964
+					item.AdviceDesc = baseDrug.Dose + baseDrug.DoseUnit + "*" + config.ToString(baseDrug.MinNumber) + baseDrug.MinUnit + "/" + baseDrug.MaxUnit
8965
+				}
8966
+			}
8967
+			this.ServeSuccessJSON(map[string]interface{}{
8968
+				"advicelist": advicelist,
8969
+			})
8970
+			return
8971
+		}
8972
+
8973
+	}
8974
+
8975
+	if configs.IsOpen != 1 {
8976
+		advicelist, _ := service.GetPatientAdviceList(patient_id, orgId, startTime, endTime, advice_type)
8977
+		this.ServeSuccessJSON(map[string]interface{}{
8978
+			"advicelist": advicelist,
8979
+		})
8980
+		return
8981
+	}
8982
+	return
8892
 
8983
 
8893
-	this.ServeSuccessJSON(map[string]interface{}{
8894
-		"advicelist": advicelist,
8895
-	})
8896
 }
8984
 }
8897
 
8985
 
8898
 func (this *PatientApiController) GetPatientInspectionList() {
8986
 func (this *PatientApiController) GetPatientInspectionList() {

+ 0 - 1
service/new_stock_service.go Vedi File

353
 			tx.Rollback()
353
 			tx.Rollback()
354
 			return nil, err
354
 			return nil, err
355
 		}
355
 		}
356
-		return nil, err
357
 	}
356
 	}
358
 	return &drugStockCount, nil
357
 	return &drugStockCount, nil
359
 }
358
 }

+ 40 - 0
service/patient_dataconfig_service.go Vedi File

182
 
182
 
183
 	return advice, err
183
 	return advice, err
184
 }
184
 }
185
+
186
+func GetHisPrecriptionadviceList(org_id int64, patient_id int64, start_time int64, end_time int64) (advice []*models.HisPrescriptionAdviceTemplate, err error) {
187
+
188
+	db := XTReadDB().Model(&advice).Where("status =1")
189
+	if org_id > 0 {
190
+		db = db.Where("user_org_id =?", org_id)
191
+	}
192
+	if patient_id > 0 {
193
+		db = db.Where("patient_id = ?", patient_id)
194
+	}
195
+	if start_time > 0 {
196
+		db = db.Where("created_time>=?", start_time)
197
+	}
198
+	if end_time > 0 {
199
+		db = db.Where("created_time<=?", end_time)
200
+	}
201
+	err = db.Find(&advice).Error
202
+
203
+	return advice, err
204
+}
205
+
206
+func GetHisadviceList(org_id int64, patient_id int64, start_time int64, end_time int64) (advice []*models.HisDoctorAdviceInfo, err error) {
207
+
208
+	db := XTReadDB().Model(&advice).Where("status =1")
209
+	if org_id > 0 {
210
+		db = db.Where("user_org_id =?", org_id)
211
+	}
212
+	if patient_id > 0 {
213
+		db = db.Where("patient_id = ?", patient_id)
214
+	}
215
+	if start_time > 0 {
216
+		db = db.Where("advice_date>=?", start_time)
217
+	}
218
+	if end_time > 0 {
219
+		db = db.Where("advice_date<=?", end_time)
220
+	}
221
+	err = db.Find(&advice).Error
222
+
223
+	return advice, err
224
+}

+ 1 - 1
service/user_service.go Vedi File

181
 
181
 
182
 func UpdateDialysisPrescription(patientid int64, orgid int64, dryweight float64, prescription models.PredialysisEvaluation) error {
182
 func UpdateDialysisPrescription(patientid int64, orgid int64, dryweight float64, prescription models.PredialysisEvaluation) error {
183
 
183
 
184
-	err := XTWriteDB().Model(&prescription).Where("patient_id = ? AND user_org_id = ? and assessment_date = ?", patientid, orgid, prescription.AssessmentDate).Update(map[string]interface{}{"dry_weight": prescription.DryWeight, "mtime": time.Now().Unix()}).Error
184
+	err := XTWriteDB().Model(&prescription).Where("patient_id = ? AND user_org_id = ? and assessment_date = ?", patientid, orgid, prescription.AssessmentDate).Update(map[string]interface{}{"dry_weight": prescription.DryWeight, "updated_time": time.Now().Unix()}).Error
185
 	fmt.Println("错误是设么", err)
185
 	fmt.Println("错误是设么", err)
186
 	return err
186
 	return err
187
 }
187
 }

+ 12 - 11
service/warhouse_service.go Vedi File

6443
 
6443
 
6444
 func ModifyNewGoodSumCount(storehouse_id int64, count int64, user_org_id int64, good_id int64, tx *gorm.DB) error {
6444
 func ModifyNewGoodSumCount(storehouse_id int64, count int64, user_org_id int64, good_id int64, tx *gorm.DB) error {
6445
 
6445
 
6446
-	err = tx.Model(&models.XtGoodStockCount{}).Where("storehouse_id = ? and status = 1 and user_org_id  = ? and good_id =?", storehouse_id, user_org_id, good_id).UpdateColumn("stock_out_count", gorm.Expr("stock_out_count + ?", count)).Error
6447
-	if err != nil {
6448
-		tx.Rollback()
6449
-		return err
6450
-	}
6446
+	err := tx.Model(&models.XtGoodStockCount{}).Where("storehouse_id = ? and status = 1 and user_org_id  = ? and good_id =?", storehouse_id, user_org_id, good_id).UpdateColumn("stock_out_count", gorm.Expr("stock_out_count + ?", count)).Error
6451
 
6447
 
6452
 	err = tx.Model(&models.XtGoodStockCount{}).Where("storehouse_id = ? and status = 1 and user_org_id  = ? and good_id =?", storehouse_id, user_org_id, good_id).UpdateColumn("stock_act_out_count", gorm.Expr("stock_act_out_count + ?", count)).Error
6448
 	err = tx.Model(&models.XtGoodStockCount{}).Where("storehouse_id = ? and status = 1 and user_org_id  = ? and good_id =?", storehouse_id, user_org_id, good_id).UpdateColumn("stock_act_out_count", gorm.Expr("stock_act_out_count + ?", count)).Error
6449
+
6450
+	fmt.Println("err---------------------------", err)
6453
 	if err != nil {
6451
 	if err != nil {
6454
 		tx.Rollback()
6452
 		tx.Rollback()
6455
 		return err
6453
 		return err
6456
 	}
6454
 	}
6457
-
6458
 	return err
6455
 	return err
6459
 }
6456
 }
6460
 
6457
 
10907
 		//更新出库数量
10904
 		//更新出库数量
10908
 		ModifyNewGoodSumCount(goods.StorehouseId, goods.Count, goods.OrgId, goods.GoodId, tx)
10905
 		ModifyNewGoodSumCount(goods.StorehouseId, goods.Count, goods.OrgId, goods.GoodId, tx)
10909
 
10906
 
10910
-		if warehouse.StockCount < maxNumber {
10911
-			tx.Rollback()
10912
-			return errors.New("库存数量不足")
10913
-
10914
-		}
10907
+		fmt.Println("warehouse.StockCount----------------", warehouse.StockCount)
10908
+		fmt.Println("warehouse.StockCount----------------", maxNumber)
10909
+		//if warehouse.StockCount < maxNumber {
10910
+		//	tx.Rollback()
10911
+		//	return errors.New("库存数量不足")
10912
+		//
10913
+		//}
10915
 
10914
 
10916
 		return nil
10915
 		return nil
10917
 	} else {
10916
 	} else {
10978
 		ModifyNewGoodSumCount(goods.StorehouseId, stock_number, goods.OrgId, goods.GoodId, tx)
10977
 		ModifyNewGoodSumCount(goods.StorehouseId, stock_number, goods.OrgId, goods.GoodId, tx)
10979
 
10978
 
10980
 		goods.Count = deliver_number - stock_number
10979
 		goods.Count = deliver_number - stock_number
10980
+
10981
+		fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh", goods.Count)
10981
 		ConsumablesNewDeliveryThirty(orgID, record_time, goods, warehouseOut, count, creator, tx)
10982
 		ConsumablesNewDeliveryThirty(orgID, record_time, goods, warehouseOut, count, creator, tx)
10982
 	}
10983
 	}
10983
 	return nil
10984
 	return nil