张保健 3 years ago
parent
commit
99f814f1ff
3 changed files with 38 additions and 7 deletions
  1. 36 7
      controllers/sz/sz_his_api_controller.go
  2. 1 0
      models/his_models.go
  3. 1 0
      service/his_service.go

+ 36 - 7
controllers/sz/sz_his_api_controller.go View File

2312
 							}
2312
 							}
2313
 							customs = append(customs, cus)
2313
 							customs = append(customs, cus)
2314
 
2314
 
2315
-						} else if subItem.Type == 3 {
2315
+						}
2316
+
2317
+					}
2318
+					if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
2319
+
2320
+						detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)), 64)
2321
+						//count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
2322
+						count, _ := strconv.ParseFloat(strconv.FormatInt(subItem.Count, 10), 64)
2323
+						temp := strings.Split(subItem.FeedetlSn, "-")
2324
+						newFl := fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) + "-" + temp[1] + "-" + temp[2]
2325
+						if subItem.Type == 3 {
2316
 							cus := &models.CustomDetail{
2326
 							cus := &models.CustomDetail{
2317
 								PrescriptionNumber: chrg_bchno,
2327
 								PrescriptionNumber: chrg_bchno,
2318
 								OrderType:          "1",
2328
 								OrderType:          "1",
2333
 						}
2343
 						}
2334
 
2344
 
2335
 					}
2345
 					}
2346
+
2336
 				}
2347
 				}
2337
 			}
2348
 			}
2338
 			//
2349
 			//
2619
 		}
2630
 		}
2620
 
2631
 
2621
 	} else {
2632
 	} else {
2622
-		if tempOrder.OrderStatus == 4 {
2633
+		if tempOrder.OrderStatus == 1 && tempOrder.IsPre == 1 {
2623
 			pay_way, _ := c.GetInt64("pay_way")
2634
 			pay_way, _ := c.GetInt64("pay_way")
2624
 			pay_price, _ := c.GetFloat("pay_price")
2635
 			pay_price, _ := c.GetFloat("pay_price")
2625
 			pay_card_no := c.GetString("pay_card_no")
2636
 			pay_card_no := c.GetString("pay_card_no")
2779
 				return
2790
 				return
2780
 			}
2791
 			}
2781
 
2792
 
2793
+		} else {
2794
+
2795
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
2796
+			return
2797
+
2782
 		}
2798
 		}
2783
 
2799
 
2784
 	}
2800
 	}
3108
 						}
3124
 						}
3109
 						customs = append(customs, cus)
3125
 						customs = append(customs, cus)
3110
 
3126
 
3111
-					} else if subItem.Type == 3 {
3127
+					}
3128
+
3129
+				}
3130
+
3131
+				if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
3132
+
3133
+					detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)), 64)
3134
+					//count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
3135
+					count, _ := strconv.ParseFloat(strconv.FormatInt(subItem.Count, 10), 64)
3136
+					temp := strings.Split(subItem.FeedetlSn, "-")
3137
+					newFl := fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) + "-" + temp[1] + "-" + temp[2]
3138
+					if subItem.Type == 3 {
3112
 						cus := &models.CustomDetail{
3139
 						cus := &models.CustomDetail{
3113
 							PrescriptionNumber: chrg_bchno,
3140
 							PrescriptionNumber: chrg_bchno,
3114
 							OrderType:          "1",
3141
 							OrderType:          "1",
3129
 					}
3156
 					}
3130
 
3157
 
3131
 				}
3158
 				}
3159
+
3132
 			}
3160
 			}
3133
 		}
3161
 		}
3134
 		//
3162
 		//
3227
 			SettleAccountsDate:  recordDateTime,
3255
 			SettleAccountsDate:  recordDateTime,
3228
 			Ctime:               time.Now().Unix(),
3256
 			Ctime:               time.Now().Unix(),
3229
 			Mtime:               time.Now().Unix(),
3257
 			Mtime:               time.Now().Unix(),
3230
-			Status:              1,
3258
+			Status:              0,
3231
 			Number:              chrg_bchno,
3259
 			Number:              chrg_bchno,
3232
 			Infcode:             0,
3260
 			Infcode:             0,
3233
 			WarnMsg:             "",
3261
 			WarnMsg:             "",
3235
 			ErrMsg:              "",
3263
 			ErrMsg:              "",
3236
 			RespondTime:         "",
3264
 			RespondTime:         "",
3237
 			InfRefmsgid:         "",
3265
 			InfRefmsgid:         "",
3238
-			OrderStatus:         4,
3266
+			OrderStatus:         1,
3239
 			IsMedicineInsurance: 1,
3267
 			IsMedicineInsurance: 1,
3240
 			SettleType:          settle_accounts_type,
3268
 			SettleType:          settle_accounts_type,
3241
 			SettleStartTime:     start_time,
3269
 			SettleStartTime:     start_time,
3344
 				}
3372
 				}
3345
 
3373
 
3346
 				if res.Transreturncode == "00000000" {
3374
 				if res.Transreturncode == "00000000" {
3347
-					order.OrderStatus = 4
3375
+					order.OrderStatus = 1
3348
 					order.Status = 1
3376
 					order.Status = 1
3349
 					order.PsnNo = health_card_no
3377
 					order.PsnNo = health_card_no
3350
 					order.Modify = admin_user_id
3378
 					order.Modify = admin_user_id
3366
 					detailStrThree := string(setlDetailThree)
3394
 					detailStrThree := string(setlDetailThree)
3367
 					order.SzMedicineInsuranceInfo = detailStrThree
3395
 					order.SzMedicineInsuranceInfo = detailStrThree
3368
 					order.Cainfo = result_three
3396
 					order.Cainfo = result_three
3397
+					order.IsPre = 1
3369
 					//err = service.UpdataOrderStatusTwo(order.Number, adminUser.CurrentOrgId)
3398
 					//err = service.UpdataOrderStatusTwo(order.Number, adminUser.CurrentOrgId)
3370
 					err = service.UpDateOrderTwo(order)
3399
 					err = service.UpDateOrderTwo(order)
3371
 					c.ServeSuccessJSON(map[string]interface{}{
3400
 					c.ServeSuccessJSON(map[string]interface{}{
4765
 		recordDate := time.Unix(item.RecordDate, 0).Format(timeLayout)
4794
 		recordDate := time.Unix(item.RecordDate, 0).Format(timeLayout)
4766
 
4795
 
4767
 		detail := &models.DrugDetail{
4796
 		detail := &models.DrugDetail{
4768
-			MedicalInsuranceNumber: item.SocialSecurityDirectoryCode,
4797
+			MedicalInsuranceNumber: item.MedicalInsuranceNumber,
4769
 			Code:                   item.Code,
4798
 			Code:                   item.Code,
4770
 			DrugName:               item.DrugName,
4799
 			DrugName:               item.DrugName,
4771
 			DrugSpec:               item.DrugSpec,
4800
 			DrugSpec:               item.DrugSpec,

+ 1 - 0
models/his_models.go View File

693
 	HisPrescriptionInfo HisPrescriptionInfo `gorm:"ForeignKey:PatientId,SettleAccountsDate;AssociationForeignKey:PatientId,RecordDate" json:"p_info"`
693
 	HisPrescriptionInfo HisPrescriptionInfo `gorm:"ForeignKey:PatientId,SettleAccountsDate;AssociationForeignKey:PatientId,RecordDate" json:"p_info"`
694
 
694
 
695
 	PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
695
 	PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
696
+	IsPre int64 `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
696
 }
697
 }
697
 
698
 
698
 func (HisOrder) TableName() string {
699
 func (HisOrder) TableName() string {

+ 1 - 0
service/his_service.go View File

599
 	PrivatePrice          float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
599
 	PrivatePrice          float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
600
 	Creator               int64   `gorm:"column:creator" json:"creator" form:"creator"`
600
 	Creator               int64   `gorm:"column:creator" json:"creator" form:"creator"`
601
 	Modify                int64   `gorm:"column:modify" json:"modify" form:"modify"`
601
 	Modify                int64   `gorm:"column:modify" json:"modify" form:"modify"`
602
+	IsPre                 int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
602
 
603
 
603
 	SzChargeInfo            string `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
604
 	SzChargeInfo            string `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
604
 	SzProjectInfo           string `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
605
 	SzProjectInfo           string `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`