csx 3 gadus atpakaļ
vecāks
revīzija
a0200f1936
2 mainītis faili ar 33 papildinājumiem un 26 dzēšanām
  1. 30 24
      controllers/his_api_controller.go
  2. 3 2
      service/his_service.go

+ 30 - 24
controllers/his_api_controller.go Parādīt failu

@@ -620,7 +620,6 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
620 620
 	advices, _ := service.FindAllHisAdviceTemplate(adminInfo.CurrentOrgId)
621 621
 	//获取所有基础药
622 622
 	drugs, _ := service.GetAllDrugLibList(adminInfo.CurrentOrgId)
623
-
624 623
 	_, config := service.FindHisStockPriceRecordByOrgId(adminInfo.CurrentOrgId)
625 624
 	if config.ID > 0 && config.IsOpen == 1 {
626 625
 		for _, item := range drugs {
@@ -714,6 +713,12 @@ func (c *HisApiController) CreateHisPrescription() {
714 713
 
715 714
 	_, stockConfig := service.FindAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
716 715
 
716
+	redisClient := service.RedisClient()
717
+	redisClient.LPush("111", patient)
718
+	str, _ := redisClient.LPop("111").Result()
719
+	fmt.Println("~~~~~" + str)
720
+	defer redisClient.Close()
721
+
717 722
 	if drugStockConfig.IsOpen == 1 {
718 723
 
719 724
 		//校验库存总量
@@ -885,8 +890,8 @@ func (c *HisApiController) CreateHisPrescription() {
885 890
 		}
886 891
 	}
887 892
 
888
-	ch := make(chan struct{})
889
-	count := 2 // count 表示活动的协程个数
893
+	//ch := make(chan struct{})
894
+	//count := 2 // count 表示活动的协程个数
890 895
 
891 896
 	go func() {
892 897
 		if drugStockConfig.IsOpen == 1 {
@@ -894,6 +899,7 @@ func (c *HisApiController) CreateHisPrescription() {
894 899
 			if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
895 900
 				prescriptions, _ := dataBody["prescriptions"].([]interface{})
896 901
 				if len(prescriptions) > 0 {
902
+
897 903
 					for _, item := range prescriptions {
898 904
 						items := item.(map[string]interface{})
899 905
 						if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
@@ -1013,7 +1019,7 @@ func (c *HisApiController) CreateHisPrescription() {
1013 1019
 				}
1014 1020
 			}
1015 1021
 		}
1016
-		ch <- struct{}{}
1022
+		//ch <- struct{}{}
1017 1023
 	}()
1018 1024
 
1019 1025
 	go func() {
@@ -1071,17 +1077,17 @@ func (c *HisApiController) CreateHisPrescription() {
1071 1077
 				}
1072 1078
 			}
1073 1079
 		}
1074
-		ch <- struct{}{}
1080
+		//ch <- struct{}{}
1075 1081
 	}()
1076 1082
 
1077
-	for range ch {
1078
-		// 每次从ch中接收数据,表明一个活动的协程结束
1079
-		count--
1080
-		// 当所有活动的协程都结束时,关闭管道
1081
-		if count == 0 {
1082
-			close(ch)
1083
-		}
1084
-	}
1083
+	//for range ch {
1084
+	//	// 每次从ch中接收数据,表明一个活动的协程结束
1085
+	//	count--
1086
+	//	// 当所有活动的协程都结束时,关闭管道
1087
+	//	if count == 0 {
1088
+	//		close(ch)
1089
+	//	}
1090
+	//}
1085 1091
 
1086 1092
 	info, _ := service.FindHisPatientPrescriptionInfo(adminInfo.CurrentOrgId, patient_id, recordDateTime, p_type, his_patient_id)
1087 1093
 	var hpInfo models.HisPrescriptionInfo
@@ -5429,17 +5435,17 @@ func (c *HisApiController) GetFaPiaoData() {
5429 5435
 	admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
5430 5436
 
5431 5437
 	c.ServeSuccessJSON(map[string]interface{}{
5432
-		"order_number":    order.Number,        //业务流水号
5433
-		"id_card_no":      his.IdCardNo,        //社会保障号
5434
-		"department_name": department.Name,     //科室
5435
-		"number":          his.Number,          //门诊号
5436
-		"date":            order.SettleEndTime, //结算日期
5437
-		"name":            order.PsnName,       //姓名
5438
-		"gender":          order.Gend,          //性别
5439
-		"psn_cash_money":  order.PsnCashPay,    //个人支付
5440
-		"pay_way":         "门诊",                //结算方式
5441
-		"medfee_sumamt":   order.MedfeeSumamt,  //总费用
5442
-		"admin_user_name": admin.UserName,      //收款员
5438
+		"order_number":    order.Number,             //业务流水号
5439
+		"id_card_no":      his.IdCardNo,             //社会保障号
5440
+		"department_name": department.Name,          //科室
5441
+		"number":          his.Number,               //门诊号
5442
+		"date":            order.SettleAccountsDate, //结算日期
5443
+		"name":            order.PsnName,            //姓名
5444
+		"gender":          order.Gend,               //性别
5445
+		"psn_cash_money":  order.PsnCashPay,         //个人支付
5446
+		"pay_way":         "门诊",                     //结算方式
5447
+		"medfee_sumamt":   order.MedfeeSumamt,       //总费用
5448
+		"admin_user_name": admin.UserName,           //收款员
5443 5449
 
5444 5450
 		"bedCostTotal":                                bedCostTotal,
5445 5451
 		"bedCostSelfTotal":                            bedCostSelfTotal,

+ 3 - 2
service/his_service.go Parādīt failu

@@ -722,7 +722,9 @@ func (BaseDrugLib) TableName() string {
722 722
 }
723 723
 
724 724
 func GetAllDrugLibList(org_id int64) (list []*BaseDrugLib, err error) {
725
-	err = readDb.Model(&BaseDrugLib{}).Where("org_id = ?  AND status = 1 AND  find_in_set('停用',drug_status) = 0", org_id).Preload("OtherDrugWarehouseInfo", "status = 1 and (stock_max_number > 0 or stock_min_number >0)").Find(&list).Error
725
+	err = readDb.Model(&BaseDrugLib{}).Where("org_id = ?  AND status = 1 AND  find_in_set('停用',drug_status) = 0", org_id).Preload("OtherDrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
726
+		return db.Where("status = 1 and (stock_max_number > 0 or stock_min_number >0)")
727
+	}).Find(&list).Error
726 728
 	return
727 729
 }
728 730
 
@@ -2237,7 +2239,6 @@ func GetBaiLinOrderData() (order []*models.NewCustomHisOrder) {
2237 2239
 	return
2238 2240
 }
2239 2241
 
2240
-
2241 2242
 func GetHisDoctorAdviceInfo(id int64) (models.HisDoctorAdviceInfo, error) {
2242 2243
 
2243 2244
 	info := models.HisDoctorAdviceInfo{}