Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
e0c4fe9588

+ 6 - 10
controllers/manage_api_controller.go View File

@@ -1040,10 +1040,10 @@ func (this *MachineApiController) GetAllOrganization() {
1040 1040
 
1041 1041
 func (this *MachineApiController) SaveInformation() {
1042 1042
 	eid, _ := this.GetInt64("eid")
1043
-	fmt.Print("eid-------", eid)
1043
+
1044 1044
 	dataBody := make(map[string]interface{}, 0)
1045 1045
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1046
-	//fmt.Println("错误是", err)
1046
+
1047 1047
 	adminUserInfo := this.GetAdminUserInfo()
1048 1048
 	orgid := adminUserInfo.CurrentOrgId
1049 1049
 
@@ -1089,21 +1089,17 @@ func (this *MachineApiController) SaveInformation() {
1089 1089
 	dialysis_time := dataBody["dialysis_time"].(string)
1090 1090
 	//fmt.Println("透析时长", dialysis_time)
1091 1091
 
1092
-	//hyperfiletration := dataBody["hyperfiltratio"].(string)
1093 1092
 	hyperfiletration := dataBody["hyperfiltratio"].(float64)
1094
-	//hyperfiletration := strconv.FormatInt(hyperfiltratios, 10)
1093
+
1095 1094
 	fmt.Println("实际超滤量", hyperfiletration)
1096 1095
 
1097
-	//weight_loss := dataBody["weight_loss"].(string)
1098 1096
 	weight_loss := dataBody["weight_loss"].(float64)
1099
-	//weight_loss := strconv.FormatInt(weightloss, 10)
1097
+
1100 1098
 	fmt.Println("体重减少", weight_loss)
1101 1099
 
1102 1100
 	warining_value := dataBody["warning_value"].(string)
1103 1101
 	fmt.Println("预警值", warining_value)
1104 1102
 
1105
-	//user_total := dataBody["user_total"].(string)
1106
-	//fmt.Println("使用次数",user_total)
1107 1103
 	usertotal := int64(dataBody["user_total"].(float64))
1108 1104
 	user_total := strconv.FormatInt(usertotal, 10)
1109 1105
 
@@ -1185,7 +1181,7 @@ func (this *MachineApiController) SaveInformation() {
1185 1181
 	sign_name := int64(dataBody["sign_name"].(float64))
1186 1182
 	//fmt.Println("签名", sign_name)
1187 1183
 
1188
-	information, errinfor := service.GetInformation(eid, startdate, orgid)
1184
+	information, errinfor := service.GetInformation(eid, startdate, orgid, classtype)
1189 1185
 	fmt.Print("errinfor", errinfor)
1190 1186
 	fmt.Print("information", information)
1191 1187
 	if errinfor == gorm.ErrRecordNotFound {
@@ -1287,7 +1283,7 @@ func (this *MachineApiController) SaveInformation() {
1287 1283
 			Bed:                   number.Number,
1288 1284
 		}
1289 1285
 		informationdata, err := service.GetLastInformationdata(eid, startdate, orgid)
1290
-		fmt.Print("informationdata----", informationdata.ID)
1286
+
1291 1287
 		errors := service.UpadateForm(informationdata.ID, orgid, &infor)
1292 1288
 		//fmt.Print("报错", errors)
1293 1289
 		if errors != nil {

+ 11 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -243,6 +243,7 @@ func (c *CheckWeightApiController) SaveBloodPressure() {
243 243
 
244 244
 		// 保存透后相关数据
245 245
 		assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysis(adminUserInfo.Org.Id, id, theAssessmentDateTime)
246
+
246 247
 		if getAADErr != nil {
247 248
 			c.ErrorLog("获取透后评估失败:%v", getAADErr)
248 249
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -268,6 +269,11 @@ func (c *CheckWeightApiController) SaveBloodPressure() {
268 269
 		afterevaluation.DiastolicBloodPressure = diastolic_blood_pressure // 舒张压
269 270
 		afterevaluation.PulseFrequency = pulse_frequency                  // 脉率
270 271
 
272
+		afterevaluation.LeaveOfficeMethod = assessmentAfterDislysis.LeaveOfficeMethod //离科方式
273
+		afterevaluation.Lapse = assessmentAfterDislysis.Lapse                         //转归
274
+		afterevaluation.Consciousness = assessmentAfterDislysis.Consciousness         //意识
275
+		afterevaluation.Fallrisk = assessmentAfterDislysis.Fallrisk                   //跌倒风险
276
+
271 277
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
272 278
 		if err == nil {
273 279
 			c.ServeSuccessJSON(map[string]interface{}{
@@ -697,6 +703,11 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
697 703
 
698 704
 		afterevaluation.WeightAfter = weight_after
699 705
 		afterevaluation.WeightLoss = weight_loss
706
+
707
+		afterevaluation.LeaveOfficeMethod = assessmentAfterDislysis.LeaveOfficeMethod //离科方式
708
+		afterevaluation.Lapse = assessmentAfterDislysis.Lapse                         //转归
709
+		afterevaluation.Consciousness = assessmentAfterDislysis.Consciousness         //意识
710
+		afterevaluation.Fallrisk = assessmentAfterDislysis.Fallrisk
700 711
 		// if (adminUserInfo.Org.Id == 9538){
701 712
 		// 	afterevaluation.ActualUltrafiltration = weight_loss * 1000  //中能建的计量单位是毫升(ml)
702 713
 		// } else {

+ 19 - 2
controllers/self_drug_api_congtroller.go View File

@@ -81,6 +81,8 @@ func SelfDrugRouters() {
81 81
 	beego.Router("/api/drug/getdrugwarehouseinfototal", &StockManagerApiController{}, "Get:GetDrugWarehouseInfoTotal")
82 82
 
83 83
 	beego.Router("/api/drug/saveinentorylist", &SelfDrugApiController{}, "Post:SaveInventoryList")
84
+
85
+	beego.Router("/api/drug/getdamagebydrugid", &SelfDrugApiController{}, "Get:GetDamageByDrugId")
84 86
 }
85 87
 
86 88
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -2359,9 +2361,8 @@ func (this *SelfDrugApiController) SaveDrugProofInventory() {
2359 2361
 	warehouse_info_id, _ := this.GetInt64("warehouse_info_id")
2360 2362
 	warehousing_unit := this.GetString("warehousing_unit")
2361 2363
 	remark := this.GetString("remark")
2362
-	//total := this.GetString("total")
2363 2364
 	proof_count, _ := this.GetInt64("proof_count")
2364
-	fmt.Println("pof_count2222222", proof_count)
2365
+
2365 2366
 	inventory := models.XtDrugInventory{
2366 2367
 		WarehouseInfoId: warehouse_info_id,
2367 2368
 		ProofCount:      proof_count,
@@ -2586,3 +2587,19 @@ func (this *SelfDrugApiController) SaveInventoryList() {
2586 2587
 		}
2587 2588
 	}
2588 2589
 }
2590
+
2591
+func (this *SelfDrugApiController) GetDamageByDrugId() {
2592
+
2593
+	drug_id, _ := this.GetInt64("drug_id")
2594
+	warehousing_order := this.GetString("warehousing_order")
2595
+	drug_type, _ := this.GetInt64("type")
2596
+	list, err := service.GetDamageByDrugId(drug_id, warehousing_order, drug_type)
2597
+	if err != nil {
2598
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
2599
+		return
2600
+	}
2601
+
2602
+	this.ServeSuccessJSON(map[string]interface{}{
2603
+		"list": list,
2604
+	})
2605
+}

+ 1 - 0
models/self_drug_models.go View File

@@ -844,6 +844,7 @@ type VmDrugInventory struct {
844 844
 	MinUnit            string             `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
845 845
 	MinCount           int64              `gorm:"column:min_count" json:"min_count" form:"min_count"`
846 846
 	Total              string             `gorm:"column:total" json:"total" form:"total"`
847
+	MinPrice           float64            `gorm:"column:min_price" json:"min_price" form:"min_price"`
847 848
 	ExpiryDate         int64              `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
848 849
 	ProductDate        int64              `gorm:"column:product_date" json:"product_date" form:"product_date"`
849 850
 	DrugOriginPlace    string             `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`

+ 2 - 2
service/manage_service.go View File

@@ -896,10 +896,10 @@ func GetAllpatient(orgid int64) (patients []*models.Patients, err error) {
896 896
 ////	return &information, nil
897 897
 ////}
898 898
 
899
-func GetInformation(eid int64, startdate int64, orgid int64) (*models.DeviceInformation, error) {
899
+func GetInformation(eid int64, startdate int64, orgid int64, classtype int64) (*models.DeviceInformation, error) {
900 900
 	var information models.DeviceInformation
901 901
 	var err error
902
-	err = UserReadDB().Model(&information).Where("equiment_id = ? and user_org_id = ? and status = ? and date = ? ", eid, orgid, 1, startdate).Find(&information).Error
902
+	err = UserReadDB().Model(&information).Where("equiment_id = ? and user_org_id = ? and status = ? and date = ?  and class = ?", eid, orgid, 1, startdate, classtype).Find(&information).Error
903 903
 	fmt.Print("", err)
904 904
 	if err == gorm.ErrRecordNotFound {
905 905
 		return nil, err

+ 21 - 3
service/self_drug_service.go View File

@@ -879,7 +879,7 @@ func CreateDrugDamage(damage models.XtDrugDamage) error {
879 879
 func GetDrugDamageList(startime int64, endtime int64, orgId int64, keyword string, limit int64, page int64) (adjust []*models.VmDrugInventory, total int64, err error) {
880 880
 	likeKey := "%" + keyword + "%"
881 881
 	offset := (page - 1) * limit
882
-	db := XTReadDB().Table("xt_drug_inventory as x").Where("x.status = 1 and inventory_type = 10")
882
+	db := XTReadDB().Table("xt_drug_inventory as x").Where("x.status = 1 and inventory_type = 11")
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)
@@ -895,12 +895,12 @@ func GetDrugDamageList(startime int64, endtime int64, orgId int64, keyword strin
895 895
 	if endtime > 0 {
896 896
 		db = db.Where("x.ctime <=?", endtime)
897 897
 	}
898
-	err = db.Group("x.drug_id").Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.number,x.drug_origin_place,x.warehouse_info_id,x.batch_number,x.stock_max_number,x.stock_min_number").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Scan(&adjust).Error
898
+	err = db.Group("x.drug_id").Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.number,x.drug_origin_place,x.warehouse_info_id,x.batch_number,x.stock_max_number,x.stock_min_number,t.min_number,t.max_unit,t.min_unit,t.min_price").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Scan(&adjust).Error
899 899
 	return adjust, total, err
900 900
 }
901 901
 
902 902
 func GetDrugDamageByOrgId(orgid int64) (list []*models.XtDrugInventory, err error) {
903
-	err = XTReadDB().Model(&list).Where("user_org_id = ? and inventory_type = 10 and status = 1", orgid).Find(&list).Error
903
+	err = XTReadDB().Model(&list).Where("user_org_id = ? and inventory_type = 11 and status = 1", orgid).Find(&list).Error
904 904
 	return list, err
905 905
 }
906 906
 
@@ -1120,3 +1120,21 @@ func CreateDrugWarehouseOutInfo(info models.DrugWarehouseOutInfo) error {
1120 1120
 	err := XTWriteDB().Create(&info).Error
1121 1121
 	return err
1122 1122
 }
1123
+
1124
+func GetDamageByDrugId(drugid int64, warhousingorder string, drugtype int64) (drug []*models.XtDrugInventory, err error) {
1125
+
1126
+	db := XTReadDB().Table("xt_drug_inventory").Where("status = 1 and inventory_type = 11 ")
1127
+
1128
+	if drugid > 0 {
1129
+		db = db.Where("drug_id = ?", drugid)
1130
+	}
1131
+	if len(warhousingorder) > 0 {
1132
+		db = db.Where("warehousing_order = ?", warhousingorder)
1133
+	}
1134
+	if drugtype > 0 {
1135
+		db = db.Where("type = ?", drugtype)
1136
+	}
1137
+
1138
+	err = db.Find(&drug).Error
1139
+	return drug, err
1140
+}