Browse Source

医保对接

csx 3 years ago
parent
commit
028c49caef

+ 60 - 59
controllers/base_api_controller.go View File

@@ -2,6 +2,7 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
+	"XT_New/models"
5 6
 	"XT_New/service"
6 7
 	"fmt"
7 8
 	"strconv"
@@ -69,36 +70,36 @@ type BaseAuthAPIController struct {
69 70
 func (this *BaseAuthAPIController) Prepare() {
70 71
 	this.BaseAPIController.Prepare()
71 72
 	if this.GetAdminUserInfo() == nil {
72
-		//var userAdmin models.AdminUser
73
-		//userAdmin.Id = 1448
74
-		//userAdmin.Mobile = "13318599895"
75
-		//
76
-		//userAdmin.Id = 597
77
-		//userAdmin.Mobile = "19874122664"
78
-		//userAdmin.IsSuperAdmin = false
79
-		//userAdmin.Status = 1
80
-		//userAdmin.CreateTime = 1530786071
81
-		//userAdmin.ModifyTime = 1530786071
82
-		//var subscibe models.ServeSubscibe
83
-		//subscibe.ID = 1
84
-		//subscibe.OrgId = 4
85
-		//subscibe.PeriodStart = 1538035409
86
-		//subscibe.PeriodEnd = 1569571409
87
-		//subscibe.State = 1
88
-		//subscibe.Status = 1
89
-		//subscibe.CreatedTime = 1538035409
90
-		//subscibe.UpdatedTime = 1538035409
91
-		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
-		//subscibes[4] = &subscibe
93
-		//var adminUserInfo service.AdminUserInfo
94
-		//adminUserInfo.CurrentOrgId = 4
95
-		//adminUserInfo.CurrentAppId = 4
96
-		//adminUserInfo.AdminUser = &userAdmin
97
-		//adminUserInfo.Subscibes = subscibes
98
-		//this.SetSession("admin_user_info", &adminUserInfo)
99
-
100
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
101
-		this.StopRun()
73
+		var userAdmin models.AdminUser
74
+		userAdmin.Id = 1448
75
+		userAdmin.Mobile = "13318599895"
76
+
77
+		userAdmin.Id = 597
78
+		userAdmin.Mobile = "19874122664"
79
+		userAdmin.IsSuperAdmin = false
80
+		userAdmin.Status = 1
81
+		userAdmin.CreateTime = 1530786071
82
+		userAdmin.ModifyTime = 1530786071
83
+		var subscibe models.ServeSubscibe
84
+		subscibe.ID = 1
85
+		subscibe.OrgId = 3877
86
+		subscibe.PeriodStart = 1538035409
87
+		subscibe.PeriodEnd = 1569571409
88
+		subscibe.State = 1
89
+		subscibe.Status = 1
90
+		subscibe.CreatedTime = 1538035409
91
+		subscibe.UpdatedTime = 1538035409
92
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
+		subscibes[4] = &subscibe
94
+		var adminUserInfo service.AdminUserInfo
95
+		adminUserInfo.CurrentOrgId = 3877
96
+		adminUserInfo.CurrentAppId = 4
97
+		adminUserInfo.AdminUser = &userAdmin
98
+		adminUserInfo.Subscibes = subscibes
99
+		this.SetSession("admin_user_info", &adminUserInfo)
100
+
101
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
102
+		//this.StopRun()
102 103
 
103 104
 	}
104 105
 
@@ -315,35 +316,35 @@ type BaseServeAPIController struct {
315 316
 func (this *BaseServeAPIController) Prepare() {
316 317
 	this.BaseAPIController.Prepare()
317 318
 	if this.GetAdminUserInfo() == nil {
318
-		//var userAdmin models.AdminUser
319
-		//userAdmin.Id = 1448
320
-		//userAdmin.Mobile = "13318599895"
321
-		//
322
-		//userAdmin.Id = 597
323
-		//userAdmin.Mobile = "19874122664"
324
-		//userAdmin.IsSuperAdmin = false
325
-		//userAdmin.Status = 1
326
-		//userAdmin.CreateTime = 1530786071
327
-		//userAdmin.ModifyTime = 1530786071
328
-		//var subscibe models.ServeSubscibe
329
-		//subscibe.ID = 1
330
-		//subscibe.OrgId = 4
331
-		//subscibe.PeriodStart = 1538035409
332
-		//subscibe.PeriodEnd = 1569571409
333
-		//subscibe.State = 1
334
-		//subscibe.Status = 1
335
-		//subscibe.CreatedTime = 1538035409
336
-		//subscibe.UpdatedTime = 1538035409
337
-		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
-		//subscibes[4] = &subscibe
339
-		//var adminUserInfo service.AdminUserInfo
340
-		//adminUserInfo.CurrentOrgId = 4
341
-		//adminUserInfo.CurrentAppId = 4
342
-		//adminUserInfo.AdminUser = &userAdmin
343
-		//adminUserInfo.Subscibes = subscibes
344
-		//this.SetSession("admin_user_info", &adminUserInfo)
345
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
346
-		this.StopRun()
319
+		var userAdmin models.AdminUser
320
+		userAdmin.Id = 1448
321
+		userAdmin.Mobile = "13318599895"
322
+
323
+		userAdmin.Id = 597
324
+		userAdmin.Mobile = "19874122664"
325
+		userAdmin.IsSuperAdmin = false
326
+		userAdmin.Status = 1
327
+		userAdmin.CreateTime = 1530786071
328
+		userAdmin.ModifyTime = 1530786071
329
+		var subscibe models.ServeSubscibe
330
+		subscibe.ID = 1
331
+		subscibe.OrgId = 3877
332
+		subscibe.PeriodStart = 1538035409
333
+		subscibe.PeriodEnd = 1569571409
334
+		subscibe.State = 1
335
+		subscibe.Status = 1
336
+		subscibe.CreatedTime = 1538035409
337
+		subscibe.UpdatedTime = 1538035409
338
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
+		subscibes[4] = &subscibe
340
+		var adminUserInfo service.AdminUserInfo
341
+		adminUserInfo.CurrentOrgId = 3877
342
+		adminUserInfo.CurrentAppId = 4
343
+		adminUserInfo.AdminUser = &userAdmin
344
+		adminUserInfo.Subscibes = subscibes
345
+		this.SetSession("admin_user_info", &adminUserInfo)
346
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
347
+		//this.StopRun()
347 348
 	}
348 349
 
349 350
 	//if adminUserInfo.AppRole != nil {

+ 35 - 2
controllers/his_api_controller.go View File

@@ -1884,6 +1884,22 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
1884 1884
 		advice.PrescribingNumber = prescribingNumber
1885 1885
 	}
1886 1886
 
1887
+	if json["frequency_type"] != nil || reflect.TypeOf(json["frequency_type"]).String() == "float64" {
1888
+		frequency_type := int64(json["frequency_type"].(float64))
1889
+		advice.FrequencyType = frequency_type
1890
+	}
1891
+
1892
+	if json["day_count"] != nil || reflect.TypeOf(json["day_count"]).String() == "float64" {
1893
+		day_count := int64(json["day_count"].(float64))
1894
+		advice.DayCount = day_count
1895
+	}
1896
+
1897
+	if json["week_day"] != nil && reflect.TypeOf(json["week_day"]).String() == "string" {
1898
+		//week_day, _ := strconv.ParseFloat(json["week_day"].(string), 64)
1899
+		week_day, _ := json["week_day"].(string)
1900
+		advice.WeekDay = week_day
1901
+	}
1902
+
1887 1903
 	if json["prescribing_number_unit"] != nil && reflect.TypeOf(json["prescribing_number_unit"]).String() == "string" {
1888 1904
 		prescribingNumberUnit, _ := json["prescribing_number_unit"].(string)
1889 1905
 		advice.PrescribingNumberUnit = prescribingNumberUnit
@@ -2146,6 +2162,22 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
2146 2162
 		project.Unit = unit
2147 2163
 	}
2148 2164
 
2165
+	if json["frequency_type"] != nil || reflect.TypeOf(json["frequency_type"]).String() == "float64" {
2166
+		frequency_type := int64(json["frequency_type"].(float64))
2167
+		project.FrequencyType = frequency_type
2168
+	}
2169
+
2170
+	if json["day_count"] != nil || reflect.TypeOf(json["day_count"]).String() == "float64" {
2171
+		day_count := int64(json["day_count"].(float64))
2172
+		project.DayCount = day_count
2173
+	}
2174
+
2175
+	if json["week_day"] != nil && reflect.TypeOf(json["week_day"]).String() == "string" {
2176
+		//week_day, _ := strconv.ParseFloat(json["week_day"].(string), 64)
2177
+		week_day, _ := json["week_day"].(string)
2178
+		project.WeekDay = week_day
2179
+	}
2180
+
2149 2181
 	_, stockConfig := service.FindAutomaticReduceRecordByOrgId(project.UserOrgId)
2150 2182
 
2151 2183
 	if project.ID == 0 {
@@ -2233,6 +2265,8 @@ func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditi
2233 2265
 
2234 2266
 func (c *HisApiController) setAdviceTemplateWithJSON(advice *models.HisPrescriptionAdviceTemplate, json map[string]interface{}) int {
2235 2267
 
2268
+	fmt.Println("~~~~~~")
2269
+
2236 2270
 	if json["drug_name"] == nil || reflect.TypeOf(json["drug_name"]).String() != "string" {
2237 2271
 		utils.ErrorLog("drug_name")
2238 2272
 		return enums.ErrorCodeParamWrong
@@ -2303,6 +2337,7 @@ func (c *HisApiController) setAdviceTemplateWithJSON(advice *models.HisPrescript
2303 2337
 		day := int64(json["day"].(float64))
2304 2338
 		advice.Day = day
2305 2339
 	}
2340
+
2306 2341
 	return 0
2307 2342
 }
2308 2343
 
@@ -4709,7 +4744,6 @@ func (c *HisApiController) CreateHisPrescriptionTemplate() {
4709 4744
 				if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
4710 4745
 					advices := items["advices"].([]interface{})
4711 4746
 					//group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
4712
-					groupNo := int64(0)
4713 4747
 					ctime := time.Now().Unix()
4714 4748
 					mtime := ctime
4715 4749
 					if len(advices) > 0 {
@@ -4721,7 +4755,6 @@ func (c *HisApiController) CreateHisPrescriptionTemplate() {
4721 4755
 							s.ExecutionState = 2
4722 4756
 							s.Status = 1
4723 4757
 							s.UserOrgId = adminInfo.CurrentOrgId
4724
-							s.Groupno = groupNo
4725 4758
 							s.CreatedTime = ctime
4726 4759
 							s.UpdatedTime = mtime
4727 4760
 							s.PatientId = patient_id

+ 4 - 0
controllers/his_config_api_controller.go View File

@@ -347,6 +347,10 @@ func (c *HisConfigApiController) setAdviceTemplateWithJSON(advice *models.HisPre
347 347
 		day := int64(json["day"].(float64))
348 348
 		advice.Day = day
349 349
 	}
350
+	if json["groupno"] != nil || reflect.TypeOf(json["groupno"]).String() == "float64" {
351
+		groupno := int64(json["groupno"].(float64))
352
+		advice.Groupno = groupno
353
+	}
350 354
 	return 0
351 355
 }
352 356
 

+ 33 - 0
controllers/new_mobile_api_controllers/mobile_his_api_controller.go View File

@@ -720,6 +720,22 @@ func (c *MobileHisApiController) setAdviceWithJSON(advice *models.HisDoctorAdvic
720 720
 		advice.HospApprFlag = hosp_appr_flag
721 721
 	}
722 722
 
723
+	if json["frequency_type"] != nil || reflect.TypeOf(json["frequency_type"]).String() == "float64" {
724
+		frequency_type := int64(json["frequency_type"].(float64))
725
+		advice.FrequencyType = frequency_type
726
+	}
727
+
728
+	if json["day_count"] != nil || reflect.TypeOf(json["day_count"]).String() == "float64" {
729
+		day_count := int64(json["day_count"].(float64))
730
+		advice.DayCount = day_count
731
+	}
732
+
733
+	if json["week_day"] != nil && reflect.TypeOf(json["week_day"]).String() == "string" {
734
+		//week_day, _ := strconv.ParseFloat(json["week_day"].(string), 64)
735
+		week_day, _ := json["week_day"].(string)
736
+		advice.WeekDay = week_day
737
+	}
738
+
723 739
 	if json["advice_id"] != nil && reflect.TypeOf(json["advice_id"]).String() == "float64" {
724 740
 		advice_id := int64(json["advice_id"].(float64))
725 741
 		advice.ID = advice_id
@@ -942,6 +958,23 @@ func (c *MobileHisApiController) setProjectWithJSON(project *models.HisPrescript
942 958
 		project.TeamId = team_id
943 959
 
944 960
 	}
961
+
962
+	if json["frequency_type"] != nil || reflect.TypeOf(json["frequency_type"]).String() == "float64" {
963
+		frequency_type := int64(json["frequency_type"].(float64))
964
+		project.FrequencyType = frequency_type
965
+	}
966
+
967
+	if json["day_count"] != nil || reflect.TypeOf(json["day_count"]).String() == "float64" {
968
+		day_count := int64(json["day_count"].(float64))
969
+		project.DayCount = day_count
970
+	}
971
+
972
+	if json["week_day"] != nil && reflect.TypeOf(json["week_day"]).String() == "string" {
973
+		//week_day, _ := strconv.ParseFloat(json["week_day"].(string), 64)
974
+		week_day, _ := json["week_day"].(string)
975
+		project.WeekDay = week_day
976
+	}
977
+
945 978
 	// if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
946 979
 	// 	price := int64(json["price"].(float64))
947 980
 	// 	formatInt_price := strconv.FormatInt(price, 10)

+ 7 - 0
models/his_models.go View File

@@ -774,6 +774,10 @@ type HisPrescriptionProject struct {
774 774
 	TeamId         int64 `gorm:"column:team_id" json:"team_id" form:"team_id"`
775 775
 
776 776
 	XtHisProjectTeam XtHisProjectTeam `gorm:"ForeignKey:TeamId;AssociationForeignKey:ID" json:"team"`
777
+
778
+	FrequencyType int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
779
+	DayCount      int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
780
+	WeekDay       string `gorm:"column:week_day" json:"week_day" form:"week_day"`
777 781
 }
778 782
 
779 783
 func (HisPrescriptionProject) TableName() string {
@@ -1394,6 +1398,9 @@ type HisPrescriptionProjectTemplate struct {
1394 1398
 	PrescriptionId     int64        `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1395 1399
 	XtHisProject       XtHisProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
1396 1400
 	GoodInfo           GoodInfo     `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"good_info"`
1401
+	FrequencyType      int64        `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
1402
+	DayCount           int64        `gorm:"column:day_count" json:"day_count" form:"day_count"`
1403
+	WeekDay            int64        `gorm:"column:week_day" json:"week_day" form:"week_day"`
1397 1404
 }
1398 1405
 
1399 1406
 func (HisPrescriptionProjectTemplate) TableName() string {

+ 4 - 0
service/his_service.go View File

@@ -1518,6 +1518,10 @@ type HisPrescriptionProject struct {
1518 1518
 	Checker        int64 `gorm:"column:checker" json:"checker" form:"checker"`
1519 1519
 	StartTime      int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
1520 1520
 	TeamId         int64 `gorm:"column:team_id" json:"team_id" form:"team_id"`
1521
+
1522
+	FrequencyType int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
1523
+	DayCount      int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
1524
+	WeekDay       string `gorm:"column:week_day" json:"week_day" form:"week_day"`
1521 1525
 }
1522 1526
 
1523 1527
 func (HisPrescriptionProject) TableName() string {