see999 3 anos atrás
pai
commit
c4c454a2a7
2 arquivos alterados com 28 adições e 6 exclusões
  1. 13 5
      controllers/his_api_controller.go
  2. 15 1
      service/his_service.go

+ 13 - 5
controllers/his_api_controller.go Ver arquivo

@@ -2802,7 +2802,9 @@ func (c *HisApiController) GetUploadInfo() {
2802 2802
  	ids_arr := strings.Split(ids_str,  ",")
2803 2803
 	if tempOrder.ID == 0 {
2804 2804
 		if settle_accounts_type == 1 { //日结
2805
+			fmt.Println(reg_type)
2805 2806
 			if reg_type == 11{
2807
+				fmt.Println(reg_type)
2806 2808
 				prescriptions,_ = service.GetPrescriptionByIds(ids_arr,adminUser.CurrentOrgId)
2807 2809
 			   }else{
2808 2810
 				prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime, reg_type)
@@ -2841,13 +2843,14 @@ func (c *HisApiController) GetUploadInfo() {
2841 2843
 		strconv.FormatInt(his.PatientId, 10)
2842 2844
 
2843 2845
 		var ids []int64
2844
-
2846
+		fmt.Println(prescriptions)
2845 2847
 		for _, item := range prescriptions {
2846 2848
 			ids = append(ids, item.ID)
2847 2849
 		}
2848
-
2849 2850
 		var total float64
2851
+		fmt.Println(prescriptions)
2850 2852
 		for _, item := range prescriptions {
2853
+			fmt.Println(item)
2851 2854
 			if item.Type == 1 { //药品
2852 2855
 				for _, subItem := range item.HisDoctorAdviceInfo {
2853 2856
 					total = total + (subItem.Price * subItem.PrescribingNumber)
@@ -4465,7 +4468,7 @@ func (c *HisApiController) PreSettle() {
4465 4468
 	ids_str := c.GetString("ids")
4466 4469
 	ids_arr := strings.Split(ids_str,  ",")
4467 4470
 
4468
-
4471
+	fmt.Println(reg_type)
4469 4472
 
4470 4473
 	if settle_accounts_type == 1 { //日结
4471 4474
 
@@ -4476,7 +4479,7 @@ func (c *HisApiController) PreSettle() {
4476 4479
 			prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime, reg_type)
4477 4480
 		}
4478 4481
 
4479
-		
4482
+		fmt.Println(prescriptions)
4480 4483
 	} else { //月结
4481 4484
 		start_time_str := c.GetString("start_time")
4482 4485
 		end_time_str := c.GetString("end_time")
@@ -4512,8 +4515,11 @@ func (c *HisApiController) PreSettle() {
4512 4515
 		ids = append(ids, item.ID)
4513 4516
 	}
4514 4517
 
4518
+	fmt.Println(ids)
4519
+
4515 4520
 	var total float64
4516 4521
 	for _, item := range prescriptions {
4522
+		fmt.Println(item)
4517 4523
 		if item.Type == 1 { //药品
4518 4524
 			for _, subItem := range item.HisDoctorAdviceInfo {
4519 4525
 				total = total + (subItem.Price * subItem.PrescribingNumber)
@@ -4560,7 +4566,7 @@ func (c *HisApiController) PreSettle() {
4560 4566
 
4561 4567
 	var customs []*Custom
4562 4568
 	for _, item := range prescriptions {
4563
-
4569
+		fmt.Println(item.Type)
4564 4570
 		if item.Type == 1 { //药品
4565 4571
 			for _, subItem := range item.HisDoctorAdviceInfo {
4566 4572
 				cus := &Custom{
@@ -4613,6 +4619,8 @@ func (c *HisApiController) PreSettle() {
4613 4619
 
4614 4620
 	}
4615 4621
 
4622
+	fmt.Println(customs)
4623
+
4616 4624
 	for _, item := range customs {
4617 4625
 		var advice_id int64 = 0
4618 4626
 		var project_id int64 = 0

+ 15 - 1
service/his_service.go Ver arquivo

@@ -2048,6 +2048,20 @@ func SaveHisOrder(his *models.HisOrder) (err error) {
2048 2048
 
2049 2049
 
2050 2050
 func GetPrescriptionByIds(ids []string, org_id int64) (prescription []*models.HisPrescription, err error) {
2051
-	err = readDb.Model(&models.HisPrescription{}).Where("id in (?) AND user_org_id = ? AND status = 1", ids, org_id).Find(&prescription).Error
2051
+	err = readDb.Model(&models.HisPrescription{}).
2052
+		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
2053
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
2054
+		}).
2055
+		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
2056
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
2057
+		}).
2058
+		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
2059
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1")
2060
+		}).Preload("TempHisOrder", func(db *gorm.DB) *gorm.DB {
2061
+		return db.Where("status = 1 AND user_org_id = ?", org_id)
2062
+	}).
2063
+		Where("id in (?) AND user_org_id = ? AND status = 1", ids,org_id).
2064
+		Find(&prescription).Error
2065
+	
2052 2066
 	return
2053 2067
 }