Browse Source

医保对接

csx 3 years ago
parent
commit
2a07e227c1

+ 33 - 1
controllers/his_api_controller.go View File

92
 
92
 
93
 	beego.Router("/api/privateexpenses/get", &HisApiController{}, "get:GetPrivateExpensesInfo")
93
 	beego.Router("/api/privateexpenses/get", &HisApiController{}, "get:GetPrivateExpensesInfo")
94
 
94
 
95
+	beego.Router("/api/changemedtype/post", &HisApiController{}, "post:ChangeMedType")
96
+
95
 }
97
 }
96
 
98
 
97
 func (c *HisApiController) Sscard() {
99
 func (c *HisApiController) Sscard() {
229
 	monthPrescriptions, _ := service.GetMonthHisPrescriptionTwo(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
231
 	monthPrescriptions, _ := service.GetMonthHisPrescriptionTwo(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
230
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
232
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
231
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
233
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
234
+	lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
232
 
235
 
233
 	order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
236
 	order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
234
 	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
237
 	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
252
 		"schedule":            sch,
255
 		"schedule":            sch,
253
 		"count":               count,
256
 		"count":               count,
254
 		"drugStockConfig":     drugStockConfig,
257
 		"drugStockConfig":     drugStockConfig,
258
+		"last_info":           lastPatientPrescriptionInfo,
255
 	})
259
 	})
256
 	return
260
 	return
257
 
261
 
2866
 			SettleType:            settle_accounts_type,
2870
 			SettleType:            settle_accounts_type,
2867
 			FaPiaoCode:            fapiao_code,
2871
 			FaPiaoCode:            fapiao_code,
2868
 			FaPiaoNumber:          fapiao_number,
2872
 			FaPiaoNumber:          fapiao_number,
2873
+			Diagnosis:             diagnosis_id,
2869
 			PType:                 2,
2874
 			PType:                 2,
2870
 		}
2875
 		}
2871
 		err = service.CreateOrder(order)
2876
 		err = service.CreateOrder(order)
3010
 			tempOrder.FaPiaoNumber = fapiao_number
3015
 			tempOrder.FaPiaoNumber = fapiao_number
3011
 			tempOrder.PType = 2
3016
 			tempOrder.PType = 2
3012
 			tempOrder.MedfeeSumamt = totals
3017
 			tempOrder.MedfeeSumamt = totals
3018
+			tempOrder.Diagnosis = diagnosis_id
3013
 
3019
 
3014
 			err = service.SaveHisOrder(&tempOrder)
3020
 			err = service.SaveHisOrder(&tempOrder)
3015
 			err = service.UpdataOrderStatusTwo(tempOrder.Number, adminUser.CurrentOrgId)
3021
 			err = service.UpdataOrderStatusTwo(tempOrder.Number, adminUser.CurrentOrgId)
3372
 	}
3378
 	}
3373
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
3379
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
3374
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
3380
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
3381
+
3382
+	lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
3383
+
3375
 	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
3384
 	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
3376
 	//获取所有科室信息
3385
 	//获取所有科室信息
3377
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
3386
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
3382
 		"prescription":        prescriptions,
3391
 		"prescription":        prescriptions,
3383
 		"case_history":        case_history,
3392
 		"case_history":        case_history,
3384
 		"info":                patientPrescriptionInfo,
3393
 		"info":                patientPrescriptionInfo,
3394
+		"last_info":           lastPatientPrescriptionInfo,
3385
 		"month_prescriptions": monthPrescriptions,
3395
 		"month_prescriptions": monthPrescriptions,
3386
 		"order":               order,
3396
 		"order":               order,
3387
 		"doctors":             doctors,
3397
 		"doctors":             doctors,
4505
 		PType:              2,
4515
 		PType:              2,
4506
 		IsPre:              1,
4516
 		IsPre:              1,
4507
 		MedType:            strconv.Itoa(int(reg_type)),
4517
 		MedType:            strconv.Itoa(int(reg_type)),
4518
+		Diagnosis:          diagnosis_id,
4508
 	}
4519
 	}
4509
 	err = service.CreateOrder(order)
4520
 	err = service.CreateOrder(order)
4510
 	if err != nil {
4521
 	if err != nil {
4613
 		}
4624
 		}
4614
 		service.CreateOrderInfo(info)
4625
 		service.CreateOrderInfo(info)
4615
 	}
4626
 	}
4616
-	his.Diagnosis = diagnosis_id
4617
 	his.SickType = sick_type
4627
 	his.SickType = sick_type
4618
 	service.UpdataHisPateint(&his)
4628
 	service.UpdataHisPateint(&his)
4619
 	err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
4629
 	err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
4650
 	})
4660
 	})
4651
 
4661
 
4652
 }
4662
 }
4663
+
4664
+func (this *HisApiController) ChangeMedType() {
4665
+	med_type := this.GetString("med_type")
4666
+	id, _ := this.GetInt64("id")
4667
+
4668
+	prescription, _ := service.GetPrescriptionById(id, this.GetAdminUserInfo().CurrentOrgId)
4669
+	prescription.MedType = med_type
4670
+	err := service.SaveHisPrescription(&prescription)
4671
+
4672
+	if err == nil {
4673
+		this.ServeSuccessJSON(map[string]interface{}{
4674
+			"msg": "修改成功",
4675
+		})
4676
+
4677
+	} else {
4678
+
4679
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
4680
+		return
4681
+
4682
+	}
4683
+
4684
+}

+ 2 - 1
models/his_hospital_models.go View File

28
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
28
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
29
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
29
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
30
 
30
 
31
-	IsPre int64 `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
31
+	IsPre     int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
32
+	Diagnosis string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
32
 }
33
 }
33
 
34
 
34
 func (HisHospitalOrder) TableName() string {
35
 func (HisHospitalOrder) TableName() string {

+ 6 - 4
models/his_models.go View File

473
 
473
 
474
 	AdminUser AdminUser `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
474
 	AdminUser AdminUser `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
475
 
475
 
476
-	SettleType      int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
477
-	SettleStartTime int64 `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
478
-	SettleEndTime   int64 `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
479
-	IsPre           int64 `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
476
+	SettleType      int64  `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
477
+	SettleStartTime int64  `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
478
+	SettleEndTime   int64  `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
479
+	IsPre           int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
480
+	Diagnosis       string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
480
 }
481
 }
481
 
482
 
482
 func (TempHisOrder) TableName() string {
483
 func (TempHisOrder) TableName() string {
958
 
959
 
959
 	HisFundSettleListResult HisFundSettleListResult `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"result"`
960
 	HisFundSettleListResult HisFundSettleListResult `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"result"`
960
 	IsPre                   int64                   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
961
 	IsPre                   int64                   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
962
+	Diagnosis               string                  `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
961
 }
963
 }
962
 
964
 
963
 func (HisOrder) TableName() string {
965
 func (HisOrder) TableName() string {

+ 10 - 0
service/his_service.go View File

111
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
111
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
112
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
112
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
113
 	IsPre        int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
113
 	IsPre        int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
114
+	Diagnosis    string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
114
 }
115
 }
115
 
116
 
116
 func (VMHisOrder) TableName() string {
117
 func (VMHisOrder) TableName() string {
806
 
807
 
807
 }
808
 }
808
 
809
 
810
+func FindLastPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date int64, p_type int64) (info models.HisPrescriptionInfo, err error) {
811
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date < ? AND patient_id = ? AND p_type = ? ", org_id, record_date, patient_id, p_type).First(&info).Error
812
+	return
813
+
814
+}
815
+
809
 func FindHisPatientPrescriptionInfo(org_id int64, patient_id int64, record_date int64, p_type int64, his_patient_id int64) (info models.HisPrescriptionInfo, err error) {
816
 func FindHisPatientPrescriptionInfo(org_id int64, patient_id int64, record_date int64, p_type int64, his_patient_id int64) (info models.HisPrescriptionInfo, err error) {
810
 	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND p_type = ? AND his_patient_id = ? ", org_id, record_date, patient_id, p_type, his_patient_id).First(&info).Error
817
 	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND p_type = ? AND his_patient_id = ? ", org_id, record_date, patient_id, p_type, his_patient_id).First(&info).Error
811
 	return
818
 	return
914
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
921
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
915
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
922
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
916
 	IsPre        int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
923
 	IsPre        int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
924
+	Diagnosis    string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
917
 }
925
 }
918
 
926
 
919
 func (HisOrder) TableName() string {
927
 func (HisOrder) TableName() string {
1110
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
1118
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
1111
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
1119
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
1112
 	IsPre        int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
1120
 	IsPre        int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
1121
+	Diagnosis    string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
1113
 }
1122
 }
1114
 
1123
 
1115
 func (XtHisOrder) TableName() string {
1124
 func (XtHisOrder) TableName() string {
1833
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
1842
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
1834
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
1843
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
1835
 	IsPre        int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
1844
 	IsPre        int64  `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
1845
+	Diagnosis    string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
1836
 }
1846
 }
1837
 
1847
 
1838
 func (CustomInComeStatistics) TableName() string {
1848
 func (CustomInComeStatistics) TableName() string {

+ 0 - 1
service/stock_service.go View File

712
 	DoseUnit                    string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
712
 	DoseUnit                    string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
713
 	DrugDay                     string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
713
 	DrugDay                     string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
714
 	MinPrice                    float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
714
 	MinPrice                    float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
715
-	PrescribingNumberUnit       string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
716
 }
715
 }
717
 
716
 
718
 func (Drug) TableName() string {
717
 func (Drug) TableName() string {