|
@@ -278,6 +278,11 @@ func SZHisManagerApiRegistRouters() {
|
278
|
278
|
|
279
|
279
|
//退费
|
280
|
280
|
beego.Router("/sz/api/refund/get", &SZHisApiController{}, "get:Refund")
|
|
281
|
+
|
|
282
|
+ beego.Router("/sz/api/readcard", &SZHisApiController{}, "get:ReadCard")
|
|
283
|
+
|
|
284
|
+ beego.Router("sz/api/refundnumber/get", &SZHisApiController{}, "get:RefundNumber")
|
|
285
|
+
|
281
|
286
|
beego.Router("/sz/api/monthrefund/get", &SZHisApiController{}, "get:MonthRefund")
|
282
|
287
|
//查询交易
|
283
|
288
|
beego.Router("/sz/api/settle/query", &SZHisApiController{}, "get:GetSettleAccounts")
|
|
@@ -324,6 +329,40 @@ type Custom struct {
|
324
|
329
|
ItemId int64
|
325
|
330
|
}
|
326
|
331
|
|
|
332
|
+func (c *SZHisApiController) ReadCard() {
|
|
333
|
+ id_card_type, _ := c.GetInt64("id_card_type")
|
|
334
|
+ adminInfo := c.GetAdminUserInfo()
|
|
335
|
+ if id_card_type != 1 {
|
|
336
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorNoReadCardException)
|
|
337
|
+ return
|
|
338
|
+ }
|
|
339
|
+ month := time.Unix(1557042972, 0).Format("1")
|
|
340
|
+ year := time.Now().Format("2006")
|
|
341
|
+ month = time.Now().Format("01")
|
|
342
|
+ day := time.Now().Format("02")
|
|
343
|
+
|
|
344
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
|
|
345
|
+ number := miConfig.Code + year + month + day +
|
|
346
|
+ fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
|
|
347
|
+ id_card_number, health_card_no, _, ret4 := ReadBasCard("MZ002" + "|" + number + "|" + miConfig.Code + "|")
|
|
348
|
+ if ret4 == 0 {
|
|
349
|
+ patient, _ := service.GetPatientByNumber(id_card_number, adminInfo.CurrentOrgId)
|
|
350
|
+ if patient.ID == 0 {
|
|
351
|
+ patient.HealthCareNo = health_card_no
|
|
352
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
|
|
353
|
+ return
|
|
354
|
+ } else {
|
|
355
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
356
|
+ "patient": patient,
|
|
357
|
+ })
|
|
358
|
+ }
|
|
359
|
+ } else {
|
|
360
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
361
|
+ return
|
|
362
|
+ }
|
|
363
|
+
|
|
364
|
+}
|
|
365
|
+
|
327
|
366
|
//获取读卡信息 -- 门诊挂号
|
328
|
367
|
//func (c *SZHisApiController) GetRegisterInfo() {
|
329
|
368
|
// adminInfo := c.GetAdminUserInfo()
|
|
@@ -1111,6 +1150,86 @@ func (c *SZHisApiController) GetRegisterInfo() {
|
1111
|
1150
|
}
|
1112
|
1151
|
}
|
1113
|
1152
|
|
|
1153
|
+func (c *SZHisApiController) RefundNumber() {
|
|
1154
|
+ order_id, _ := c.GetInt64("order_id")
|
|
1155
|
+ record_time := c.GetString("record_time")
|
|
1156
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
1157
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
1158
|
+ timeLayout := "2006-01-02"
|
|
1159
|
+ loc, _ := time.LoadLocation("Local")
|
|
1160
|
+ adminUser := c.GetAdminUserInfo()
|
|
1161
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
1162
|
+ fmt.Println(err)
|
|
1163
|
+ if err != nil {
|
|
1164
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1165
|
+ return
|
|
1166
|
+ }
|
|
1167
|
+ recordDateTime := theTime.Unix()
|
|
1168
|
+ fmt.Println(recordDateTime)
|
|
1169
|
+ var order models.HisOrder
|
|
1170
|
+ order, _ = service.GetHisOrderByID(order_id)
|
|
1171
|
+ if order.ID == 0 {
|
|
1172
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
|
|
1173
|
+ return
|
|
1174
|
+ }
|
|
1175
|
+ his, _ := service.GetHisPatientInfo(adminUser.CurrentOrgId, patient_id, theTime.Unix())
|
|
1176
|
+ roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
1177
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
1178
|
+ //结算流程
|
|
1179
|
+ var doctor_name string
|
|
1180
|
+ var doctor_code string
|
|
1181
|
+ if roles.ID == 0 {
|
|
1182
|
+ doctor_name = "管理员"
|
|
1183
|
+ doctor_code = "01"
|
|
1184
|
+ } else {
|
|
1185
|
+ doctor_name = roles.UserName
|
|
1186
|
+ doctor_code = strconv.FormatInt(admin_user_id, 10)
|
|
1187
|
+
|
|
1188
|
+ }
|
|
1189
|
+ month := time.Unix(1557042972, 0).Format("1")
|
|
1190
|
+ year := time.Now().Format("2006")
|
|
1191
|
+ month = time.Now().Format("01")
|
|
1192
|
+ day := time.Now().Format("02")
|
|
1193
|
+ //number := miConfig.Code + year + month + day + "1367866"
|
|
1194
|
+ number := miConfig.Code + year + month + day +
|
|
1195
|
+ fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
|
|
1196
|
+ //number := miConfig.Code + year + month + day + "1590003"
|
|
1197
|
+
|
|
1198
|
+ //流水号
|
|
1199
|
+ //number_two := miConfig.Code + "-" + year + month + day + "-" + strconv.FormatInt(patient_id, 10)
|
|
1200
|
+ verifyCode, version_code := ReadCardGetCode("JY002" + "|" + number + "|" + miConfig.Code)
|
|
1201
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
1202
|
+ if config.IsOpen == 1 { //对接了医保,走医保流程
|
|
1203
|
+ result := service.SzybJY002(doctor_name, doctor_code, miConfig.Code, his.MzNumber, order.Number, verifyCode, number, version_code)
|
|
1204
|
+ var dat map[string]interface{}
|
|
1205
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
1206
|
+ fmt.Println(dat)
|
|
1207
|
+ } else {
|
|
1208
|
+ fmt.Println(err)
|
|
1209
|
+ }
|
|
1210
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
1211
|
+ var res ResultThree
|
|
1212
|
+ if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
1213
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
1214
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1215
|
+ return
|
|
1216
|
+ }
|
|
1217
|
+ if res.Transreturncode == "00000000" {
|
|
1218
|
+ service.UpdataHisStatusSZ(adminUser.CurrentOrgId, his.MzNumber, his.Number, result)
|
|
1219
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1220
|
+ "msg": "退号成功",
|
|
1221
|
+ })
|
|
1222
|
+ } else {
|
|
1223
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1224
|
+ "failed_code": -10,
|
|
1225
|
+ "msg": res.Transreturnmessage,
|
|
1226
|
+ })
|
|
1227
|
+
|
|
1228
|
+ }
|
|
1229
|
+ }
|
|
1230
|
+
|
|
1231
|
+}
|
|
1232
|
+
|
1114
|
1233
|
//上传明细----结算----确认订单
|
1115
|
1234
|
func (c *SZHisApiController) GetSettleInfo() {
|
1116
|
1235
|
pay_way, _ := c.GetInt64("pay_way")
|
|
@@ -2570,7 +2689,7 @@ func ReadCardGetCode(request string) (string, string) {
|
2570
|
2689
|
return "", ""
|
2571
|
2690
|
}
|
2572
|
2691
|
|
2573
|
|
-////读卡
|
|
2692
|
+////获取卡信息
|
2574
|
2693
|
func ReadBasCardGetNumber(request string) (string, string, string, string, error, int64) {
|
2575
|
2694
|
DllDef2 := syscall.MustLoadDLL("SSCardDriver_SZ.dll")
|
2576
|
2695
|
readCards := DllDef2.MustFindProc("iReadCardBas")
|
|
@@ -2597,6 +2716,27 @@ func ReadBasCardGetNumber(request string) (string, string, string, string, error
|
2597
|
2716
|
return "", "", "", "", err, -10
|
2598
|
2717
|
}
|
2599
|
2718
|
|
|
2719
|
+//读卡
|
|
2720
|
+func ReadBasCard(request string) (string, string, error, int64) {
|
|
2721
|
+ DllDef2 := syscall.MustLoadDLL("SSCardDriver_SZ.dll")
|
|
2722
|
+ readCards := DllDef2.MustFindProc("iReadCardBas")
|
|
2723
|
+ str := request
|
|
2724
|
+ str3 := make([]byte, 1024)
|
|
2725
|
+ ret4, _, err := readCards.Call(IntPtr(1), StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
|
|
2726
|
+ fmt.Println(":", string(str3))
|
|
2727
|
+ fmt.Println(":", ConvertToString(string(str3), "gbk", "utf-8"))
|
|
2728
|
+ if ret4 == 0 {
|
|
2729
|
+ result := string(str3)
|
|
2730
|
+ result_arr := strings.Split(result, "|")
|
|
2731
|
+ //根据业务的人员信息跟设备读社保卡获取的信息进行匹配,判断是否为同一个人,相同则进行挂号操作,不同则报错
|
|
2732
|
+ id_card_number := result_arr[1]
|
|
2733
|
+ health_card_no := result_arr[2]
|
|
2734
|
+
|
|
2735
|
+ return id_card_number, health_card_no, err, 0
|
|
2736
|
+ }
|
|
2737
|
+ return "", "", err, -10
|
|
2738
|
+}
|
|
2739
|
+
|
2600
|
2740
|
//
|
2601
|
2741
|
////iReadCardBas_HSM_Step1 ---- 1903 iCardInnerAuthentication --- iReadCardBas_HSM_Step2
|
2602
|
2742
|
//func ReadCardBasHSM(number string) string {
|
|
@@ -2872,7 +3012,6 @@ func (c *SZHisApiController) GetRevocation() {
|
2872
|
3012
|
RetailPrice: item.RetailPrice, //协议机构内部项目收费价格
|
2873
|
3013
|
LimitRemark: item.LimitRemark,
|
2874
|
3014
|
MedicalInsuranceNumber: item.MedicalInsuranceNumber, //社保目录
|
2875
|
|
-
|
2876
|
3015
|
}
|
2877
|
3016
|
customs = append(customs, detail)
|
2878
|
3017
|
}
|
|
@@ -3477,7 +3616,6 @@ func (c *SZHisApiController) GetMedicalList() {
|
3477
|
3616
|
IdentificationOutpatients: "", //门诊大病医师标识
|
3478
|
3617
|
OutpatientIllnessCategory: item.OutpatientIllnessCategory, //门诊大病类别
|
3479
|
3618
|
StartTime: 20201012, //开始日期
|
3480
|
|
-
|
3481
|
3619
|
}
|
3482
|
3620
|
result := service.SzybYS001(doctor_name, doctor_code, miConfig.Code, detail)
|
3483
|
3621
|
fmt.Println("reuslt9999999999999999", result)
|
|
@@ -3577,7 +3715,6 @@ func (c *SZHisApiController) GetMedicalList() {
|
3577
|
3715
|
IdentificationOutpatients: "1", //门诊大病医师标识
|
3578
|
3716
|
OutpatientIllnessCategory: "血友病", //门诊大病类别
|
3579
|
3717
|
StartTime: 20210311, //开始日期
|
3580
|
|
-
|
3581
|
3718
|
}
|
3582
|
3719
|
result := service.SzybYS002(doctor_name, doctor_code, miConfig.Code, detail)
|
3583
|
3720
|
fmt.Println("reuslt9999999999999999", result)
|