|
@@ -936,7 +936,7 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
|
936
|
936
|
id, _ := this.GetInt64("id")
|
937
|
937
|
patient_id, _ := this.GetInt64("patient_id")
|
938
|
938
|
admin_user_id, _ := this.GetInt64("admin_user_id")
|
939
|
|
- //record_time := this.GetString("record_time")
|
|
939
|
+ record_time := this.GetString("record_time")
|
940
|
940
|
|
941
|
941
|
adminInfo := this.GetAdminUserInfo()
|
942
|
942
|
miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
|
|
@@ -948,14 +948,14 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
|
948
|
948
|
return
|
949
|
949
|
}
|
950
|
950
|
|
951
|
|
- //timeLayout := "2006-01-02"
|
952
|
|
- //loc, _ := time.LoadLocation("Local")
|
953
|
|
- //theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
954
|
|
- //if err != nil {
|
955
|
|
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
956
|
|
- // return
|
957
|
|
- //}
|
958
|
|
- //recordDateTime := theTime.Unix()
|
|
951
|
+ timeLayout := "2006-01-02"
|
|
952
|
+ loc, _ := time.LoadLocation("Local")
|
|
953
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
954
|
+ if err != nil {
|
|
955
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
956
|
+ return
|
|
957
|
+ }
|
|
958
|
+ recordDateTime := theTime.Unix()
|
959
|
959
|
|
960
|
960
|
var patient service.Patients
|
961
|
961
|
if patient_id == 0 {
|
|
@@ -1052,6 +1052,45 @@ func (this *ZHHisApiController) GetZHOutHospitalCheck() {
|
1052
|
1052
|
record.OutHosptialTime = struct2402.Endtime
|
1053
|
1053
|
record.OutWay = 1
|
1054
|
1054
|
service.CreateHospitalRecord(&record)
|
|
1055
|
+
|
|
1056
|
+ orders, _ := service.GetHisOrderInfoByNumberThree(record.Number)
|
|
1057
|
+
|
|
1058
|
+ //orders, _ := service.GetHisOrderInfoByNumberThree(record.Number)
|
|
1059
|
+
|
|
1060
|
+ var total float64
|
|
1061
|
+ for _, item := range orders {
|
|
1062
|
+ total = total + item.DetItemFeeSumamt
|
|
1063
|
+ }
|
|
1064
|
+
|
|
1065
|
+ //allTotal := fmt.Sprintf("%.4f", total)
|
|
1066
|
+
|
|
1067
|
+ order := &models.HisOrder{
|
|
1068
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
1069
|
+ HisPatientId: record.ID,
|
|
1070
|
+ PatientId: record.PatientId,
|
|
1071
|
+ SettleAccountsDate: recordDateTime,
|
|
1072
|
+ Ctime: time.Now().Unix(),
|
|
1073
|
+ Mtime: time.Now().Unix(),
|
|
1074
|
+ Status: 1,
|
|
1075
|
+ Number: record.Number,
|
|
1076
|
+ Infcode: 0,
|
|
1077
|
+ WarnMsg: "",
|
|
1078
|
+ Cainfo: "",
|
|
1079
|
+ ErrMsg: "",
|
|
1080
|
+ RespondTime: "",
|
|
1081
|
+ InfRefmsgid: "",
|
|
1082
|
+ OrderStatus: 1,
|
|
1083
|
+ MdtrtId: record.Number,
|
|
1084
|
+ IsMedicineInsurance: 1,
|
|
1085
|
+ PType: 1,
|
|
1086
|
+ MedfeeSumamt: total,
|
|
1087
|
+ }
|
|
1088
|
+ err = service.CreateOrder(order)
|
|
1089
|
+ if err != nil {
|
|
1090
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
|
|
1091
|
+ return
|
|
1092
|
+ }
|
|
1093
|
+
|
1055
|
1094
|
this.ServeSuccessJSON(map[string]interface{}{
|
1056
|
1095
|
"msg": "出院成功",
|
1057
|
1096
|
})
|
|
@@ -1081,89 +1120,40 @@ func (c *ZHHisApiController) GetSettleInfo() {
|
1081
|
1120
|
fapiao_code := c.GetString("fapiao_code")
|
1082
|
1121
|
fapiao_number := c.GetString("fapiao_number")
|
1083
|
1122
|
|
1084
|
|
- order, _ := service.GetHisOrderByID(order_id)
|
1085
|
1123
|
record, _ := service.GetInHospitalRecord(in_hospital_id)
|
1086
|
|
-
|
1087
|
1124
|
miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
|
1088
|
|
-
|
1089
|
|
- allTotal := fmt.Sprintf("%.4f", order.MedfeeSumamt)
|
1090
|
1125
|
roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
|
1091
|
|
-
|
|
1126
|
+ order, _ := service.GetHisOrderByID(order_id)
|
|
1127
|
+ allTotal := fmt.Sprintf("%.4f", order.MedfeeSumamt)
|
1092
|
1128
|
var rf []*ResultFive
|
1093
|
1129
|
json.Unmarshal([]byte(record.Iinfo), &rf)
|
1094
|
1130
|
chrg_bchno := order.Number
|
1095
|
1131
|
cert_no := record.Certno
|
1096
|
|
-
|
1097
|
|
- var insutypes []string
|
1098
|
|
-
|
1099
|
|
- var insutype string
|
1100
|
|
- var is390 int = 0
|
1101
|
|
- var is310 int = 0
|
1102
|
|
-
|
1103
|
1132
|
if record.ID == 0 {
|
1104
|
1133
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
1105
|
1134
|
return
|
1106
|
|
-
|
1107
|
1135
|
}
|
1108
|
|
-
|
1109
|
1136
|
if record.InHospitalStatus == 1 && record.OutHospitalStatus == 0 {
|
1110
|
1137
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHospitalNoExistDataException)
|
1111
|
1138
|
return
|
1112
|
1139
|
}
|
1113
|
|
-
|
1114
|
|
- for _, item := range rf {
|
1115
|
|
- if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
|
1116
|
|
- insutypes = append(insutypes, item.Insutype)
|
1117
|
|
- }
|
1118
|
|
- }
|
1119
|
|
-
|
1120
|
|
- if len(insutypes) == 1 {
|
1121
|
|
- insutype = insutypes[0]
|
1122
|
|
- } else {
|
1123
|
|
- for _, i := range insutypes {
|
1124
|
|
- if i == "390" {
|
1125
|
|
- is390 = 1
|
1126
|
|
- }
|
1127
|
|
-
|
1128
|
|
- if i == "310" {
|
1129
|
|
- is310 = 1
|
1130
|
|
- }
|
1131
|
|
- }
|
1132
|
|
- }
|
1133
|
|
- if is390 == 1 {
|
1134
|
|
- insutype = "390"
|
1135
|
|
- }
|
1136
|
|
-
|
1137
|
|
- if is310 == 1 {
|
1138
|
|
- insutype = "310"
|
1139
|
|
- }
|
1140
|
|
-
|
1141
|
|
- if len(insutypes) == 0 {
|
1142
|
|
- insutype = "310"
|
1143
|
|
- }
|
1144
|
|
-
|
1145
|
1140
|
if record.IdCardType == 1 {
|
1146
|
|
-
|
1147
|
1141
|
} else {
|
1148
|
|
-
|
1149
|
1142
|
cert_no = record.Certno
|
1150
|
|
-
|
1151
|
1143
|
}
|
1152
|
|
-
|
1153
|
|
- result, src_resquest := service.ZHGdyb2304(record.PsnNo, record.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "0", record.IdCardType, 0, 0, 0, 0, record.Certificates)
|
|
1144
|
+ var result string
|
|
1145
|
+ var src_resquest string
|
|
1146
|
+ result, src_resquest = service.ZHGdyb2304(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)
|
1154
|
1147
|
var dat map[string]interface{}
|
1155
|
1148
|
if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
1156
|
1149
|
fmt.Println(dat)
|
1157
|
1150
|
} else {
|
1158
|
1151
|
fmt.Println(err)
|
1159
|
1152
|
}
|
1160
|
|
-
|
1161
|
1153
|
userJSONBytes, _ := json.Marshal(dat)
|
1162
|
|
-
|
1163
|
1154
|
var res ResultSeven
|
1164
|
1155
|
var resSeven10265 ResultSeven10265
|
1165
|
1156
|
if miConfig.Code == "H15049901371" {
|
1166
|
|
-
|
1167
|
1157
|
if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
|
1168
|
1158
|
utils.ErrorLog("解析失败:%v", err)
|
1169
|
1159
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
@@ -1295,9 +1285,6 @@ func (c *ZHHisApiController) GetUploadInfo() {
|
1295
|
1285
|
|
1296
|
1286
|
var prescriptions []*models.HisPrescription
|
1297
|
1287
|
|
1298
|
|
- var start_time int64
|
1299
|
|
- var end_time int64
|
1300
|
|
-
|
1301
|
1288
|
data := make(map[string]interface{})
|
1302
|
1289
|
if settle_accounts_type == 1 { //日结
|
1303
|
1290
|
prescriptions, _ = service.GetZHHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
|
|
@@ -1313,14 +1300,12 @@ func (c *ZHHisApiController) GetUploadInfo() {
|
1313
|
1300
|
return
|
1314
|
1301
|
}
|
1315
|
1302
|
recordStartTime := theStartTime.Unix()
|
1316
|
|
- start_time = recordStartTime
|
1317
|
1303
|
theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
|
1318
|
1304
|
if err != nil {
|
1319
|
1305
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
1320
|
1306
|
return
|
1321
|
1307
|
}
|
1322
|
1308
|
recordEndTime := theEndTime.Unix()
|
1323
|
|
- end_time = recordEndTime
|
1324
|
1309
|
prescriptions, _ = service.GetZHMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
|
1325
|
1310
|
|
1326
|
1311
|
}
|
|
@@ -1607,6 +1592,7 @@ func (c *ZHHisApiController) GetUploadInfo() {
|
1607
|
1592
|
service.CreateOrderInfo(info)
|
1608
|
1593
|
}
|
1609
|
1594
|
}
|
|
1595
|
+
|
1610
|
1596
|
err := service.UpDatePrescriptionOrderStatus(adminUser.CurrentOrgId, ids)
|
1611
|
1597
|
if err == nil {
|
1612
|
1598
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -1619,59 +1605,7 @@ func (c *ZHHisApiController) GetUploadInfo() {
|
1619
|
1605
|
}
|
1620
|
1606
|
|
1621
|
1607
|
} else {
|
1622
|
|
- var total float64
|
1623
|
|
- for _, item := range prescriptions {
|
1624
|
|
- if item.Type == 1 { //药品
|
1625
|
|
- for _, subItem := range item.HisDoctorAdviceInfo {
|
1626
|
|
- total = total + (subItem.Price * subItem.PrescribingNumber)
|
1627
|
|
- }
|
1628
|
|
- }
|
1629
|
|
- if item.Type == 2 { //项目
|
1630
|
|
- for _, subItem := range item.HisPrescriptionProject {
|
1631
|
|
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
|
1632
|
|
- total = total + (subItem.Price * cnt)
|
1633
|
|
- }
|
1634
|
|
- }
|
1635
|
|
- }
|
1636
|
|
- for _, item := range prescriptions {
|
1637
|
|
- for _, subItem := range item.HisAdditionalCharge {
|
1638
|
|
- total = total + (subItem.Price * float64(subItem.Count))
|
1639
|
|
- }
|
1640
|
|
- }
|
1641
|
|
- allTotal := fmt.Sprintf("%.4f", total)
|
1642
|
|
- totals, _ := strconv.ParseFloat(allTotal, 64)
|
1643
|
|
-
|
1644
|
|
- order := &models.HisOrder{
|
1645
|
|
- UserOrgId: adminUser.CurrentOrgId,
|
1646
|
|
- HisPatientId: record.ID,
|
1647
|
|
- PatientId: record.PatientId,
|
1648
|
|
- SettleAccountsDate: recordDateTime,
|
1649
|
|
- Ctime: time.Now().Unix(),
|
1650
|
|
- Mtime: time.Now().Unix(),
|
1651
|
|
- Status: 1,
|
1652
|
|
- Number: record.Number,
|
1653
|
|
- Infcode: 0,
|
1654
|
|
- WarnMsg: "",
|
1655
|
|
- Cainfo: "",
|
1656
|
|
- ErrMsg: "",
|
1657
|
|
- RespondTime: "",
|
1658
|
|
- InfRefmsgid: "",
|
1659
|
|
- OrderStatus: 1,
|
1660
|
|
- MdtrtId: record.Number,
|
1661
|
|
- IsMedicineInsurance: 1,
|
1662
|
|
- SettleType: settle_accounts_type,
|
1663
|
|
- SettleStartTime: start_time,
|
1664
|
|
- SettleEndTime: end_time,
|
1665
|
|
- Creator: roles.AdminUserId,
|
1666
|
|
- Modify: roles.AdminUserId,
|
1667
|
|
- PType: 1,
|
1668
|
|
- MedfeeSumamt: totals,
|
1669
|
|
- }
|
1670
|
|
- err = service.CreateOrder(order)
|
1671
|
|
- if err != nil {
|
1672
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
|
1673
|
|
- return
|
1674
|
|
- }
|
|
1608
|
+
|
1675
|
1609
|
for _, subItem := range ress {
|
1676
|
1610
|
for _, item := range subItem.Output.Result {
|
1677
|
1611
|
temp := strings.Split(item.FeedetlSn, "-")
|
|
@@ -1690,7 +1624,7 @@ func (c *ZHHisApiController) GetUploadInfo() {
|
1690
|
1624
|
project_id = id
|
1691
|
1625
|
}
|
1692
|
1626
|
info := &models.HisOrderInfo{
|
1693
|
|
- OrderNumber: order.Number,
|
|
1627
|
+ OrderNumber: record.Number,
|
1694
|
1628
|
FeedetlSn: item.FeedetlSn,
|
1695
|
1629
|
UploadDate: time.Now().Unix(),
|
1696
|
1630
|
AdviceId: advice_id,
|
|
@@ -1718,7 +1652,6 @@ func (c *ZHHisApiController) GetUploadInfo() {
|
1718
|
1652
|
ChrgitmLv: item.ChrgitmLv,
|
1719
|
1653
|
UserOrgId: adminUser.CurrentOrgId,
|
1720
|
1654
|
HisPatientId: record.ID,
|
1721
|
|
- OrderId: order.ID,
|
1722
|
1655
|
ProjectId: project_id,
|
1723
|
1656
|
Type: types,
|
1724
|
1657
|
SettleType: settle_accounts_type,
|
|
@@ -1726,6 +1659,7 @@ func (c *ZHHisApiController) GetUploadInfo() {
|
1726
|
1659
|
service.CreateOrderInfo(info)
|
1727
|
1660
|
}
|
1728
|
1661
|
}
|
|
1662
|
+ service.UpDatePrescriptionOrderStatus(adminUser.CurrentOrgId, ids)
|
1729
|
1663
|
service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, record.Number)
|
1730
|
1664
|
service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, patientPrescription.PatientId, record.Number, recordDateTime)
|
1731
|
1665
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -1900,13 +1834,14 @@ func (c *ZHHisApiController) ZHRefundDetail() {
|
1900
|
1834
|
|
1901
|
1835
|
} else {
|
1902
|
1836
|
//prescriptions, _ = service.GetZHMonthHisUploadPrescription(adminUser.CurrentOrgId, patient_id, recordDateTime)
|
1903
|
|
- var order models.HisOrder
|
1904
|
|
- order, _ = service.GetHisOrderByID(order_id)
|
1905
|
|
- record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
|
|
1837
|
+ //var order models.HisOrder
|
|
1838
|
+ //order, _ = service.GetHisOrderByID(order_id)
|
|
1839
|
+ //record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
|
|
1840
|
+ record, _ := service.GetInHospitalRecord(his_patient_id)
|
1906
|
1841
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
1907
|
1842
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
1908
|
1843
|
|
1909
|
|
- result := service.Gdyb2302(order.PsnNo, order.MdtrtId, miConfig.OrgName, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
|
|
1844
|
+ result := service.Gdyb2302(record.PsnNo, record.Number, miConfig.OrgName, roles.UserName, record.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code, "0000", 0)
|
1910
|
1845
|
var dat map[string]interface{}
|
1911
|
1846
|
if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
1912
|
1847
|
fmt.Println(dat)
|
|
@@ -1939,7 +1874,7 @@ func (c *ZHHisApiController) ZHRefundDetail() {
|
1939
|
1874
|
}
|
1940
|
1875
|
|
1941
|
1876
|
if res2.Infcode == 0 {
|
1942
|
|
- err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId, "", result)
|
|
1877
|
+ err := service.UpdataOrderStatus(order_id, record.Number, adminUser.CurrentOrgId, "", result)
|
1943
|
1878
|
if err == nil {
|
1944
|
1879
|
c.ServeSuccessJSON(map[string]interface{}{
|
1945
|
1880
|
"msg": "退费成功",
|
|
@@ -1955,7 +1890,7 @@ func (c *ZHHisApiController) ZHRefundDetail() {
|
1955
|
1890
|
})
|
1956
|
1891
|
}
|
1957
|
1892
|
} else {
|
1958
|
|
- err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId, "", "")
|
|
1893
|
+ err := service.UpdataOrderStatus(order_id, record.Number, adminUser.CurrentOrgId, "", "")
|
1959
|
1894
|
if err == nil {
|
1960
|
1895
|
c.ServeSuccessJSON(map[string]interface{}{
|
1961
|
1896
|
"msg": "退费成功",
|