Browse Source

拉取代码

XMLWAN 3 years ago
parent
commit
07783d1269
3 changed files with 97 additions and 1032 deletions
  1. 9 914
      controllers/sz/sz_his_api_controller.go
  2. BIN
      gdyb
  3. 88 118
      service/sz_his_service.go

+ 9 - 914
controllers/sz/sz_his_api_controller.go View File

@@ -10,14 +10,11 @@ import (
10 10
 	"gdyb/utils"
11 11
 	"github.com/astaxie/beego"
12 12
 	"math"
13
-	//"strings"
14
-	//"time"
15
-
16
-	//"math"
17
-	//"math/rand"
18
-	//"strconv"
19
-	//"strings"
13
+	"math/rand"
14
+	"strconv"
15
+	"strings"
20 16
 	"syscall"
17
+	"time"
21 18
 	"unsafe"
22 19
 )
23 20
 
@@ -175,19 +172,16 @@ type SZHisApiController struct {
175 172
 
176 173
 func SZHisManagerApiRegistRouters() {
177 174
 	//挂号
178
-	//beego.Router("/sz/api/register/get", &SZHisApiController{}, "get:GetRegisterInfo")
175
+	beego.Router("/sz/api/register/get", &SZHisApiController{}, "get:GetRegisterInfo")
179 176
 	//上传明细,预结算
180
-	//beego.Router("/sz/api/upload/get", &SZHisApiController{}, "get:GetUploadInfo")
181
-
182 177
 	beego.Router("/sz/api/upload/get", &SZHisApiController{}, "get:GetUploadInfo")
183 178
 	//结算
184
-	//beego.Router("/sz/api/settle/get", &SZHisApiController{}, "get:GetSettleInfo")
179
+	beego.Router("/sz/api/settle/get", &SZHisApiController{}, "get:GetSettleInfo")
185 180
 	//退费
186
-	//beego.Router("/sz/api/refund/get", &SZHisApiController{}, "get:RefundDetail")
187 181
 	beego.Router("/sz/api/refund/get", &SZHisApiController{}, "get:Refund")
188 182
 	beego.Router("/sz/api/monthrefund/get", &SZHisApiController{}, "get:MonthRefund")
189 183
 	//查询交易
190
-	//beego.Router("/sz/api/settle/query", &SZHisApiController{}, "get:GetSettleAccounts")
184
+	beego.Router("/sz/api/settle/query", &SZHisApiController{}, "get:GetSettleAccounts")
191 185
 
192 186
 	//机构药品目录备案
193 187
 	beego.Router("/sz/api/drug/get", &SZHisApiController{}, "get:GetDrugList")
@@ -203,6 +197,7 @@ func SZHisManagerApiRegistRouters() {
203 197
 	beego.Router("/sz/api/medical/get", &SZHisApiController{}, "get:GetMedicalList")
204 198
 	//医药师信息更新
205 199
 	beego.Router("/sz/api/update/medical/get", &SZHisApiController{}, "get:GetUpdateMedicalList")
200
+
206 201
 }
207 202
 
208 203
 func IntPtr(n int) uintptr {
@@ -1036,887 +1031,7 @@ func (c *SZHisApiController) Refund() {
1036 1031
 
1037 1032
 		result := service.SzybJY002(doctor_name, doctor_code, miConfig.Code, order.OrgSetlNumber, order.MzNumber, verifyCode)
1038 1033
 		fmt.Println(result)
1039
-//func (c *SZHisApiController) GetRegisterInfo() {
1040
-//	adminInfo := c.GetAdminUserInfo()
1041
-//	admin_user_id, _ := c.GetInt64("admin_user_id")
1042
-//
1043
-//	patient_id, _ := c.GetInt64("id")
1044
-//	record_time := c.GetString("record_time")
1045
-//	settlementValue, _ := c.GetInt64("settlement_value")
1046
-//	medical_insurance_card := c.GetString("medical_insurance_card")
1047
-//	name := c.GetString("name")
1048
-//	id_card_type, _ := c.GetInt64("id_card_type")
1049
-//	certificates, _ := c.GetInt64("certificates")
1050
-//	medical_care, _ := c.GetInt64("medical_care")
1051
-//	birthday := c.GetString("birthday")
1052
-//	id_card := c.GetString("id_card")
1053
-//	register_type, _ := c.GetInt64("register")
1054
-//	doctor, _ := c.GetInt64("doctor")
1055
-//	department, _ := c.GetInt64("department")
1056
-//	gender, _ := c.GetInt64("sex")
1057
-//	registration_fee, _ := c.GetFloat("registration_fee")
1058
-//	medical_expenses, _ := c.GetFloat("medical_expenses")
1059
-//	social_type, _ := c.GetInt64("social_type")
1060
-//
1061
-//	timeLayout := "2006-01-02"
1062
-//	loc, _ := time.LoadLocation("Local")
1063
-//	birthdays, _ := time.ParseInLocation(timeLayout+" 15:04:05", birthday+" 00:00:00", loc)
1064
-//	birthUnix := birthdays.Unix()
1065
-//
1066
-//	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
1067
-//	if err != nil {
1068
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1069
-//		return
1070
-//	}
1071
-//
1072
-//	var patient service.Patients
1073
-//	if patient_id == 0 {
1074
-//		patient, _ = service.GetPatientByIDCard(id_card, adminInfo.CurrentOrgId)
1075
-//	} else {
1076
-//		patient, _ = service.GetPatientByIDTwo(adminInfo.CurrentOrgId, patient_id)
1077
-//	}
1078
-//
1079
-//	miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
1080
-//	if patient.ID == 0 {
1081
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
1082
-//		return
1083
-//	}
1084
-//	if len(patient.IdCardNo) == 0 {
1085
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeIDCartNo)
1086
-//		return
1087
-//	}
1088
-//
1089
-//	adminRole, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
1090
-//
1091
-//	var doctor_name string
1092
-//	var doctor_code string
1093
-//	if adminRole.ID == 0 {
1094
-//
1095
-//		doctor_name = "黄亦轩"
1096
-//		doctor_code = "1001"
1097
-//
1098
-//	} else {
1099
-//		doctor_name = adminRole.UserName
1100
-//		doctor_code = strconv.FormatInt(admin_user_id, 10)
1101
-//
1102
-//	}
1103
-//	month := time.Unix(1557042972, 0).Format("1")
1104
-//	year := time.Now().Format("2006")
1105
-//	month = time.Now().Format("01")
1106
-//	day := time.Now().Format("02")
1107
-//	//流水号
1108
-//	number := miConfig.Code + "-" + year + month + day + "-" + strconv.FormatInt(patient_id, 10)
1109
-//
1110
-//	//1.读卡 获取交易验证码,医疗证号,发卡地区行政区划代码
1111
-//	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
1112
-//	readCards := DllDef2.MustFindProc("iReadCardBas")
1113
-//	str3 := make([]byte, 256)
1114
-//	ret4, _, err4 := readCards.Call(StrPtr(number), (uintptr)(unsafe.Pointer(&str3[0])))
1115
-//	fmt.Println(":", string(str3))
1116
-//
1117
-//	if err4 != nil {
1118
-//		fmt.Println("SSCard的运算结果为:", ret4)
1119
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
1120
-//		return
1121
-//	}
1122
-//
1123
-//	if ret4 == 0 {
1124
-//		result := string(str3)
1125
-//		fmt.Println(result)
1126
-//		result_arr := strings.Split(result, "|")
1127
-//		//医疗证号
1128
-//		yiliao_number := result_arr[12]
1129
-//		//VerifyCode
1130
-//		verifyCode := result_arr[11] + "|" + result_arr[13]
1131
-//
1132
-//		//根据业务的人员信息跟设备读社保卡获取的信息进行匹配,判断是否为同一个人,相同则进行挂号操作,不同则报错
1133
-//		id_card_number := result_arr[1]
1134
-//
1135
-//		tempPatient, _ := service.GetPatientByNumber(id_card_number, adminInfo.CurrentOrgId)
1136
-//		if tempPatient.ID == patient_id {
1137
-//			//挂号
1138
-//			resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, "013", yiliao_number, verifyCode, number)
1139
-//			his := models.VMHisPatient{
1140
-//				Name:                   name,
1141
-//				Gender:                 gender,
1142
-//				Birthday:               birthUnix,
1143
-//				MedicalTreatmentType:   medical_care,
1144
-//				IdType:                 certificates,
1145
-//				IdCardNo:               id_card,
1146
-//				BalanceAccountsType:    settlementValue,
1147
-//				SocialType:             social_type,
1148
-//				MedicalInsuranceNumber: medical_insurance_card,
1149
-//				RegisterType:           register_type,
1150
-//				RegisterCost:           registration_fee,
1151
-//				TreatmentCost:          medical_expenses,
1152
-//				Status:                 1,
1153
-//				Ctime:                  time.Now().Unix(),
1154
-//				Mtime:                  time.Now().Unix(),
1155
-//				Iinfo:                  resp_result,
1156
-//				PatientId:              patient.ID,
1157
-//				RecordDate:             theTime.Unix(),
1158
-//				UserOrgId:              adminInfo.CurrentOrgId,
1159
-//				AdminUserId:            admin_user_id,
1160
-//				IsReturn:               1,
1161
-//				IdCardType:             id_card_type,
1162
-//				Doctor:                 doctor,
1163
-//				Departments:            department,
1164
-//			}
1165
-//			service.CreateHisPatientTwo(&his)
1166
-//
1167
-//		} else {
1168
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
1169
-//			return
1170
-//		}
1171
-//
1172
-//	} else {
1173
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
1174
-//		return
1175
-//	}
1176
-//
1177
-//}
1178
-
1179
-//上传明细----预结算----确认订单
1180
-//func (c *SZHisApiController) GetUploadInfo() {
1181
-//
1182
-//	patient_id, _ := c.GetInt64("id")
1183
-//	record_time := c.GetString("record_time")
1184
-//
1185
-//	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
1186
-//	admin_user_id, _ := c.GetInt64("admin_user_id")
1187
-//
1188
-//	timestamp := time.Now().Unix()
1189
-//	tempTime := time.Unix(timestamp, 0)
1190
-//	timeFormat := tempTime.Format("20060102150405")
1191
-//	chrgBchno := rand.Intn(10000) + 1000
1192
-//	chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(1, 10)
1193
-//	//miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1194
-//
1195
-//	month := time.Unix(1557042972, 0).Format("1")
1196
-//	year := time.Now().Format("2006")
1197
-//	month = time.Now().Format("01")
1198
-//	day := time.Now().Format("02")
1199
-//
1200
-//	timeLayout := "2006-01-02"
1201
-//	loc, _ := time.LoadLocation("Local")
1202
-//	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
1203
-//	if err != nil {
1204
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1205
-//		return
1206
-//	}
1207
-//	recordDateTime := theTime.Unix()
1208
-//
1209
-//	adminUser := c.GetAdminUserInfo()
1210
-//	var prescriptions []*models.HisPrescription
1211
-//
1212
-//	var start_time int64
1213
-//	var end_time int64
1214
-//
1215
-//	if settle_accounts_type == 1 { //日结
1216
-//		prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, patient_id, recordDateTime)
1217
-//
1218
-//	} else { //月结
1219
-//		start_time_str := c.GetString("start_time")
1220
-//		end_time_str := c.GetString("end_time")
1221
-//		timeLayout := "2006-01-02"
1222
-//		loc, _ := time.LoadLocation("Local")
1223
-//		theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
1224
-//		if err != nil {
1225
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1226
-//			return
1227
-//		}
1228
-//		recordStartTime := theStartTime.Unix()
1229
-//		start_time = recordStartTime
1230
-//
1231
-//		theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
1232
-//		if err != nil {
1233
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1234
-//			return
1235
-//		}
1236
-//		recordEndTime := theEndTime.Unix()
1237
-//		end_time = recordEndTime
1238
-//
1239
-//		prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, patient_id, recordStartTime, recordEndTime)
1240
-//	}
1241
-//
1242
-//	var ids []int64
1243
-//	for _, item := range prescriptions {
1244
-//		ids = append(ids, item.ID)
1245
-//	}
1246
-//
1247
-//	adminRole, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1248
-//	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1249
-//
1250
-//	var doctor_name string
1251
-//	var doctor_code string
1252
-//	if adminRole.ID == 0 {
1253
-//
1254
-//		doctor_name = "黄亦轩"
1255
-//		doctor_code = "1001"
1256
-//
1257
-//	} else {
1258
-//		doctor_name = adminRole.UserName
1259
-//		doctor_code = strconv.FormatInt(admin_user_id, 10)
1260
-//
1261
-//	}
1262
-//	var yiliao_number string
1263
-//	//1.读卡 获取交易验证码,医疗证号,发卡地区行政区划代码
1264
-//	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
1265
-//	readCards := DllDef2.MustFindProc("iReadCardBas")
1266
-//	str3 := make([]byte, 256)
1267
-//	ret4, _, err4 := readCards.Call(StrPtr(number), (uintptr)(unsafe.Pointer(&str3[0])))
1268
-//	fmt.Println(":", string(str3))
1269
-//
1270
-//	if err4 != nil {
1271
-//		fmt.Println("SSCard的运算结果为:", ret4)
1272
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
1273
-//		return
1274
-//	}
1275
-//
1276
-//	if ret4 == 0 {
1277
-//		//result := string(str3)
1278
-//		//fmt.Println(result)
1279
-//		//result_arr := strings.Split(result, "|")
1280
-//		////医疗证号
1281
-//		//yiliao_number := result_arr[12]
1282
-//		//VerifyCode
1283
-//		//verifyCode := result_arr[11] + "|" + result_arr[13]
1284
-//
1285
-//		//根据业务的人员信息跟设备读社保卡获取的信息进行匹配,判断是否为同一个人,相同则进行挂号操作,不同则报错
1286
-//		//id_card_number := result_arr[1]
1287
-//
1288
-//		//tempPatient, _ := service.GetPatientByNumber(id_card_number, adminInfo.CurrentOrgId)
1289
-//		//if tempPatient.ID == patient_id {
1290
-//		//	//挂号
1291
-//		//	resp_result := service.SzybMZ002(doctor_name, doctor_code, miConfig.Code, "013", yiliao_number, verifyCode, number)
1292
-//		//	his := models.VMHisPatient{
1293
-//		//		Name:                   name,
1294
-//		//		Gender:                 gender,
1295
-//		//		Birthday:               birthUnix,
1296
-//		//		MedicalTreatmentType:   medical_care,
1297
-//		//		IdType:                 certificates,
1298
-//		//		IdCardNo:               id_card,
1299
-//		//		BalanceAccountsType:    settlementValue,
1300
-//		//		SocialType:             social_type,
1301
-//		//		MedicalInsuranceNumber: medical_insurance_card,
1302
-//		//		RegisterType:           register_type,
1303
-//		//		RegisterCost:           registration_fee,
1304
-//		//		TreatmentCost:          medical_expenses,
1305
-//		//		Status:                 1,
1306
-//		//		Ctime:                  time.Now().Unix(),
1307
-//		//		Mtime:                  time.Now().Unix(),
1308
-//		//		Iinfo:                  resp_result,
1309
-//		//		PatientId:              patient.ID,
1310
-//		//		RecordDate:             theTime.Unix(),
1311
-//		//		UserOrgId:              adminInfo.CurrentOrgId,
1312
-//		//		AdminUserId:            admin_user_id,
1313
-//		//		IsReturn:               1,
1314
-//		//		IdCardType:             id_card_type,
1315
-//		//		Doctor:                 doctor,
1316
-//		//		Departments:            department,
1317
-//		//	}
1318
-//		//	service.CreateHisPatientTwo(&his)
1319
-//		//
1320
-//		//} else {
1321
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
1322
-//		//	return
1323
-//		//}
1324
-//
1325
-//	}
1326
-//
1327
-//	//流水号
1328
-//	number := miConfig.Code + "-" + year + month + day + "-" + strconv.FormatInt(patient_id, 10)
1329
-//
1330
-//	verifyCode := ReadCardGetCode("FY001" + "|" + number + "|" + miConfig.Code)
1331
-//
1332
-//	var customs []*models.CustomDetail
1333
-//
1334
-//	for _, item := range prescriptions {
1335
-//		if item.Type == 1 { //药品
1336
-//			for _, subItem := range item.HisDoctorAdviceInfo {
1337
-//				if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
1338
-//					detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber), 64)
1339
-//					price, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price), 64)
1340
-//					cus := &models.CustomDetail{
1341
-//						PrescriptionNumber: chrg_bchno,
1342
-//						OrderType:          "1",
1343
-//						ChargeSerialNumber: subItem.FeedetlSn,
1344
-//						Code:               subItem.BaseDrugLib.MedicalInsuranceNumber,
1345
-//						CodeName:           subItem.BaseDrugLib.DrugName,
1346
-//						Flag:               "1",
1347
-//						Price:              price,
1348
-//						Count:              subItem.PrescribingNumber,
1349
-//						ChargeOrderDate:    year + month + day,
1350
-//						DoctorCode:         doctor_code,
1351
-//						Total:              detItemFeeSumamt,
1352
-//						DoseCode:           "",
1353
-//						Spec:               strconv.FormatFloat(subItem.DrugSpec, 'E', -1, 64) + subItem.DrugSpecUnit,
1354
-//					}
1355
-//					customs = append(customs, cus)
1356
-//				}
1357
-//			}
1358
-//		}
1359
-//
1360
-//		if item.Type == 2 { //项目
1361
-//			for _, subItem := range item.HisPrescriptionProject {
1362
-//				if len(subItem.HisProject.MedicalCode) > 0 {
1363
-//					detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)), 64)
1364
-//
1365
-//					count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
1366
-//
1367
-//					cus := &models.CustomDetail{
1368
-//						PrescriptionNumber: chrg_bchno,
1369
-//						OrderType:          "1",
1370
-//						ChargeSerialNumber: subItem.FeedetlSn,
1371
-//						Code:               subItem.HisProject.MedicalCode,
1372
-//						CodeName:           subItem.HisProject.ProjectName,
1373
-//						Flag:               "1",
1374
-//						Price:              subItem.Price,
1375
-//						Count:              count,
1376
-//						ChargeOrderDate:    year + month + day,
1377
-//						DoctorCode:         doctor_code,
1378
-//						Total:              detItemFeeSumamt,
1379
-//						DoseCode:           "",
1380
-//						Spec:               "",
1381
-//					}
1382
-//					customs = append(customs, cus)
1383
-//				}
1384
-//			}
1385
-//		}
1386
-//
1387
-//		for _, subItem := range item.HisAdditionalCharge {
1388
-//			if len(subItem.XtHisAddtionConfig.Code) > 0 {
1389
-//				detItemFeeSumamt, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)), 64)
1390
-//
1391
-//				count, _ := strconv.ParseFloat(fmt.Sprintf("%f", subItem.Count), 64)
1392
-//				cus := &models.CustomDetail{
1393
-//					PrescriptionNumber: chrg_bchno,
1394
-//					OrderType:          "1",
1395
-//					ChargeSerialNumber: subItem.FeedetlSn,
1396
-//					Code:               subItem.XtHisAddtionConfig.Code,
1397
-//					CodeName:           subItem.XtHisAddtionConfig.Name,
1398
-//					Flag:               "1",
1399
-//					Price:              subItem.Price,
1400
-//					Count:              count,
1401
-//					ChargeOrderDate:    year + month + day,
1402
-//					DoctorCode:         doctor_code,
1403
-//					Total:              detItemFeeSumamt,
1404
-//					DoseCode:           "",
1405
-//					Spec:               "",
1406
-//				}
1407
-//				customs = append(customs, cus)
1408
-//			}
1409
-//		}
1410
-//	}
1411
-//
1412
-//	var pagesize int = 50
1413
-//	var start int = 1
1414
-//	var stop int
1415
-//	var pagecount int
1416
-//	var curpage int
1417
-//	var isSuccess bool = true
1418
-//	//总页数,向上取整,注意除之前要先转换类型为float64
1419
-//	pagecount = int(math.Ceil(float64(len(customs)) / float64(pagesize)))
1420
-//
1421
-//	var ress []*Result
1422
-//	for curpage = 1; curpage <= pagecount; curpage++ {
1423
-//		if curpage == 1 {
1424
-//			start = 1
1425
-//		} else {
1426
-//			start = (curpage-1)*pagesize + 1
1427
-//		}
1428
-//		stop = curpage * pagesize
1429
-//		if stop > len(customs) {
1430
-//			stop = len(customs)
1431
-//		}
1432
-//		//这里就可以查看开始和结束了
1433
-//		fmt.Println(customs[start-1 : stop])
1434
-//		result := service.SzybFY001(doctor_name, doctor_code, miConfig.Code, customs, verifyCode, yiliao_number)
1435
-//		//fmt.Println(result)
1436
-//
1437
-//		var dat map[string]interface{}
1438
-//		if err := json.Unmarshal([]byte(result), &dat); err == nil {
1439
-//			fmt.Println(dat)
1440
-//		} else {
1441
-//			fmt.Println(err)
1442
-//		}
1443
-//
1444
-//		userJSONBytes, _ := json.Marshal(dat)
1445
-//
1446
-//		var res Result
1447
-//		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1448
-//			utils.ErrorLog("解析失败:%v", err)
1449
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1450
-//			return
1451
-//		}
1452
-//		if res.Transreturncode == "00000000" {
1453
-//			ress = append(ress, &res)
1454
-//		} else {
1455
-//			isSuccess = false
1456
-//			//预结算报错
1457
-//			errlog := &models.HisOrderError{
1458
-//				UserOrgId:  adminUser.CurrentOrgId,
1459
-//				Ctime:      time.Now().Unix(),
1460
-//				Mtime:      time.Now().Unix(),
1461
-//				Number:     chrg_bchno,
1462
-//				ErrMsg:     res.Transreturnmessage,
1463
-//				Status:     1,
1464
-//				PatientId:  patient_id,
1465
-//				RecordTime: recordDateTime,
1466
-//				Stage:      10,
1467
-//			}
1468
-//			service.CreateErrMsgLog(errlog)
1469
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1470
-//			return
1471
-//		}
1472
-//		//设置变量,根据变量的值来判断上传是否成功
1473
-//	}
1474
-//
1475
-//	if isSuccess == true {
1476
-//		order := &models.HisOrder{
1477
-//			UserOrgId:           adminUser.CurrentOrgId,
1478
-//			HisPatientId:        0,
1479
-//			PatientId:           patient_id,
1480
-//			SettleAccountsDate:  recordDateTime,
1481
-//			Ctime:               time.Now().Unix(),
1482
-//			Mtime:               time.Now().Unix(),
1483
-//			Status:              1,
1484
-//			Number:              chrg_bchno,
1485
-//			Infcode:             0,
1486
-//			WarnMsg:             "",
1487
-//			Cainfo:              "",
1488
-//			ErrMsg:              "",
1489
-//			RespondTime:         "",
1490
-//			InfRefmsgid:         "",
1491
-//			OrderStatus:         1,
1492
-//			IsMedicineInsurance: 1,
1493
-//			SettleType:          settle_accounts_type,
1494
-//			SettleStartTime:     start_time,
1495
-//			SettleEndTime:       end_time,
1496
-//			Creator:             admin_user_id,
1497
-//			Modify:              admin_user_id,
1498
-//		}
1499
-//		err = service.CreateOrder(order)
1500
-//		if err != nil {
1501
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
1502
-//			return
1503
-//		}
1504
-//
1505
-//		for _, subItem := range ress {
1506
-//			for _, item := range subItem.Transbody.Outputlist {
1507
-//
1508
-//				temp := strings.Split(item.Aae072, "-")
1509
-//				var advice_id int64 = 0
1510
-//				var project_id int64 = 0
1511
-//				var types int64 = 0
1512
-//
1513
-//				id, _ := strconv.ParseInt(temp[2], 10, 64)
1514
-//				types, _ = strconv.ParseInt(temp[1], 10, 64)
1515
-//
1516
-//				if temp[1] == "1" {
1517
-//					advice_id = id
1518
-//					project_id = 0
1519
-//				} else if temp[1] == "2" {
1520
-//					advice_id = 0
1521
-//					project_id = id
1522
-//				}
1523
-//
1524
-//				info := &models.HisOrderInfo{
1525
-//					OrderNumber:      order.Number,
1526
-//					FeedetlSn:        item.Aae072,
1527
-//					UploadDate:       time.Now().Unix(),
1528
-//					AdviceId:         advice_id,
1529
-//					DetItemFeeSumamt: item.Akc264,
1530
-//					Cnt:              item.Akc226,
1531
-//					Pric:             float64(item.Akc225),
1532
-//					PatientId:        patient_id,
1533
-//					Status:           1,
1534
-//					ChrgitmLv:        item.Aka065,
1535
-//					Mtime:            time.Now().Unix(),
1536
-//					Ctime:            time.Now().Unix(),
1537
-//					UserOrgId:        adminUser.CurrentOrgId,
1538
-//					OrderId:          order.ID,
1539
-//					ProjectId:        project_id,
1540
-//					Type:             types,
1541
-//					OverPricPsnPay:   item.Akc268,
1542
-//					AllowReimburse:   item.Cka319,
1543
-//				}
1544
-//				service.CreateOrderInfo(info)
1545
-//
1546
-//			}
1547
-//		}
1548
-//		service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
1549
-//		service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, patient_id, chrg_bchno, recordDateTime)
1550
-//
1551
-//		var total float64
1552
-//		for _, item := range prescriptions {
1553
-//			if item.Type == 1 { //药品
1554
-//				for _, subItem := range item.HisDoctorAdviceInfo {
1555
-//					total = total + (subItem.Price * subItem.PrescribingNumber)
1556
-//				}
1557
-//			}
1558
-//			if item.Type == 2 { //项目
1559
-//				for _, subItem := range item.HisPrescriptionProject {
1560
-//					total = total + (subItem.Price * float64(subItem.Count))
1561
-//				}
1562
-//			}
1563
-//		}
1564
-//
1565
-//		for _, item := range prescriptions {
1566
-//			for _, subItem := range item.HisAdditionalCharge {
1567
-//				total = total + (subItem.Price * float64(subItem.Count))
1568
-//			}
1569
-//		}
1570
-//
1571
-//		verifyCode := ReadCardGetCode("FY004" + "|" + number + "|" + miConfig.Code)
1572
-//		result_two := service.SzybFY004(doctor_name, doctor_code, miConfig.Code, "", total, order.Number, verifyCode, number)
1573
-//		var dat map[string]interface{}
1574
-//		if err := json.Unmarshal([]byte(result_two), &dat); err == nil {
1575
-//			fmt.Println(dat)
1576
-//		} else {
1577
-//			fmt.Println(err)
1578
-//		}
1579
-//
1580
-//		userJSONBytes, _ := json.Marshal(dat)
1581
-//		var res ResultTwo
1582
-//		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1583
-//			utils.ErrorLog("解析失败:%v", err)
1584
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1585
-//			return
1586
-//		}
1587
-//
1588
-//		if res.Transreturncode == "00000000" {
1589
-//			c.ServeSuccessJSON(map[string]interface{}{
1590
-//				"msg": "预结算成功",
1591
-//			})
1592
-//		} else {
1593
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1594
-//			return
1595
-//		}
1596
-//
1597
-//	} else {
1598
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreSettleFaildParamWrong)
1599
-//		return
1600
-//	}
1601
-//
1602
-//}
1603
-//func (c *SZHisApiController) GetSettleInfo() {
1604
-//	patient_id, _ := c.GetInt64("id")
1605
-//	order_id, _ := c.GetInt64("order_id")
1606
-//	record_time := c.GetString("record_time")
1607
-//	pay_way, _ := c.GetInt64("pay_way")
1608
-//	pay_price, _ := c.GetFloat("pay_price")
1609
-//	pay_card_no := c.GetString("pay_card_no")
1610
-//	discount_price, _ := c.GetFloat("discount_price")
1611
-//	preferential_price, _ := c.GetFloat("preferential_price")
1612
-//	reality_price, _ := c.GetFloat("reality_price")
1613
-//	found_price, _ := c.GetFloat("found_price")
1614
-//	medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
1615
-//	private_price, _ := c.GetFloat("private_price")
1616
-//	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
1617
-//	admin_user_id, _ := c.GetInt64("admin_user_id")
1618
-//
1619
-//	timeLayout := "2006-01-02"
1620
-//	loc, _ := time.LoadLocation("Local")
1621
-//	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
1622
-//	if err != nil {
1623
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1624
-//		return
1625
-//	}
1626
-//	recordDateTime := theTime.Unix()
1627
-//	adminUser := c.GetAdminUserInfo()
1628
-//
1629
-//	var prescriptions []*models.HisPrescription
1630
-//
1631
-//	data := make(map[string]interface{})
1632
-//	if settle_accounts_type == 1 { //日结
1633
-//		prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, patient_id, recordDateTime)
1634
-//		data["pre"] = prescriptions
1635
-//
1636
-//	} else { //月结
1637
-//		start_time_str := c.GetString("start_time")
1638
-//		end_time_str := c.GetString("end_time")
1639
-//		timeLayout := "2006-01-02"
1640
-//		loc, _ := time.LoadLocation("Local")
1641
-//		theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
1642
-//		if err != nil {
1643
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1644
-//			return
1645
-//		}
1646
-//		recordStartTime := theStartTime.Unix()
1647
-//		theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
1648
-//		if err != nil {
1649
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1650
-//			return
1651
-//		}
1652
-//		recordEndTime := theEndTime.Unix()
1653
-//		prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, patient_id, recordStartTime, recordEndTime)
1654
-//		data["pre"] = prescriptions
1655
-//
1656
-//	}
1657
-//
1658
-//	roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1659
-//	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
1660
-//	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1661
-//	strconv.FormatInt(his.PatientId, 10)
1662
-//
1663
-//	order_src, _ := service.GetHisOrderByID(order_id)
1664
-//
1665
-//	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1666
-//	if config.IsOpen == 1 { //对接了医保,走医保流程
1667
-//
1668
-//		var total float64
1669
-//		for _, item := range prescriptions {
1670
-//			if item.Type == 1 { //药品
1671
-//				for _, subItem := range item.HisDoctorAdviceInfo {
1672
-//					total = total + (subItem.Price * subItem.PrescribingNumber)
1673
-//				}
1674
-//			}
1675
-//			if item.Type == 2 { //项目
1676
-//				for _, subItem := range item.HisPrescriptionProject {
1677
-//					total = total + (subItem.Price * float64(subItem.Count))
1678
-//				}
1679
-//			}
1680
-//		}
1681
-//
1682
-//		for _, item := range prescriptions {
1683
-//			for _, subItem := range item.HisAdditionalCharge {
1684
-//				total = total + (subItem.Price * float64(subItem.Count))
1685
-//			}
1686
-//		}
1687
-//
1688
-//		//结算流程
1689
-//
1690
-//		var doctor_name string
1691
-//		var doctor_code string
1692
-//		if roles.ID == 0 {
1693
-//
1694
-//			doctor_name = "黄亦轩"
1695
-//			doctor_code = "1001"
1696
-//
1697
-//		} else {
1698
-//			doctor_name = roles.UserName
1699
-//			doctor_code = strconv.FormatInt(admin_user_id, 10)
1700
-//
1701
-//		}
1702
-//		month := time.Unix(1557042972, 0).Format("1")
1703
-//		year := time.Now().Format("2006")
1704
-//		month = time.Now().Format("01")
1705
-//		day := time.Now().Format("02")
1706
-//		//流水号
1707
-//		number := miConfig.Code + "-" + year + month + day + "-" + strconv.FormatInt(patient_id, 10)
1708
-//
1709
-//		//1.读卡 获取交易验证码,医疗证号,发卡地区行政区划代码
1710
-//		DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
1711
-//		readCards := DllDef2.MustFindProc("iReadCardBas")
1712
-//		str3 := make([]byte, 256)
1713
-//		ret4, _, err4 := readCards.Call(StrPtr(number), (uintptr)(unsafe.Pointer(&str3[0])))
1714
-//		fmt.Println(":", string(str3))
1715
-//
1716
-//		if err4 != nil {
1717
-//			fmt.Println("SSCard的运算结果为:", ret4)
1718
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
1719
-//			return
1720
-//		}
1721
-//
1722
-//		if ret4 == 0 {
1723
-//			result := string(str3)
1724
-//			fmt.Println(result)
1725
-//			result_arr := strings.Split(result, "|")
1726
-//			//医疗证号
1727
-//			yiliao_number := result_arr[12]
1728
-//			//VerifyCode
1729
-//			//verifyCode := result_arr[11] + "|" + result_arr[13]
1730
-//			//根据业务的人员信息跟设备读社保卡获取的信息进行匹配,判断是否为同一个人,相同则进行挂号操作,不同则报错
1731
-//			//id_card_number := result_arr[1]
1732
-//			verifyCode := ReadCardGetCode("FY005" + "|" + number + "|" + miConfig.Code)
1733
-//			result_three := service.SzybFY005(doctor_name, doctor_code, miConfig.Code, "", total, yiliao_number, verifyCode, number)
1734
-//			var dat map[string]interface{}
1735
-//			if err := json.Unmarshal([]byte(result_three), &dat); err == nil {
1736
-//				fmt.Println(dat)
1737
-//			} else {
1738
-//				fmt.Println(err)
1739
-//			}
1740
-//			userJSONBytes, _ := json.Marshal(dat)
1741
-//			var res ResultTwo
1742
-//			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
1743
-//				utils.ErrorLog("解析失败:%v", err)
1744
-//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1745
-//				return
1746
-//			}
1747
-//
1748
-//			if res.Transreturncode == "00000000" {
1749
-//				order_src.OrderStatus = 2
1750
-//				order_src.PayWay = pay_way
1751
-//				order_src.PayPrice = pay_price
1752
-//				order_src.PayCardNo = pay_card_no
1753
-//				order_src.DiscountPrice = discount_price
1754
-//				order_src.PreferentialPrice = preferential_price
1755
-//				order_src.RealityPrice = reality_price
1756
-//				order_src.FoundPrice = found_price
1757
-//				order_src.MedicalInsurancePrice = medical_insurance_price
1758
-//				order_src.PrivatePrice = private_price
1759
-//				order_src.Creator = order_src.Creator
1760
-//				order_src.Modify = roles.ID
1761
-//
1762
-//				order_src.MedfeeSumamt = res.Transbody.Akc264
1763
-//
1764
-//				order_src.SetlId = res.Transbody.Ckc618
1765
-//				order_src.FundPaySumamt = res.Transbody.Akb068
1766
-//				order_src.AcctPay = res.Transbody.Akb066
1767
-//				order_src.PsnCashPay = res.Transbody.Akb067
1768
-//				order_src.PsnPartAmt = res.Transbody.Akb067
1769
-//				order_src.AccountPrice = res.Transbody.Aae240
1770
-//
1771
-//				setlDetailOne, _ := json.Marshal(res.Transbody.Outputlist1)
1772
-//				detailStrOne := string(setlDetailOne)
1773
-//				order_src.SzChargeInfo = detailStrOne
1774
-//
1775
-//				setlDetailTwo, _ := json.Marshal(res.Transbody.Outputlist2)
1776
-//				detailStrTwo := string(setlDetailTwo)
1777
-//				order_src.SzProjectInfo = detailStrTwo
1778
-//
1779
-//				setlDetailThree, _ := json.Marshal(res.Transbody.Outputlist3)
1780
-//				detailStrThree := string(setlDetailThree)
1781
-//				order_src.SzMedicineInsuranceInfo = detailStrThree
1782
-//
1783
-//				err = service.UpdataOrderStatusTwo(order_src.Number, adminUser.CurrentOrgId)
1784
-//				err = service.UpDateOrder(order_src)
1785
-//
1786
-//				c.ServeSuccessJSON(map[string]interface{}{
1787
-//					"msg": "结算成功",
1788
-//				})
1789
-//
1790
-//			} else {
1791
-//
1792
-//			}
1793
-//
1794
-//		}
1795
-//
1796
-//	}
1797
-//}
1798 1034
 
1799
-//func (c *SZHisApiController) Refund() {
1800
-//	order_id, _ := c.GetInt64("order_id")
1801
-//	number := c.GetString("number")
1802
-//	record_time := c.GetString("record_time")
1803
-//	patient_id, _ := c.GetInt64("patient_id")
1804
-//	timeLayout := "2006-01-02"
1805
-//	loc, _ := time.LoadLocation("Local")
1806
-//	adminUser := c.GetAdminUserInfo()
1807
-//	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
1808
-//	fmt.Println(err)
1809
-//	if err != nil {
1810
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1811
-//		return
1812
-//	}
1813
-//	recordDateTime := theTime.Unix()
1814
-//	his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
1815
-//	patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
1816
-//	var order models.HisOrder
1817
-//	order, _ = service.GetHisOrderByID(order_id)
1818
-//
1819
-//	if order.ID == 0 {
1820
-//		order, _ = service.GetHisOrderThree(recordDateTime, patient_id, adminUser.CurrentOrgId)
1821
-//
1822
-//	}
1823
-//
1824
-//	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
1825
-//	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
1826
-//
1827
-//	if config.IsOpen == 1 { //对接了医保,走医保流程
1828
-//
1829
-//		//api := "http://127.0.0.1:9532/" + "gdyb/nine?psn_no=" + his.PsnNo +
1830
-//		//	"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&setl_id=" + order.SetlId + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
1831
-//		//	"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1832
-//		//resp, requestErr := http.Get(api)
1833
-//		//if requestErr != nil {
1834
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1835
-//		//	return
1836
-//		//}
1837
-//		//body, ioErr := ioutil.ReadAll(resp.Body)
1838
-//		//if ioErr != nil {
1839
-//		//	utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
1840
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1841
-//		//	return
1842
-//		//}
1843
-//		//var respJSON map[string]interface{}
1844
-//		//if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
1845
-//		//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1846
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1847
-//		//	return
1848
-//		//}
1849
-//		//respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
1850
-//		//userJSONBytes, _ := json.Marshal(respJSON)
1851
-//		//fmt.Println(respJSON)
1852
-//		//fmt.Println(userJSONBytes)
1853
-//		//
1854
-//		//api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
1855
-//		//	"&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
1856
-//		//	"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1857
-//		//resp2, requestErr2 := http.Get(api2)
1858
-//		//if requestErr2 != nil {
1859
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1860
-//		//	return
1861
-//		//}
1862
-//		//
1863
-//		//body2, ioErr2 := ioutil.ReadAll(resp2.Body)
1864
-//		//if ioErr2 != nil {
1865
-//		//	utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
1866
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1867
-//		//	return
1868
-//		//}
1869
-//		//var respJSON2 map[string]interface{}
1870
-//		//if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
1871
-//		//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1872
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1873
-//		//	return
1874
-//		//}
1875
-//
1876
-//		//api3 := "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
1877
-//		//	"&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
1878
-//		//	"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1879
-//		//resp3, requestErr3 := http.Get(api3)
1880
-//		//if requestErr3 != nil {
1881
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1882
-//		//	return
1883
-//		//}
1884
-//		//
1885
-//		//body3, ioErr3 := ioutil.ReadAll(resp3.Body)
1886
-//		//if ioErr3 != nil {
1887
-//		//	utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
1888
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1889
-//		//	return
1890
-//		//}
1891
-//		//var respJSON3 map[string]interface{}
1892
-//		//if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
1893
-//		//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
1894
-//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1895
-//		//	return
1896
-//		//}
1897
-//		err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
1898
-//		//service.UpdataRegStatus(patient_id, recordDateTime, adminUser.CurrentOrgId)
1899
-//
1900
-//		if err == nil {
1901
-//			c.ServeSuccessJSON(map[string]interface{}{
1902
-//				"msg": "退费成功",
1903
-//			})
1904
-//		} else {
1905
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1906
-//			return
1907
-//		}
1908
-//	} else {
1909
-//		err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
1910
-//		if err == nil {
1911
-//			c.ServeSuccessJSON(map[string]interface{}{
1912
-//				"msg": "退费成功",
1913
-//			})
1914
-//		} else {
1915
-//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1916
-//			return
1917
-//		}
1918
-//	}
1919
-//}
1920 1035
 		var dat map[string]interface{}
1921 1036
 		if err := json.Unmarshal([]byte(result), &dat); err == nil {
1922 1037
 			fmt.Println(dat)
@@ -2084,7 +1199,7 @@ func (c *SZHisApiController) GetSettleAccounts() {
2084 1199
 	}
2085 1200
 }
2086 1201
 
2087
-////获取verifyCode
1202
+//获取verifyCode
2088 1203
 //func ReadCardGetCode(request string) string {
2089 1204
 //	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
2090 1205
 //	readCards := DllDef2.MustFindProc("iVerifyCode")
@@ -2189,26 +1304,6 @@ func (c *SZHisApiController) GetSettleAccounts() {
2189 1304
 //	return ""
2190 1305
 //}
2191 1306
 
2192
-//func ReadCardGetCode(request string) string {
2193
-//	DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
2194
-//	readCards := DllDef2.MustFindProc("iVerifyCode")
2195
-//	str := request
2196
-//	str3 := make([]byte, 256)
2197
-//	ret4, _, _ := readCards.Call(StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
2198
-//	fmt.Println(":", string(str3))
2199
-//
2200
-//	if ret4 == 0 {
2201
-//		result := string(str3)
2202
-//		fmt.Println(result)
2203
-//		result_arr := strings.Split(result, "|")
2204
-//		verifyCode := result_arr[0] + "|" + result_arr[1]
2205
-//
2206
-//		return verifyCode
2207
-//
2208
-//	}
2209
-//	return ""
2210
-//}
2211
-
2212 1307
 func (c *SZHisApiController) GetDrugList() {
2213 1308
 
2214 1309
 	//获取药品库数据

BIN
gdyb View File


+ 88 - 118
service/sz_his_service.go View File

@@ -6,6 +6,7 @@ import (
6 6
 	"fmt"
7 7
 	"gdyb/models"
8 8
 	"io/ioutil"
9
+	"math/rand"
9 10
 	"net/http"
10 11
 	"time"
11 12
 	_ "unsafe"
@@ -350,93 +351,22 @@ func SzybJY002(doctor string, doctor_code string, fixmedins_code string, setl_nu
350 351
 	inputData["akc190"] = mz_number
351 352
 	inputData["bke384"] = setl_number
352 353
 
353
-//func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string, verify_code string) string {
354
-//	// 生成输入报文
355
-//	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
356
-//	inputData := make(map[string]interface{})
357
-//	inputMessage["transType"] = "JY002" // 交易编码
358
-//
359
-//	inputData["akc190"] = "2021033012131415"
360
-//	inputData["bke384"] = number
361
-//
362
-//	inputMessage["transBody"] = inputData
363
-//	bytesData, err := json.Marshal(inputMessage)
364
-//	fmt.Println(string(bytesData))
365
-//	if err != nil {
366
-//		fmt.Println(err.Error())
367
-//		return err.Error()
368
-//	}
369
-//	reader := bytes.NewReader(bytesData)
370
-//	//url := "http://192.168.1.99:10000"
371
-//	url := "http://192.168.1.228:17001/szsi-portal/transData"
372
-//
373
-//	request, err := http.NewRequest("POST", url, reader)
374
-//	if err != nil {
375
-//		fmt.Println(err.Error())
376
-//		return err.Error()
377
-//	}
378
-//
379
-//	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
380
-//
381
-//	client := http.Client{}
382
-//	resp, err := client.Do(request)
383
-//	if err != nil {
384
-//		fmt.Println(err.Error())
385
-//		return err.Error()
386
-//	}
387
-//	respBytes, err := ioutil.ReadAll(resp.Body)
388
-//	if err != nil {
389
-//		fmt.Println(err.Error())
390
-//		return err.Error()
391
-//	}
392
-//	fmt.Println(string(respBytes))
393
-//	str := string(respBytes)
394
-//	return str
395
-//}
396
-
397
-//func SzybJY003(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string, verify_code string) string {
398
-//	// 生成输入报文
399
-//	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
400
-//	inputData := make(map[string]interface{})
401
-//	inputMessage["transType"] = "JY002" // 交易编码
402
-//
403
-//	inputData["akc190"] = "2021033012131415"
404
-//	inputData["bke384"] = number
405
-//
406
-//	inputMessage["transBody"] = inputData
407
-//	bytesData, err := json.Marshal(inputMessage)
408
-//	fmt.Println(string(bytesData))
409
-//	if err != nil {
410
-//		fmt.Println(err.Error())
411
-//		return err.Error()
412
-//	}
413
-//	reader := bytes.NewReader(bytesData)
414
-//	//url := "http://192.168.1.99:10000"
415
-//	url := "http://192.168.1.228:17001/szsi-portal/transData"
416
-//
417
-//	request, err := http.NewRequest("POST", url, reader)
418
-//	if err != nil {
419
-//		fmt.Println(err.Error())
420
-//		return err.Error()
421
-//	}
422
-//
423
-//	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
424
-//
425
-//	client := http.Client{}
426
-//	resp, err := client.Do(request)
427
-//	if err != nil {
428
-//		fmt.Println(err.Error())
429
-//		return err.Error()
430
-//	}
431
-//	respBytes, err := ioutil.ReadAll(resp.Body)
432
-//	if err != nil {
433
-//		fmt.Println(err.Error())
434
-//		return err.Error()
435
-//	}
436
-//	fmt.Println(string(respBytes))
437
-//	str := string(respBytes)
438
-//	return str
439
-//}
354
+	inputMessage["transBody"] = inputData
355
+	bytesData, err := json.Marshal(inputMessage)
356
+	fmt.Println(string(bytesData))
357
+	if err != nil {
358
+		fmt.Println(err.Error())
359
+		return err.Error()
360
+	}
361
+	reader := bytes.NewReader(bytesData)
362
+	//url := "http://192.168.1.99:10000"
363
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
364
+
365
+	request, err := http.NewRequest("POST", url, reader)
366
+	if err != nil {
367
+		fmt.Println(err.Error())
368
+		return err.Error()
369
+	}
440 370
 
441 371
 	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
442 372
 
@@ -460,42 +390,13 @@ func SzybJY003(doctor string, doctor_code string, fixmedins_code string, setl_nu
460 390
 	// 生成输入报文
461 391
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
462 392
 
463
-func SzybML008(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail) string {
464
-	//生成输入报文
465
-	inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
466
-
467 393
 	inputData := make(map[string]interface{})
468 394
 	inputMessage["transType"] = "JY003" // 交易编码
469 395
 
470
-	inputData["listsize"] = len(datas)
471
-	inputMessage["transType"] = "ML008" // 交易编码
472
-	feedetail := make([]map[string]interface{}, 0)
473 396
 	inputData["akc190"] = mz_number
474 397
 	inputData["bke384"] = setl_number
475 398
 
476
-	for _, item := range datas {
477
-		fmt.Println("中国222222", item.DrugDosageName)
478
-		feedetailInfo := make(map[string]interface{})
479
-		feedetailInfo["ake001"] = item.MedicalInsuranceNumber
480
-		feedetailInfo["bkm017"] = item.Code
481
-		feedetailInfo["ake005"] = "110100002"
482
-		feedetailInfo["ake006"] = item.DrugName
483
-		feedetailInfo["aka074"] = item.DrugSpec
484
-		feedetailInfo["aka070"] = item.DrugDosageName
485
-		//feedetailInfo["aka070"] = "片"
486
-		feedetailInfo["aka067"] = item.MinUnit
487
-		feedetailInfo["bka053"] = item.ManufacturerName
488
-		feedetailInfo["aka064"] = "1"
489
-		feedetailInfo["bka505"] = item.LastPrice
490
-		feedetailInfo["bka506"] = item.RetailPrice
491
-		feedetailInfo["aae030"] = 20210406
492
-		feedetailInfo["aae013"] = item.LimitRemark
493
-		feedetail = append(feedetail, feedetailInfo)
494
-	}
495
-
496
-	inputData["inputlist"] = feedetail
497 399
 	inputMessage["transBody"] = inputData
498
-
499 400
 	bytesData, err := json.Marshal(inputMessage)
500 401
 	fmt.Println(string(bytesData))
501 402
 	if err != nil {
@@ -528,7 +429,6 @@ func SzybML008(doctor string, doctor_code string, fixmedins_code string, datas [
528 429
 	fmt.Println(string(respBytes))
529 430
 	str := string(respBytes)
530 431
 	return str
531
-
532 432
 }
533 433
 
534 434
 // 生成基础报文
@@ -544,7 +444,7 @@ func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string,
544 444
 
545 445
 	msec := time.Now().Format("000")
546 446
 
547
-	//生成输入报文
447
+	// 生成输入报文
548 448
 	inputMessage := make(map[string]interface{})
549 449
 	//
550 450
 
@@ -572,6 +472,76 @@ func msToTime(ms int64) string {
572 472
 	return tm.Format("2006-02-01 15:04:05.000")
573 473
 }
574 474
 
475
+func SzybML008(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail) string {
476
+	//生成输入报文
477
+	inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
478
+
479
+	inputData := make(map[string]interface{})
480
+	inputMessage["transType"] = "JY003" // 交易编码
481
+
482
+	inputData["listsize"] = len(datas)
483
+	inputMessage["transType"] = "ML008" // 交易编码
484
+	feedetail := make([]map[string]interface{}, 0)
485
+	//inputData["akc190"] = mz_number
486
+	//inputData["bke384"] = setl_number
487
+
488
+	for _, item := range datas {
489
+		fmt.Println("中国222222", item.DrugDosageName)
490
+		feedetailInfo := make(map[string]interface{})
491
+		feedetailInfo["ake001"] = item.MedicalInsuranceNumber
492
+		feedetailInfo["bkm017"] = item.Code
493
+		feedetailInfo["ake005"] = "110100002"
494
+		feedetailInfo["ake006"] = item.DrugName
495
+		feedetailInfo["aka074"] = item.DrugSpec
496
+		feedetailInfo["aka070"] = item.DrugDosageName
497
+		//feedetailInfo["aka070"] = "片"
498
+		feedetailInfo["aka067"] = item.MinUnit
499
+		feedetailInfo["bka053"] = item.ManufacturerName
500
+		feedetailInfo["aka064"] = "1"
501
+		feedetailInfo["bka505"] = item.LastPrice
502
+		feedetailInfo["bka506"] = item.RetailPrice
503
+		feedetailInfo["aae030"] = 20210406
504
+		feedetailInfo["aae013"] = item.LimitRemark
505
+		feedetail = append(feedetail, feedetailInfo)
506
+	}
507
+
508
+	inputData["inputlist"] = feedetail
509
+	inputMessage["transBody"] = inputData
510
+
511
+	bytesData, err := json.Marshal(inputMessage)
512
+	fmt.Println(string(bytesData))
513
+	if err != nil {
514
+		fmt.Println(err.Error())
515
+		return err.Error()
516
+	}
517
+	reader := bytes.NewReader(bytesData)
518
+	//url := "http://192.168.1.99:10000"
519
+	url := "http://192.168.1.228:17001/szsi-portal/transData"
520
+
521
+	request, err := http.NewRequest("POST", url, reader)
522
+	if err != nil {
523
+		fmt.Println(err.Error())
524
+		return err.Error()
525
+	}
526
+
527
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
528
+
529
+	client := http.Client{}
530
+	resp, err := client.Do(request)
531
+	if err != nil {
532
+		fmt.Println(err.Error())
533
+		return err.Error()
534
+	}
535
+	respBytes, err := ioutil.ReadAll(resp.Body)
536
+	if err != nil {
537
+		fmt.Println(err.Error())
538
+		return err.Error()
539
+	}
540
+	fmt.Println(string(respBytes))
541
+	str := string(respBytes)
542
+	return str
543
+}
544
+
575 545
 // 生成基础报文
576 546
 func SetSZDrugMessage(doctor string, doctor_code string, fixmedins_code string) map[string]interface{} {
577 547
 	month := time.Unix(1557042972, 0).Format("1")