csx 4 years ago
parent
commit
4fef768b4f
4 changed files with 188 additions and 108 deletions
  1. 7 1
      controllers/gdyb_controller.go
  2. 149 106
      controllers/his_api_controller.go
  3. 21 0
      models/his_models.go
  4. 11 1
      service/gdyb_service.go

+ 7 - 1
controllers/gdyb_controller.go View File

313
 	med_type := c.GetString("med_type")
313
 	med_type := c.GetString("med_type")
314
 	id_card_type, _ := c.GetInt64("id_card_type")
314
 	id_card_type, _ := c.GetInt64("id_card_type")
315
 
315
 
316
-	result := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type)
316
+	fulamt_ownpay_amt, _ := c.GetFloat("fulamt_ownpay_amt")
317
+	overlmt_selfpay, _ := c.GetFloat("overlmt_selfpay")
318
+	preselfpay_amt, _ := c.GetFloat("preselfpay_amt")
319
+	inscp_scp_amt, _ := c.GetFloat("inscp_scp_amt")
320
+
321
+	result := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, fulamt_ownpay_amt, overlmt_selfpay, preselfpay_amt, inscp_scp_amt)
317
 	var dat map[string]interface{}
322
 	var dat map[string]interface{}
318
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
323
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
319
 		fmt.Println(dat)
324
 		fmt.Println(dat)
407
 	} else {
412
 	} else {
408
 		fmt.Println(err)
413
 		fmt.Println(err)
409
 	}
414
 	}
415
+
410
 	c.ServeSuccessJSON(map[string]interface{}{
416
 	c.ServeSuccessJSON(map[string]interface{}{
411
 		"pre": dat,
417
 		"pre": dat,
412
 	})
418
 	})

+ 149 - 106
controllers/his_api_controller.go View File

1070
 	}
1070
 	}
1071
 }
1071
 }
1072
 
1072
 
1073
-//上传明细----结算
1073
+//上传明细----结算----确认订单
1074
 func (c *HisApiController) GetUploadInfo() {
1074
 func (c *HisApiController) GetUploadInfo() {
1075
 	id, _ := c.GetInt64("id")
1075
 	id, _ := c.GetInt64("id")
1076
 	record_time := c.GetString("record_time")
1076
 	record_time := c.GetString("record_time")
1077
-	pay_way, _ := c.GetInt64("pay_way")
1078
-	pay_price, _ := c.GetFloat("pay_price")
1079
-	pay_card_no := c.GetString("pay_card_no")
1080
-	discount_price, _ := c.GetFloat("discount_price")
1081
-	preferential_price, _ := c.GetFloat("preferential_price")
1082
-	reality_price, _ := c.GetFloat("reality_price")
1083
-	found_price, _ := c.GetFloat("found_price")
1084
-	medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
1085
-	private_price, _ := c.GetFloat("private_price")
1077
+	//pay_way, _ := c.GetInt64("pay_way")
1078
+	//pay_price, _ := c.GetFloat("pay_price")
1079
+	//pay_card_no := c.GetString("pay_card_no")
1080
+	//discount_price, _ := c.GetFloat("discount_price")
1081
+	//preferential_price, _ := c.GetFloat("preferential_price")
1082
+	//reality_price, _ := c.GetFloat("reality_price")
1083
+	//found_price, _ := c.GetFloat("found_price")
1084
+	//medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
1085
+	//private_price, _ := c.GetFloat("private_price")
1086
 	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
1086
 	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
1087
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1087
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1088
 
1088
 
1190
 
1190
 
1191
 		if res.Infcode == 0 {
1191
 		if res.Infcode == 0 {
1192
 			order := &models.HisOrder{
1192
 			order := &models.HisOrder{
1193
-				UserOrgId:             adminUser.CurrentOrgId,
1194
-				HisPatientId:          his.ID,
1195
-				PatientId:             his.PatientId,
1196
-				SettleAccountsDate:    recordDateTime,
1197
-				Ctime:                 time.Now().Unix(),
1198
-				Mtime:                 time.Now().Unix(),
1199
-				Status:                1,
1200
-				Number:                chrg_bchno,
1201
-				Infcode:               res.Infcode,
1202
-				WarnMsg:               res.WarnMsg,
1203
-				Cainfo:                res.Cainfo,
1204
-				ErrMsg:                res.ErrMsg,
1205
-				RespondTime:           res.RefmsgTime,
1206
-				InfRefmsgid:           res.InfRefmsgid,
1207
-				OrderStatus:           1,
1208
-				PayWay:                pay_way,
1209
-				PayPrice:              pay_price,
1210
-				PayCardNo:             pay_card_no,
1211
-				DiscountPrice:         discount_price,
1212
-				PreferentialPrice:     preferential_price,
1213
-				RealityPrice:          reality_price,
1214
-				FoundPrice:            found_price,
1215
-				MedicalInsurancePrice: medical_insurance_price,
1216
-				PrivatePrice:          private_price,
1217
-				IsMedicineInsurance:   1,
1218
-				SettleType:            settle_accounts_type,
1219
-				SettleStartTime:       start_time,
1220
-				SettleEndTime:         end_time,
1221
-				Creator:               roles.ID,
1222
-				Modify:                roles.ID,
1193
+				UserOrgId:           adminUser.CurrentOrgId,
1194
+				HisPatientId:        his.ID,
1195
+				PatientId:           his.PatientId,
1196
+				SettleAccountsDate:  recordDateTime,
1197
+				Ctime:               time.Now().Unix(),
1198
+				Mtime:               time.Now().Unix(),
1199
+				Status:              1,
1200
+				Number:              chrg_bchno,
1201
+				Infcode:             res.Infcode,
1202
+				WarnMsg:             res.WarnMsg,
1203
+				Cainfo:              res.Cainfo,
1204
+				ErrMsg:              res.ErrMsg,
1205
+				RespondTime:         res.RefmsgTime,
1206
+				InfRefmsgid:         res.InfRefmsgid,
1207
+				OrderStatus:         1,
1208
+				IsMedicineInsurance: 1,
1209
+				SettleType:          settle_accounts_type,
1210
+				SettleStartTime:     start_time,
1211
+				SettleEndTime:       end_time,
1212
+				Creator:             roles.ID,
1213
+				Modify:              roles.ID,
1223
 			}
1214
 			}
1224
 			err = service.CreateOrder(order)
1215
 			err = service.CreateOrder(order)
1225
 			if err != nil {
1216
 			if err != nil {
1363
 						Status:     1,
1354
 						Status:     1,
1364
 						PatientId:  id,
1355
 						PatientId:  id,
1365
 						RecordTime: recordDateTime,
1356
 						RecordTime: recordDateTime,
1366
-						Stage:      6,
1357
+						Stage:      7,
1367
 					}
1358
 					}
1368
 					service.CreateErrMsgLog(errlog)
1359
 					service.CreateErrMsgLog(errlog)
1369
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
1360
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
1414
 					setlDetail, _ := json.Marshal(res.Output.Setldetail)
1405
 					setlDetail, _ := json.Marshal(res.Output.Setldetail)
1415
 					detailStr := string(setlDetail)
1406
 					detailStr := string(setlDetail)
1416
 					order.SetlDetail = detailStr
1407
 					order.SetlDetail = detailStr
1417
-					err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
1408
+
1409
+					//err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
1418
 					err = service.UpDateOrder(order)
1410
 					err = service.UpDateOrder(order)
1419
 
1411
 
1420
 					//订单确认
1412
 					//订单确认
1449
 								Status:     1,
1441
 								Status:     1,
1450
 								PatientId:  id,
1442
 								PatientId:  id,
1451
 								RecordTime: recordDateTime,
1443
 								RecordTime: recordDateTime,
1452
-								Stage:      7,
1444
+								Stage:      8,
1453
 							}
1445
 							}
1454
 							service.CreateErrMsgLog(errlog)
1446
 							service.CreateErrMsgLog(errlog)
1455
 							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
1447
 							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
1498
 
1490
 
1499
 func (c *HisApiController) GetSettleInfo() {
1491
 func (c *HisApiController) GetSettleInfo() {
1500
 	id, _ := c.GetInt64("id")
1492
 	id, _ := c.GetInt64("id")
1493
+	order_id, _ := c.GetInt64("order_id")
1494
+
1501
 	record_time := c.GetString("record_time")
1495
 	record_time := c.GetString("record_time")
1502
-	//pay_way, _ := c.GetInt64("pay_way")
1503
-	//pay_price, _ := c.GetFloat("pay_price")
1504
-	//pay_card_no := c.GetString("pay_card_no")
1505
-	//discount_price, _ := c.GetFloat("discount_price")
1506
-	//preferential_price, _ := c.GetFloat("preferential_price")
1507
-	//reality_price, _ := c.GetFloat("reality_price")
1508
-	//found_price, _ := c.GetFloat("found_price")
1509
-	//medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
1510
-	//private_price, _ := c.GetFloat("private_price")
1496
+	pay_way, _ := c.GetInt64("pay_way")
1497
+	pay_price, _ := c.GetFloat("pay_price")
1498
+	pay_card_no := c.GetString("pay_card_no")
1499
+	discount_price, _ := c.GetFloat("discount_price")
1500
+	preferential_price, _ := c.GetFloat("preferential_price")
1501
+	reality_price, _ := c.GetFloat("reality_price")
1502
+	found_price, _ := c.GetFloat("found_price")
1503
+	medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
1504
+	private_price, _ := c.GetFloat("private_price")
1511
 	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
1505
 	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
1512
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1506
 	admin_user_id, _ := c.GetInt64("admin_user_id")
1513
 
1507
 
1523
 
1517
 
1524
 	var prescriptions []*models.HisPrescription
1518
 	var prescriptions []*models.HisPrescription
1525
 
1519
 
1526
-	//var start_time int64
1527
-	//var end_time int64
1528
-
1529
 	data := make(map[string]interface{})
1520
 	data := make(map[string]interface{})
1530
 	if settle_accounts_type == 1 { //日结
1521
 	if settle_accounts_type == 1 { //日结
1531
 		prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
1522
 		prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
1542
 			return
1533
 			return
1543
 		}
1534
 		}
1544
 		recordStartTime := theStartTime.Unix()
1535
 		recordStartTime := theStartTime.Unix()
1545
-		//start_time = recordStartTime
1546
 		theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
1536
 		theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
1547
 		if err != nil {
1537
 		if err != nil {
1548
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1538
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1549
 			return
1539
 			return
1550
 		}
1540
 		}
1551
 		recordEndTime := theEndTime.Unix()
1541
 		recordEndTime := theEndTime.Unix()
1552
-		//end_time = recordEndTime
1553
 		prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
1542
 		prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
1554
 		data["pre"] = prescriptions
1543
 		data["pre"] = prescriptions
1555
 
1544
 
1567
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
1556
 	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
1568
 	strconv.FormatInt(his.PatientId, 10)
1557
 	strconv.FormatInt(his.PatientId, 10)
1569
 
1558
 
1559
+	order_src, _ := service.GetHisOrderByID(order_id)
1560
+
1570
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1561
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1571
 	if config.IsOpen == 1 { //对接了医保,走医保流程
1562
 	if config.IsOpen == 1 { //对接了医保,走医保流程
1572
 
1563
 
1608
 		api := "http://127.0.0.1:9532/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
1599
 		api := "http://127.0.0.1:9532/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
1609
 			insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
1600
 			insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
1610
 			"&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" +
1601
 			"&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" +
1611
-			miConfig.SecretKey + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&id_card_type=" + strconv.FormatInt(int64(his.IdCardType), 10)
1602
+			miConfig.SecretKey + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&id_card_type=" + strconv.FormatInt(int64(his.IdCardType), 10) + "&fulamt_ownpay_amt=" + strconv.FormatFloat(order_src.FulamtOwnpayAmt, 'E', -1, 64) + "&overlmt_selfpay=" + strconv.FormatFloat(order_src.OverlmtSelfPay, 'E', -1, 64) + "&preselfpay_amt=" + strconv.FormatFloat(order_src.PreselfpayAmt, 'E', -1, 64) + "&inscp_scp_amt=" + strconv.FormatFloat(order_src.InscpScpAmt, 'E', -1, 64)
1612
 		resp, requestErr := http.Get(api)
1603
 		resp, requestErr := http.Get(api)
1613
 		if requestErr != nil {
1604
 		if requestErr != nil {
1614
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1605
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1652
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
1643
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
1653
 			return
1644
 			return
1654
 		} else {
1645
 		} else {
1655
-			order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
1656
-			order.OrderStatus = 2
1657
-			order.MdtrtId = res.Output.Setlinfo.MdtrtID
1658
-			order.SetlId = res.Output.Setlinfo.SetlID
1659
-			order.PsnNo = res.Output.Setlinfo.PsnNo
1660
-			order.PsnName = res.Output.Setlinfo.PsnName
1661
-			order.PsnCertType = res.Output.Setlinfo.PsnCertType
1662
-			order.Certno = res.Output.Setlinfo.Certno
1663
-			order.Gend = res.Output.Setlinfo.Gend
1664
-			order.Naty = res.Output.Setlinfo.Naty
1665
-			order.Age = res.Output.Setlinfo.Age
1666
-			order.Insutype = res.Output.Setlinfo.Insutype
1667
-			order.PsnType = res.Output.Setlinfo.PsnType
1668
-			order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
1669
-			order.SetlTime = res.Output.Setlinfo.SetlTime
1670
-			order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
1671
-			order.MedType = res.Output.Setlinfo.MedType
1672
-			order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
1673
-			order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
1674
-			order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
1675
-			order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
1676
-			order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
1677
-			order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
1678
-			order.HifpPay = res.Output.Setlinfo.HifpPay
1679
-			order.CvlservPay = res.Output.Setlinfo.CvlservPay
1680
-			order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
1681
-			order.HifesPay = res.Output.Setlinfo.HifesPay
1682
-			order.HifobPay = res.Output.Setlinfo.HifobPay
1683
-			order.MafPay = res.Output.Setlinfo.MafPay
1684
-			order.OthPay = res.Output.Setlinfo.OthPay
1685
-			order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
1686
-			order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
1687
-			order.AcctPay = res.Output.Setlinfo.AcctPay
1688
-			order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
1689
-			order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
1690
-			order.Balc = res.Output.Setlinfo.Balc
1691
-			order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
1692
-			order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
1693
-			order.ClrOptins = res.Output.Setlinfo.ClrOptins
1694
-			order.ClrWay = res.Output.Setlinfo.ClrWay
1695
-			order.Creator = order.Creator
1696
-			order.Modify = roles.ID
1646
+			order_src.OrderStatus = 2
1647
+			order_src.PayWay = pay_way
1648
+			order_src.PayPrice = pay_price
1649
+			order_src.PayCardNo = pay_card_no
1650
+			order_src.DiscountPrice = discount_price
1651
+			order_src.PreferentialPrice = preferential_price
1652
+			order_src.RealityPrice = reality_price
1653
+			order_src.FoundPrice = found_price
1654
+			order_src.MedicalInsurancePrice = medical_insurance_price
1655
+			order_src.PrivatePrice = private_price
1656
+			order_src.MdtrtId = res.Output.Setlinfo.MdtrtID
1657
+			order_src.SetlId = res.Output.Setlinfo.SetlID
1658
+			order_src.PsnNo = res.Output.Setlinfo.PsnNo
1659
+			order_src.PsnName = res.Output.Setlinfo.PsnName
1660
+			order_src.PsnCertType = res.Output.Setlinfo.PsnCertType
1661
+			order_src.Certno = res.Output.Setlinfo.Certno
1662
+			order_src.Gend = res.Output.Setlinfo.Gend
1663
+			order_src.Naty = res.Output.Setlinfo.Naty
1664
+			order_src.Age = res.Output.Setlinfo.Age
1665
+			order_src.Insutype = res.Output.Setlinfo.Insutype
1666
+			order_src.PsnType = res.Output.Setlinfo.PsnType
1667
+			order_src.CvlservFlag = res.Output.Setlinfo.CvlservFlag
1668
+			order_src.SetlTime = res.Output.Setlinfo.SetlTime
1669
+			order_src.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
1670
+			order_src.MedType = res.Output.Setlinfo.MedType
1671
+			order_src.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
1672
+			order_src.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
1673
+			order_src.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
1674
+			order_src.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
1675
+			order_src.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
1676
+			order_src.ActPayDedc = res.Output.Setlinfo.ActPayDedc
1677
+			order_src.HifpPay = res.Output.Setlinfo.HifpPay
1678
+			order_src.CvlservPay = res.Output.Setlinfo.CvlservPay
1679
+			order_src.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
1680
+			order_src.HifesPay = res.Output.Setlinfo.HifesPay
1681
+			order_src.HifobPay = res.Output.Setlinfo.HifobPay
1682
+			order_src.MafPay = res.Output.Setlinfo.MafPay
1683
+			order_src.OthPay = res.Output.Setlinfo.OthPay
1684
+			order_src.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
1685
+			order_src.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
1686
+			order_src.AcctPay = res.Output.Setlinfo.AcctPay
1687
+			order_src.PsnCashPay = res.Output.Setlinfo.PsnCashPay
1688
+			order_src.HospPartAmt = res.Output.Setlinfo.HospPartAmt
1689
+			order_src.Balc = res.Output.Setlinfo.Balc
1690
+			order_src.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
1691
+			order_src.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
1692
+			order_src.ClrOptins = res.Output.Setlinfo.ClrOptins
1693
+			order_src.ClrWay = res.Output.Setlinfo.ClrWay
1694
+			order_src.Creator = order_src.Creator
1695
+			order_src.Modify = roles.ID
1697
 			setlDetail, _ := json.Marshal(res.Output.Setldetail)
1696
 			setlDetail, _ := json.Marshal(res.Output.Setldetail)
1698
 			detailStr := string(setlDetail)
1697
 			detailStr := string(setlDetail)
1699
-			order.SetlDetail = detailStr
1698
+			order_src.SetlDetail = detailStr
1700
 			err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
1699
 			err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
1701
-			err = service.UpDateOrder(order)
1700
+			err = service.UpDateOrder(order_src)
1702
 
1701
 
1703
 			if err == nil {
1702
 			if err == nil {
1704
 				c.ServeSuccessJSON(map[string]interface{}{
1703
 				c.ServeSuccessJSON(map[string]interface{}{
2059
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2058
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2060
 			return
2059
 			return
2061
 		}
2060
 		}
2061
+
2062
 		if res.Infcode == 0 {
2062
 		if res.Infcode == 0 {
2063
-			c.ServeSuccessJSON(map[string]interface{}{
2064
-				"stmt_rslt":      res.Output.Stmtinfo.StmtRslt,
2065
-				"stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
2066
-			})
2063
+			micc := &models.MedicalInsuranceCostCompare{
2064
+				StartTime: startime.Unix(),
2065
+				EndTime:   endtime.Unix(),
2066
+				Insutype:  insutype,
2067
+				CheckType: 1,
2068
+				Num:       fixmedins_setl_cnt,
2069
+				Mtime:     time.Now().Unix(),
2070
+				Status:    1,
2071
+				UserOrgId: adminUser.CurrentOrgId,
2072
+				CostTotal: medfee_sumamt,
2073
+				FuncTotal: fund_pay_sumamt,
2074
+				PsnPay:    acct_pay,
2075
+				Creator:   admin_user_id,
2076
+				Ctime:     time.Now().Unix(),
2077
+			}
2078
+
2079
+			err := service.CreateMedicalInsuranceCostCompareRecord(micc)
2080
+
2081
+			if err == nil {
2082
+				c.ServeSuccessJSON(map[string]interface{}{
2083
+					"stmt_rslt":      res.Output.Stmtinfo.StmtRslt,
2084
+					"stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
2085
+				})
2086
+
2087
+			} else {
2088
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2089
+			}
2090
+
2067
 		} else {
2091
 		} else {
2068
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2092
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2069
 		}
2093
 		}
2214
 
2238
 
2215
 			if res.Infcode == 0 {
2239
 			if res.Infcode == 0 {
2216
 				service.Gdyb9102(baseParams, zip_name, res.Output.FileQuryNo)
2240
 				service.Gdyb9102(baseParams, zip_name, res.Output.FileQuryNo)
2241
+
2242
+				micc := &models.MedicalInsuranceCostCompare{
2243
+					StartTime: startime.Unix(),
2244
+					EndTime:   endtime.Unix(),
2245
+					Insutype:  "0",
2246
+					CheckType: 2,
2247
+					Num:       fixmedins_setl_cnt,
2248
+					Mtime:     time.Now().Unix(),
2249
+					Status:    1,
2250
+					UserOrgId: adminUser.CurrentOrgId,
2251
+					CostTotal: medfee_sumamt,
2252
+					FuncTotal: fund_pay_sumamt,
2253
+					PsnPay:    psn_cash_pay,
2254
+					Creator:   admin_user_id,
2255
+					Ctime:     time.Now().Unix(),
2256
+				}
2257
+
2258
+				service.CreateMedicalInsuranceCostCompareRecord(micc)
2259
+
2217
 				c.ServeSuccessJSON(map[string]interface{}{
2260
 				c.ServeSuccessJSON(map[string]interface{}{
2218
 					"msg": "明细对账成功",
2261
 					"msg": "明细对账成功",
2219
 				})
2262
 				})

+ 21 - 0
models/his_models.go View File

965
 	Price            string
965
 	Price            string
966
 	MedListCodg      string
966
 	MedListCodg      string
967
 }
967
 }
968
+
969
+type MedicalInsuranceCostCompare struct {
970
+	ID        int64   `gorm:"column:id" json:"id" form:"id"`
971
+	StartTime int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
972
+	EndTime   int64   `gorm:"column:end_time" json:"end_time" form:"end_time"`
973
+	Insutype  string  `gorm:"column:insutype" json:"insutype" form:"insutype"`
974
+	CheckType int64   `gorm:"column:check_type" json:"check_type" form:"check_type"`
975
+	Num       int64   `gorm:"column:num" json:"num" form:"num"`
976
+	Mtime     int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
977
+	Status    int64   `gorm:"column:status" json:"status" form:"status"`
978
+	UserOrgId int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
979
+	CostTotal float64 `gorm:"column:cost_total" json:"cost_total" form:"cost_total"`
980
+	FuncTotal float64 `gorm:"column:func_total" json:"func_total" form:"func_total"`
981
+	PsnPay    float64 `gorm:"column:psn_pay" json:"psn_pay" form:"psn_pay"`
982
+	Creator   int64   `gorm:"column:creator" json:"creator" form:"creator"`
983
+	Ctime     int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
984
+}
985
+
986
+func (MedicalInsuranceCostCompare) TableName() string {
987
+	return "medical_insurance_cost_compare"
988
+}

+ 11 - 1
service/gdyb_service.go View File

709
 }
709
 }
710
 
710
 
711
 //  门诊结算
711
 //  门诊结算
712
-func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64) string {
712
+func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64) string {
713
 	// 生成签名
713
 	// 生成签名
714
 	nonce := GetRandomString(32)
714
 	nonce := GetRandomString(32)
715
 	timestamp := time.Now().Unix()
715
 	timestamp := time.Now().Unix()
740
 	inputData["insutype"] = insutype    // 险种类型
740
 	inputData["insutype"] = insutype    // 险种类型
741
 	inputData["invono"] = ""            // 发票号
741
 	inputData["invono"] = ""            // 发票号
742
 
742
 
743
+	inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
744
+	inputData["overlmt_selfpay"] = overlmt_selfpay     //
745
+	inputData["preselfpay_amt"] = preselfpay_amt       //
746
+	inputData["inscp_scp_amt"] = inscp_scp_amt         //
747
+
743
 	input["data"] = inputData
748
 	input["data"] = inputData
744
 	inputMessage["input"] = input //交易输入
749
 	inputMessage["input"] = input //交易输入
745
 
750
 
1917
 	req.Header.Set("Content-Type", writer.FormDataContentType())
1922
 	req.Header.Set("Content-Type", writer.FormDataContentType())
1918
 	return req, err
1923
 	return req, err
1919
 }
1924
 }
1925
+
1926
+func CreateMedicalInsuranceCostCompareRecord(record *models.MedicalInsuranceCostCompare) error {
1927
+	err := writeDb.Save(&record).Error
1928
+	return err
1929
+}