Browse Source

2024/6/17

28169 9 months ago
parent
commit
9203f31508

BIN
XT_New.exe View File


+ 6 - 6
controllers/base_api_controller.go View File

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

+ 4 - 1
controllers/dialysis_api_controller.go View File

@@ -5036,7 +5036,7 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
5036 5036
 		advice.AdviceType = adviceType
5037 5037
 
5038 5038
 		advice.StartTime = StartTime
5039
-		if StartTime < 0 {
5039
+		if advice.StartTime < 0 {
5040 5040
 			advice.StartTime = time.Now().Unix()
5041 5041
 		}
5042 5042
 		advice.AdviceDate = AdviceDate
@@ -5167,6 +5167,9 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
5167 5167
 					child.Remark = Remark
5168 5168
 					child.AdviceType = adviceType
5169 5169
 					child.StartTime = StartTime
5170
+					if child.StartTime < 0 {
5171
+						child.StartTime = time.Now().Unix()
5172
+					}
5170 5173
 					child.AdviceDate = AdviceDate
5171 5174
 					child.RecordDate = RecordDate
5172 5175
 					child.Status = 1

+ 6 - 3
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -1814,7 +1814,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1814 1814
 					}
1815 1815
 				}
1816 1816
 
1817
-				//针对异常未出库问题的脚本
1817
+				fmt.Println("org_id =============================", adminInfo.Org.Id)
1818
+				////针对异常未出库问题的脚本
1818 1819
 				if adminInfo.Org.Id == 10598 {
1819 1820
 
1820 1821
 					newadviceInfo := &models.HisDoctorAdviceInfo{
@@ -1901,8 +1902,10 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1901 1902
 						}
1902 1903
 					}
1903 1904
 					//按最小单位出库
1904
-					var cha_count = total_count - out_count
1905
-					fmt.Println("cha_count--------------------------------------", cha_count)
1905
+					//var cha_count = total_count - out_count
1906
+					fmt.Println("cha_count--------------------------------------", out_count)
1907
+
1908
+					var cha_count = 1
1906 1909
 					newadviceInfo.PrescribingNumber = float64(cha_count)
1907 1910
 					newadviceInfo.PrescribingNumberUnit = medical.MinUnit
1908 1911
 					service.NewHisDrugsDelivery(advice.UserOrgId, creater, newadviceInfo, tx)

+ 8 - 1
controllers/new_mobile_api_controllers/new_manage_api_controller.go View File

@@ -149,6 +149,13 @@ func (this *NewManageApiController) SaveDisInfectionInfo() {
149 149
 	order, _ := service.GetPatientOrderInfo(scheduledate, patientid, orgid)
150 150
 	//查询病人今日透后评估数据
151 151
 	dislysis, _ := service.GetAssessmentAfterDissDataTwo(patientid, orgid, scheduledate)
152
+
153
+	assessmentBeforThrity, _ := service.GetAssessmentBeforThrity(orgid, patientid, scheduledate)
154
+
155
+	var weight_los float64
156
+
157
+	weight_los = assessmentBeforThrity.WeightBefore - dislysis.WeightAfter
158
+
152 159
 	fmt.Println("透析减少", dislysis.WeightLoss)
153 160
 	//			//根据床位号获取设备id
154 161
 	addmacher, _ := service.GetEquimentIDTwo(bedid, orgid)
@@ -187,7 +194,7 @@ func (this *NewManageApiController) SaveDisInfectionInfo() {
187 194
 			StartTime:             order.StartTime,
188 195
 			EndTime:               order.EndTime,
189 196
 			Contagion:             con,
190
-			WeightLoss:            dislysis.WeightLoss,
197
+			WeightLoss:            weight_los,
191 198
 			Hyperfiltratio:        dislysis.ActualUltrafiltration,
192 199
 			DialysisHour:          strconv.FormatInt(dislysis.ActualTreatmentHour, 10),
193 200
 			MachineRun:            1,

+ 1 - 0
controllers/pharmacy_controller.go View File

@@ -757,6 +757,7 @@ func (this *PharmacyController) GetPatientsWithDrugs() {
757 757
 		return
758 758
 	}
759 759
 	listll, err := service.PartitionAndLayoutDrug(deliveryway, stime, etime, orgid, shift, partition, list)
760
+	fmt.Println("list1---------------------------", listll)
760 761
 	if err != nil {
761 762
 		utils.ErrorLog(err.Error())
762 763
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)

+ 22 - 0
controllers/role_controller.go View File

@@ -238,7 +238,9 @@ func (this *RoleAPIController) EditPurviewInitData() {
238 238
 	_, _, DengjiPurview := service.GetOtherAllGeneralPurviewVMsProcessed("/hospitalRecord/index")
239 239
 	_, _, GongjuPurview := service.GetOtherAllGeneralPurviewVMsProcessed("/hisTool")
240 240
 	_, _, ShoufeiPurview := service.GetOtherAllGeneralPurviewVMsProcessed("/hospitalCharges")
241
+
241 242
 	_, _, outpatientRegistrationPurview := service.GetOtherAllGeneralPurviewVMsProcessed("/outpatientRegistration/index")
243
+
242 244
 	_, _, outpatientRegistrationPurviewTwo := service.GetOtherAllGeneralPurviewVMsProcessed("/outpatientDoctorStation")
243 245
 	_, _, outpatientRegistrationPurviewThree := service.GetOtherAllGeneralPurviewVMsProcessed("/outpatientCharges")
244 246
 	_, _, outpatientRegistrationPurviewFour := service.GetOtherAllGeneralPurviewVMsProcessed("/hospitalStation")
@@ -252,6 +254,8 @@ func (this *RoleAPIController) EditPurviewInitData() {
252 254
 	_, _, originDevicePurview := service.GetOtherAllGeneralPurviewVMsProcessed("/device/manage")
253 255
 	_, _, originDataUploadPurview := service.GetOtherAllGeneralPurviewVMsProcessed("/data/upload")
254 256
 
257
+	_, _, originDialysisanalysisPurview := service.GetOtherAllGeneralPurviewVMsProcessed("/Dialysisanalysis")
258
+
255 259
 	_, _, originConsumablesPurview := service.GetOtherAllGeneralPurviewVMsProcessed("/stock/consumablesManagement")
256 260
 	_, _, originDrugsPurview := service.GetOtherAllGeneralPurviewVMsProcessed("/stock/drugs")
257 261
 	_, _, originSelfPreparedMedicinePurview := service.GetOtherAllGeneralPurviewVMsProcessed("/stock/selfPreparedMedicineIndex")
@@ -394,11 +398,15 @@ func (this *RoleAPIController) EditPurviewInitData() {
394 398
 	}
395 399
 
396 400
 	for _, item := range subOutpatientPurviewTreeViewModel {
401
+
397 402
 		if item.Name == "押金管理" {
398 403
 			item.Childs = append(item.Childs, subYajinPurviewTreeViewModel...)
399 404
 		}
400 405
 
401 406
 		if item.Name == "门诊挂号" {
407
+			for _, subitem := range subPurviewTreeViewModel {
408
+				fmt.Println(subitem.Name)
409
+			}
402 410
 			item.Childs = append(item.Childs, subPurviewTreeViewModel...)
403 411
 		}
404 412
 
@@ -664,6 +672,17 @@ func (this *RoleAPIController) EditPurviewInitData() {
664 672
 		subBedPrviewTreeViewModel = append(subBedPrviewTreeViewModel, temp)
665 673
 	}
666 674
 
675
+	subDialysisanalysisPrviewTreeViewModel := []*service.PurviewTreeViewModel{}
676
+	for _, item := range originDialysisanalysisPurview {
677
+		temp := &service.PurviewTreeViewModel{
678
+			ID:     item.Id,
679
+			PID:    item.Parentid,
680
+			Name:   item.Name,
681
+			Number: 1,
682
+		}
683
+		subDialysisanalysisPrviewTreeViewModel = append(subDialysisanalysisPrviewTreeViewModel, temp)
684
+	}
685
+
667 686
 	for _, item := range subDialysisPurviewTreeViewModel {
668 687
 		if item.Name == "透析记录" {
669 688
 			item.Childs = append(item.Childs, purviews_func...)
@@ -689,6 +708,9 @@ func (this *RoleAPIController) EditPurviewInitData() {
689 708
 		if item.Name == "质控上报" {
690 709
 			item.Childs = append(item.Childs, subDataUploadPurviewTreeViewModel...)
691 710
 		}
711
+		if item.Name == "专业质控" {
712
+			item.Childs = append(item.Childs, subDialysisanalysisPrviewTreeViewModel...)
713
+		}
692 714
 	}
693 715
 
694 716
 	for _, item := range subStockPurviewTreeViewModel {

+ 96 - 30
controllers/self_drug_api_congtroller.go View File

@@ -152,6 +152,12 @@ func SelfDrugRouters() {
152 152
 	beego.Router("/api/drug/getselfdrugbatchnumber", &SelfDrugApiController{}, "Get:GetSelfDrugBatchNumber")
153 153
 
154 154
 	beego.Router("/api/drug/postsetfdrugwarehouseout", &SelfDrugApiController{}, "Post:PostSelfDrugWarehouseOut")
155
+
156
+	beego.Router("/api/drug/getallselfdrugwarehouseoutlist", &SelfDrugApiController{}, "Get:GetAllSelfDrugWarehouseOutList")
157
+
158
+	beego.Router("/api/drug/deleteselfwarehouseout", &SelfDrugApiController{}, "Get:DeleteSelfWarehouseOut")
159
+
160
+	beego.Router("/api/drug/getselfdrugwarehouseoutbyid", &SelfDrugApiController{}, "Get:GetSelfDrugWarehouseOutById")
155 161
 }
156 162
 
157 163
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -5005,7 +5011,7 @@ func (c *SelfDrugApiController) DeleteSelfDrugWarehouse() {
5005 5011
 
5006 5012
 func (c *SelfDrugApiController) TocheckSelfWarehouseingInfo() {
5007 5013
 
5008
-	id, _ := c.GetInt64("id")
5014
+	id, _ := c.GetInt64("warehousing_id")
5009 5015
 	patient_id, _ := c.GetInt64("patient_id")
5010 5016
 	orgId := c.GetAdminUserInfo().CurrentOrgId
5011 5017
 	info, _ := service.GetSelfWarehouseInfoByWarehouseInfo(id, patient_id, orgId)
@@ -5153,8 +5159,6 @@ func (c *SelfDrugApiController) GetSelfDrugBatchNumber() {
5153 5159
 
5154 5160
 func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5155 5161
 
5156
-	fmt.Println("开启===========================================================")
5157
-
5158 5162
 	db := service.XTWriteDB()
5159 5163
 	tx := db.Begin()
5160 5164
 	defer func() {
@@ -5166,11 +5170,14 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5166 5170
 	}()
5167 5171
 	patient_id, _ := c.GetInt64("patient_id")
5168 5172
 	warehouse_out_id, _ := c.GetInt64("warehouse_out_id")
5173
+
5169 5174
 	ctime := time.Now().Unix()
5170 5175
 	adminUserInfo := c.GetAdminUserInfo()
5171 5176
 
5172 5177
 	warehousing_out_time := c.GetString("warehousing_out_time")
5178
+
5173 5179
 	warehousingOutDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", warehousing_out_time)
5180
+
5174 5181
 	if parseDateErr != nil {
5175 5182
 		c.ErrorLog("日期(%v)解析错误:%v", warehousingOutDate, parseDateErr)
5176 5183
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -5186,7 +5193,7 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5186 5193
 	number = number + total
5187 5194
 	warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
5188 5195
 	operation_time := time.Now().Unix()
5189
-	fmt.Println("operation_time=================================", operation_time)
5196
+
5190 5197
 	creater := adminUserInfo.AdminUser.Id
5191 5198
 	//创建一个出库单
5192 5199
 	warehouseOut := models.XtSelfDrugWarehouseOut{
@@ -5240,24 +5247,14 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5240 5247
 					return
5241 5248
 				}
5242 5249
 
5243
-				if items["price"] == nil || reflect.TypeOf(items["price"]).String() != "string" {
5244
-					utils.ErrorLog("price")
5245
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5246
-					return
5247
-				}
5248
-				price, _ := strconv.ParseFloat(items["price"].(string), 64)
5249
-
5250 5250
 				count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
5251 5251
 
5252
-				total := float64(count) * price
5253
-				retail_price_total := float64(count) * price
5254 5252
 				remark := items["remark"].(string)
5255 5253
 				max_unit := items["max_unit"].(string)
5256 5254
 				dealer := int64(items["dealer"].(float64))
5257 5255
 
5258 5256
 				manufacturer := int64(items["manufacturer"].(float64))
5259 5257
 
5260
-				number := items["number"].(string)
5261 5258
 				batch_number := items["batch_number"].(string)
5262 5259
 
5263 5260
 				warehouse_info_id := int64(items["warehouse_info_id"].(float64))
@@ -5290,15 +5287,6 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5290 5287
 					}
5291 5288
 				}
5292 5289
 
5293
-				admin_user_id := int64(items["admin_user_id"].(float64))
5294
-
5295
-				//if items["last_price"] == nil || reflect.TypeOf(items["last_price"]).String() != "string" {
5296
-				//  utils.ErrorLog("last_price")
5297
-				//  c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5298
-				//  return
5299
-				//}
5300
-				//last_price, _ := strconv.ParseFloat(items["last_price"].(string), 64)
5301
-
5302 5290
 				stock_count, _ := items["stock_count"].(string)
5303 5291
 
5304 5292
 				patient_id := int64(items["patient_id"].(float64))
@@ -5313,8 +5301,8 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5313 5301
 					WarehouseOutId:          lastWarehouseOut.ID,
5314 5302
 					DrugId:                  drug_id,
5315 5303
 					Count:                   count,
5316
-					Price:                   price,
5317
-					TotalPrice:              total,
5304
+					Price:                   0,
5305
+					TotalPrice:              0,
5318 5306
 					Status:                  1,
5319 5307
 					Ctime:                   warehousingOutDate.Unix(),
5320 5308
 					Mtime:                   ctime,
@@ -5323,16 +5311,16 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5323 5311
 					Type:                    0,
5324 5312
 					Manufacturer:            manufacturer,
5325 5313
 					Dealer:                  dealer,
5326
-					RetailPrice:             price,
5327
-					RetailTotalPrice:        retail_price_total,
5314
+					RetailPrice:             0,
5315
+					RetailTotalPrice:        0,
5328 5316
 					CountUnit:               max_unit,
5329 5317
 					ExpiryDate:              expiryDates,
5330 5318
 					ProductDate:             productDates,
5331
-					Number:                  number,
5319
+					Number:                  "",
5332 5320
 					BatchNumber:             batch_number,
5333 5321
 					IsSys:                   0,
5334 5322
 					WarehouseInfoId:         warehouse_info_id,
5335
-					AdminUserId:             admin_user_id,
5323
+					AdminUserId:             0,
5336 5324
 					StockCount:              stock_count,
5337 5325
 					IsCheck:                 2,
5338 5326
 					SysRecordTime:           warehousingOutDate.Unix(),
@@ -5361,7 +5349,7 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5361 5349
 
5362 5350
 	manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
5363 5351
 
5364
-	warehousingOutInfoList, _ := service.GetDrugWarehouseOutListById(lastWarehouseOut.ID, adminUserInfo.CurrentOrgId)
5352
+	warehousingOutInfoList, _ := service.GetSelfDrugWarehouseOutListById(lastWarehouseOut.ID, adminUserInfo.CurrentOrgId, tx)
5365 5353
 
5366 5354
 	var drugType = "药品类型"
5367 5355
 	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
@@ -5382,3 +5370,81 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5382 5370
 	})
5383 5371
 	return
5384 5372
 }
5373
+
5374
+func (c *SelfDrugApiController) GetAllSelfDrugWarehouseOutList() {
5375
+
5376
+	keyword := c.GetString("keyword")
5377
+
5378
+	patient_id, _ := c.GetInt64("patient_id")
5379
+
5380
+	start_time := c.GetString("start_time")
5381
+
5382
+	end_time := c.GetString("end_time")
5383
+
5384
+	timeLayout := "2006-01-02"
5385
+	loc, _ := time.LoadLocation("Local")
5386
+	var startTime int64
5387
+	if len(start_time) > 0 {
5388
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5389
+		if err != nil {
5390
+			fmt.Println(err)
5391
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5392
+			return
5393
+		}
5394
+		startTime = theTime.Unix()
5395
+	}
5396
+	var endTime int64
5397
+	if len(end_time) > 0 {
5398
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
5399
+		if err != nil {
5400
+			utils.ErrorLog(err.Error())
5401
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5402
+			return
5403
+		}
5404
+		endTime = theTime.Unix()
5405
+	}
5406
+	orgId := c.GetAdminUserInfo().CurrentOrgId
5407
+	baseList, _ := service.GetAllBaseDrugListByKeyWord(keyword, orgId)
5408
+	var ids []int64
5409
+	for _, item := range baseList {
5410
+		ids = append(ids, item.ID)
5411
+	}
5412
+	outInfo, _ := service.GetAllSelfDrugWarehouseOutList(ids, patient_id, startTime, endTime, orgId)
5413
+
5414
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
5415
+	dealerList, _ := service.GetAllDealerList(orgId)
5416
+	var drugType = "药品类型"
5417
+	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
5418
+	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
5419
+
5420
+	c.ServeSuccessJSON(map[string]interface{}{
5421
+		"outInfo":          outInfo,
5422
+		"manufacturerList": manufacturerList,
5423
+		"dealerList":       dealerList,
5424
+		"drugTypeList":     drugTypeList,
5425
+	})
5426
+}
5427
+
5428
+func (c *SelfDrugApiController) DeleteSelfWarehouseOut() {
5429
+
5430
+	id, _ := c.GetInt64("id")
5431
+
5432
+	service.DeleteSelfWarehouseOut(id)
5433
+
5434
+	c.ServeSuccessJSON(map[string]interface{}{
5435
+		"msg": "ok",
5436
+	})
5437
+
5438
+	return
5439
+}
5440
+
5441
+func (c *SelfDrugApiController) GetSelfDrugWarehouseOutById() {
5442
+
5443
+	id, _ := c.GetInt64("id")
5444
+
5445
+	outInfo, _ := service.GetSelfDrugWarehouseOutById(id)
5446
+
5447
+	c.ServeSuccessJSON(map[string]interface{}{
5448
+		"outInfo": outInfo,
5449
+	})
5450
+}

+ 45 - 44
models/drug.go View File

@@ -511,50 +511,51 @@ func (XtSelfDrugWarehouseOut) TableName() string {
511 511
 }
512 512
 
513 513
 type XtSelfDrugWarehouseOutInfo struct {
514
-	ID                      int64   `gorm:"column:id" json:"id" form:"id"`
515
-	WarehouseOutId          int64   `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
516
-	DrugId                  int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
517
-	WarehousingOutTarget    int64   `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
518
-	Count                   int64   `gorm:"column:count" json:"count" form:"count"`
519
-	CountUnit               string  `gorm:"column:count_unit" json:"count_unit" form:"count_unit"`
520
-	Price                   float64 `gorm:"column:price" json:"price" form:"price"`
521
-	TotalPrice              float64 `gorm:"column:total_price" json:"total_price" form:"total_price"`
522
-	ProductDate             int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
523
-	ExpiryDate              int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
524
-	Mtime                   int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
525
-	Ctime                   int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
526
-	Status                  int64   `gorm:"column:status" json:"status" form:"status"`
527
-	OrgId                   int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
528
-	Remark                  string  `gorm:"column:remark" json:"remark" form:"remark"`
529
-	IsCancel                int64   `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
530
-	WarehouseOutOrderNumber string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
531
-	Type                    int64   `gorm:"column:type" json:"type" form:"type"`
532
-	Dealer                  int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
533
-	Manufacturer            int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
534
-	IsSys                   int64   `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
535
-	SysRecordTime           int64   `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
536
-	RetailPrice             float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
537
-	RetailTotalPrice        float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
538
-	WarehouseInfoId         int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
539
-	Number                  string  `gorm:"column:number" json:"number" form:"number"`
540
-	BatchNumber             string  `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
541
-	PatientId               int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
542
-	AdviceId                int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
543
-	SupplyCancelOutId       int64   `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
544
-	SupplyWarehouseId       int64   `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
545
-	IsSource                int64   `gorm:"column:is_source" json:"is_source" form:"is_source"`
546
-	StorehouseId            int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
547
-	SecondWarehouseInfoId   int64   `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
548
-	AdminUserId             int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
549
-	LastPrice               float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
550
-	StockCount              string  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
551
-	PharmacyId              int64   `gorm:"column:pharmacy_id" json:"pharmacy_id" form:"pharmacy_id"`
552
-	IsCheck                 int64   `gorm:"column:is_check" json:"is_check" form:"is_check"`
553
-	OverCount               int64   `gorm:"column:over_count" json:"over_count" form:"over_count"`
554
-	OrderId                 int64   `gorm:"column:order_id" json:"order_id" form:"order_id"`
555
-	ManafacturerName        string  `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
556
-	DepartmentName          string  `gorm:"column:department_name" json:"department_name" form:"department_name"`
557
-	ClassType               string  `gorm:"column:class_type" json:"class_type" form:"class_type"`
514
+	ID                      int64       `gorm:"column:id" json:"id" form:"id"`
515
+	WarehouseOutId          int64       `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
516
+	DrugId                  int64       `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
517
+	WarehousingOutTarget    int64       `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
518
+	Count                   int64       `gorm:"column:count" json:"count" form:"count"`
519
+	CountUnit               string      `gorm:"column:count_unit" json:"count_unit" form:"count_unit"`
520
+	Price                   float64     `gorm:"column:price" json:"price" form:"price"`
521
+	TotalPrice              float64     `gorm:"column:total_price" json:"total_price" form:"total_price"`
522
+	ProductDate             int64       `gorm:"column:product_date" json:"product_date" form:"product_date"`
523
+	ExpiryDate              int64       `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
524
+	Mtime                   int64       `gorm:"column:mtime" json:"mtime" form:"mtime"`
525
+	Ctime                   int64       `gorm:"column:ctime" json:"ctime" form:"ctime"`
526
+	Status                  int64       `gorm:"column:status" json:"status" form:"status"`
527
+	OrgId                   int64       `gorm:"column:org_id" json:"org_id" form:"org_id"`
528
+	Remark                  string      `gorm:"column:remark" json:"remark" form:"remark"`
529
+	IsCancel                int64       `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
530
+	WarehouseOutOrderNumber string      `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
531
+	Type                    int64       `gorm:"column:type" json:"type" form:"type"`
532
+	Dealer                  int64       `gorm:"column:dealer" json:"dealer" form:"dealer"`
533
+	Manufacturer            int64       `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
534
+	IsSys                   int64       `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
535
+	SysRecordTime           int64       `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
536
+	RetailPrice             float64     `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
537
+	RetailTotalPrice        float64     `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
538
+	WarehouseInfoId         int64       `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
539
+	Number                  string      `gorm:"column:number" json:"number" form:"number"`
540
+	BatchNumber             string      `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
541
+	PatientId               int64       `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
542
+	AdviceId                int64       `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
543
+	SupplyCancelOutId       int64       `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
544
+	SupplyWarehouseId       int64       `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
545
+	IsSource                int64       `gorm:"column:is_source" json:"is_source" form:"is_source"`
546
+	StorehouseId            int64       `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
547
+	SecondWarehouseInfoId   int64       `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
548
+	AdminUserId             int64       `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
549
+	LastPrice               float64     `gorm:"column:last_price" json:"last_price" form:"last_price"`
550
+	StockCount              string      `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
551
+	PharmacyId              int64       `gorm:"column:pharmacy_id" json:"pharmacy_id" form:"pharmacy_id"`
552
+	IsCheck                 int64       `gorm:"column:is_check" json:"is_check" form:"is_check"`
553
+	OverCount               int64       `gorm:"column:over_count" json:"over_count" form:"over_count"`
554
+	OrderId                 int64       `gorm:"column:order_id" json:"order_id" form:"order_id"`
555
+	ManafacturerName        string      `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
556
+	DepartmentName          string      `gorm:"column:department_name" json:"department_name" form:"department_name"`
557
+	ClassType               string      `gorm:"column:class_type" json:"class_type" form:"class_type"`
558
+	BaseDrugLib             BaseDrugLib `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId"json:"drug" `
558 559
 }
559 560
 
560 561
 func (XtSelfDrugWarehouseOutInfo) TableName() string {

+ 10 - 1
service/gobal_config_service.go View File

@@ -1149,8 +1149,17 @@ func GetPrescriptionList(patient_id int64, schedule_date int64, user_org_id int6
1149 1149
 func GetLastMonitorRecordList(patient_id int64, schedule_date int64, user_org_id int64) (models.MonitoringRecord, error) {
1150 1150
 
1151 1151
 	record := models.MonitoringRecord{}
1152
-	err := XTReadDB().Where("patient_id =? and monitoring_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, user_org_id).Order("operate_time desc").Last(&record).Error
1152
+	var err error
1153
+	if user_org_id != 10060 {
1154
+		err = XTReadDB().Where("patient_id =? and monitoring_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, user_org_id).Order("operate_time desc").Last(&record).Error
1155
+	}
1156
+
1157
+	if user_org_id == 10060 {
1158
+		err = XTReadDB().Where("patient_id =? and monitoring_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, user_org_id).Order("id desc").Last(&record).Error
1159
+	}
1160
+
1153 1161
 	return record, err
1162
+
1154 1163
 }
1155 1164
 
1156 1165
 func GetLastAfter(patient_id int64, schedule_date int64, user_org_id int64) (models.XtAssessmentAfterDislysis, error) {

+ 3 - 3
service/pharmacy_service.go View File

@@ -670,7 +670,7 @@ func FindMedicationList(orgid, drug_id, stime, etime, is_medicine int64) (pp []*
670 670
 	InitDrugidIsNil(orgid, stime, etime)
671 671
 	var tmp []*models.HisDoctorAdviceInfoL
672 672
 	err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
673
-		"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and drug_id = ? and is_medicine = ?", stime, etime, orgid, drug_id, is_medicine).Find(&tmp).Error
673
+		"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and drug_id = ? and is_medicine = ?", stime, etime, orgid, drug_id, is_medicine).Find(&tmp).Error
674 674
 	if err != nil {
675 675
 		return pp, err
676 676
 	}
@@ -693,7 +693,7 @@ func FindMedicationList(orgid, drug_id, stime, etime, is_medicine int64) (pp []*
693 693
 
694 694
 	var tmp_advice []*models.XtDoctorAdviceL
695 695
 	err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
696
-		"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and drug_id = ? and is_medicine = ?", stime, etime, orgid, drug_id, is_medicine).Find(&tmp_advice).Error
696
+		"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and drug_id = ? and is_medicine = ?", stime, etime, orgid, drug_id, is_medicine).Find(&tmp_advice).Error
697 697
 	if err != nil {
698 698
 		return pp, err
699 699
 	}
@@ -2215,7 +2215,7 @@ func CalculateTheTotalAmount(tmp []*models.PatientInformation, drug_id int64) (t
2215 2215
 	minmunber := t.MinNumber                               //拆零数量
2216 2216
 	terrUnit := ""
2217 2217
 	for _, v := range tmp {
2218
-		fmt.Println("v2332233232322323", v.Quantity)
2218
+
2219 2219
 		switch v.Unit {
2220 2220
 		case t.MaxUnit:
2221 2221
 			maxunit = maxunit + v.Quantity

+ 57 - 1
service/self_drug_service.go View File

@@ -3660,7 +3660,7 @@ func DeleteSelfDrugWarehouse(id int64, tx *gorm.DB) error {
3660 3660
 
3661 3661
 func GetSelfWarehouseInfoByWarehouseInfo(id int64, patient_id int64, org_id int64) (info []*models.XtSelfDrugWarehouseInfo, err error) {
3662 3662
 
3663
-	err = XTReadDB().Where("id =? and patient_id =? and warehousing_id = ? and status=1 and org_id =?", id, patient_id, org_id).Find(&info).Error
3663
+	err = XTReadDB().Where("warehousing_id =? and patient_id =? and status=1 and org_id =?", id, patient_id, org_id).Find(&info).Error
3664 3664
 	return info, err
3665 3665
 }
3666 3666
 
@@ -3738,3 +3738,59 @@ func CreateSelfDrugStockSum(drug models.XtSelfDrugStockCount, tx *gorm.DB) error
3738 3738
 	}
3739 3739
 	return err
3740 3740
 }
3741
+
3742
+func GetSelfDrugWarehouseOutListById(warehouse_out_id int64, orgId int64, tx *gorm.DB) (info []*models.XtSelfDrugWarehouseOutInfo, err error) {
3743
+
3744
+	err = tx.Where("warehouse_out_id = ? and org_id  =? and status = 1", warehouse_out_id, orgId).Preload("BaseDrugLib", "status=1").Find(&info).Error
3745
+
3746
+	if err != gorm.ErrRecordNotFound {
3747
+		if err != nil {
3748
+			tx.Rollback()
3749
+			return info, err
3750
+		}
3751
+	}
3752
+	return info, err
3753
+}
3754
+
3755
+func GetAllSelfDrugWarehouseOutList(ids []int64, patient_id int64, start_time int64, end_time int64, org_id int64) (outInfo []*models.XtSelfDrugWarehouseOutInfo, err error) {
3756
+
3757
+	db := XTReadDB().Model(&outInfo).Where("status =1")
3758
+	if len(ids) > 0 {
3759
+		db = db.Where("drug_id in(?)", ids)
3760
+	}
3761
+	if patient_id > 0 {
3762
+		db = db.Where("patient_id = ?", patient_id)
3763
+	}
3764
+
3765
+	if start_time > 0 {
3766
+		db = db.Where("sys_record_time >=?", start_time)
3767
+	}
3768
+
3769
+	if end_time > 0 {
3770
+		db = db.Where("sys_record_time <=?", end_time)
3771
+	}
3772
+
3773
+	if org_id > 0 {
3774
+		db = db.Where("org_id =?", org_id)
3775
+	}
3776
+
3777
+	err = db.Preload("BaseDrugLib", "status=1 and org_id = ?", org_id).Find(&outInfo).Error
3778
+
3779
+	return outInfo, err
3780
+
3781
+}
3782
+
3783
+func DeleteSelfWarehouseOut(id int64) (models.XtSelfDrugWarehouseOutInfo, error) {
3784
+
3785
+	outInfo := models.XtSelfDrugWarehouseOutInfo{}
3786
+	err := XTWriteDB().Model(&outInfo).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
3787
+
3788
+	return outInfo, err
3789
+}
3790
+
3791
+func GetSelfDrugWarehouseOutById(id int64) (outInfo []*models.XtSelfDrugWarehouseOutInfo, err error) {
3792
+
3793
+	err = XTReadDB().Where("id = ? and status =1", id).Find(&outInfo).Error
3794
+
3795
+	return outInfo, err
3796
+}

+ 5 - 2
service/stock_service.go View File

@@ -8186,8 +8186,11 @@ func GetSelfDrugLastWarehouseOut(orgid int64, tx *gorm.DB) (models.XtSelfDrugWar
8186 8186
 	out := models.XtSelfDrugWarehouseOut{}
8187 8187
 	err := tx.Where("org_id = ? and status = 1", orgid).Find(&out).Error
8188 8188
 	if err != gorm.ErrRecordNotFound {
8189
-		tx.Rollback()
8190
-		return out, err
8189
+		if err != nil {
8190
+			tx.Rollback()
8191
+			return out, err
8192
+		}
8193
+
8191 8194
 	}
8192 8195
 	return out, err
8193 8196
 }