浏览代码

医保对接

csx 3 年前
父节点
当前提交
a0200f1936
共有 2 个文件被更改,包括 33 次插入26 次删除
  1. 30 24
      controllers/his_api_controller.go
  2. 3 2
      service/his_service.go

+ 30 - 24
controllers/his_api_controller.go 查看文件

620
 	advices, _ := service.FindAllHisAdviceTemplate(adminInfo.CurrentOrgId)
620
 	advices, _ := service.FindAllHisAdviceTemplate(adminInfo.CurrentOrgId)
621
 	//获取所有基础药
621
 	//获取所有基础药
622
 	drugs, _ := service.GetAllDrugLibList(adminInfo.CurrentOrgId)
622
 	drugs, _ := service.GetAllDrugLibList(adminInfo.CurrentOrgId)
623
-
624
 	_, config := service.FindHisStockPriceRecordByOrgId(adminInfo.CurrentOrgId)
623
 	_, config := service.FindHisStockPriceRecordByOrgId(adminInfo.CurrentOrgId)
625
 	if config.ID > 0 && config.IsOpen == 1 {
624
 	if config.ID > 0 && config.IsOpen == 1 {
626
 		for _, item := range drugs {
625
 		for _, item := range drugs {
714
 
713
 
715
 	_, stockConfig := service.FindAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
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
 	if drugStockConfig.IsOpen == 1 {
722
 	if drugStockConfig.IsOpen == 1 {
718
 
723
 
719
 		//校验库存总量
724
 		//校验库存总量
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
 	go func() {
896
 	go func() {
892
 		if drugStockConfig.IsOpen == 1 {
897
 		if drugStockConfig.IsOpen == 1 {
894
 			if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
899
 			if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
895
 				prescriptions, _ := dataBody["prescriptions"].([]interface{})
900
 				prescriptions, _ := dataBody["prescriptions"].([]interface{})
896
 				if len(prescriptions) > 0 {
901
 				if len(prescriptions) > 0 {
902
+
897
 					for _, item := range prescriptions {
903
 					for _, item := range prescriptions {
898
 						items := item.(map[string]interface{})
904
 						items := item.(map[string]interface{})
899
 						if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
905
 						if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
1013
 				}
1019
 				}
1014
 			}
1020
 			}
1015
 		}
1021
 		}
1016
-		ch <- struct{}{}
1022
+		//ch <- struct{}{}
1017
 	}()
1023
 	}()
1018
 
1024
 
1019
 	go func() {
1025
 	go func() {
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
 	info, _ := service.FindHisPatientPrescriptionInfo(adminInfo.CurrentOrgId, patient_id, recordDateTime, p_type, his_patient_id)
1092
 	info, _ := service.FindHisPatientPrescriptionInfo(adminInfo.CurrentOrgId, patient_id, recordDateTime, p_type, his_patient_id)
1087
 	var hpInfo models.HisPrescriptionInfo
1093
 	var hpInfo models.HisPrescriptionInfo
5429
 	admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
5435
 	admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
5430
 
5436
 
5431
 	c.ServeSuccessJSON(map[string]interface{}{
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
 		"bedCostTotal":                                bedCostTotal,
5450
 		"bedCostTotal":                                bedCostTotal,
5445
 		"bedCostSelfTotal":                            bedCostSelfTotal,
5451
 		"bedCostSelfTotal":                            bedCostSelfTotal,

+ 3 - 2
service/his_service.go 查看文件

722
 }
722
 }
723
 
723
 
724
 func GetAllDrugLibList(org_id int64) (list []*BaseDrugLib, err error) {
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
 	return
728
 	return
727
 }
729
 }
728
 
730
 
2237
 	return
2239
 	return
2238
 }
2240
 }
2239
 
2241
 
2240
-
2241
 func GetHisDoctorAdviceInfo(id int64) (models.HisDoctorAdviceInfo, error) {
2242
 func GetHisDoctorAdviceInfo(id int64) (models.HisDoctorAdviceInfo, error) {
2242
 
2243
 
2243
 	info := models.HisDoctorAdviceInfo{}
2244
 	info := models.HisDoctorAdviceInfo{}