|
@@ -464,6 +464,7 @@ func ZHHisManagerApiRegistRouters() {
|
464
|
464
|
beego.Router("/zh/api/inhopitalcheck/get", &ZHHisApiController{}, "get:GetZHInHospitalCheck")
|
465
|
465
|
beego.Router("/zh/api/outhopitalcheck/get", &ZHHisApiController{}, "get:GetZHOutHospitalCheck")
|
466
|
466
|
beego.Router("/zh/api/uploadinfo/get", &ZHHisApiController{}, "get:GetUploadInfo")
|
|
467
|
+ beego.Router("/zh/api/presettle/get", &ZHHisApiController{}, "get:GetPreSettleInfo")
|
467
|
468
|
beego.Router("/zh/api/settle/get", &ZHHisApiController{}, "get:GetSettleInfo")
|
468
|
469
|
beego.Router("/zh/api/inthopitaluncheck/get", &ZHHisApiController{}, "get:GetZHInHospitalUnCheck")
|
469
|
470
|
beego.Router("/zh/api/outhopitaluncheck/get", &ZHHisApiController{}, "get:GetZHOutHospitalUnCheck")
|
|
@@ -952,6 +953,7 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
|
952
|
953
|
patient_id, _ := this.GetInt64("patient_id")
|
953
|
954
|
admin_user_id, _ := this.GetInt64("admin_user_id")
|
954
|
955
|
record_time := this.GetString("record_time")
|
|
956
|
+ out_time := this.GetString("out_time")
|
955
|
957
|
|
956
|
958
|
adminInfo := this.GetAdminUserInfo()
|
957
|
959
|
miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
|
|
@@ -996,7 +998,7 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
|
996
|
998
|
struct2402.PsnNo = record.PsnNo
|
997
|
999
|
struct2402.Insutype = record.InsutypeType
|
998
|
1000
|
struct2402.DscgWay = "1"
|
999
|
|
- struct2402.Endtime = timeFormatOne
|
|
1001
|
+ struct2402.Endtime = out_time
|
1000
|
1002
|
struct2402.DscgDeptName = departmentInfo.Number
|
1001
|
1003
|
struct2402.DscgDeptCodg = strconv.FormatInt(int64(departmentInfo.ID), 10)
|
1002
|
1004
|
struct2402.MdtrtId = record.Number
|
|
@@ -1289,6 +1291,157 @@ func (c *ZHHisApiController) GetSettleInfo() {
|
1289
|
1291
|
}
|
1290
|
1292
|
|
1291
|
1293
|
}
|
|
1294
|
+func (c *ZHHisApiController) GetPreSettleInfo() {
|
|
1295
|
+ order_id, _ := c.GetInt64("order_id")
|
|
1296
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
1297
|
+ in_hospital_id, _ := c.GetInt64("in_hospital_id")
|
|
1298
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
1299
|
+
|
|
1300
|
+ record, _ := service.GetInHospitalRecord(in_hospital_id)
|
|
1301
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
|
1302
|
+ roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
|
|
1303
|
+ order, _ := service.GetHisOrderByID(order_id)
|
|
1304
|
+ allTotal := fmt.Sprintf("%.4f", order.MedfeeSumamt)
|
|
1305
|
+ var rf []*ResultFive
|
|
1306
|
+ json.Unmarshal([]byte(record.Iinfo), &rf)
|
|
1307
|
+ chrg_bchno := order.Number
|
|
1308
|
+ cert_no := record.Certno
|
|
1309
|
+ if record.ID == 0 {
|
|
1310
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1311
|
+ return
|
|
1312
|
+ }
|
|
1313
|
+ if record.InHospitalStatus == 1 && record.OutHospitalStatus == 0 {
|
|
1314
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHospitalNoExistDataException)
|
|
1315
|
+ return
|
|
1316
|
+ }
|
|
1317
|
+ if record.IdCardType == 1 {
|
|
1318
|
+ } else {
|
|
1319
|
+ cert_no = record.Certno
|
|
1320
|
+ }
|
|
1321
|
+ var result string
|
|
1322
|
+ var src_resquest string
|
|
1323
|
+ result, src_resquest = service.ZHGdyb2303(record.PsnNo, record.Number, chrg_bchno, cert_no, record.InsutypeType, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "0", record.IdCardType, 0, 0, 0, 0, record.Certificates)
|
|
1324
|
+ saveLog(result, src_resquest, "2303", "住院预结算")
|
|
1325
|
+ var dat map[string]interface{}
|
|
1326
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
1327
|
+ fmt.Println(dat)
|
|
1328
|
+ } else {
|
|
1329
|
+ fmt.Println(err)
|
|
1330
|
+ }
|
|
1331
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
1332
|
+ var res ResultSeven
|
|
1333
|
+ var resSeven10265 ResultSeven10265
|
|
1334
|
+ if miConfig.Code == "H15049901371" {
|
|
1335
|
+ if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
|
|
1336
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
1337
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1338
|
+ return
|
|
1339
|
+ }
|
|
1340
|
+ Infcode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
|
|
1341
|
+ res.Infcode = Infcode
|
|
1342
|
+ res.InfRefmsgid = resSeven10265.InfRefmsgid
|
|
1343
|
+ res.RespondTime = resSeven10265.RespondTime
|
|
1344
|
+ res.ErrMsg = resSeven10265.ErrMsg
|
|
1345
|
+ res.Output = resSeven10265.Output
|
|
1346
|
+ res.WarnMsg = resSeven10265.WarnMsg
|
|
1347
|
+ res.Cainfo = resSeven10265.Cainfo
|
|
1348
|
+
|
|
1349
|
+ } else {
|
|
1350
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
1351
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
1352
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1353
|
+ return
|
|
1354
|
+ }
|
|
1355
|
+
|
|
1356
|
+ }
|
|
1357
|
+
|
|
1358
|
+ if res.Infcode != 0 {
|
|
1359
|
+ errlog := &models.HisOrderError{
|
|
1360
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
1361
|
+ Ctime: time.Now().Unix(),
|
|
1362
|
+ Mtime: time.Now().Unix(),
|
|
1363
|
+ Number: chrg_bchno,
|
|
1364
|
+ ErrMsg: res.ErrMsg,
|
|
1365
|
+ Status: 1,
|
|
1366
|
+ PatientId: patient_id,
|
|
1367
|
+ RecordTime: time.Now().Unix(),
|
|
1368
|
+ Stage: 6,
|
|
1369
|
+ }
|
|
1370
|
+ service.CreateErrMsgLog(errlog)
|
|
1371
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1372
|
+ "failed_code": -10,
|
|
1373
|
+ "msg": res.ErrMsg,
|
|
1374
|
+ })
|
|
1375
|
+ return
|
|
1376
|
+ } else {
|
|
1377
|
+ //order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
|
|
1378
|
+ order.OrderStatus = 2
|
|
1379
|
+ order.MdtrtId = res.Output.Setlinfo.MdtrtID
|
|
1380
|
+ order.SetlId = res.Output.Setlinfo.SetlID
|
|
1381
|
+ order.PsnNo = res.Output.Setlinfo.PsnNo
|
|
1382
|
+ order.PsnName = res.Output.Setlinfo.PsnName
|
|
1383
|
+ order.PsnCertType = res.Output.Setlinfo.PsnCertType
|
|
1384
|
+ order.Certno = res.Output.Setlinfo.Certno
|
|
1385
|
+ order.Gend = res.Output.Setlinfo.Gend
|
|
1386
|
+ order.Naty = res.Output.Setlinfo.Naty
|
|
1387
|
+ order.Age = res.Output.Setlinfo.Age
|
|
1388
|
+ order.Insutype = res.Output.Setlinfo.Insutype
|
|
1389
|
+ order.PsnType = res.Output.Setlinfo.PsnType
|
|
1390
|
+ order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
|
|
1391
|
+ order.SetlTime = res.Output.Setlinfo.SetlTime
|
|
1392
|
+ order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
|
|
1393
|
+ if res.Output.Setlinfo.MedType == "140104" {
|
|
1394
|
+
|
|
1395
|
+ order.MedType = "14"
|
|
1396
|
+
|
|
1397
|
+ } else {
|
|
1398
|
+
|
|
1399
|
+ order.MedType = res.Output.Setlinfo.MedType
|
|
1400
|
+
|
|
1401
|
+ }
|
|
1402
|
+ order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
|
|
1403
|
+ order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
|
|
1404
|
+ order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
|
|
1405
|
+ order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
|
|
1406
|
+ order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
|
|
1407
|
+ order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
|
|
1408
|
+ order.HifpPay = res.Output.Setlinfo.HifpPay
|
|
1409
|
+ order.CvlservPay = res.Output.Setlinfo.CvlservPay
|
|
1410
|
+ order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
|
|
1411
|
+ order.HifesPay = res.Output.Setlinfo.HifesPay
|
|
1412
|
+ order.HifobPay = res.Output.Setlinfo.HifobPay
|
|
1413
|
+ order.MafPay = res.Output.Setlinfo.MafPay
|
|
1414
|
+ order.OthPay = res.Output.Setlinfo.OthPay
|
|
1415
|
+ order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
|
|
1416
|
+ order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
|
|
1417
|
+ order.AcctPay = res.Output.Setlinfo.AcctPay
|
|
1418
|
+ order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
|
|
1419
|
+ order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
|
|
1420
|
+ order.Balc = res.Output.Setlinfo.Balc
|
|
1421
|
+ order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
|
|
1422
|
+ order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
|
|
1423
|
+ order.ClrOptins = res.Output.Setlinfo.ClrOptins
|
|
1424
|
+ order.ClrWay = res.Output.Setlinfo.ClrWay
|
|
1425
|
+ order.Creator = order.Creator
|
|
1426
|
+ order.Modify = roles.AdminUserId
|
|
1427
|
+ order.RequestLog = src_resquest
|
|
1428
|
+ setlDetail, _ := json.Marshal(res.Output.Setldetail)
|
|
1429
|
+ detailStr := string(setlDetail)
|
|
1430
|
+ order.SetlDetail = detailStr
|
|
1431
|
+ err := service.UpdataOrderStatusTwo(chrg_bchno, c.GetAdminUserInfo().CurrentOrgId)
|
|
1432
|
+ err = service.UpDateOrder(order)
|
|
1433
|
+ if err == nil {
|
|
1434
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1435
|
+ "msg": "结算成功",
|
|
1436
|
+ })
|
|
1437
|
+ } else {
|
|
1438
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
|
|
1439
|
+ return
|
|
1440
|
+ }
|
|
1441
|
+ }
|
|
1442
|
+
|
|
1443
|
+}
|
|
1444
|
+
|
1292
|
1445
|
func (c *ZHHisApiController) GetUploadInfo() {
|
1293
|
1446
|
id, _ := c.GetInt64("id")
|
1294
|
1447
|
record_time := c.GetString("record_time")
|
|
@@ -1421,7 +1574,7 @@ func (c *ZHHisApiController) GetUploadInfo() {
|
1421
|
1574
|
for _, item := range prescriptions {
|
1422
|
1575
|
if item.Type == 1 { //药品
|
1423
|
1576
|
for _, subItem := range item.HisDoctorAdviceInfo {
|
1424
|
|
- if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
|
|
1577
|
+ if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 && subItem.BaseDrugLib.IsUser != 1 {
|
1425
|
1578
|
//var randNum int
|
1426
|
1579
|
//randNum = rand.Intn(10000) + 1000
|
1427
|
1580
|
cus := &models.NewCustom{
|