csx hace 3 años
padre
commit
2a07e227c1

+ 33 - 1
controllers/his_api_controller.go Ver fichero

@@ -92,6 +92,8 @@ func HisManagerApiRegistRouters() {
92 92
 
93 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 99
 func (c *HisApiController) Sscard() {
@@ -229,6 +231,7 @@ func (c *HisApiController) GetHisPatientInfo() {
229 231
 	monthPrescriptions, _ := service.GetMonthHisPrescriptionTwo(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
230 232
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
231 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 236
 	order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
234 237
 	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
@@ -252,6 +255,7 @@ func (c *HisApiController) GetHisPatientInfo() {
252 255
 		"schedule":            sch,
253 256
 		"count":               count,
254 257
 		"drugStockConfig":     drugStockConfig,
258
+		"last_info":           lastPatientPrescriptionInfo,
255 259
 	})
256 260
 	return
257 261
 
@@ -2866,6 +2870,7 @@ func (c *HisApiController) GetUploadInfo() {
2866 2870
 			SettleType:            settle_accounts_type,
2867 2871
 			FaPiaoCode:            fapiao_code,
2868 2872
 			FaPiaoNumber:          fapiao_number,
2873
+			Diagnosis:             diagnosis_id,
2869 2874
 			PType:                 2,
2870 2875
 		}
2871 2876
 		err = service.CreateOrder(order)
@@ -3010,6 +3015,7 @@ func (c *HisApiController) GetUploadInfo() {
3010 3015
 			tempOrder.FaPiaoNumber = fapiao_number
3011 3016
 			tempOrder.PType = 2
3012 3017
 			tempOrder.MedfeeSumamt = totals
3018
+			tempOrder.Diagnosis = diagnosis_id
3013 3019
 
3014 3020
 			err = service.SaveHisOrder(&tempOrder)
3015 3021
 			err = service.UpdataOrderStatusTwo(tempOrder.Number, adminUser.CurrentOrgId)
@@ -3372,6 +3378,9 @@ func (c *HisApiController) GetHisChargePatientInfo() {
3372 3378
 	}
3373 3379
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
3374 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 3384
 	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
3376 3385
 	//获取所有科室信息
3377 3386
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
@@ -3382,6 +3391,7 @@ func (c *HisApiController) GetHisChargePatientInfo() {
3382 3391
 		"prescription":        prescriptions,
3383 3392
 		"case_history":        case_history,
3384 3393
 		"info":                patientPrescriptionInfo,
3394
+		"last_info":           lastPatientPrescriptionInfo,
3385 3395
 		"month_prescriptions": monthPrescriptions,
3386 3396
 		"order":               order,
3387 3397
 		"doctors":             doctors,
@@ -4505,6 +4515,7 @@ func (c *HisApiController) PreSettle() {
4505 4515
 		PType:              2,
4506 4516
 		IsPre:              1,
4507 4517
 		MedType:            strconv.Itoa(int(reg_type)),
4518
+		Diagnosis:          diagnosis_id,
4508 4519
 	}
4509 4520
 	err = service.CreateOrder(order)
4510 4521
 	if err != nil {
@@ -4613,7 +4624,6 @@ func (c *HisApiController) PreSettle() {
4613 4624
 		}
4614 4625
 		service.CreateOrderInfo(info)
4615 4626
 	}
4616
-	his.Diagnosis = diagnosis_id
4617 4627
 	his.SickType = sick_type
4618 4628
 	service.UpdataHisPateint(&his)
4619 4629
 	err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
@@ -4650,3 +4660,25 @@ func (c *HisApiController) GetPrivateExpensesInfo() {
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 Ver fichero

@@ -28,7 +28,8 @@ type HisHospitalOrder struct {
28 28
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
29 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 35
 func (HisHospitalOrder) TableName() string {

+ 6 - 4
models/his_models.go Ver fichero

@@ -473,10 +473,11 @@ type TempHisOrder struct {
473 473
 
474 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 483
 func (TempHisOrder) TableName() string {
@@ -958,6 +959,7 @@ type HisOrder struct {
958 959
 
959 960
 	HisFundSettleListResult HisFundSettleListResult `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"result"`
960 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 965
 func (HisOrder) TableName() string {

+ 10 - 0
service/his_service.go Ver fichero

@@ -111,6 +111,7 @@ type VMHisOrder struct {
111 111
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
112 112
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
113 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 117
 func (VMHisOrder) TableName() string {
@@ -806,6 +807,12 @@ func FindPatientPrescriptionInfo(org_id int64, patient_id int64, record_date int
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 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 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 818
 	return
@@ -914,6 +921,7 @@ type HisOrder struct {
914 921
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
915 922
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
916 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 927
 func (HisOrder) TableName() string {
@@ -1110,6 +1118,7 @@ type XtHisOrder struct {
1110 1118
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
1111 1119
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
1112 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 1124
 func (XtHisOrder) TableName() string {
@@ -1833,6 +1842,7 @@ type CustomInComeStatistics struct {
1833 1842
 	FaPiaoCode   string `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
1834 1843
 	FaPiaoNumber string `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
1835 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 1848
 func (CustomInComeStatistics) TableName() string {

+ 0 - 1
service/stock_service.go Ver fichero

@@ -712,7 +712,6 @@ type Drug struct {
712 712
 	DoseUnit                    string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
713 713
 	DrugDay                     string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
714 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 717
 func (Drug) TableName() string {