Browse Source

医保对接

csx 3 years ago
parent
commit
25eaa8601a

+ 2 - 1
controllers/his_api_controller.go View File

@@ -3704,6 +3704,7 @@ func (c *HisApiController) GetHisOrderList() {
3704 3704
 	types, _ := c.GetInt64("type", 0)
3705 3705
 	keywords := c.GetString("keywords")
3706 3706
 	p_type, _ := c.GetInt64("p_type", 0)
3707
+	sort_type, _ := c.GetInt64("sort_type", 0)
3707 3708
 
3708 3709
 	timeLayout := "2006-01-02"
3709 3710
 	loc, _ := time.LoadLocation("Local")
@@ -3730,7 +3731,7 @@ func (c *HisApiController) GetHisOrderList() {
3730 3731
 
3731 3732
 	adminUser := c.GetAdminUserInfo()
3732 3733
 	org_id := adminUser.CurrentOrgId
3733
-	order, err, total := service.GetHisOrderList(org_id, page, limit, startTime, endTime, types, keywords, p_type)
3734
+	order, err, total := service.GetHisOrderList(org_id, page, limit, startTime, endTime, types, keywords, p_type, sort_type)
3734 3735
 
3735 3736
 	for _, item := range order {
3736 3737
 		info, _ := service.GetHisPrescriptionByPatientID(item.PatientId, item.UserOrgId)

+ 15 - 0
controllers/his_charge_api_controller.go View File

@@ -28,6 +28,8 @@ func HisChargeApiRegistRouters() {
28 28
 	beego.Router("/api/fapiao", &HisChargeApiController{}, "get:GetFaPiaoRecord")
29 29
 	beego.Router("/api/fapiao/is_use", &HisChargeApiController{}, "post:UpdateFaPiaoRecordIsUse")
30 30
 
31
+	beego.Router("/api/his/getyidiclear", &HisChargeApiController{}, "get:GetHisYidiClearRecord")
32
+
31 33
 }
32 34
 
33 35
 func (c *HisChargeApiController) UpdateFaPiaoRecordIsUse() {
@@ -301,3 +303,16 @@ func (c *HisChargeApiController) GetHisInspectionInfo() {
301 303
 		return
302 304
 	}
303 305
 }
306
+
307
+func (c *HisChargeApiController) GetHisYidiClearRecord() {
308
+	records, err := service.FindHisYidiClearRecord(c.GetAdminUserInfo().CurrentOrgId)
309
+	if err == nil {
310
+		c.ServeSuccessJSON(map[string]interface{}{
311
+			"list": records,
312
+		})
313
+		return
314
+	} else {
315
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
316
+		return
317
+	}
318
+}

+ 10 - 0
service/his_charge_service.go View File

@@ -301,3 +301,13 @@ func FindFapiaoByIsUse(org_id int64) (models.HisFapiaoRecord, error) {
301 301
 	err := readDb.Model(&models.HisFapiaoRecord{}).Where("user_org_id = ? AND status = 1 AND is_use = 1", org_id).First(&record).Error
302 302
 	return record, err
303 303
 }
304
+
305
+func FindHisYidiClearRecord(org_id int64) (records []*models.HisYidiClearRecord, err error) {
306
+	err = readDb.Model(&models.HisYidiClearRecord{}).Where("user_org_id = ? AND status = 1", org_id).Find(&records).Error
307
+	return
308
+}
309
+
310
+func GetHisYidiClearRecordById(org_id int64, id int64) (record models.HisYidiClearRecord, err error) {
311
+	err = readDb.Model(&models.HisYidiClearRecord{}).Where("user_org_id = ? AND status = 1 AND id = ?", org_id, id).First(&record).Error
312
+	return
313
+}

+ 8 - 2
service/his_service.go View File

@@ -854,7 +854,7 @@ func SavePatientPrescriptionInfo(info models.HisPrescriptionInfo) (err error) {
854 854
 	return
855 855
 }
856 856
 
857
-func GetHisOrderList(user_org_id int64, page int64, limit int64, start_time int64, end_time int64, doctor_id int64, keywords string, p_type int64) (order []*models.HisOrder, err error, total int64) {
857
+func GetHisOrderList(user_org_id int64, page int64, limit int64, start_time int64, end_time int64, doctor_id int64, keywords string, p_type int64, sort_type int64) (order []*models.HisOrder, err error, total int64) {
858 858
 	offset := (page - 1) * limit
859 859
 	db := readDb.Model(&models.HisOrder{})
860 860
 
@@ -883,7 +883,13 @@ func GetHisOrderList(user_org_id int64, page int64, limit int64, start_time int6
883 883
 		Preload("HisHospitalCheckRecord", "status = 1 AND user_org_id = ?", user_org_id)
884 884
 	db = db.Preload("HisFundSettleListResult", "status = 1")
885 885
 	db = db.Count(&total)
886
-	err = db.Limit(limit).Offset(offset).Order("settle_accounts_date desc,ctime").Find(&order).Error
886
+	db = db.Limit(limit).Offset(offset)
887
+	if sort_type == 1 {
888
+		err = db.Order("settle_accounts_date desc,ctime desc").Find(&order).Error
889
+	}
890
+	if sort_type == 2 {
891
+		err = db.Order("setl_time desc,ctime desc").Find(&order).Error
892
+	}
887 893
 	return
888 894
 }
889 895