Bladeren bron

Merge branch '20211122' of http://git.shengws.com/csx/XT_New into 20211122

csx 3 jaren geleden
bovenliggende
commit
26c3f7fa60

+ 1 - 1
conf/app.conf Bestand weergeven

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode = dev
4 4
 
5 5
 #

+ 4 - 3
controllers/drug_stock_api_contorller.go Bestand weergeven

@@ -246,7 +246,7 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
246 246
 					warehouseInfo.StockMinNumber = 0
247 247
 					warehouseInfo.MaxUnit = min_unit
248 248
 				}
249
-				if max_unit == medical.MinUnit {
249
+				if max_unit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
250 250
 					warehouseInfo.StockMaxNumber = 0
251 251
 					warehouseInfo.StockMinNumber = warehousing_count
252 252
 					warehouseInfo.MaxUnit = min_unit
@@ -278,6 +278,7 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
278 278
 
279 279
 				if medical.MaxUnit == medical.MinUnit {
280 280
 					drugflow.MaxUnit = min_unit
281
+
281 282
 				}
282 283
 				if max_unit == medical.MinUnit {
283 284
 					warehouseInfo.MaxUnit = min_unit
@@ -602,7 +603,7 @@ func (c *StockDrugApiController) EditDrugWarehouse() {
602 603
 						warehouseInfo.StockMinNumber = 0
603 604
 						warehouseInfo.MaxUnit = min_unit
604 605
 					}
605
-					if max_unit == medical.MinUnit {
606
+					if max_unit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
606 607
 						warehouseInfo.StockMaxNumber = 0
607 608
 						warehouseInfo.StockMinNumber = warehousing_count
608 609
 						warehouseInfo.MaxUnit = min_unit
@@ -641,7 +642,7 @@ func (c *StockDrugApiController) EditDrugWarehouse() {
641 642
 						warehouseInfo.MaxUnit = min_unit
642 643
 					}
643 644
 
644
-					if max_unit == medical.MinUnit {
645
+					if max_unit == medical.MinUnit && medical.MinUnit != medical.MaxUnit {
645 646
 						warehouseInfo.StockMaxNumber = 0
646 647
 						warehouseInfo.StockMinNumber = warehousing_count
647 648
 						warehouseInfo.MaxUnit = min_unit

+ 16 - 1
controllers/schedule_api_controller.go Bestand weergeven

@@ -753,6 +753,8 @@ func (this *ScheduleApiController) UrgentScheduleData() {
753 753
 func (this *ScheduleApiController) SearchSchedulePatients() {
754 754
 	keywords := this.GetString("keywords")
755 755
 	week_type, _ := this.GetInt64("week_type", 0)
756
+	start_sch := this.GetString("start_sch")
757
+	end_sch := this.GetString("end_sch")
756 758
 
757 759
 	thisTime1 := time.Now()
758 760
 	thisTime2 := time.Now()
@@ -765,9 +767,22 @@ func (this *ScheduleApiController) SearchSchedulePatients() {
765 767
 
766 768
 	switch week_type {
767 769
 	case 1:
770
+		timeLayout := "2006-01-02"
771
+		loc, _ := time.LoadLocation("Local")
772
+
773
+		var startSchTime int64
774
+		if len(start_sch) > 0 {
775
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_sch+" 00:00:00", loc)
776
+			startSchTime = theTime.Unix()
777
+		}
778
+		var endSchTime int64
779
+		if len(end_sch) > 0 {
780
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_sch+" 00:00:00", loc)
781
+			endSchTime = theTime.Unix()
782
+		}
768 783
 
769 784
 		adminUserInfo := this.GetAdminUserInfo()
770
-		list, _ := service.GetSchedualPatientsByKeywords(keywords, adminUserInfo.CurrentOrgId)
785
+		list, _ := service.GetSchedualPatientsByKeywords(keywords, adminUserInfo.CurrentOrgId, startSchTime, endSchTime)
771 786
 		this.ServeSuccessJSON(map[string]interface{}{
772 787
 			"schdules": list,
773 788
 		})

+ 43 - 4
controllers/stock_in_api_controller.go Bestand weergeven

@@ -212,8 +212,16 @@ func (c *StockManagerApiController) CreateWarehouse() {
212 212
 					return
213 213
 				}
214 214
 				price, _ := strconv.ParseFloat(items["price"].(string), 64)
215
+
215 216
 				total := float64(warehousing_count) * price
216 217
 
218
+				if items["packing_price"] == nil || reflect.TypeOf(items["packing_price"]).String() != "string" {
219
+					utils.ErrorLog("packing_price")
220
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
221
+					return
222
+				}
223
+				packing_price, _ := strconv.ParseFloat(items["packing_price"].(string), 64)
224
+
217 225
 				var productDates int64
218 226
 				var expiryDates int64
219 227
 
@@ -274,6 +282,7 @@ func (c *StockManagerApiController) CreateWarehouse() {
274 282
 					StockCount:       warehousing_count,
275 283
 					Dealer:           dealer,
276 284
 					LicenseNumber:    license_number,
285
+					PackingPrice:     packing_price,
277 286
 				}
278 287
 				warehousingInfo = append(warehousingInfo, warehouseInfo)
279 288
 
@@ -521,7 +530,12 @@ func (c *StockManagerApiController) EditWarehouse() {
521 530
 				}
522 531
 				price, _ := strconv.ParseFloat(items["price"].(string), 64)
523 532
 				total := float64(warehousing_count) * price
524
-
533
+				if items["packing_price"] == nil || reflect.TypeOf(items["packing_price"]).String() != "string" {
534
+					utils.ErrorLog("packing_price")
535
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
536
+					return
537
+				}
538
+				packing_price, _ := strconv.ParseFloat(items["packing_price"].(string), 64)
525 539
 				var productDates int64
526 540
 				var expiryDates int64
527 541
 
@@ -588,6 +602,7 @@ func (c *StockManagerApiController) EditWarehouse() {
588 602
 						Dealer:           dealer,
589 603
 						StockCount:       warehousing_count,
590 604
 						LicenseNumber:    license_number,
605
+						PackingPrice:     packing_price,
591 606
 					}
592 607
 					warehousingInfo = append(warehousingInfo, warehouseInfo)
593 608
 
@@ -613,6 +628,7 @@ func (c *StockManagerApiController) EditWarehouse() {
613 628
 						Manufacturer:     manufacturer,
614 629
 						Dealer:           dealer,
615 630
 						LicenseNumber:    license_number,
631
+						PackingPrice:     packing_price,
616 632
 					}
617 633
 					upDateWarehousingInfo = append(upDateWarehousingInfo, warehouseInfo)
618 634
 
@@ -703,9 +719,18 @@ func (c *StockManagerApiController) EditWarehouse() {
703 719
 				goodinfo := models.WarehousingInfo{
704 720
 					WarehousingCount: item.WarehousingCount,
705 721
 					StockCount:       info.StockCount + total,
722
+					Price:            item.Price,
723
+					Manufacturer:     item.Manufacturer,
724
+					Number:           item.Number,
725
+					ProductDate:      item.ProductDate,
726
+					ExpiryDate:       item.ExpiryDate,
727
+					LicenseNumber:    item.LicenseNumber,
728
+					Dealer:           item.Dealer,
729
+					Remark:           item.Remark,
730
+					PackingPrice:     item.PackingPrice,
706 731
 				}
707 732
 
708
-				service.UpdateWarehouseInfoByGoodId(goodinfo, item.ID)
733
+				service.UpdateWarehouseInfoByGoodIdOne(goodinfo, item.ID)
709 734
 
710 735
 				//flowStock := models.VmStockFlow{
711 736
 				//	Count:         item.WarehousingCount,
@@ -736,8 +761,17 @@ func (c *StockManagerApiController) EditWarehouse() {
736 761
 				goodinfo := models.WarehousingInfo{
737 762
 					WarehousingCount: item.WarehousingCount,
738 763
 					StockCount:       info.StockCount - total,
764
+					Price:            item.Price,
765
+					Manufacturer:     item.Manufacturer,
766
+					Number:           item.Number,
767
+					ProductDate:      item.ProductDate,
768
+					ExpiryDate:       item.ExpiryDate,
769
+					LicenseNumber:    item.LicenseNumber,
770
+					Dealer:           item.Dealer,
771
+					Remark:           item.Remark,
772
+					PackingPrice:     item.PackingPrice,
739 773
 				}
740
-				service.UpdateWarehouseInfoByGoodId(goodinfo, item.ID)
774
+				service.UpdateWarehouseInfoByGoodIdOne(goodinfo, item.ID)
741 775
 				//改变库存
742 776
 				good, _ := service.GetLastInfoMationById(info.GoodId)
743 777
 				warhouseCount := strconv.FormatInt(total, 10)
@@ -761,6 +795,7 @@ func (c *StockManagerApiController) EditWarehouse() {
761 795
 					LicenseNumber:    item.LicenseNumber,
762 796
 					Dealer:           item.Dealer,
763 797
 					Remark:           item.Remark,
798
+					PackingPrice:     item.PackingPrice,
764 799
 				}
765 800
 				service.UpdateWarehouseInfoByGoodIdOne(goodinfo, item.ID)
766 801
 			}
@@ -7248,10 +7283,14 @@ func (this *StockManagerApiController) SaveStockInventoryList() {
7248 7283
 				ExpireDate:              expiry_date,
7249 7284
 				ReturnCount:             0,
7250 7285
 			}
7251
-
7286
+			// warehosueinfos, _ := service.GetWarehouseInfoByIdNight(id)
7252 7287
 			info := models.WarehousingInfo{
7253 7288
 				StockCount: last_stock_count,
7254 7289
 			}
7290
+
7291
+			//if(last_stock_count > warehosueinfos.StockCount){
7292
+			//  info.WarehousingCount = last_stock_count
7293
+			//}
7255 7294
 			//更改库存
7256 7295
 			service.UpdatedWarehousingInfo(info, id)
7257 7296
 			if stock_count != last_stock_count {

+ 1 - 0
models/self_drug_models.go Bestand weergeven

@@ -675,6 +675,7 @@ type VmDrugWarehouseOutInfo struct {
675 675
 	DrugName                string  `json:"drug_name"`
676 676
 	Number                  string  `gorm:"column:number" json:"number" form:"number"`
677 677
 	WarehouseInfoId         int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
678
+	MedicalInsuranceNumber  string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
678 679
 }
679 680
 
680 681
 type XtDrugAdjustPrice struct {

+ 34 - 32
models/stock_models.go Bestand weergeven

@@ -131,6 +131,7 @@ type WarehousingInfo struct {
131 131
 	Type             int64       `gorm:"column:type" json:"type"`
132 132
 	LicenseNumber    string      `gorm:"column:license_number" json:"license_number" form:"license_number"`
133 133
 	WarehouseInfoId  int64       `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
134
+	PackingPrice     float64     `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
134 135
 }
135 136
 
136 137
 func (WarehousingInfo) TableName() string {
@@ -442,38 +443,39 @@ type VmWarehouseInfo struct {
442 443
 }
443 444
 
444 445
 type WarehouseOutInfoOne struct {
445
-	ID                      int64   `gorm:"column:id" json:"id"`
446
-	WarehouseOutId          int64   `gorm:"column:warehouse_out_id" json:"warehouse_out_id"`
447
-	WarehouseInfotId        int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
448
-	GoodId                  int64   `gorm:"column:good_id" json:"good_id"`
449
-	GoodTypeId              int64   `gorm:"column:good_type_id" json:"good_type_id"`
450
-	WarehousingOutTarget    int64   `gorm:"column:warehousing_out_target" json:"warehousing_out_target"`
451
-	Count                   int64   `gorm:"column:count" json:"count"`
452
-	Price                   float64 `gorm:"column:price" json:"price"`
453
-	TotalPrice              float64 `gorm:"column:total_price" json:"total_price"`
454
-	ProductDate             int64   `gorm:"column:product_date" json:"product_date"`
455
-	ExpiryDate              int64   `gorm:"column:expiry_date" json:"expiry_date"`
456
-	Mtime                   int64   `gorm:"column:mtime" json:"mtime"`
457
-	Ctime                   int64   `gorm:"column:ctime" json:"ctime"`
458
-	Status                  int64   `gorm:"column:status" json:"status"`
459
-	OrgId                   int64   `gorm:"column:org_id" json:"org_id"`
460
-	Remark                  string  `gorm:"column:remark" json:"remark"`
461
-	IsCancel                int64   `gorm:"column:is_cancel" json:"is_cancel"`
462
-	WarehouseOutOrderNumber string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number"`
463
-	Type                    int64   `gorm:"column:type" json:"type"`
464
-	Dealer                  int64   `gorm:"column:dealer" json:"dealer"`
465
-	Manufacturer            int64   `gorm:"column:manufacturer" json:"manufacturer"`
466
-	IsSys                   int64   `gorm:"column:is_sys" json:"is_sys"`
467
-	SysRecordTime           int64   `gorm:"column:sys_record_time" json:"sys_record_time"`
468
-	PatientId               int64   `gorm:"column:patient_id" json:"patient_id"`
469
-	GoodName                string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
470
-	SpecificationName       string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
471
-	MinNumber               int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
472
-	PackingPrice            float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
473
-	MinUnit                 string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
474
-	Number                  string  `gorm:"column:number" json:"number" form:"number"`
475
-	PackingUnit             string  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
476
-	LicenseNumber           string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
446
+	ID                          int64   `gorm:"column:id" json:"id"`
447
+	WarehouseOutId              int64   `gorm:"column:warehouse_out_id" json:"warehouse_out_id"`
448
+	WarehouseInfotId            int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
449
+	GoodId                      int64   `gorm:"column:good_id" json:"good_id"`
450
+	GoodTypeId                  int64   `gorm:"column:good_type_id" json:"good_type_id"`
451
+	WarehousingOutTarget        int64   `gorm:"column:warehousing_out_target" json:"warehousing_out_target"`
452
+	Count                       int64   `gorm:"column:count" json:"count"`
453
+	Price                       float64 `gorm:"column:price" json:"price"`
454
+	TotalPrice                  float64 `gorm:"column:total_price" json:"total_price"`
455
+	ProductDate                 int64   `gorm:"column:product_date" json:"product_date"`
456
+	ExpiryDate                  int64   `gorm:"column:expiry_date" json:"expiry_date"`
457
+	Mtime                       int64   `gorm:"column:mtime" json:"mtime"`
458
+	Ctime                       int64   `gorm:"column:ctime" json:"ctime"`
459
+	Status                      int64   `gorm:"column:status" json:"status"`
460
+	OrgId                       int64   `gorm:"column:org_id" json:"org_id"`
461
+	Remark                      string  `gorm:"column:remark" json:"remark"`
462
+	IsCancel                    int64   `gorm:"column:is_cancel" json:"is_cancel"`
463
+	WarehouseOutOrderNumber     string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number"`
464
+	Type                        int64   `gorm:"column:type" json:"type"`
465
+	Dealer                      int64   `gorm:"column:dealer" json:"dealer"`
466
+	Manufacturer                int64   `gorm:"column:manufacturer" json:"manufacturer"`
467
+	IsSys                       int64   `gorm:"column:is_sys" json:"is_sys"`
468
+	SysRecordTime               int64   `gorm:"column:sys_record_time" json:"sys_record_time"`
469
+	PatientId                   int64   `gorm:"column:patient_id" json:"patient_id"`
470
+	GoodName                    string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
471
+	SpecificationName           string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
472
+	MinNumber                   int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
473
+	PackingPrice                float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
474
+	MinUnit                     string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
475
+	Number                      string  `gorm:"column:number" json:"number" form:"number"`
476
+	PackingUnit                 string  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
477
+	LicenseNumber               string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
478
+	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
477 479
 }
478 480
 
479 481
 type WarehouseOutInfoTwo struct {

+ 2 - 2
service/gobal_config_service.go Bestand weergeven

@@ -809,7 +809,7 @@ func GetSingleOrderDetail(id int64, orgid int64) (info []*models.VmDrugWarehouse
809 809
 		db = db.Where("x.warehouse_out_id = ?", id)
810 810
 	}
811 811
 
812
-	err = db.Select("x.id,x.warehouse_out_id,x.drug_id,sum(x.count) as count,x.count_unit,x.price,x.total_price,x.product_date,x.expiry_date,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,t.drug_name,t.drug_type,t.max_unit,t.min_unit,t.min_number,x.number,x.batch_number,t.dose,t.dose_unit,t.last_price,t.min_price,x.warehouse_info_id").Joins("left join xt_base_drug as t on t.id = x.drug_id").Group("x.drug_id").Scan(&info).Error
812
+	err = db.Select("x.id,x.warehouse_out_id,x.drug_id,sum(x.count) as count,x.count_unit,x.price,x.total_price,x.product_date,x.expiry_date,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,t.drug_name,t.drug_type,t.max_unit,t.min_unit,t.min_number,x.number,x.batch_number,t.dose,t.dose_unit,t.last_price,t.min_price,t.medical_insurance_number,x.warehouse_info_id").Joins("left join xt_base_drug as t on t.id = x.drug_id").Group("x.drug_id").Scan(&info).Error
813 813
 	return info, err
814 814
 }
815 815
 
@@ -830,7 +830,7 @@ func GetSingeOrderFlow(id int64, orgid int64) (outInfo []*models.VmDrugWarehouse
830 830
 		db = db.Where("x.warehouse_out_id in(?)", id)
831 831
 	}
832 832
 
833
-	err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.count,x.count_unit,x.price,x.total_price,x.product_date,x.expiry_date,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,t.drug_name,t.drug_type,t.max_unit,t.min_unit,t.min_number,x.number,x.batch_number,t.dose,t.dose_unit,t.last_price,t.min_price").Joins("left join xt_base_drug as t on t.id = x.drug_id").Scan(&outInfo).Error
833
+	err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.count,x.count_unit,x.price,x.total_price,x.product_date,x.expiry_date,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,t.drug_name,t.drug_type,t.max_unit,t.min_unit,t.min_number,t.retail_price,x.number,x.batch_number,t.dose,t.dose_unit,t.last_price,t.min_price").Joins("left join xt_base_drug as t on t.id = x.drug_id").Scan(&outInfo).Error
834 834
 	return outInfo, err
835 835
 }
836 836
 

+ 50 - 38
service/mobile_dialysis_service.go Bestand weergeven

@@ -2025,51 +2025,63 @@ func ModifyFinishDialysisOrder(order *models.DialysisOrder) error {
2025 2025
 	tx.Commit()
2026 2026
 	return err
2027 2027
 }
2028
-
2029 2028
 func MobileGetLastDryWeight(orgID int64, patientID int64) (*models.SgjPatientDryweight, error) {
2030 2029
 	var record models.SgjPatientDryweight
2031
-	redis := RedisClient()
2032
-	defer redis.Close()
2033
-
2034
-	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":last_dry_weight"
2035
-	last_dry_weight_str, _ := redis.Get(key).Result()
2036
-
2037
-	if len(last_dry_weight_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2038
-		err := readDb.Model(&models.SgjPatientDryweight{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Last(&record).Error
2039
-		if err != nil {
2040
-			if err == gorm.ErrRecordNotFound {
2041
-				if record.ID <= 0 {
2042
-					redis.Set(key, "null", time.Second*60*60*18)
2043
-				}
2044
-				return nil, nil
2045
-			} else {
2046
-				return nil, err
2047
-			}
2048
-		} else {
2049
-			if record.ID > 0 {
2050
-				//缓存数据
2051
-				last_dry_weight_str, err := json.Marshal(record)
2052
-				if err == nil {
2053
-					redis.Set(key, last_dry_weight_str, time.Second*60*60*18)
2054
-					return nil, err
2055
-				}
2056
-			} else {
2057
-				redis.Set(key, "null", time.Second*60*60*18)
2058
-				return nil, err
2059
-			}
2060
-			return &record, nil
2061
-		}
2062
-	} else { //缓存数据了数据,将redis缓存的json字符串转为map
2063
-		if last_dry_weight_str == "null" {
2064
-			return &record, nil
2030
+	err := readDb.Model(&models.SgjPatientDryweight{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Last(&record).Error
2031
+	if err != nil {
2032
+		if err == gorm.ErrRecordNotFound {
2033
+			return nil, nil
2065 2034
 		} else {
2066
-			json.Unmarshal([]byte(last_dry_weight_str), &record)
2067
-			return &record, nil
2035
+			return nil, err
2068 2036
 		}
2069
-
2070 2037
 	}
2038
+	return &record, nil
2071 2039
 }
2072 2040
 
2041
+//func MobileGetLastDryWeight(orgID int64, patientID int64) (*models.SgjPatientDryweight, error) {
2042
+//	var record models.SgjPatientDryweight
2043
+//	redis := RedisClient()
2044
+//	defer redis.Close()
2045
+//
2046
+//	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":last_dry_weight"
2047
+//	last_dry_weight_str, _ := redis.Get(key).Result()
2048
+//
2049
+//	if len(last_dry_weight_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2050
+//		err := readDb.Model(&models.SgjPatientDryweight{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Last(&record).Error
2051
+//		if err != nil {
2052
+//			if err == gorm.ErrRecordNotFound {
2053
+//				if record.ID <= 0 {
2054
+//					redis.Set(key, "null", time.Second*60*60*18)
2055
+//				}
2056
+//				return nil, nil
2057
+//			} else {
2058
+//				return nil, err
2059
+//			}
2060
+//		} else {
2061
+//			if record.ID > 0 {
2062
+//				//缓存数据
2063
+//				last_dry_weight_str, err := json.Marshal(record)
2064
+//				if err == nil {
2065
+//					redis.Set(key, last_dry_weight_str, time.Second*60*60*18)
2066
+//					return nil, err
2067
+//				}
2068
+//			} else {
2069
+//				redis.Set(key, "null", time.Second*60*60*18)
2070
+//				return nil, err
2071
+//			}
2072
+//			return &record, nil
2073
+//		}
2074
+//	} else { //缓存数据了数据,将redis缓存的json字符串转为map
2075
+//		if last_dry_weight_str == "null" {
2076
+//			return &record, nil
2077
+//		} else {
2078
+//			json.Unmarshal([]byte(last_dry_weight_str), &record)
2079
+//			return &record, nil
2080
+//		}
2081
+//
2082
+//	}
2083
+//}
2084
+
2073 2085
 // 透析方案
2074 2086
 func MobileGetDialysisSolutionByModeIdSix(orgID int64, patientID int64, mode_id int64) (*models.DialysisSolution, error) {
2075 2087
 	var record models.DialysisSolution

+ 9 - 8
service/role_service.go Bestand weergeven

@@ -1,14 +1,14 @@
1 1
 package service
2 2
 
3 3
 import (
4
+	"XT_New/models"
5
+	"XT_New/utils"
4 6
 	"database/sql"
7
+	"encoding/json"
5 8
 	"fmt"
6 9
 	"strconv"
7 10
 	"strings"
8 11
 	"time"
9
-	"encoding/json"
10
-	"XT_New/models"
11
-	"XT_New/utils"
12 12
 
13 13
 	"github.com/jinzhu/gorm"
14 14
 )
@@ -131,9 +131,10 @@ type AdminUserManageViewModel struct {
131 131
 	TitleName       string `gorm:"-" json:"title_name"`
132 132
 	IsSubSuperAdmin bool   `gorm:"-" json:"is_sub_super_admin"`
133 133
 	//mobile          string `gorm:"-" json:"mobile"`
134
-	Sort     int `gorm:"sort" json:"sort"`
135
-	IsMark   int `gorm:"is_mark" json:"is_mark"`
136
-	UserType int `gorm:"user_type" json:"user_type"`
134
+	Sort         int    `gorm:"sort" json:"sort"`
135
+	IsMark       int    `gorm:"is_mark" json:"is_mark"`
136
+	UserType     int    `gorm:"user_type" json:"user_type"`
137
+	DoctorNumber string `gorm:"column:doctor_number" json:"doctor_number" form:"doctor_number"`
137 138
 }
138 139
 
139 140
 func GetAdminUsersAndLoginInfo(orgID int64, appID int64, page int, count int) ([]*AdminUserManageViewModel, int, error) {
@@ -144,7 +145,7 @@ func GetAdminUsersAndLoginInfo(orgID int64, appID int64, page int, count int) ([
144 145
 		page = 1
145 146
 	}
146 147
 	var viewModels []*AdminUserManageViewModel = make([]*AdminUserManageViewModel, 0)
147
-	rows, err := readUserDb.Raw("SELECT u_a_r.admin_user_id, u_a_r.user_name, u_a_r.user_title, u_l.ip, u_l.ctime, u_a_r.status,u_a_r.avatar,u_a_r.role_ids,u_a_r.sort,u_a_r.is_mark,u_a_r.user_type FROM sgj_user_admin_role AS u_a_r   LEFT JOIN (SELECT * FROM (SELECT admin_user_id, org_id, app_id, ip, ctime FROM sgj_user_admin_login_log WHERE org_id = ? AND app_id = ?  ORDER BY ctime DESC) AS t GROUP BY admin_user_id) AS u_l  ON u_a_r.org_id = u_l.org_id AND u_a_r.app_id = u_l.app_id AND u_a_r.admin_user_id = u_l.admin_user_id WHERE u_a_r.org_id = ? AND u_a_r.app_id = ? GROUP BY u_a_r.admin_user_id  LIMIT ? OFFSET ?;", orgID, appID, orgID, appID, count, (page-1)*count).Rows()
148
+	rows, err := readUserDb.Raw("SELECT u_a_r.admin_user_id, u_a_r.user_name,u_a_r.doctor_number, u_a_r.user_title, u_l.ip, u_l.ctime, u_a_r.status,u_a_r.avatar,u_a_r.role_ids,u_a_r.sort,u_a_r.is_mark,u_a_r.user_type FROM sgj_user_admin_role AS u_a_r   LEFT JOIN (SELECT * FROM (SELECT admin_user_id, org_id, app_id, ip, ctime FROM sgj_user_admin_login_log WHERE org_id = ? AND app_id = ?  ORDER BY ctime DESC) AS t GROUP BY admin_user_id) AS u_l  ON u_a_r.org_id = u_l.org_id AND u_a_r.app_id = u_l.app_id AND u_a_r.admin_user_id = u_l.admin_user_id WHERE u_a_r.org_id = ? AND u_a_r.app_id = ? GROUP BY u_a_r.admin_user_id  LIMIT ? OFFSET ?;", orgID, appID, orgID, appID, count, (page-1)*count).Rows()
148 149
 	defer rows.Close()
149 150
 	if err != nil {
150 151
 		if err == gorm.ErrRecordNotFound {
@@ -795,7 +796,7 @@ func GetUserAllRole(org_id int64, admin_user_id int64) (role models.App_Role, er
795 796
 	defer redis.Close()
796 797
 
797 798
 	// cur_date := time.Now().Format("2006-01-02")
798
-	key := "user_all_role:" + strconv.FormatInt(org_id, 10) + ":"+ strconv.FormatInt(admin_user_id, 10)
799
+	key := "user_all_role:" + strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(admin_user_id, 10)
799 800
 	role_str, _ := redis.Get(key).Result()
800 801
 
801 802
 	if len(role_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis

+ 2 - 2
service/schedule_service.go Bestand weergeven

@@ -446,7 +446,7 @@ func GetSchedualPatientsByKeywordsAndWeek(keywords string, org_id int64, start_t
446 446
 
447 447
 }
448 448
 
449
-func GetSchedualPatientsByKeywords(keywords string, org_id int64) (schedule []*models.Schedule, err error) {
449
+func GetSchedualPatientsByKeywords(keywords string, org_id int64, startime int64, endtime int64) (schedule []*models.Schedule, err error) {
450 450
 	likeKey := "%" + keywords + "%"
451 451
 
452 452
 	err = readDb.
@@ -456,7 +456,7 @@ func GetSchedualPatientsByKeywords(keywords string, org_id int64) (schedule []*m
456 456
 		Preload("DeviceNumber", "status = 1 ").
457 457
 		Preload("TreatmentMode", "status = 1 ").
458 458
 		Joins("JOIN xt_patients as p ON p.id = s.patient_id AND (p.name LIKE ? OR p.dialysis_no LIKE ?)", likeKey, likeKey).
459
-		Where("s.user_org_id=? and s.schedule_date >= UNIX_TIMESTAMP(DATE_FORMAT(NOW(),'%Y-%m-%d 00:00:00')) and s.schedule_date <= UNIX_TIMESTAMP(DATE_FORMAT( SUBDATE(CURDATE(),DATE_FORMAT(CURDATE(),'%w')-7), '%Y-%m-%d 23:59:59')) and s.status=1", org_id).
459
+		Where("s.user_org_id=? and s.schedule_date >= ? and s.schedule_date <= ? and s.status=1", org_id, startime, endtime).
460 460
 		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id, s.status, s.created_time, s.updated_time, p.name as patient").
461 461
 		Order("schedule_date asc").
462 462
 		Find(&schedule).Error

+ 12 - 4
service/stock_service.go Bestand weergeven

@@ -411,11 +411,11 @@ func CreateWarehousingInfo(warehousingInfo []*models.WarehousingInfo) (err error
411 411
 	if len(warehousingInfo) > 0 {
412 412
 		utx := writeDb.Begin()
413 413
 		if len(warehousingInfo) > 0 {
414
-			thisSQL := "INSERT INTO xt_warehouse_info (warehousing_id, good_id, good_type_id, number, product_date,expiry_date,warehousing_count,price,total_price,dealer,manufacturer,remark,ctime,mtime,status,org_id,warehousing_order,type,stock_count,license_number) VALUES "
414
+			thisSQL := "INSERT INTO xt_warehouse_info (warehousing_id, good_id, good_type_id, number, product_date,expiry_date,warehousing_count,price,total_price,dealer,manufacturer,remark,ctime,mtime,status,org_id,warehousing_order,type,stock_count,license_number,packing_price) VALUES "
415 415
 			insertParams := make([]string, 0)
416 416
 			insertData := make([]interface{}, 0)
417 417
 			for _, info := range warehousingInfo {
418
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
418
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
419 419
 				insertData = append(insertData, info.WarehousingId)
420 420
 				insertData = append(insertData, info.GoodId)
421 421
 				insertData = append(insertData, info.GoodTypeId)
@@ -436,6 +436,7 @@ func CreateWarehousingInfo(warehousingInfo []*models.WarehousingInfo) (err error
436 436
 				insertData = append(insertData, info.Type)
437 437
 				insertData = append(insertData, info.WarehousingCount)
438 438
 				insertData = append(insertData, info.LicenseNumber)
439
+				insertData = append(insertData, info.PackingPrice)
439 440
 			}
440 441
 			thisSQL += strings.Join(insertParams, ", ")
441 442
 			err = utx.Exec(thisSQL, insertData...).Error
@@ -3850,7 +3851,7 @@ func GetOrderDetialByOrderIdOne(id []string, orgid int64) (out []*models.Warehou
3850 3851
 		db = db.Where("x.org_id = ?", orgid)
3851 3852
 	}
3852 3853
 
3853
-	err = db.Select("x.id,x.warehouse_out_id,x.good_id,sum(x.count) as count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,x.is_sys,x.sys_record_time,x.number,x.remark,x.license_number,t.good_name,t.good_type_id,t.specification_name,t.min_number,t.packing_unit,t.min_unit").Joins("left join xt_good_information as t on t.id=x.good_id").Group("x.warehouse_out_id,x.good_id").Order("x.ctime desc").Scan(&out).Error
3854
+	err = db.Select("x.id,x.warehouse_out_id,x.good_id,sum(x.count) as count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,t.social_security_directory_code,x.is_sys,x.sys_record_time,x.number,x.remark,x.license_number,t.good_name,t.good_type_id,t.specification_name,t.min_number,t.packing_unit,t.min_unit").Joins("left join xt_good_information as t on t.id=x.good_id").Group("x.warehouse_out_id,x.good_id").Order("x.ctime desc").Scan(&out).Error
3854 3855
 	return out, err
3855 3856
 }
3856 3857
 
@@ -5229,6 +5230,13 @@ func GetInventoryDetailById(id []string) (list []*models.XtStockInventory, err e
5229 5230
 	return list, err
5230 5231
 }
5231 5232
 
5233
+func GetWarehouseInfoByIdNight(id int64) (models.WarehousingInfo, error) {
5234
+
5235
+	info := models.WarehousingInfo{}
5236
+	err := XTReadDB().Where("id = ? and status = 1", id).Find(&info).Error
5237
+	return info, err
5238
+}
5239
+
5232 5240
 func GetWarehouseInfoById(id int64) (models.WarehousingInfo, error) {
5233 5241
 
5234 5242
 	info := models.WarehousingInfo{}
@@ -5493,7 +5501,7 @@ func UpdateWarehouseInfoByGoodId(info models.WarehousingInfo, id int64) error {
5493 5501
 
5494 5502
 func UpdateWarehouseInfoByGoodIdOne(info models.WarehousingInfo, id int64) error {
5495 5503
 
5496
-	err := XTWriteDB().Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark}).Error
5504
+	err := XTWriteDB().Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark, "packing_price": info.PackingPrice}).Error
5497 5505
 	return err
5498 5506
 }
5499 5507
 

+ 42 - 41
service/warhouse_service.go Bestand weergeven

@@ -101,6 +101,7 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
101 101
 	if advice.PrescribingNumberUnit == drup.MaxUnit {
102 102
 		drug_price = drup.RetailPrice
103 103
 	}
104
+	fmt.Println(drug_price)
104 105
 
105 106
 	if advice.PrescribingNumberUnit == drup.MinUnit {
106 107
 		drug_price = drup.MinPrice
@@ -145,9 +146,9 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
145 146
 			DrugId:                  advice.DrugId,
146 147
 			Number:                  warehouse.Number,
147 148
 			BatchNumber:             warehouse.BatchNumber,
148
-			Price:                   drug_price,
149
+			Price:                   warehouse.RetailPrice,
149 150
 			CountUnit:               drup.MinUnit,
150
-			RetailPrice:             drug_price,
151
+			RetailPrice:             warehouse.RetailPrice,
151 152
 			ProductDate:             warehouse.ProductDate,
152 153
 			ExpiryDate:              warehouse.ExpiryDate,
153 154
 			PatientId:               advice.PatientId,
@@ -163,7 +164,7 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
163 164
 			ProductDate:             warehouse.ProductDate,
164 165
 			ExpireDate:              warehouse.ExpiryDate,
165 166
 			Count:                   deliver_number, //按最小单位计算,
166
-			Price:                   drug_price,
167
+			Price:                   warehouse.RetailPrice,
167 168
 			Status:                  1,
168 169
 			Ctime:                   time.Now().Unix(),
169 170
 			UserOrgId:               orgID,
@@ -278,7 +279,7 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
278 279
 			DrugId:                  advice.DrugId,
279 280
 			Number:                  warehouse.Number,
280 281
 			BatchNumber:             warehouse.BatchNumber,
281
-			Price:                   drug_price,
282
+			Price:                   warehouse.RetailPrice,
282 283
 			CountUnit:               drup.MinUnit,
283 284
 			ProductDate:             warehouse.ProductDate,
284 285
 			ExpiryDate:              warehouse.ExpiryDate,
@@ -318,7 +319,7 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
318 319
 			ProductDate:       warehouse.ProductDate,
319 320
 			ExpiryDate:        warehouse.ExpiryDate,
320 321
 			WarehousingCount:  warehouse.WarehousingCount,
321
-			Price:             warehouse.Price,
322
+			Price:             warehouse.RetailPrice,
322 323
 			TotalPrice:        warehouse.TotalPrice,
323 324
 			Dealer:            warehouse.Dealer,
324 325
 			Manufacturer:      warehouse.Manufacturer,
@@ -354,7 +355,7 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
354 355
 			ProductDate:             warehouse.ProductDate,
355 356
 			ExpireDate:              warehouse.ExpiryDate,
356 357
 			Count:                   stock_number,
357
-			Price:                   drug_price,
358
+			Price:                   warehouse.RetailPrice,
358 359
 			Status:                  1,
359 360
 			Ctime:                   time.Now().Unix(),
360 361
 			UserOrgId:               orgID,
@@ -477,7 +478,7 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
477 478
 	if advice.PrescribingNumberUnit != drup.MaxUnit && advice.PrescribingNumberUnit != drup.MinUnit {
478 479
 		min_price = drup.RetailPrice
479 480
 	}
480
-
481
+	fmt.Println(min_price)
481 482
 	// 根据先进先出原则,查询最先入库的批次,进行出库
482 483
 	// 如果没有对应的库存,则报错
483 484
 
@@ -511,9 +512,9 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
511 512
 			DrugId:                  advice.DrugId,
512 513
 			Number:                  warehouse.Number,
513 514
 			BatchNumber:             warehouse.BatchNumber,
514
-			Price:                   min_price,
515
+			Price:                   warehouse.RetailPrice,
515 516
 			CountUnit:               drup.MinUnit,
516
-			RetailPrice:             min_price,
517
+			RetailPrice:             warehouse.RetailPrice,
517 518
 			ProductDate:             warehouse.ProductDate,
518 519
 			ExpiryDate:              warehouse.ExpiryDate,
519 520
 			PatientId:               advice.PatientId,
@@ -530,7 +531,7 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
530 531
 			ProductDate:             warehouse.ProductDate,
531 532
 			ExpireDate:              warehouse.ExpiryDate,
532 533
 			Count:                   deliver_number,
533
-			Price:                   min_price,
534
+			Price:                   warehouse.RetailPrice,
534 535
 			Status:                  1,
535 536
 			Ctime:                   time.Now().Unix(),
536 537
 			UserOrgId:               orgID,
@@ -659,8 +660,8 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
659 660
 			DrugId:                  advice.DrugId,
660 661
 			Number:                  warehouse.Number,
661 662
 			BatchNumber:             warehouse.BatchNumber,
662
-			Price:                   min_price,
663
-			RetailPrice:             min_price,
663
+			Price:                   warehouse.RetailPrice,
664
+			RetailPrice:             warehouse.RetailPrice,
664 665
 			ProductDate:             warehouse.ProductDate,
665 666
 			ExpiryDate:              warehouse.ExpiryDate,
666 667
 			PatientId:               advice.PatientId,
@@ -678,7 +679,7 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
678 679
 			ProductDate:             warehouse.ProductDate,
679 680
 			ExpireDate:              warehouse.ExpiryDate,
680 681
 			Count:                   stock_number,
681
-			Price:                   min_price,
682
+			Price:                   warehouse.RetailPrice,
682 683
 			Status:                  1,
683 684
 			Ctime:                   time.Now().Unix(),
684 685
 			UserOrgId:               orgID,
@@ -926,7 +927,7 @@ func AutoDrugDeliverInfo(orgID int64, prescribingNumber int64, warehouseout *mod
926 927
 		}
927 928
 		warehouseOutInfo.Count = stock_number
928 929
 
929
-		warehouseOutInfo.CountUnit = advice.CountUnit
930
+		//warehouseOutInfo.CountUnit = advice.CountUnit
930 931
 
931 932
 		errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
932 933
 		if errOne != nil {
@@ -1124,7 +1125,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1124 1125
 			PatientId:               patient_id,
1125 1126
 			Number:                  warehouse.Number,
1126 1127
 			LicenseNumber:           warehouse.LicenseNumber,
1127
-			Price:                   info.PackingPrice,
1128
+			Price:                   warehouse.PackingPrice,
1128 1129
 			ExpiryDate:              warehouse.ExpiryDate,
1129 1130
 			ProductDate:             warehouse.ProductDate,
1130 1131
 			ProjectId:               goods.ProjectId,
@@ -1172,7 +1173,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1172 1173
 				ProductDate:             warehouse.ProductDate,
1173 1174
 				ExpireDate:              warehouse.ExpiryDate,
1174 1175
 				Count:                   deliver_number,
1175
-				Price:                   info.PackingPrice,
1176
+				Price:                   warehouse.PackingPrice,
1176 1177
 				Status:                  1,
1177 1178
 				Ctime:                   time.Now().Unix(),
1178 1179
 				UserOrgId:               orgID,
@@ -1207,7 +1208,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1207 1208
 					ProductDate:             warehouse.ProductDate,
1208 1209
 					ExpireDate:              warehouse.ExpiryDate,
1209 1210
 					Count:                   exsit.Count + goods.Count,
1210
-					Price:                   info.PackingPrice,
1211
+					Price:                   warehouse.PackingPrice,
1211 1212
 					Status:                  1,
1212 1213
 					Ctime:                   time.Now().Unix(),
1213 1214
 					UserOrgId:               orgID,
@@ -1241,7 +1242,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1241 1242
 				ProductDate:             warehouse.ProductDate,
1242 1243
 				ExpireDate:              warehouse.ExpiryDate,
1243 1244
 				Count:                   deliver_number,
1244
-				Price:                   info.PackingPrice,
1245
+				Price:                   warehouse.PackingPrice,
1245 1246
 				Status:                  1,
1246 1247
 				Ctime:                   time.Now().Unix(),
1247 1248
 				UserOrgId:               orgID,
@@ -1275,7 +1276,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1275 1276
 					ProductDate:             warehouse.ProductDate,
1276 1277
 					ExpireDate:              warehouse.ExpiryDate,
1277 1278
 					Count:                   exsit.Count + goods.Count,
1278
-					Price:                   info.PackingPrice,
1279
+					Price:                   warehouse.PackingPrice,
1279 1280
 					Status:                  1,
1280 1281
 					Ctime:                   time.Now().Unix(),
1281 1282
 					UserOrgId:               orgID,
@@ -1341,7 +1342,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1341 1342
 			PatientId:               patient_id,
1342 1343
 			Number:                  warehouse.Number,
1343 1344
 			LicenseNumber:           warehouse.LicenseNumber,
1344
-			Price:                   info.PackingPrice,
1345
+			Price:                   warehouse.PackingPrice,
1345 1346
 			ExpiryDate:              warehouse.ExpiryDate,
1346 1347
 			ProductDate:             warehouse.ProductDate,
1347 1348
 			ProjectId:               goods.ProjectId,
@@ -1365,7 +1366,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1365 1366
 				ProductDate:             warehouse.ProductDate,
1366 1367
 				ExpireDate:              warehouse.ExpiryDate,
1367 1368
 				Count:                   stock_number,
1368
-				Price:                   info.PackingPrice,
1369
+				Price:                   warehouse.PackingPrice,
1369 1370
 				Status:                  1,
1370 1371
 				Ctime:                   time.Now().Unix(),
1371 1372
 				UserOrgId:               orgID,
@@ -1397,7 +1398,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1397 1398
 					ProductDate:             warehouse.ProductDate,
1398 1399
 					ExpireDate:              warehouse.ExpiryDate,
1399 1400
 					Count:                   exsit.Count + goods.Count,
1400
-					Price:                   info.PackingPrice,
1401
+					Price:                   warehouse.PackingPrice,
1401 1402
 					Status:                  1,
1402 1403
 					Ctime:                   time.Now().Unix(),
1403 1404
 					UserOrgId:               orgID,
@@ -1434,7 +1435,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1434 1435
 				ProductDate:             warehouse.ProductDate,
1435 1436
 				ExpireDate:              warehouse.ExpiryDate,
1436 1437
 				Count:                   stock_number,
1437
-				Price:                   info.PackingPrice,
1438
+				Price:                   warehouse.PackingPrice,
1438 1439
 				Status:                  1,
1439 1440
 				Ctime:                   time.Now().Unix(),
1440 1441
 				UserOrgId:               orgID,
@@ -1466,7 +1467,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
1466 1467
 					ProductDate:             warehouse.ProductDate,
1467 1468
 					ExpireDate:              warehouse.ExpiryDate,
1468 1469
 					Count:                   exsit.Count + goods.Count,
1469
-					Price:                   info.PackingPrice,
1470
+					Price:                   warehouse.PackingPrice,
1470 1471
 					Status:                  1,
1471 1472
 					Ctime:                   time.Now().Unix(),
1472 1473
 					UserOrgId:               orgID,
@@ -1694,7 +1695,7 @@ func ConsumablesDeliveryOne(orgID int64, record_time int64, goods *models.Wareho
1694 1695
 			Status:                  1,
1695 1696
 			Ctime:                   time.Now().Unix(),
1696 1697
 			Mtime:                   0,
1697
-			Price:                   goods.Price,
1698
+			Price:                   warehouse.PackingPrice,
1698 1699
 			WarehousingDetailId:     0,
1699 1700
 			WarehouseOutDetailId:    warehouseOutInfo.ID,
1700 1701
 			CancelOutDetailId:       0,
@@ -1742,7 +1743,7 @@ func ConsumablesDeliveryOne(orgID int64, record_time int64, goods *models.Wareho
1742 1743
 			ExpiryDate:              goods.ExpiryDate,
1743 1744
 			ProductDate:             goods.ProductDate,
1744 1745
 			Number:                  warehouse.Number,
1745
-			Price:                   goods.Price,
1746
+			Price:                   warehouse.PackingPrice,
1746 1747
 			LicenseNumber:           goods.LicenseNumber,
1747 1748
 		}
1748 1749
 		warehouseOutInfo.Count = stock_number
@@ -1785,7 +1786,7 @@ func ConsumablesDeliveryOne(orgID int64, record_time int64, goods *models.Wareho
1785 1786
 			Status:                  1,
1786 1787
 			Ctime:                   time.Now().Unix(),
1787 1788
 			Mtime:                   0,
1788
-			Price:                   goods.Price,
1789
+			Price:                   warehouse.PackingPrice,
1789 1790
 			WarehousingDetailId:     0,
1790 1791
 			WarehouseOutDetailId:    warehouseOutInfo.ID,
1791 1792
 			CancelOutDetailId:       0,
@@ -1850,7 +1851,7 @@ func ConsumablesDeliveryTwo(orgID int64, goods *models.WarehouseOutInfo, count i
1850 1851
 			ExpiryDate:              goods.ExpiryDate,
1851 1852
 			ProductDate:             goods.ProductDate,
1852 1853
 			Number:                  goods.Number,
1853
-			Price:                   goods.Price,
1854
+			Price:                   warehouse.PackingPrice,
1854 1855
 			LicenseNumber:           goods.LicenseNumber,
1855 1856
 			ConsumableType:          2,
1856 1857
 		}
@@ -1900,7 +1901,7 @@ func ConsumablesDeliveryTwo(orgID int64, goods *models.WarehouseOutInfo, count i
1900 1901
 			ExpiryDate:              goods.ExpiryDate,
1901 1902
 			ProductDate:             goods.ProductDate,
1902 1903
 			Number:                  goods.Number,
1903
-			Price:                   goods.Price,
1904
+			Price:                   warehouse.PackingPrice,
1904 1905
 			LicenseNumber:           goods.LicenseNumber,
1905 1906
 			ConsumableType:          2,
1906 1907
 		}
@@ -1990,7 +1991,7 @@ func NewDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
1990 1991
 			DrugId:                  advice.DrugId,
1991 1992
 			Number:                  warehouse.Number,
1992 1993
 			BatchNumber:             warehouse.BatchNumber,
1993
-			Price:                   drug_price,
1994
+			Price:                   warehouse.RetailPrice,
1994 1995
 			CountUnit:               drup.MinUnit,
1995 1996
 			RetailPrice:             drug_price,
1996 1997
 			ProductDate:             warehouse.ProductDate,
@@ -2009,7 +2010,7 @@ func NewDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
2009 2010
 			ProductDate:             warehouse.ProductDate,
2010 2011
 			ExpireDate:              warehouse.ExpiryDate,
2011 2012
 			Count:                   deliver_number, //按最小单位计算,
2012
-			Price:                   drug_price,
2013
+			Price:                   warehouse.RetailPrice,
2013 2014
 			Status:                  1,
2014 2015
 			Ctime:                   time.Now().Unix(),
2015 2016
 			UserOrgId:               orgID,
@@ -2116,7 +2117,7 @@ func NewDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
2116 2117
 			DrugId:                  advice.DrugId,
2117 2118
 			Number:                  warehouse.Number,
2118 2119
 			BatchNumber:             warehouse.BatchNumber,
2119
-			Price:                   drug_price,
2120
+			Price:                   warehouse.RetailPrice,
2120 2121
 			CountUnit:               drup.MinUnit,
2121 2122
 			ProductDate:             warehouse.ProductDate,
2122 2123
 			ExpiryDate:              warehouse.ExpiryDate,
@@ -2207,7 +2208,7 @@ func NewDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
2207 2208
 			ProductDate:             warehouse.ProductDate,
2208 2209
 			ExpireDate:              warehouse.ExpiryDate,
2209 2210
 			Count:                   deliver_number,
2210
-			Price:                   drug_price,
2211
+			Price:                   warehouse.RetailPrice,
2211 2212
 			Status:                  1,
2212 2213
 			Ctime:                   time.Now().Unix(),
2213 2214
 			UserOrgId:               orgID,
@@ -2264,7 +2265,7 @@ func NewHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout
2264 2265
 	if advice.PrescribingNumberUnit != drup.MaxUnit && advice.PrescribingNumberUnit != drup.MinUnit {
2265 2266
 		min_price = drup.RetailPrice
2266 2267
 	}
2267
-
2268
+	fmt.Println(min_price)
2268 2269
 	// 根据先进先出原则,查询最先入库的批次,进行出库
2269 2270
 	// 如果没有对应的库存,则报错
2270 2271
 	//开启事物
@@ -2298,9 +2299,9 @@ func NewHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout
2298 2299
 			DrugId:                  advice.DrugId,
2299 2300
 			Number:                  warehouse.Number,
2300 2301
 			BatchNumber:             warehouse.BatchNumber,
2301
-			Price:                   min_price,
2302
+			Price:                   warehouse.RetailPrice,
2302 2303
 			CountUnit:               drup.MinUnit,
2303
-			RetailPrice:             min_price,
2304
+			RetailPrice:             warehouse.RetailPrice,
2304 2305
 			ProductDate:             warehouse.ProductDate,
2305 2306
 			ExpiryDate:              warehouse.ExpiryDate,
2306 2307
 			PatientId:               advice.PatientId,
@@ -2317,7 +2318,7 @@ func NewHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout
2317 2318
 			ProductDate:             warehouse.ProductDate,
2318 2319
 			ExpireDate:              warehouse.ExpiryDate,
2319 2320
 			Count:                   deliver_number,
2320
-			Price:                   min_price,
2321
+			Price:                   warehouse.RetailPrice,
2321 2322
 			Status:                  1,
2322 2323
 			Ctime:                   time.Now().Unix(),
2323 2324
 			UserOrgId:               orgID,
@@ -2418,8 +2419,8 @@ func NewHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout
2418 2419
 			DrugId:                  advice.DrugId,
2419 2420
 			Number:                  warehouse.Number,
2420 2421
 			BatchNumber:             warehouse.BatchNumber,
2421
-			Price:                   min_price,
2422
-			RetailPrice:             min_price,
2422
+			Price:                   warehouse.RetailPrice,
2423
+			RetailPrice:             warehouse.RetailPrice,
2423 2424
 			ProductDate:             warehouse.ProductDate,
2424 2425
 			ExpiryDate:              warehouse.ExpiryDate,
2425 2426
 			PatientId:               advice.PatientId,
@@ -2437,7 +2438,7 @@ func NewHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout
2437 2438
 			ProductDate:             warehouse.ProductDate,
2438 2439
 			ExpireDate:              warehouse.ExpiryDate,
2439 2440
 			Count:                   stock_number,
2440
-			Price:                   min_price,
2441
+			Price:                   warehouse.RetailPrice,
2441 2442
 			Status:                  1,
2442 2443
 			Ctime:                   time.Now().Unix(),
2443 2444
 			UserOrgId:               orgID,
@@ -2489,7 +2490,7 @@ func NewHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout
2489 2490
 			ProductDate:       warehouse.ProductDate,
2490 2491
 			ExpiryDate:        warehouse.ExpiryDate,
2491 2492
 			WarehousingCount:  warehouse.WarehousingCount,
2492
-			Price:             warehouse.Price,
2493
+			Price:             warehouse.RetailPrice,
2493 2494
 			TotalPrice:        warehouse.TotalPrice,
2494 2495
 			Dealer:            warehouse.Dealer,
2495 2496
 			Manufacturer:      warehouse.Manufacturer,