瀏覽代碼

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

csx 3 年之前
父節點
當前提交
172e383e71
共有 4 個文件被更改,包括 108 次插入52 次删除
  1. 5 5
      conf/app.conf
  2. 64 23
      controllers/sg/his_api_controller.go
  3. 26 23
      models/his_models.go
  4. 13 1
      service/his_service.go

+ 5 - 5
conf/app.conf 查看文件

1
 appname = 血透
1
 appname = 血透
2
 httpport = 9532
2
 httpport = 9532
3
-runmode = dev
3
+runmode = prod
4
 
4
 
5
 
5
 
6
 #
6
 #
53
 front_end_domain = "https://xt.kuyicloud.com/#"
53
 front_end_domain = "https://xt.kuyicloud.com/#"
54
 #url  = "http://192.168.1.228:17001/szsi-portal/transData"
54
 #url  = "http://192.168.1.228:17001/szsi-portal/transData"
55
 url = "http://192.168.1.88:6666/szsi-portal/transData"
55
 url = "http://192.168.1.88:6666/szsi-portal/transData"
56
-gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57
-#gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
56
+#gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57
+gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
58
 #gdyb_paasid = "sg03_prd"
58
 #gdyb_paasid = "sg03_prd"
59
-gdyb_paasid = "jm_sc_yjyy"
59
+#gdyb_paasid = "jm_sc_yjyy"
60
 #gdyb_paasid = "zh_prd_yjyy"
60
 #gdyb_paasid = "zh_prd_yjyy"
61
-#gdyb_paasid = "sz_prd_yjyy"
61
+gdyb_paasid = "sz_prd_yjyy"
62
 #gdyb_paasid = "zq_prd_yjyy"
62
 #gdyb_paasid = "zq_prd_yjyy"
63
 
63
 
64
 
64
 

+ 64 - 23
controllers/sg/his_api_controller.go 查看文件

51
 	beego.Router("/api/readcard", &HisApiController{}, "get:ReadCard")
51
 	beego.Router("/api/readcard", &HisApiController{}, "get:ReadCard")
52
 
52
 
53
 	//beego.Router("/api/testpay", &HisApiController{}, "get:TestPay")
53
 	//beego.Router("/api/testpay", &HisApiController{}, "get:TestPay")
54
-
55
 	beego.Router("/api/presettle/get", &HisApiController{}, "get:GetPreUploadInfo")
54
 	beego.Router("/api/presettle/get", &HisApiController{}, "get:GetPreUploadInfo")
56
 
55
 
57
 	//beego.Router("/api/settle/get", &HisApiController{}, "get:GetSettleInfo")
56
 	//beego.Router("/api/settle/get", &HisApiController{}, "get:GetSettleInfo")
58
 
57
 
59
 	beego.Router("/api/310", &HisApiController{}, "get:Check310")
58
 	beego.Router("/api/310", &HisApiController{}, "get:Check310")
59
+
60
 	beego.Router("/api/390", &HisApiController{}, "get:Check390")
60
 	beego.Router("/api/390", &HisApiController{}, "get:Check390")
61
 
61
 
62
 	beego.Router("/api/patient/info", &HisApiController{}, "get:GetPatientInfo")
62
 	beego.Router("/api/patient/info", &HisApiController{}, "get:GetPatientInfo")
63
-
64
 	//备案撤销相关接口
63
 	//备案撤销相关接口
65
 	beego.Router("/api/checkcode/get", &HisApiController{}, "get:GetCheckCode")
64
 	beego.Router("/api/checkcode/get", &HisApiController{}, "get:GetCheckCode")
66
 	beego.Router("/api/uncheckcode/get", &HisApiController{}, "get:UnCheckCode")
65
 	beego.Router("/api/uncheckcode/get", &HisApiController{}, "get:UnCheckCode")
2565
 						}
2564
 						}
2566
 					}
2565
 					}
2567
 
2566
 
2568
-					allTotal := fmt.Sprintf("%.2f", total)
2567
+					allTotal := fmt.Sprintf("%.4f", total)
2569
 					if res.Infcode == 0 {
2568
 					if res.Infcode == 0 {
2570
 						var rf []*ResultFive
2569
 						var rf []*ResultFive
2571
 						json.Unmarshal([]byte(his.Iinfo), &rf)
2570
 						json.Unmarshal([]byte(his.Iinfo), &rf)
2818
 
2817
 
2819
 	} else if tempOrder.ID > 0 {
2818
 	} else if tempOrder.ID > 0 {
2820
 		if tempOrder.IsPre == 1 {
2819
 		if tempOrder.IsPre == 1 {
2821
-			allTotal := fmt.Sprintf("%.2f", tempOrder.MedfeeSumamt)
2820
+			allTotal := fmt.Sprintf("%.4f", tempOrder.MedfeeSumamt)
2822
 			var rf []*ResultFive
2821
 			var rf []*ResultFive
2823
 			json.Unmarshal([]byte(his.Iinfo), &rf)
2822
 			json.Unmarshal([]byte(his.Iinfo), &rf)
2824
 			chrg_bchno := tempOrder.Number
2823
 			chrg_bchno := tempOrder.Number
3933
 					}
3932
 					}
3934
 				}
3933
 				}
3935
 
3934
 
3936
-				allTotal := fmt.Sprintf("%.2f", total)
3935
+				allTotal := fmt.Sprintf("%.4f", total)
3937
 				if res.Infcode == 0 {
3936
 				if res.Infcode == 0 {
3938
 					var rf []*ResultFive
3937
 					var rf []*ResultFive
3939
 					json.Unmarshal([]byte(his.Iinfo), &rf)
3938
 					json.Unmarshal([]byte(his.Iinfo), &rf)
4798
 			"&setl_optins=" + "定点医保中心" +
4797
 			"&setl_optins=" + "定点医保中心" +
4799
 			"&stmt_begndate=" + start_time +
4798
 			"&stmt_begndate=" + start_time +
4800
 			"&stm_enddate=" + end_time +
4799
 			"&stm_enddate=" + end_time +
4801
-			"&medfee_sumamt=" + fmt.Sprintf("%.2f", medfee_sumamt) +
4802
-			"&fund_pay_sumamt=" + fmt.Sprintf("%.2f", fund_pay_sumamt) +
4803
-			"&acct_pay=" + fmt.Sprintf("%.2f", acct_pay) +
4800
+			"&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
4801
+			"&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
4802
+			"&acct_pay=" + fmt.Sprintf("%.4f", acct_pay) +
4804
 			"&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
4803
 			"&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
4805
 			"&fixmedins_code=" + miConfig.Code +
4804
 			"&fixmedins_code=" + miConfig.Code +
4806
 			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
4805
 			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
5038
 				str = item.SetlId + "	" +
5037
 				str = item.SetlId + "	" +
5039
 					item.MdtrtId + "	" +
5038
 					item.MdtrtId + "	" +
5040
 					item.PsnNo + "	" +
5039
 					item.PsnNo + "	" +
5041
-					fmt.Sprintf("%.2f", item.MedfeeSumamt) + "	" +
5042
-					fmt.Sprintf("%.2f", item.FundPaySumamt) + "	" +
5043
-					fmt.Sprintf("%.2f", item.AcctPay) + "	" + refd_setl_flag + "\r\n"
5040
+					fmt.Sprintf("%.4f", item.MedfeeSumamt) + "	" +
5041
+					fmt.Sprintf("%.4f", item.FundPaySumamt) + "	" +
5042
+					fmt.Sprintf("%.4f", item.AcctPay) + "	" + refd_setl_flag + "\r\n"
5044
 				_, err = f.Write([]byte(str))
5043
 				_, err = f.Write([]byte(str))
5045
 			}
5044
 			}
5046
 			if item.OrderStatus == 3 {
5045
 			if item.OrderStatus == 3 {
5049
 				str = item.SetlId + "	" +
5048
 				str = item.SetlId + "	" +
5050
 					item.MdtrtId + "	" +
5049
 					item.MdtrtId + "	" +
5051
 					item.PsnNo + "	" +
5050
 					item.PsnNo + "	" +
5052
-					fmt.Sprintf("%.2f", item.MedfeeSumamt) + "	" +
5053
-					fmt.Sprintf("%.2f", item.FundPaySumamt) + "	" +
5054
-					fmt.Sprintf("%.2f", item.AcctPay) + "	" + "1" + "\r\n"
5051
+					fmt.Sprintf("%.4f", item.MedfeeSumamt) + "	" +
5052
+					fmt.Sprintf("%.4f", item.FundPaySumamt) + "	" +
5053
+					fmt.Sprintf("%.4f", item.AcctPay) + "	" + "1" + "\r\n"
5055
 				_, err = f.Write([]byte(str))
5054
 				_, err = f.Write([]byte(str))
5056
 
5055
 
5057
 				var str2 string
5056
 				var str2 string
5058
 				str2 = item.SetlId + "	" +
5057
 				str2 = item.SetlId + "	" +
5059
 					item.MdtrtId + "	" +
5058
 					item.MdtrtId + "	" +
5060
 					item.PsnNo + "	" +
5059
 					item.PsnNo + "	" +
5061
-					fmt.Sprintf("%.2f", 0-item.MedfeeSumamt) + "	" +
5062
-					fmt.Sprintf("%.2f", 0-item.FundPaySumamt) + "	" +
5063
-					fmt.Sprintf("%.2f", 0-item.AcctPay) + "	" + "1" + "\r\n"
5060
+					fmt.Sprintf("%.4f", 0-item.MedfeeSumamt) + "	" +
5061
+					fmt.Sprintf("%.4f", 0-item.FundPaySumamt) + "	" +
5062
+					fmt.Sprintf("%.4f", 0-item.AcctPay) + "	" + "1" + "\r\n"
5064
 				_, err = f.Write([]byte(str2))
5063
 				_, err = f.Write([]byte(str2))
5065
 			}
5064
 			}
5066
 
5065
 
5115
 				"&setl_optins=" + "定点医保中心" +
5114
 				"&setl_optins=" + "定点医保中心" +
5116
 				"&stmt_begndate=" + start_time +
5115
 				"&stmt_begndate=" + start_time +
5117
 				"&stm_enddate=" + end_time +
5116
 				"&stm_enddate=" + end_time +
5118
-				"&medfee_sumamt=" + fmt.Sprintf("%.2f", medfee_sumamt) +
5119
-				"&fund_pay_sumamt=" + fmt.Sprintf("%.2f", fund_pay_sumamt) +
5120
-				"&cash_payamt=" + fmt.Sprintf("%.2f", psn_cash_pay) +
5117
+				"&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
5118
+				"&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
5119
+				"&cash_payamt=" + fmt.Sprintf("%.4f", psn_cash_pay) +
5121
 				"&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
5120
 				"&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
5122
 				"&fixmedins_code=" + miConfig.Code +
5121
 				"&fixmedins_code=" + miConfig.Code +
5123
 				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
5122
 				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
5184
 	}
5183
 	}
5185
 }
5184
 }
5186
 
5185
 
5186
+type CustomOrderInfo struct {
5187
+	Name  string
5188
+	Spec  string
5189
+	Unit  string
5190
+	Count float64
5191
+	Price float64
5192
+	Total float64
5193
+}
5194
+
5187
 func (c *HisApiController) GetSettleAccounts() {
5195
 func (c *HisApiController) GetSettleAccounts() {
5188
 	//id, _ := c.GetInt64("id")
5196
 	//id, _ := c.GetInt64("id")
5189
 	//record_time := c.GetString("record_time")
5197
 	//record_time := c.GetString("record_time")
5204
 	his, _ := service.GetHisPatientByNumber(order.MdtrtId)
5212
 	his, _ := service.GetHisPatientByNumber(order.MdtrtId)
5205
 	orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
5213
 	orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
5206
 	orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
5214
 	orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
5215
+	orderInfos_three, _ := service.GetHisOrderInfoByNumberThree(order.Number)
5216
+
5217
+	var orderInfos_four []*models.HisOrderInfo
5218
+	for _, item := range orderInfos_three {
5219
+		if item.HisPrescriptionProject.HisProject.CostClassify == 3 {
5220
+			item.HisPrescriptionProject.IsCheckTeam = 1
5221
+			orderInfos_four = append(orderInfos_four, item)
5222
+
5223
+		}
5224
+		if item.HisPrescriptionProject.HisProject.CostClassify != 3 {
5225
+			item.HisPrescriptionProject.IsCheckTeam = 2
5226
+			orderInfos_two = append(orderInfos_two, item)
5227
+		}
5228
+	}
5229
+
5230
+	new_order_info := RemoveRepeatedTeam(orderInfos_four)
5231
+	var cus_slice []CustomOrderInfo
5232
+	for _, item := range new_order_info {
5233
+		var cus CustomOrderInfo
5234
+		cus.Name = item.HisPrescriptionProject.XtHisProjectTeam.ProjectTeam
5235
+		cus.Unit = ""
5236
+		cus.Spec = ""
5237
+		for _, subItem := range orderInfos_four {
5238
+			if item.HisPrescriptionProject.TeamId == subItem.HisPrescriptionProject.TeamId {
5239
+				cus.Count = cus.Count + subItem.Cnt
5240
+				cus.Price = cus.Price + subItem.Pric
5241
+				cus.Total = cus.Total + (cus.Price * cus.Count)
5242
+			}
5243
+		}
5244
+		cus_slice = append(cus_slice, cus)
5245
+	}
5246
+
5207
 	orderInfos = append(orderInfos, orderInfos_two...)
5247
 	orderInfos = append(orderInfos, orderInfos_two...)
5208
 	//diagnosisConfig, _ := service.FindDiagnoseById(his.Diagnosis)
5248
 	//diagnosisConfig, _ := service.FindDiagnoseById(his.Diagnosis)
5209
 
5249
 
5482
 				"org_name":                                    miConfig.OrgName,
5522
 				"org_name":                                    miConfig.OrgName,
5483
 				"org_code":                                    miConfig.Code,
5523
 				"org_code":                                    miConfig.Code,
5484
 				"order_number":                                order.Number,
5524
 				"order_number":                                order.Number,
5525
+				"check_order_info":                            cus_slice,
5485
 			})
5526
 			})
5486
 		}
5527
 		}
5487
 	}
5528
 	}
6683
 	return fd
6724
 	return fd
6684
 }
6725
 }
6685
 
6726
 
6686
-func RemoveRepeatedCode(arr []string) (newArr []string) {
6687
-	newArr = make([]string, 0)
6727
+func RemoveRepeatedTeam(arr []*models.HisOrderInfo) (newArr []*models.HisOrderInfo) {
6728
+	newArr = make([]*models.HisOrderInfo, 0)
6688
 	for i := 0; i < len(arr); i++ {
6729
 	for i := 0; i < len(arr); i++ {
6689
 		repeat := false
6730
 		repeat := false
6690
 		for j := i + 1; j < len(arr); j++ {
6731
 		for j := i + 1; j < len(arr); j++ {
6691
-			if arr[i] == arr[j] {
6732
+			if arr[i].HisPrescriptionProject.TeamId == arr[j].HisPrescriptionProject.TeamId {
6692
 				repeat = true
6733
 				repeat = true
6693
 				break
6734
 				break
6694
 			}
6735
 			}

+ 26 - 23
models/his_models.go 查看文件

483
 }
483
 }
484
 
484
 
485
 type HisPrescriptionProject struct {
485
 type HisPrescriptionProject struct {
486
-	ID                 int64      `gorm:"column:id" json:"id" form:"id"`
487
-	ProjectId          int64      `gorm:"column:project_id" json:"project_id" form:"project_id"`
488
-	Price              float64    `gorm:"column:price" json:"price" form:"price"`
489
-	UserOrgId          int64      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
490
-	Status             int64      `gorm:"column:status" json:"status" form:"status"`
491
-	Ctime              int64      `gorm:"column:ctime" json:"ctime" form:"ctime"`
492
-	Mtime              int64      `gorm:"column:mtime" json:"mtime" form:"mtime"`
493
-	PatientId          int64      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
494
-	HisPatientId       int64      `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
495
-	RecordDate         int64      `gorm:"column:record_date" json:"record_date" form:"record_date"`
496
-	PrescriptionId     int64      `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
497
-	Count              int64      `gorm:"column:count" json:"count" form:"count"`
498
-	FeedetlSn          string     `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
499
-	MedListCodg        string     `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
500
-	SingleDose         string     `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
501
-	DeliveryWay        string     `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
502
-	ExecutionFrequency string     `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
503
-	Day                string     `gorm:"column:day" json:"day" form:"day"`
504
-	HisProject         HisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
505
-	GoodInfo           GoodInfo   `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
506
-	Type               int64      `gorm:"column:type" json:"type" form:"type"`
507
-	Remark             string     `gorm:"column:remark" json:"remark" form:"remark"`
508
-	Unit               string     `gorm:"column:unit" json:"unit" form:"unit"`
486
+	ID                 int64            `gorm:"column:id" json:"id" form:"id"`
487
+	ProjectId          int64            `gorm:"column:project_id" json:"project_id" form:"project_id"`
488
+	Price              float64          `gorm:"column:price" json:"price" form:"price"`
489
+	UserOrgId          int64            `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
490
+	Status             int64            `gorm:"column:status" json:"status" form:"status"`
491
+	Ctime              int64            `gorm:"column:ctime" json:"ctime" form:"ctime"`
492
+	Mtime              int64            `gorm:"column:mtime" json:"mtime" form:"mtime"`
493
+	PatientId          int64            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
494
+	HisPatientId       int64            `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
495
+	RecordDate         int64            `gorm:"column:record_date" json:"record_date" form:"record_date"`
496
+	PrescriptionId     int64            `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
497
+	Count              int64            `gorm:"column:count" json:"count" form:"count"`
498
+	FeedetlSn          string           `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
499
+	MedListCodg        string           `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
500
+	SingleDose         string           `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
501
+	DeliveryWay        string           `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
502
+	ExecutionFrequency string           `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
503
+	Day                string           `gorm:"column:day" json:"day" form:"day"`
504
+	HisProject         HisProject       `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
505
+	GoodInfo           GoodInfo         `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
506
+	Type               int64            `gorm:"column:type" json:"type" form:"type"`
507
+	Remark             string           `gorm:"column:remark" json:"remark" form:"remark"`
508
+	Unit               string           `gorm:"column:unit" json:"unit" form:"unit"`
509
+	TeamId             int64            `gorm:"column:team_id" json:"team_id" form:"team_id"`
510
+	XtHisProjectTeam   XtHisProjectTeam `gorm:"ForeignKey:TeamId;AssociationForeignKey:ID" json:"team"`
511
+	IsCheckTeam        int64            `gorm:"-" json:"is_check_team" form:"is_check_team"`
509
 }
512
 }
510
 
513
 
511
 func (HisPrescriptionProject) TableName() string {
514
 func (HisPrescriptionProject) TableName() string {

+ 13 - 1
service/his_service.go 查看文件

953
 
953
 
954
 func GetHisOrderInfoByNumberTwo(order_number string) (order []*models.HisOrderInfo, err error) {
954
 func GetHisOrderInfoByNumberTwo(order_number string) (order []*models.HisOrderInfo, err error) {
955
 	db := readDb.Model(&models.HisOrderInfo{})
955
 	db := readDb.Model(&models.HisOrderInfo{})
956
+	db = db.Joins("Join his_prescription_project as p  On p.id = his_order_info.project_id AND p.team_id = 0")
956
 	db = db.Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
957
 	db = db.Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
957
-		return db.Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("status = 1")
958
+		return db.Preload("XtHisProjectTeam", "status = 1").Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("status = 1")
959
+	})
960
+	err = db.Where("order_number = ? AND status = 1 AND project_id > 0", order_number).Find(&order).Error
961
+	return
962
+}
963
+
964
+func GetHisOrderInfoByNumberThree(order_number string) (order []*models.HisOrderInfo, err error) {
965
+	db := readDb.Model(&models.HisOrderInfo{})
966
+	db = db.Joins("Join his_prescription_project as p  On p.id = his_order_info.project_id AND p.team_id > 0")
967
+
968
+	db = db.Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
969
+		return db.Preload("XtHisProjectTeam", "status = 1").Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("status = 1")
958
 	})
970
 	})
959
 	err = db.Where("order_number = ? AND status = 1 AND project_id > 0", order_number).Find(&order).Error
971
 	err = db.Where("order_number = ? AND status = 1 AND project_id > 0", order_number).Find(&order).Error
960
 	return
972
 	return