Browse Source

医保对接

csx 4 years ago
parent
commit
5cbd5480c9
3 changed files with 19 additions and 17 deletions
  1. 6 6
      controllers/base_api_controller.go
  2. 4 4
      controllers/his_api_controller.go
  3. 9 7
      service/his_service.go

+ 6 - 6
controllers/base_api_controller.go View File

@@ -81,7 +81,7 @@ func (this *BaseAuthAPIController) Prepare() {
81 81
 		userAdmin.ModifyTime = 1530786071
82 82
 		var subscibe models.ServeSubscibe
83 83
 		subscibe.ID = 1
84
-		subscibe.OrgId = 3877
84
+		subscibe.OrgId = 9919
85 85
 		subscibe.PeriodStart = 1538035409
86 86
 		subscibe.PeriodEnd = 1569571409
87 87
 		subscibe.State = 1
@@ -91,8 +91,8 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 3877
95
-		adminUserInfo.CurrentAppId = 3877
94
+		adminUserInfo.CurrentOrgId = 9919
95
+		adminUserInfo.CurrentAppId = 4
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
98 98
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -327,7 +327,7 @@ func (this *BaseServeAPIController) Prepare() {
327 327
 		userAdmin.ModifyTime = 1530786071
328 328
 		var subscibe models.ServeSubscibe
329 329
 		subscibe.ID = 1
330
-		subscibe.OrgId = 3877
330
+		subscibe.OrgId = 9919
331 331
 		subscibe.PeriodStart = 1538035409
332 332
 		subscibe.PeriodEnd = 1569571409
333 333
 		subscibe.State = 1
@@ -337,8 +337,8 @@ func (this *BaseServeAPIController) Prepare() {
337 337
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
338 338
 		subscibes[4] = &subscibe
339 339
 		var adminUserInfo service.AdminUserInfo
340
-		adminUserInfo.CurrentOrgId = 3877
341
-		adminUserInfo.CurrentAppId = 8642
340
+		adminUserInfo.CurrentOrgId = 9919
341
+		adminUserInfo.CurrentAppId = 4
342 342
 		adminUserInfo.AdminUser = &userAdmin
343 343
 		adminUserInfo.Subscibes = subscibes
344 344
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 4 - 4
controllers/his_api_controller.go View File

@@ -141,8 +141,8 @@ func (c *HisApiController) GetHisPatientList() {
141 141
 	}
142 142
 	recordDateTime := theTime.Unix()
143 143
 	adminInfo := c.GetAdminUserInfo()
144
-	patients, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
145
-	patients_two, _ := service.GetHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
144
+	patients, _ := service.GetHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
145
+	patients_two, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
146 146
 	patients = append(patients, patients_two...)
147 147
 	patients = RemoveRepeatedPatient(patients)
148 148
 
@@ -2471,7 +2471,7 @@ func (this *HisApiController) GetAdminUsers() {
2471 2471
 	})
2472 2472
 }
2473 2473
 
2474
-func (this *DialysisApiController) GetLastOrNextHisPrescription() {
2474
+func (this *HisApiController) GetLastOrNextHisPrescription() {
2475 2475
 	change_type, _ := this.GetInt64("type", 0)
2476 2476
 	record_date := this.GetString("record_time")
2477 2477
 	patient_id, _ := this.GetInt64("patient_id", 0)
@@ -2498,7 +2498,7 @@ func (this *DialysisApiController) GetLastOrNextHisPrescription() {
2498 2498
 	}
2499 2499
 }
2500 2500
 
2501
-func (this *DialysisApiController) GetCallHisPrescription() {
2501
+func (this *HisApiController) GetCallHisPrescription() {
2502 2502
 	patient_id, _ := this.GetInt64("patient_id", 0)
2503 2503
 	timeLayout := "2006-01-02"
2504 2504
 	loc, _ := time.LoadLocation("Local")

+ 9 - 7
service/his_service.go View File

@@ -109,11 +109,13 @@ func (VMHisOrder) TableName() string {
109 109
 }
110 110
 
111 111
 type Patients struct {
112
-	ID                    int64                 `gorm:"column:id" json:"id" form:"id"`
113
-	UserOrgId             int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
114
-	Name                  string                `gorm:"column:name" json:"name" form:"name"`
115
-	Status                int64                 `gorm:"column:status" json:"status" form:"status"`
116
-	IdCardNo              string                `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
112
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
113
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
114
+	Name         string `gorm:"column:name" json:"name" form:"name"`
115
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
116
+	IdCardNo     string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
117
+	ScheduleType int64  `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
118
+
117 119
 	Schedule              Schedule              `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"schedule"`
118 120
 	HisPatient            HisPatient            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"his_patient"`
119 121
 	HisPrescription       []*HisPrescription    `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"prescription"`
@@ -139,11 +141,11 @@ func (HisPrescription) TableName() string {
139 141
 }
140 142
 
141 143
 func GetScheduleHisPatientList(org_id int64, keywords string, record_date int64) (patients []*Patients, err error) {
142
-	db := readDb.Model(&Patients{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id).
144
+	db := readDb.Model(&Patients{}).Select("xt_patients.id,xt_patients.user_org_id,xt_patients.name,xt_patients.status,xt_patients.id_card_no,sch.schedule_type as sch_type").Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id).
143 145
 		Joins("join xt_schedule as sch ON sch.patient_id = xt_patients.id AND sch.schedule_date = ? AND sch.status = 1 AND sch.user_org_id = ?", record_date, org_id)
144 146
 	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
145 147
 	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
146
-	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date).Group("xt_patients.id").Find(&patients).Error
148
+	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date).Group("xt_patients.id").Order("sch_type").Find(&patients).Error
147 149
 	return
148 150
 }
149 151