Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 3 years ago
parent
commit
4a1f765e82

+ 7 - 2
controllers/sg/his_api_controller.go View File

3313
 						}
3313
 						}
3314
 						if item.Type == 2 { //项目
3314
 						if item.Type == 2 { //项目
3315
 							for _, subItem := range item.HisPrescriptionProject {
3315
 							for _, subItem := range item.HisPrescriptionProject {
3316
-								total = total + (subItem.Price * float64(subItem.Count))
3316
+								cnt, _ := strconv.ParseFloat(subItem.Count, 64)
3317
+
3318
+								total = total + (subItem.Price * cnt)
3317
 							}
3319
 							}
3318
 						}
3320
 						}
3319
 					}
3321
 					}
4682
 						}
4684
 						}
4683
 					}
4685
 					}
4684
 					if item.Type == 2 { //项目
4686
 					if item.Type == 2 { //项目
4687
+
4685
 						for _, subItem := range item.HisPrescriptionProject {
4688
 						for _, subItem := range item.HisPrescriptionProject {
4686
-							total = total + (subItem.Price * float64(subItem.Count))
4689
+							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
4690
+
4691
+							total = total + (subItem.Price * cnt)
4687
 						}
4692
 						}
4688
 					}
4693
 					}
4689
 				}
4694
 				}

+ 130 - 40
controllers/zh/zh_his_api_controller.go View File

273
 	beego.Router("/zh/api/outhopitaluncheck/get", &ZHHisApiController{}, "get:GetZHOutHospitalUnCheck")
273
 	beego.Router("/zh/api/outhopitaluncheck/get", &ZHHisApiController{}, "get:GetZHOutHospitalUnCheck")
274
 	beego.Router("/zh/api/refund", &ZHHisApiController{}, "get:ZHRefund")
274
 	beego.Router("/zh/api/refund", &ZHHisApiController{}, "get:ZHRefund")
275
 	beego.Router("/zh/api/refunddetail", &ZHHisApiController{}, "get:ZHRefundDetail")
275
 	beego.Router("/zh/api/refunddetail", &ZHHisApiController{}, "get:ZHRefundDetail")
276
+	beego.Router("/zh/api/patient/info", &ZHHisApiController{}, "get:ƒ")
276
 
277
 
277
 }
278
 }
279
+func (c *ZHHisApiController) GetZHPatientInfo() {
280
+	id_card_no := c.GetString("id_card_no")
281
+	admin_user_id, _ := c.GetInt64("admin_user_id")
282
+
283
+	patient, _ := service.GetPatientByIDCard(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
284
+
285
+	if patient.ID == 0 {
286
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
287
+		return
288
+	}
289
+
290
+	role, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
291
+	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
292
+	config, _ := service.GetMedicalInsuranceConfig(c.GetAdminUserInfo().CurrentOrgId)
293
+	if config.IsOpen == 1 {
294
+
295
+		result := service.Gdyb1101A(id_card_no, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
296
+		var dat map[string]interface{}
297
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
298
+			fmt.Println(dat)
299
+		} else {
300
+			fmt.Println(err)
301
+		}
302
+
303
+		userJSONBytes, _ := json.Marshal(dat)
304
+		var res ResultTwo
305
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
306
+			utils.ErrorLog("解析失败:%v", err)
307
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
308
+			return
309
+		}
310
+
311
+		var insutypes []string
312
+
313
+		var insutype string
314
+		var is390 int = 0
315
+		var is310 int = 0
316
+		for _, item := range res.Output.Iinfo {
317
+			if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
318
+				insutypes = append(insutypes, item.Insutype)
319
+			}
320
+		}
321
+		if len(insutypes) == 1 {
322
+			insutype = insutypes[0]
323
+		} else {
324
+			for _, i := range insutypes {
325
+				if i == "390" {
326
+					is390 = 1
327
+				}
328
+
329
+				if i == "310" {
330
+					is310 = 1
331
+				}
332
+			}
333
+		}
334
+		if is390 == 1 {
335
+			insutype = "390"
336
+		}
337
+		if is310 == 1 {
338
+			insutype = "310"
339
+		}
340
+
341
+		if len(insutypes) == 0 {
342
+			insutype = "310"
343
+		}
344
+
345
+		if res.Infcode != 0 {
346
+			c.ServeSuccessJSON(map[string]interface{}{
347
+				"failed_code": -10,
348
+				"msg":         res.ErrMsg,
349
+			})
350
+		} else {
351
+			c.ServeSuccessJSON(map[string]interface{}{
352
+				"failed_code": 0,
353
+				"info":        res,
354
+				"insutype":    insutype,
355
+			})
356
+		}
357
+
358
+	}
359
+}
278
 
360
 
279
 func (c *ZHHisApiController) GetZHInHospitalCheck() {
361
 func (c *ZHHisApiController) GetZHInHospitalCheck() {
280
 	id, _ := c.GetInt64("id")
362
 	id, _ := c.GetInt64("id")
293
 	start_time := c.GetString("start_time")
375
 	start_time := c.GetString("start_time")
294
 	balance_accounts_type, _ := c.GetInt64("balance_accounts_type")
376
 	balance_accounts_type, _ := c.GetInt64("balance_accounts_type")
295
 
377
 
378
+	social_type, _ := c.GetInt64("social_type")
379
+	psn_type, _ := c.GetInt64("psn_type")
380
+
296
 	//reg_type, _ := c.GetInt64("p_type")
381
 	//reg_type, _ := c.GetInt64("p_type")
297
 	med_type, _ := c.GetInt64("med_type")
382
 	med_type, _ := c.GetInt64("med_type")
298
 	diagnosis_ids_arr := strings.Split(diagnosis_ids, "-")
383
 	diagnosis_ids_arr := strings.Split(diagnosis_ids, "-")
346
 
431
 
347
 	if res2.Infcode == 0 {
432
 	if res2.Infcode == 0 {
348
 
433
 
349
-		var insutypes []string
350
-
351
-		var insutype string
352
-		var is390 int = 0
353
-		var is310 int = 0
354
-		for _, item := range res2.Output.Iinfo {
355
-			if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
356
-				insutypes = append(insutypes, item.Insutype)
357
-			}
358
-		}
359
-		if len(insutypes) == 1 {
360
-			insutype = insutypes[0]
361
-		} else {
362
-			for _, i := range insutypes {
363
-				if i == "390" {
364
-					is390 = 1
365
-				}
366
-
367
-				if i == "310" {
368
-					is310 = 1
369
-				}
370
-			}
371
-		}
372
-		if is390 == 1 {
373
-			insutype = "390"
374
-		}
375
-		if is310 == 1 {
376
-			insutype = "310"
377
-		}
378
-
379
-		if len(insutypes) == 0 {
380
-			insutype = "310"
381
-		}
434
+		//var insutypes []string
435
+		//
436
+		//var insutype string
437
+		//var is390 int = 0
438
+		//var is310 int = 0
439
+		//for _, item := range res2.Output.Iinfo {
440
+		//	if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
441
+		//		insutypes = append(insutypes, item.Insutype)
442
+		//	}
443
+		//}
444
+		//if len(insutypes) == 1 {
445
+		//	insutype = insutypes[0]
446
+		//} else {
447
+		//	for _, i := range insutypes {
448
+		//		if i == "390" {
449
+		//			is390 = 1
450
+		//		}
451
+		//
452
+		//		if i == "310" {
453
+		//			is310 = 1
454
+		//		}
455
+		//	}
456
+		//}
457
+		//if is390 == 1 {
458
+		//	insutype = "390"
459
+		//}
460
+		//if is310 == 1 {
461
+		//	insutype = "310"
462
+		//}
463
+		//
464
+		//if len(insutypes) == 0 {
465
+		//	insutype = "310"
466
+		//}
382
 
467
 
383
 		timestamp := time.Now().Unix()
468
 		timestamp := time.Now().Unix()
384
 		tempTime := time.Unix(timestamp, 0)
469
 		tempTime := time.Unix(timestamp, 0)
389
 		timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
474
 		timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
390
 		var struct2401 service.Struct2401
475
 		var struct2401 service.Struct2401
391
 		struct2401.PsnNo = res2.Output.Baseinfo.PsnNo
476
 		struct2401.PsnNo = res2.Output.Baseinfo.PsnNo
392
-		struct2401.Insutype = insutype
477
+		struct2401.Insutype = strconv.FormatInt(int64(social_type), 10)
393
 		struct2401.MdtrtCertType = "02"
478
 		struct2401.MdtrtCertType = "02"
394
 		struct2401.MdtrtCertNo = res2.Output.Baseinfo.Certno
479
 		struct2401.MdtrtCertNo = res2.Output.Baseinfo.Certno
395
 		struct2401.MedType = strconv.FormatInt(int64(med_type), 10)
480
 		struct2401.MedType = strconv.FormatInt(int64(med_type), 10)
473
 				Gend:                 res2.Output.Baseinfo.Gend,
558
 				Gend:                 res2.Output.Baseinfo.Gend,
474
 				Naty:                 res2.Output.Baseinfo.Naty,
559
 				Naty:                 res2.Output.Baseinfo.Naty,
475
 				MedType:              med_type,
560
 				MedType:              med_type,
476
-				InsutypeType:         insutype,
561
+				InsutypeType:         strconv.FormatInt(int64(social_type), 10),
477
 				Brdy:                 res2.Output.Baseinfo.Brdy,
562
 				Brdy:                 res2.Output.Baseinfo.Brdy,
478
 				Iinfo:                infoStr,
563
 				Iinfo:                infoStr,
479
 				Idetinfo:             idetinfoStr,
564
 				Idetinfo:             idetinfoStr,
489
 				Certificates:         certificates,
574
 				Certificates:         certificates,
490
 				Phone:                phone,
575
 				Phone:                phone,
491
 				BalanceAccountsType:  balance_accounts_type,
576
 				BalanceAccountsType:  balance_accounts_type,
577
+				PsnType:              psn_type,
492
 			}
578
 			}
493
 			service.CreateHospitalRecord(inHospital)
579
 			service.CreateHospitalRecord(inHospital)
494
 			c.ServeSuccessJSON(map[string]interface{}{
580
 			c.ServeSuccessJSON(map[string]interface{}{
953
 					//randNum = rand.Intn(10000) + 1000
1039
 					//randNum = rand.Intn(10000) + 1000
954
 					if subItem.Type == 2 {
1040
 					if subItem.Type == 2 {
955
 						if len(subItem.HisProject.MedicalCode) > 0 {
1041
 						if len(subItem.HisProject.MedicalCode) > 0 {
1042
+							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
956
 							cus := &models.NewCustom{
1043
 							cus := &models.NewCustom{
957
-								DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
958
-								Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
1044
+								DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
1045
+								Cut:              fmt.Sprintf("%.2f", cnt),
959
 								FeedetlSn:        subItem.FeedetlSn,
1046
 								FeedetlSn:        subItem.FeedetlSn,
960
 								Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
1047
 								Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
961
 								MedListCodg:      subItem.HisProject.MedicalCode,
1048
 								MedListCodg:      subItem.HisProject.MedicalCode,
965
 						}
1052
 						}
966
 					} else if subItem.Type == 3 {
1053
 					} else if subItem.Type == 3 {
967
 						if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
1054
 						if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
1055
+							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
1056
+
968
 							cus := &models.NewCustom{
1057
 							cus := &models.NewCustom{
969
-								DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
970
-								Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
1058
+								DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
1059
+								Cut:              fmt.Sprintf("%.2f", cnt),
971
 								FeedetlSn:        subItem.FeedetlSn,
1060
 								FeedetlSn:        subItem.FeedetlSn,
972
 								Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
1061
 								Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
973
 								MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
1062
 								MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
1136
 					}
1225
 					}
1137
 					if item.Type == 2 { //项目
1226
 					if item.Type == 2 { //项目
1138
 						for _, subItem := range item.HisPrescriptionProject {
1227
 						for _, subItem := range item.HisPrescriptionProject {
1139
-							total = total + (subItem.Price * float64(subItem.Count))
1228
+							cnt, _ := strconv.ParseFloat(subItem.Count, 64)
1229
+							total = total + (subItem.Price * cnt)
1140
 						}
1230
 						}
1141
 					}
1231
 					}
1142
 				}
1232
 				}

+ 1 - 1
models/his_models.go View File

495
 	HisPatientId       int64            `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
495
 	HisPatientId       int64            `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
496
 	RecordDate         int64            `gorm:"column:record_date" json:"record_date" form:"record_date"`
496
 	RecordDate         int64            `gorm:"column:record_date" json:"record_date" form:"record_date"`
497
 	PrescriptionId     int64            `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
497
 	PrescriptionId     int64            `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
498
-	Count              int64            `gorm:"column:count" json:"count" form:"count"`
498
+	Count              string           `gorm:"column:count" json:"count" form:"count"`
499
 	FeedetlSn          string           `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
499
 	FeedetlSn          string           `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
500
 	MedListCodg        string           `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
500
 	MedListCodg        string           `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
501
 	SingleDose         string           `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
501
 	SingleDose         string           `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`

+ 1 - 0
models/zh_his_models.go View File

40
 	OutWay               int64  `gorm:"column:out_way" json:"out_way" form:"out_way"`
40
 	OutWay               int64  `gorm:"column:out_way" json:"out_way" form:"out_way"`
41
 	Phone                string `gorm:"column:phone" json:"phone" form:"phone"`
41
 	Phone                string `gorm:"column:phone" json:"phone" form:"phone"`
42
 	BalanceAccountsType  int64  `gorm:"column:balance_accounts_type" json:"balance_accounts_type" form:"balance_accounts_type"`
42
 	BalanceAccountsType  int64  `gorm:"column:balance_accounts_type" json:"balance_accounts_type" form:"balance_accounts_type"`
43
+	PsnType              int64  `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
43
 }
44
 }
44
 
45
 
45
 func (HisHospitalCheckRecord) TableName() string {
46
 func (HisHospitalCheckRecord) TableName() string {

+ 7 - 5
service/gdyb_service.go View File

839
 				//randNum = rand.Intn(10000) + 1000
839
 				//randNum = rand.Intn(10000) + 1000
840
 				if subItem.Type == 2 {
840
 				if subItem.Type == 2 {
841
 					if len(subItem.HisProject.MedicalCode) > 0 {
841
 					if len(subItem.HisProject.MedicalCode) > 0 {
842
-
842
+						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
843
 						cus := &Custom{
843
 						cus := &Custom{
844
-							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
845
-							Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
844
+							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
845
+							Cut:              fmt.Sprintf("%.2f", cnt),
846
 							FeedetlSn:        subItem.FeedetlSn,
846
 							FeedetlSn:        subItem.FeedetlSn,
847
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
847
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
848
 							MedListCodg:      subItem.HisProject.MedicalCode,
848
 							MedListCodg:      subItem.HisProject.MedicalCode,
855
 
855
 
856
 				} else if subItem.Type == 3 {
856
 				} else if subItem.Type == 3 {
857
 					if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
857
 					if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
858
+						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
859
+
858
 						cus := &Custom{
860
 						cus := &Custom{
859
-							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
860
-							Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
861
+							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
862
+							Cut:              fmt.Sprintf("%.2f", cnt),
861
 							FeedetlSn:        subItem.FeedetlSn,
863
 							FeedetlSn:        subItem.FeedetlSn,
862
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
864
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
863
 							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
865
 							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,

+ 7 - 4
service/hbyb_service.go View File

298
 				//randNum = rand.Intn(10000) + 1000
298
 				//randNum = rand.Intn(10000) + 1000
299
 				if subItem.Type == 2 {
299
 				if subItem.Type == 2 {
300
 					if len(subItem.HisProject.MedicalCode) > 0 {
300
 					if len(subItem.HisProject.MedicalCode) > 0 {
301
+						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
301
 
302
 
302
 						cus := &Custom{
303
 						cus := &Custom{
303
-							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
304
-							Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
304
+							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
305
+							Cut:              fmt.Sprintf("%.2f", cnt),
305
 							FeedetlSn:        subItem.FeedetlSn,
306
 							FeedetlSn:        subItem.FeedetlSn,
306
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
307
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
307
 							MedListCodg:      subItem.HisProject.MedicalCode,
308
 							MedListCodg:      subItem.HisProject.MedicalCode,
312
 
313
 
313
 				} else if subItem.Type == 3 {
314
 				} else if subItem.Type == 3 {
314
 					if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
315
 					if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
316
+						cnt, _ := strconv.ParseFloat(subItem.Count, 64)
317
+
315
 						cus := &Custom{
318
 						cus := &Custom{
316
-							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
317
-							Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
319
+							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
320
+							Cut:              fmt.Sprintf("%.2f", cnt),
318
 							FeedetlSn:        subItem.FeedetlSn,
321
 							FeedetlSn:        subItem.FeedetlSn,
319
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
322
 							Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
320
 							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,
323
 							MedListCodg:      subItem.GoodInfo.MedicalInsuranceNumber,