Browse Source

医保对接

csx 4 years ago
parent
commit
358f8bc9c5

+ 3 - 0
.idea/misc.xml View File

@@ -3,6 +3,9 @@
3 3
   <component name="JavaScriptSettings">
4 4
     <option name="languageLevel" value="ES6" />
5 5
   </component>
6
+  <component name="RustProjectSettings">
7
+    <option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
8
+  </component>
6 9
   <component name="SvnBranchConfigurationManager">
7 10
     <option name="myConfigurationMap">
8 11
       <map>

+ 1 - 1
conf/app.conf View File

@@ -5,7 +5,7 @@ runmode = prod
5 5
 #
6 6
 copyrequestbody = true
7 7
 sessionon = true
8
-sessiongcmaxlifetime = 64800
8
+#sessiongcmaxlifetime = 64800
9 9
 
10 10
 tokencookiemaxlifetime = 7200
11 11
 enablexsrf = false

+ 22 - 0
controllers/his_api_controller.go View File

@@ -78,6 +78,8 @@ func HisManagerApiRegistRouters() {
78 78
 	beego.Router("/api/orderdetail/get", &HisApiController{}, "get:GetAllOrderDetail")
79 79
 	beego.Router("/api/orderdetaicollect/get", &HisApiController{}, "get:GetAllOrderDetailCollect")
80 80
 
81
+	beego.Router("/api/cost/compare", &HisApiController{}, "get:GetMedicalInsuranceCostCompareList")
82
+
81 83
 }
82 84
 
83 85
 func (c *HisApiController) Sscard() {
@@ -2731,3 +2733,23 @@ func (c *HisApiController) GetAllOrderDetailCollect() {
2731 2733
 	})
2732 2734
 	return
2733 2735
 }
2736
+
2737
+func (c *HisApiController) GetMedicalInsuranceCostCompareList() {
2738
+	page, _ := c.GetInt64("page")
2739
+	limit, _ := c.GetInt64("limit")
2740
+	keywords := c.GetString("keywords")
2741
+
2742
+	if page <= 0 {
2743
+		page = 1
2744
+	}
2745
+	if limit <= 0 {
2746
+		limit = 10
2747
+	}
2748
+	list, total, _ := service.GetMedicalInsuranceCostCompareList(c.GetAdminUserInfo().CurrentOrgId, page, limit, keywords)
2749
+	c.ServeSuccessJSON(map[string]interface{}{
2750
+		"total": total,
2751
+		"list":  list,
2752
+	})
2753
+	return
2754
+
2755
+}

+ 2 - 1
controllers/new_mobile_api_controllers/new_role_api_controller.go View File

@@ -436,7 +436,8 @@ func (this *NewRoleApiController) AddRoleStaff() {
436 436
 }
437 437
 
438 438
 func (this *NewRoleApiController) GetFuntionPurviews() {
439
-	functionPurview, _ := service.GetFunctionPurview()
439
+	pid, _ := this.GetInt64("pid")
440
+	functionPurview, _ := service.GetFunctionPurview(pid)
440 441
 	this.ServeSuccessJSON(map[string]interface{}{
441 442
 		"funtion_purview": functionPurview,
442 443
 	})

+ 1 - 1
controllers/role_controller.go View File

@@ -558,7 +558,7 @@ func (this *RoleAPIController) EditPurviewInitData() {
558 558
 		if item.Name == "耗材管理" {
559 559
 			item.Childs = append(item.Childs, subConsumablesPurviewTreeViewModel...)
560 560
 		}
561
-		if item.Name == "药管理" {
561
+		if item.Name == "药管理" {
562 562
 			item.Childs = append(item.Childs, subDrugPurviewTreeViewModel...)
563 563
 		}
564 564
 		if item.Name == "自备药管理" {

+ 44 - 3
service/his_service.go View File

@@ -988,7 +988,9 @@ func GetHisPrescriptionByType(change_type int64, record_time int64, org_id int64
988 988
 		err = readDb.Model(&VMOtherHisPrescriptionInfo{}).Where("patient_id = ? AND user_org_id = ? AND  status=1 AND record_date  = ?", patient_id, org_id, Id.RecordDate).
989 989
 			Preload("VMHisPrescription", func(db *gorm.DB) *gorm.DB {
990 990
 				return db.Where("status = 1 AND user_org_id = ?", org_id).
991
-					Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ?", org_id).
991
+					Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
992
+						return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
993
+					}).
992 994
 					Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
993 995
 						return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
994 996
 					})
@@ -1000,7 +1002,9 @@ func GetHisPrescriptionByType(change_type int64, record_time int64, org_id int64
1000 1002
 		err = readDb.Model(&VMOtherHisPrescriptionInfo{}).Where("patient_id = ? AND user_org_id = ? AND  status=1 AND record_date  = ?", patient_id, org_id, Id.RecordDate).
1001 1003
 			Preload("VMHisPrescription", func(db *gorm.DB) *gorm.DB {
1002 1004
 				return db.Where("status = 1 AND user_org_id = ?", org_id).
1003
-					Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ?", org_id).
1005
+					Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1006
+						return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
1007
+					}).
1004 1008
 					Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1005 1009
 						return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
1006 1010
 					})
@@ -1013,7 +1017,9 @@ func GetCallHisPrescriptions(start_time int64, end_time int64, org_id int64, pat
1013 1017
 	err = readDb.Model(&VMOtherHisPrescriptionInfo{}).Where("patient_id = ? AND user_org_id = ? AND  status=1 AND record_date >= ? AND record_date <= ?", patient_id, org_id, start_time, end_time).
1014 1018
 		Preload("VMHisPrescription", func(db *gorm.DB) *gorm.DB {
1015 1019
 			return db.Where("status = 1 AND user_org_id = ?", org_id).
1016
-				Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ?", org_id).
1020
+				Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1021
+					return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
1022
+				}).
1017 1023
 				Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1018 1024
 					return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject", "status=1")
1019 1025
 				})
@@ -1253,3 +1259,38 @@ func GetHisOrderDetailByNumber(order_number string, org_id int64) (order []*HisO
1253 1259
 	}).Find(&order).Error
1254 1260
 	return
1255 1261
 }
1262
+
1263
+type MedicalInsuranceCostCompare struct {
1264
+	ID        int64   `gorm:"column:id" json:"id" form:"id"`
1265
+	StartTime int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
1266
+	EndTime   int64   `gorm:"column:end_time" json:"end_time" form:"end_time"`
1267
+	Insutype  string  `gorm:"column:insutype" json:"insutype" form:"insutype"`
1268
+	CheckType int64   `gorm:"column:check_type" json:"check_type" form:"check_type"`
1269
+	Num       int64   `gorm:"column:num" json:"num" form:"num"`
1270
+	Mtime     int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
1271
+	Status    int64   `gorm:"column:status" json:"status" form:"status"`
1272
+	UserOrgId int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1273
+	CostTotal float64 `gorm:"column:cost_total" json:"cost_total" form:"cost_total"`
1274
+	FuncTotal float64 `gorm:"column:func_total" json:"func_total" form:"func_total"`
1275
+	PsnPay    float64 `gorm:"column:psn_pay" json:"psn_pay" form:"psn_pay"`
1276
+	Creator   int64   `gorm:"column:creator" json:"creator" form:"creator"`
1277
+	Ctime     int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
1278
+}
1279
+
1280
+func (MedicalInsuranceCostCompare) TableName() string {
1281
+	return "medical_insurance_cost_compare"
1282
+}
1283
+
1284
+func GetMedicalInsuranceCostCompareList(orgID, page, limit int64, keywords string) (list []*MedicalInsuranceCostCompare, total int, err error) {
1285
+	offset := (page - 1) * limit
1286
+	db := readDb.Model(&MedicalInsuranceCostCompare{}).Where("user_org_id = ?", orgID)
1287
+
1288
+	if len(keywords) == 0 {
1289
+		db = db.Where("status=1")
1290
+		err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
1291
+	} else {
1292
+		db = db.Where("status=1")
1293
+		err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
1294
+	}
1295
+	return
1296
+}

+ 17 - 14
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go View File

@@ -1,5 +1,7 @@
1 1
 package schedule_dialysis
2 2
 
3
+import "XT_New/models"
4
+
3 5
 type PatientVM struct {
4 6
 	ID                           int64   `gorm:"column:id" json:"id" form:"id"`
5 7
 	UserOrgId                    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -519,20 +521,21 @@ type ScheduleVM struct {
519 521
 	BedID        int64 `gorm:"column:bed_id" json:"bed_id"`
520 522
 	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
521 523
 
522
-	Patient                  *PatientVM                  `gorm:"ForeignKey:PatientID" json:"patient"`
523
-	DialysisOrder            DialysisOrderVM             `gorm:"ForeignKey:DialysisDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"dialysis_order"`
524
-	Prescription             PrescriptionVM              `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"prescription"`
525
-	ReceiveAssessment        ReceiveAssessmentVM         `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"receive_assessment"`
526
-	XtReceiveTreatmentAsses  *XtReceiveTreatmentAsses    `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"xt_receive_assessment"`
527
-	AssessmentBeforeDislysis AssessmentBeforeDislysisVM  `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"assessment_before_dislysis"`
528
-	AssessmentAfterDislysis  AssessmentAfterDislysisVM   `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"assessment_after_dislysis"`
529
-	MonitoringRecords        []*MonitoringRecordVM       `gorm:"ForeignKey:MonitoringDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"monitor_records"`
530
-	DeviceNumber             *DeviceNumberVM             `gorm:"ForeignKey:BedID" json:"device_number"`
531
-	DeviceZone               *DeviceZoneVM               `gorm:"ForeignKey:PartitionId" json:"device_zone"`
532
-	Advices                  []*DoctorAdviceVM           `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientId" json:"advices"`
533
-	DoubleCheck              *DoubleCheckVM              `gorm:"ForeignKey:CheckDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"check"`
534
-	Summer                   *SummerVM                   `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"summer"`
535
-	LastAfterWeight          XtAssessmentAfterDislysisVM `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
524
+	Patient                  *PatientVM                    `gorm:"ForeignKey:PatientID" json:"patient"`
525
+	DialysisOrder            DialysisOrderVM               `gorm:"ForeignKey:DialysisDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"dialysis_order"`
526
+	Prescription             PrescriptionVM                `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"prescription"`
527
+	ReceiveAssessment        ReceiveAssessmentVM           `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"receive_assessment"`
528
+	XtReceiveTreatmentAsses  *XtReceiveTreatmentAsses      `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"xt_receive_assessment"`
529
+	AssessmentBeforeDislysis AssessmentBeforeDislysisVM    `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"assessment_before_dislysis"`
530
+	AssessmentAfterDislysis  AssessmentAfterDislysisVM     `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"assessment_after_dislysis"`
531
+	MonitoringRecords        []*MonitoringRecordVM         `gorm:"ForeignKey:MonitoringDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"monitor_records"`
532
+	DeviceNumber             *DeviceNumberVM               `gorm:"ForeignKey:BedID" json:"device_number"`
533
+	DeviceZone               *DeviceZoneVM                 `gorm:"ForeignKey:PartitionId" json:"device_zone"`
534
+	Advices                  []*DoctorAdviceVM             `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientId" json:"advices"`
535
+	DoubleCheck              *DoubleCheckVM                `gorm:"ForeignKey:CheckDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"check"`
536
+	Summer                   *SummerVM                     `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"summer"`
537
+	LastAfterWeight          XtAssessmentAfterDislysisVM   `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
538
+	HisAdvices               []*models.HisDoctorAdviceInfo `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"his_advices"`
536 539
 }
537 540
 
538 541
 func (ScheduleVM) TableName() string {

+ 5 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go View File

@@ -42,6 +42,11 @@ func GetSchedules(orgID int64, schIDs []string) ([]*ScheduleVM, error) {
42 42
 				Where("user_org_id = ? AND advice_type = 2 AND status = 1", orgID).
43 43
 				Order("start_time asc, groupno desc, advice_order desc, id asc")
44 44
 		}).
45
+		Preload("HisAdvices", func(db *gorm.DB) *gorm.DB {
46
+			return db.Select("id, user_org_id, patient_id, advice_type, advice_date, record_date, start_time, drug_spec_unit,advice_name,advice_desc, reminder_date, drug_spec, drug_spec_unit, single_dose, single_dose_unit, prescribing_number, prescribing_number_unit, delivery_way, execution_frequency, advice_doctor, status, created_time,updated_time, advice_affirm, remark, stop_time, stop_reason, stop_doctor, stop_state, parent_id, execution_time, execution_staff, execution_state, checker, check_state, check_time, groupno, IF(parent_id > 0, parent_id, id) as advice_order").
47
+				Where("user_org_id = ? AND status = 1", orgID).
48
+				Order("start_time asc, groupno desc, advice_order desc, id asc")
49
+		}).
45 50
 		Where("user_org_id = ? AND status = 1 AND id in (?)", orgID, schIDs).Order("schedule_date desc").
46 51
 		Find(&schedules).
47 52
 		Error