Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 3 years ago
parent
commit
c2729de3e5

+ 1 - 1
conf/app.conf View File

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9532
3
-runmode = dev
3
+runmode = prod
4 4
 
5 5
 #
6 6
 copyrequestbody = true

+ 3 - 5
controllers/sg/gdyb_controller.go View File

@@ -159,9 +159,7 @@ func (c *GdybController) PostFour() {
159 159
 	diag_code := c.GetString("diag_code")
160 160
 	sick_code := c.GetString("sick_code")
161 161
 	sick_name := c.GetString("sick_name")
162
-
163
-	fmt.Println(sick_code)
164
-	fmt.Println(sick_name)
162
+	dept := c.GetString("dept")
165 163
 
166 164
 	insuplc_admdvs := c.GetString("insuplc_admdvs")
167 165
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
@@ -169,9 +167,9 @@ func (c *GdybController) PostFour() {
169 167
 
170 168
 	var result string
171 169
 	if insuplc_admdvs == "440781" { //
172
-		result = service.Gdyb2203A(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name)
170
+		result = service.Gdyb2203A(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept)
173 171
 	} else {
174
-		result = service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name)
172
+		result = service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept)
175 173
 	}
176 174
 	var dat map[string]interface{}
177 175
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {

+ 22 - 233
controllers/sg/his_api_controller.go View File

@@ -11,7 +11,6 @@ import (
11 11
 	"gdyb/service"
12 12
 	"gdyb/utils"
13 13
 	"github.com/astaxie/beego"
14
-	"github.com/jinzhu/gorm"
15 14
 	"github.com/shopspring/decimal"
16 15
 	"io"
17 16
 	"io/ioutil"
@@ -1589,13 +1588,13 @@ func (c *HisApiController) GetRegisterInfo() {
1589 1588
 	certificates, _ := c.GetInt64("certificates")
1590 1589
 	medical_care, _ := c.GetInt64("medical_care")
1591 1590
 	birthday := c.GetString("birthday")
1592
-	age, _ := c.GetInt64("age")
1591
+	//age, _ := c.GetInt64("age")
1593 1592
 	id_card := c.GetString("id_card")
1594 1593
 	register_type, _ := c.GetInt64("register")
1595 1594
 	doctor, _ := c.GetInt64("doctor")
1596 1595
 	department, _ := c.GetInt64("department")
1597 1596
 	gender, _ := c.GetInt64("sex")
1598
-	phone := c.GetString("phone")
1597
+	//phone := c.GetString("phone")
1599 1598
 	registration_fee, _ := c.GetFloat("registration_fee")
1600 1599
 	medical_expenses, _ := c.GetFloat("medical_expenses")
1601 1600
 	social_type, _ := c.GetInt64("social_type")
@@ -1645,6 +1644,7 @@ func (c *HisApiController) GetRegisterInfo() {
1645 1644
 	config, _ := service.GetMedicalInsuranceConfig(adminInfo.CurrentOrgId)
1646 1645
 	roles, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
1647 1646
 
1647
+	//就诊结算未完成,不能进行二次挂号
1648 1648
 	his, _ := service.GetHisPatientInfoTwo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1649 1649
 	if len(his) >= 1 {
1650 1650
 		order, _ := service.GetNewHisOrderTwo(adminInfo.CurrentOrgId, his[len(his)-1].Number, his[len(his)-1].PatientId, recordDateTime)
@@ -1655,7 +1655,7 @@ func (c *HisApiController) GetRegisterInfo() {
1655 1655
 	}
1656 1656
 
1657 1657
 	if config.IsOpen == 1 {
1658
-		api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&certificates=" + strconv.FormatInt(certificates, 10)
1658
+		api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&certificates=" + strconv.FormatInt(certificates, 10)
1659 1659
 		resp, requestErr := http.Get(api)
1660 1660
 		if requestErr != nil {
1661 1661
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -1779,6 +1779,8 @@ func (c *HisApiController) GetRegisterInfo() {
1779 1779
 				insutype = "310"
1780 1780
 			}
1781 1781
 
1782
+			insutype = "390"
1783
+
1782 1784
 			//if count == 1 {
1783 1785
 			//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
1784 1786
 			//	return
@@ -1851,7 +1853,7 @@ func (c *HisApiController) GetRegisterInfo() {
1851 1853
 				api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
1852 1854
 					"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
1853 1855
 					"&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
1854
-					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.CountryCode + "&sick_name=" + sickConfig.ClassName
1856
+					"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.CountryCode + "&sick_name=" + sickConfig.ClassName + "&dept=" + roles.UserName
1855 1857
 				resp2, requestErr2 := http.Get(api2)
1856 1858
 				if requestErr2 != nil {
1857 1859
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -1937,45 +1939,6 @@ func (c *HisApiController) GetRegisterInfo() {
1937 1939
 
1938 1940
 			//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGdybOneException)
1939 1941
 		}
1940
-	} else {
1941
-		timeStr := time.Now().Format("2006-01-02")
1942
-		timeArr := strings.Split(timeStr, "-")
1943
-		var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(patient.ID, 10)
1944
-
1945
-		his, err := service.GetHisPatientInfo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
1946
-		var hisPatient models.XtHisPatient
1947
-		if err == gorm.ErrRecordNotFound || his.ID == 0 {
1948
-			hisPatient = models.XtHisPatient{
1949
-				Name:                   name,
1950
-				Age:                    age,
1951
-				Gender:                 gender,
1952
-				Birthday:               birthUnix,
1953
-				Phone:                  phone,
1954
-				MedicalTreatmentType:   medical_care,
1955
-				IdType:                 certificates,
1956
-				IdCardNo:               id_card,
1957
-				BalanceAccountsType:    settlementValue,
1958
-				SocialType:             social_type,
1959
-				MedicalInsuranceNumber: medical_insurance_card,
1960
-				RegisterType:           register_type,
1961
-				RegisterCost:           registration_fee,
1962
-				TreatmentCost:          medical_expenses,
1963
-				AdminUserId:            admin_user_id,
1964
-				UserOrgId:              adminInfo.CurrentOrgId,
1965
-				Status:                 1,
1966
-				RecordDate:             recordDateTime,
1967
-				IsReturn:               1,
1968
-				PatientId:              patient.ID,
1969
-				Ctime:                  time.Now().Unix(),
1970
-				Mtime:                  time.Now().Unix(),
1971
-				Number:                 str,
1972
-			}
1973
-			service.CreateHisPatient(&hisPatient)
1974
-
1975
-		}
1976
-		c.ServeSuccessJSON(map[string]interface{}{
1977
-			"his_info": hisPatient,
1978
-		})
1979 1942
 	}
1980 1943
 }
1981 1944
 
@@ -2298,6 +2261,7 @@ func (c *HisApiController) GetUploadInfo() {
2298 2261
 					insutype = "310"
2299 2262
 				}
2300 2263
 
2264
+				insutype = "390"
2301 2265
 				if his.IdCardType == 1 {
2302 2266
 					cert_no = his.MedicalInsuranceNumber
2303 2267
 
@@ -2439,168 +2403,6 @@ func (c *HisApiController) GetUploadInfo() {
2439 2403
 			//c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCalOrderException)
2440 2404
 			//return
2441 2405
 		}
2442
-
2443
-	} else {
2444
-		var total float64
2445
-		for _, item := range prescriptions {
2446
-			if item.Type == 1 { //药品
2447
-				for _, subItem := range item.HisDoctorAdviceInfo {
2448
-					total = total + (subItem.Price * subItem.PrescribingNumber)
2449
-				}
2450
-			}
2451
-			if item.Type == 2 { //项目
2452
-				for _, subItem := range item.HisPrescriptionProject {
2453
-					total = total + (subItem.Price * float64(subItem.Count))
2454
-				}
2455
-			}
2456
-
2457
-			for _, subItem := range item.HisAdditionalCharge {
2458
-				total = total + (subItem.Price * float64(subItem.Count))
2459
-			}
2460
-		}
2461
-
2462
-		allTotal := fmt.Sprintf("%.2f", total)
2463
-		totals, _ := strconv.ParseFloat(allTotal, 64)
2464
-		order := &models.HisOrder{
2465
-			UserOrgId:             adminUser.CurrentOrgId,
2466
-			HisPatientId:          his.ID,
2467
-			PatientId:             id,
2468
-			SettleAccountsDate:    recordDateTime,
2469
-			Ctime:                 time.Now().Unix(),
2470
-			Mtime:                 time.Now().Unix(),
2471
-			Status:                1,
2472
-			OrderStatus:           2,
2473
-			Number:                chrg_bchno,
2474
-			MedfeeSumamt:          totals,
2475
-			PayWay:                pay_way,
2476
-			PayPrice:              pay_price,
2477
-			PayCardNo:             pay_card_no,
2478
-			DiscountPrice:         discount_price,
2479
-			PreferentialPrice:     preferential_price,
2480
-			RealityPrice:          reality_price,
2481
-			FoundPrice:            found_price,
2482
-			MedicalInsurancePrice: medical_insurance_price,
2483
-			PrivatePrice:          private_price,
2484
-		}
2485
-		err = service.CreateOrder(order)
2486
-		if err != nil {
2487
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
2488
-			return
2489
-		}
2490
-
2491
-		var customs []*Custom
2492
-		for _, item := range prescriptions {
2493
-
2494
-			if item.Type == 1 { //药品
2495
-				for _, subItem := range item.HisDoctorAdviceInfo {
2496
-					cus := &Custom{
2497
-						AdviceId:         subItem.ID,
2498
-						ProjectId:        0,
2499
-						DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
2500
-						Cut:              fmt.Sprintf("%.2f", subItem.PrescribingNumber),
2501
-						FeedetlSn:        subItem.FeedetlSn,
2502
-						Price:            fmt.Sprintf("%.2f", subItem.Price),
2503
-						MedListCodg:      subItem.MedListCodg,
2504
-						Type:             1,
2505
-					}
2506
-					customs = append(customs, cus)
2507
-				}
2508
-			}
2509
-
2510
-			if item.Type == 2 { //项目
2511
-				for _, subItem := range item.HisPrescriptionProject {
2512
-
2513
-					cus := &Custom{
2514
-						AdviceId:         0,
2515
-						ProjectId:        subItem.ID,
2516
-						DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
2517
-						Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
2518
-						FeedetlSn:        subItem.FeedetlSn,
2519
-						Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
2520
-						MedListCodg:      subItem.MedListCodg,
2521
-						Type:             2,
2522
-					}
2523
-
2524
-					customs = append(customs, cus)
2525
-				}
2526
-			}
2527
-
2528
-			for _, item := range item.HisAdditionalCharge {
2529
-				cus := &Custom{
2530
-					ItemId:           item.ID,
2531
-					AdviceId:         0,
2532
-					ProjectId:        0,
2533
-					DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
2534
-					Cut:              fmt.Sprintf("%.2f", float64(item.Count)),
2535
-					FeedetlSn:        item.FeedetlSn,
2536
-					Price:            fmt.Sprintf("%.2f", float64(item.Price)),
2537
-					MedListCodg:      item.XtHisAddtionConfig.Code,
2538
-					Type:             3,
2539
-				}
2540
-
2541
-				customs = append(customs, cus)
2542
-			}
2543
-
2544
-		}
2545
-
2546
-		for _, item := range customs {
2547
-			var advice_id int64 = 0
2548
-			var project_id int64 = 0
2549
-			var item_id int64 = 0
2550
-
2551
-			var types int64 = 0
2552
-
2553
-			if item.Type == 1 {
2554
-				advice_id = item.AdviceId
2555
-				project_id = 0
2556
-				item_id = 0
2557
-			} else if item.Type == 2 {
2558
-				advice_id = 0
2559
-				item_id = 0
2560
-
2561
-				project_id = item.ProjectId
2562
-			} else if item.Type == 3 {
2563
-				advice_id = 0
2564
-				item_id = item.ItemId
2565
-				project_id = 0
2566
-			}
2567
-
2568
-			detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
2569
-			cut, _ := strconv.ParseFloat(item.Cut, 32)
2570
-			pric, _ := strconv.ParseFloat(item.Price, 32)
2571
-
2572
-			info := &models.HisOrderInfo{
2573
-				OrderNumber:      order.Number,
2574
-				UploadDate:       time.Now().Unix(),
2575
-				AdviceId:         advice_id,
2576
-				DetItemFeeSumamt: detItemFeeSumamt,
2577
-				Cnt:              cut,
2578
-				Pric:             pric,
2579
-				PatientId:        id,
2580
-				Status:           1,
2581
-				Mtime:            time.Now().Unix(),
2582
-				Ctime:            time.Now().Unix(),
2583
-				UserOrgId:        adminUser.CurrentOrgId,
2584
-				HisPatientId:     his.ID,
2585
-				OrderId:          order.ID,
2586
-				ProjectId:        project_id,
2587
-				Type:             types,
2588
-				ItemId:           item_id,
2589
-			}
2590
-			service.CreateOrderInfo(info)
2591
-		}
2592
-		//err := service.UpDateAddtionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
2593
-		err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
2594
-		err = service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime)
2595
-		err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
2596
-		if err == nil {
2597
-			c.ServeSuccessJSON(map[string]interface{}{
2598
-				"msg": "结算成功",
2599
-			})
2600
-		} else {
2601
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
2602
-			return
2603
-		}
2604 2406
 	}
2605 2407
 }
2606 2408
 
@@ -3339,23 +3141,25 @@ func (c *HisApiController) GetPreUploadInfo() {
3339 3141
 func (c *HisApiController) Refund() {
3340 3142
 	order_id, _ := c.GetInt64("order_id")
3341 3143
 	admin_user_id, _ := c.GetInt64("admin_user_id")
3342
-	record_time := c.GetString("record_time")
3343
-	patient_id, _ := c.GetInt64("patient_id")
3344
-	timeLayout := "2006-01-02"
3345
-	loc, _ := time.LoadLocation("Local")
3144
+	//record_time := c.GetString("record_time")
3145
+	//patient_id, _ := c.GetInt64("patient_id")
3146
+	//timeLayout := "2006-01-02"
3147
+	//loc, _ := time.LoadLocation("Local")
3346 3148
 	adminUser := c.GetAdminUserInfo()
3347
-	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
3348
-	if err != nil {
3349
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3350
-		return
3351
-	}
3352
-	recordDateTime := theTime.Unix()
3149
+	//theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
3150
+	//if err != nil {
3151
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3152
+	//	return
3153
+	//}
3154
+	//recordDateTime := theTime.Unix()
3353 3155
 	//his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
3354 3156
 	var order models.HisOrder
3355 3157
 	order, _ = service.GetHisOrderByID(order_id)
3356 3158
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
3357 3159
 	if order.ID == 0 {
3358
-		order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
3160
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3161
+		return
3162
+		//order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
3359 3163
 	}
3360 3164
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3361 3165
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
@@ -3417,16 +3221,6 @@ func (c *HisApiController) Refund() {
3417 3221
 				"msg":  res.ErrMsg,
3418 3222
 			})
3419 3223
 		}
3420
-	} else {
3421
-		err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId, "", "")
3422
-		if err == nil {
3423
-			c.ServeSuccessJSON(map[string]interface{}{
3424
-				"msg": "退费成功",
3425
-			})
3426
-		} else {
3427
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3428
-			return
3429
-		}
3430 3224
 	}
3431 3225
 }
3432 3226
 
@@ -3434,7 +3228,6 @@ func (c *HisApiController) RefundNumber() {
3434 3228
 	record_time := c.GetString("record_time")
3435 3229
 	//patient_id, _ := c.GetInt64("patient_id")
3436 3230
 	admin_user_id, _ := c.GetInt64("admin_user_id")
3437
-
3438 3231
 	his_patient_id, _ := c.GetInt64("id")
3439 3232
 
3440 3233
 	timeLayout := "2006-01-02"
@@ -3449,7 +3242,7 @@ func (c *HisApiController) RefundNumber() {
3449 3242
 	recordDateTime := theTime.Unix()
3450 3243
 	//his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
3451 3244
 
3452
-	his, _ := service.GetNewHisPatientRecord(adminUser.CurrentOrgId, his_patient_id)
3245
+	his, _ := service.GetHisPatientRecord(adminUser.CurrentOrgId, his_patient_id)
3453 3246
 	//patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
3454 3247
 	//order, _ := service.GetHisOrderByID(order_id)
3455 3248
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
@@ -3491,11 +3284,7 @@ func (c *HisApiController) RefundNumber() {
3491 3284
 		}
3492 3285
 
3493 3286
 		if res2.Infcode == 0 {
3494
-			//err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
3495 3287
 			service.UpdataRegStatusTwo(his_patient_id, recordDateTime, adminUser.CurrentOrgId)
3496
-
3497
-			//err := service.UpdataRegStatus2()
3498
-
3499 3288
 			if err == nil {
3500 3289
 				c.ServeSuccessJSON(map[string]interface{}{
3501 3290
 					"msg": "退号成功",

+ 10 - 6
controllers/sz/sz_his_api_controller.go View File

@@ -1664,7 +1664,9 @@ func (c *SZHisApiController) GetRegisterInfo() {
1664 1664
 
1665 1665
 func (c *SZHisApiController) RefundNumber() {
1666 1666
 	record_time := c.GetString("record_time")
1667
-	patient_id, _ := c.GetInt64("patient_id")
1667
+	//patient_id, _ := c.GetInt64("patient_id")
1668
+	his_patient_id, _ := c.GetInt64("his_patient_id")
1669
+
1668 1670
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1669 1671
 	timeLayout := "2006-01-02"
1670 1672
 	loc, _ := time.LoadLocation("Local")
@@ -1678,7 +1680,7 @@ func (c *SZHisApiController) RefundNumber() {
1678 1680
 	recordDateTime := theTime.Unix()
1679 1681
 	fmt.Println(recordDateTime)
1680 1682
 
1681
-	his, _ := service.GetHisPatientInfo(adminUser.CurrentOrgId, patient_id, theTime.Unix())
1683
+	his, _ := service.GetNewHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, theTime.Unix())
1682 1684
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1683 1685
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1684 1686
 	//结算流程
@@ -1721,7 +1723,7 @@ func (c *SZHisApiController) RefundNumber() {
1721 1723
 			return
1722 1724
 		}
1723 1725
 		if res.Transreturncode == "00000000" {
1724
-			service.UpdataHisStatusSZ(adminUser.CurrentOrgId, his.MzNumber, his.Number, result)
1726
+			service.UpdataHisStatusSZ(adminUser.CurrentOrgId, his.MzNumber, his.Number, result, his_patient_id)
1725 1727
 			c.ServeSuccessJSON(map[string]interface{}{
1726 1728
 				"msg": "退号成功",
1727 1729
 			})
@@ -3217,7 +3219,9 @@ func (c *SZHisApiController) GetSettleInfo() {
3217 3219
 func (c *SZHisApiController) Refund() {
3218 3220
 	order_id, _ := c.GetInt64("order_id")
3219 3221
 	record_time := c.GetString("record_time")
3220
-	patient_id, _ := c.GetInt64("patient_id")
3222
+	//patient_id, _ := c.GetInt64("patient_id")
3223
+	//his_patient_id, _ := c.GetInt64("his_patient_id")
3224
+
3221 3225
 	admin_user_id, _ := c.GetInt64("admin_user_id")
3222 3226
 	timeLayout := "2006-01-02"
3223 3227
 	loc, _ := time.LoadLocation("Local")
@@ -3236,7 +3240,7 @@ func (c *SZHisApiController) Refund() {
3236 3240
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
3237 3241
 		return
3238 3242
 	}
3239
-	his, _ := service.GetHisPatientInfo(adminUser.CurrentOrgId, patient_id, theTime.Unix())
3243
+	//his, _ := service.GetNewHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, theTime.Unix())
3240 3244
 	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
3241 3245
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
3242 3246
 	//结算流程
@@ -3297,7 +3301,7 @@ func (c *SZHisApiController) Refund() {
3297 3301
 		}
3298 3302
 		if res.Transreturncode == "00000000" {
3299 3303
 			service.UpdataOrderlog(order_id, adminUser.CurrentOrgId, result)
3300
-			service.UpdataOrderStatusSZ(order_id, order.Number, adminUser.CurrentOrgId, his.MzNumber, his.Number)
3304
+			service.UpdataOrderStatusSZ(order_id, order.Number, adminUser.CurrentOrgId)
3301 3305
 			service.UpdataOrderInfoStatus(order.ID, order.Number, adminUser.CurrentOrgId)
3302 3306
 			c.ServeSuccessJSON(map[string]interface{}{
3303 3307
 				"msg": "退费成功",

+ 5 - 5
service/gdyb_service.go View File

@@ -238,7 +238,7 @@ func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, doc
238 238
 	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
239 239
 
240 240
 	// 生成输入报文
241
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
241
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
242 242
 	input := make(map[string]interface{})
243 243
 	inputData := make(map[string]interface{})
244 244
 	inputMessage["infno"] = "2201"                // 交易编码
@@ -371,7 +371,7 @@ func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
371 371
 }
372 372
 
373 373
 // 门诊就诊信息上传
374
-func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string) string {
374
+func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string) string {
375 375
 	// 生成签名
376 376
 	nonce := GetRandomString(32)
377 377
 	timestamp := time.Now().Unix()
@@ -380,7 +380,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
380 380
 	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
381 381
 
382 382
 	// 生成输入报文
383
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
383
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
384 384
 	input := make(map[string]interface{})
385 385
 	inputData := make(map[string]interface{})
386 386
 	diseinfo := make([]map[string]interface{}, 0)
@@ -459,7 +459,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, di
459 459
 }
460 460
 
461 461
 // 门诊就诊信息上传
462
-func Gdyb2203A(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string) string {
462
+func Gdyb2203A(psnNo string, mdtrtId string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string) string {
463 463
 	// 生成签名
464 464
 	nonce := GetRandomString(32)
465 465
 	timestamp := time.Now().Unix()
@@ -468,7 +468,7 @@ func Gdyb2203A(psnNo string, mdtrtId string, doctor string, department string, d
468 468
 	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
469 469
 
470 470
 	// 生成输入报文
471
-	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
471
+	inputMessage := SetInputMessage(nonce, timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
472 472
 	input := make(map[string]interface{})
473 473
 	inputData := make(map[string]interface{})
474 474
 	diseinfo := make([]map[string]interface{}, 0)

+ 1 - 0
service/his_service.go View File

@@ -726,6 +726,7 @@ func UpdataRegStatusTwo(his_patient_id int64, record_time int64, org_id int64) {
726 726
 	writeDb.Model(&models.HisPatient{}).Where("status = 1 AND record_date =? AND user_org_id = ? AND his_patient_id = ?", record_time, org_id, his_patient_id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()})
727 727
 	writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND user_org_id = ? AND his_patient_id = ?", org_id, his_patient_id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()})
728 728
 	writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1  AND user_org_id = ? AND his_patient_id = ?", org_id, his_patient_id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()})
729
+
729 730
 }
730 731
 
731 732
 func UpdataRegStatus2(id int64) error {

+ 4 - 3
service/sz_his_service.go View File

@@ -1417,7 +1417,7 @@ func GetDoseCode(dose_id int64, user_org_id int64) (error, string) {
1417 1417
 	return err, data.Code
1418 1418
 }
1419 1419
 
1420
-func UpdataOrderStatusSZ(id int64, number string, user_org_id int64, his_mz_number string, his_number string) (err error) {
1420
+func UpdataOrderStatusSZ(id int64, number string, user_org_id int64) (err error) {
1421 1421
 	err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix(), "status": 0}).Error
1422 1422
 	err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 1, "mtime": time.Now().Unix()}).Error
1423 1423
 	err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 1, "mtime": time.Now().Unix()}).Error
@@ -1426,9 +1426,10 @@ func UpdataOrderStatusSZ(id int64, number string, user_org_id int64, his_mz_numb
1426 1426
 
1427 1427
 }
1428 1428
 
1429
-func UpdataHisStatusSZ(user_org_id int64, his_mz_number string, his_number string, result string) (err error) {
1429
+func UpdataHisStatusSZ(user_org_id int64, his_mz_number string, his_number string, result string, his_patient_id int64) (err error) {
1430 1430
 	err = writeDb.Model(&models.HisPatient{}).Where("status = 1 AND user_org_id = ? AND mz_number = ? AND number = ?", user_org_id, his_mz_number, his_number).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix(), "refund_detail": result}).Error
1431
-
1431
+	writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND user_org_id = ? AND his_patient_id = ?", user_org_id, his_patient_id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()})
1432
+	writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1  AND user_org_id = ? AND his_patient_id = ?", user_org_id, his_patient_id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()})
1432 1433
 	return
1433 1434
 }
1434 1435