Browse Source

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

XMLWAN 3 years ago
parent
commit
b37236bfae

+ 59 - 15
controllers/his_api_controller.go View File

60
 	beego.Router("/api/presettle/get", &HisApiController{}, "get:PreSettle")
60
 	beego.Router("/api/presettle/get", &HisApiController{}, "get:PreSettle")
61
 
61
 
62
 	beego.Router("/api/refund/post", &HisApiController{}, "post:Refund")
62
 	beego.Router("/api/refund/post", &HisApiController{}, "post:Refund")
63
+	beego.Router("/api/refundnumber/post", &HisApiController{}, "post:RefundNumber")
63
 
64
 
64
 	beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
65
 	beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
65
-
66
 	beego.Router("/api/doctor/list", &HisApiController{}, "get:GetAdminUsers")
66
 	beego.Router("/api/doctor/list", &HisApiController{}, "get:GetAdminUsers")
67
 
67
 
68
 	//beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
68
 	//beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
90
 
90
 
91
 	beego.Router("/api/hisprescriptiontemplate/create", &HisApiController{}, "post:CreateHisPrescriptionTemplate")
91
 	beego.Router("/api/hisprescriptiontemplate/create", &HisApiController{}, "post:CreateHisPrescriptionTemplate")
92
 
92
 
93
+	beego.Router("/api/privateexpenses/get", &HisApiController{}, "get:GetPrivateExpensesInfo")
94
+
93
 }
95
 }
94
 
96
 
95
 func (c *HisApiController) Sscard() {
97
 func (c *HisApiController) Sscard() {
3025
 //退款
3027
 //退款
3026
 func (c *HisApiController) Refund() {
3028
 func (c *HisApiController) Refund() {
3027
 	order_id, _ := c.GetInt64("order_id")
3029
 	order_id, _ := c.GetInt64("order_id")
3028
-	//number := c.GetString("number")
3029
-
3030
 	order, _ := service.GetHisOrderByID(order_id)
3030
 	order, _ := service.GetHisOrderByID(order_id)
3031
 	adminUser := c.GetAdminUserInfo()
3031
 	adminUser := c.GetAdminUserInfo()
3032
-	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3033
-	if config.IsOpen == 1 { //对接了医保,走医保流程
3034
-
3032
+	err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId)
3033
+	if err == nil {
3034
+		c.ServeSuccessJSON(map[string]interface{}{
3035
+			"msg": "退费成功",
3036
+		})
3035
 	} else {
3037
 	} else {
3036
-		err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId)
3037
-		if err == nil {
3038
-			c.ServeSuccessJSON(map[string]interface{}{
3039
-				"msg": "退费成功",
3040
-			})
3041
-		} else {
3042
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3043
-			return
3044
-		}
3038
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3039
+		return
3040
+	}
3041
+}
3045
 
3042
 
3043
+func (c *HisApiController) RefundNumber() {
3044
+	his_patient_id, _ := c.GetInt64("id")
3045
+	info, _ := service.GetNewHisPatientInfo(his_patient_id)
3046
+	info.Status = 0
3047
+	err := service.SaveHisPatient(info)
3048
+	if err == nil {
3049
+		c.ServeSuccessJSON(map[string]interface{}{
3050
+			"msg": "退号成功",
3051
+		})
3052
+	} else {
3053
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3054
+		return
3046
 	}
3055
 	}
3047
 
3056
 
3048
 }
3057
 }
3401
 
3410
 
3402
 func (c *HisApiController) GetAllOrderDetailCollect() {
3411
 func (c *HisApiController) GetAllOrderDetailCollect() {
3403
 	order_id, _ := c.GetInt64("id", 0)
3412
 	order_id, _ := c.GetInt64("id", 0)
3413
+
3404
 	order, _ := service.GetHisOrderByID(order_id)
3414
 	order, _ := service.GetHisOrderByID(order_id)
3405
 	if order.ID == 0 {
3415
 	if order.ID == 0 {
3406
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
3416
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
4304
 					return
4314
 					return
4305
 				}
4315
 				}
4306
 				types := int64(items["type"].(float64))
4316
 				types := int64(items["type"].(float64))
4317
+
4318
+				if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
4319
+					utils.ErrorLog("med_type")
4320
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4321
+					return
4322
+				}
4323
+				med_type := strconv.Itoa(int(items["med_type"].(float64)))
4324
+
4307
 				ctime := time.Now().Unix()
4325
 				ctime := time.Now().Unix()
4308
 				prescription := &models.HisPrescriptionInfoTemplate{
4326
 				prescription := &models.HisPrescriptionInfoTemplate{
4309
 					PatientId:   patient_id,
4327
 					PatientId:   patient_id,
4315
 					Creator:     adminInfo.AdminUser.Id,
4333
 					Creator:     adminInfo.AdminUser.Id,
4316
 					Status:      1,
4334
 					Status:      1,
4317
 					PTemplateId: template.ID,
4335
 					PTemplateId: template.ID,
4336
+					MedType:     med_type,
4318
 				}
4337
 				}
4319
 				service.CreateHisPrescriptionInfoTemplate(prescription)
4338
 				service.CreateHisPrescriptionInfoTemplate(prescription)
4320
 
4339
 
4602
 		})
4621
 		})
4603
 	}
4622
 	}
4604
 }
4623
 }
4624
+
4625
+func (c *HisApiController) GetPrivateExpensesInfo() {
4626
+	order_id, _ := c.GetInt64("id", 0)
4627
+	his_patient_id, _ := c.GetInt64("his_patient_id", 0)
4628
+	order, _ := service.GetHisOrderByID(order_id)
4629
+	role, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, c.GetAdminUserInfo().AdminUser.Id)
4630
+	if order.ID == 0 {
4631
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
4632
+		return
4633
+	}
4634
+	his, _ := service.GetHisPatientByIdThree(his_patient_id)
4635
+	org_id := c.GetAdminUserInfo().CurrentOrgId
4636
+	adminInfo, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
4637
+	order_info, _ := service.GetHisOrderDetailByNumber(order.Number, org_id)
4638
+	patient, _ := service.GetPatientByID(org_id, order.PatientId)
4639
+	c.ServeSuccessJSON(map[string]interface{}{
4640
+		"order":         order,
4641
+		"order_info":    order_info,
4642
+		"patient":       patient,
4643
+		"admin_info":    adminInfo,
4644
+		"his":           his,
4645
+		"current_admin": role,
4646
+	})
4647
+
4648
+}

+ 8 - 0
controllers/his_config_api_controller.go View File

130
 				}
130
 				}
131
 				types := int64(items["type"].(float64))
131
 				types := int64(items["type"].(float64))
132
 
132
 
133
+				if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
134
+					utils.ErrorLog("med_type")
135
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
136
+					return
137
+				}
138
+				med_type := strconv.Itoa(int(items["med_type"].(float64)))
139
+
133
 				ctime := time.Now().Unix()
140
 				ctime := time.Now().Unix()
134
 				prescription := &models.HisPrescriptionInfoTemplate{
141
 				prescription := &models.HisPrescriptionInfoTemplate{
135
 					ID:          id,
142
 					ID:          id,
142
 					Creator:     adminInfo.AdminUser.Id,
149
 					Creator:     adminInfo.AdminUser.Id,
143
 					Status:      1,
150
 					Status:      1,
144
 					PTemplateId: src_template.ID,
151
 					PTemplateId: src_template.ID,
152
+					MedType:     med_type,
145
 				}
153
 				}
146
 				service.CreateHisPrescriptionInfoTemplate(prescription)
154
 				service.CreateHisPrescriptionInfoTemplate(prescription)
147
 
155
 

+ 2 - 0
controllers/his_project_api_controller.go View File

1189
 	adminUserInfo := this.GetAdminUserInfo()
1189
 	adminUserInfo := this.GetAdminUserInfo()
1190
 	advicePrint, err := service.GetDoctorAdvicePrint(patient_id, recordDateTime, idStrs, adminUserInfo.CurrentOrgId)
1190
 	advicePrint, err := service.GetDoctorAdvicePrint(patient_id, recordDateTime, idStrs, adminUserInfo.CurrentOrgId)
1191
 	projectlist, err := service.GetAllProjectList(adminUserInfo.CurrentOrgId, "")
1191
 	projectlist, err := service.GetAllProjectList(adminUserInfo.CurrentOrgId, "")
1192
+	his, _ := service.GetLastHisPatient(patient_id, adminUserInfo.CurrentOrgId)
1192
 	//prescriptionInfo, _ := service.GetPrscriptionInfo(patient_id, recordDateTime)
1193
 	//prescriptionInfo, _ := service.GetPrscriptionInfo(patient_id, recordDateTime)
1193
 	hisPatient, _ := service.GetHisPatientById(patient_id)
1194
 	hisPatient, _ := service.GetHisPatientById(patient_id)
1194
 	if err != nil {
1195
 	if err != nil {
1199
 		"advicePrint": advicePrint,
1200
 		"advicePrint": advicePrint,
1200
 		"projectlist": projectlist,
1201
 		"projectlist": projectlist,
1201
 		"hisPatient":  hisPatient,
1202
 		"hisPatient":  hisPatient,
1203
+		"his":         his,
1202
 	})
1204
 	})
1203
 }
1205
 }
1204
 
1206
 

+ 5 - 5
controllers/new_mobile_api_controllers/mobile_his_api_controller.go View File

470
 				}
470
 				}
471
 				types := int64(items["type"].(float64))
471
 				types := int64(items["type"].(float64))
472
 
472
 
473
-				if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
474
-					utils.ErrorLog("med_type")
475
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
476
-					return
477
-				}
473
+				//if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
474
+				//	utils.ErrorLog("med_type")
475
+				//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
476
+				//	return
477
+				//}
478
 				//med_type := int64(items["med_type"].(float64))
478
 				//med_type := int64(items["med_type"].(float64))
479
 				//med_type := strconv.Itoa(int(items["med_type"].(float64)))
479
 				//med_type := strconv.Itoa(int(items["med_type"].(float64)))
480
 				//med_type := strconv.Itoa(int(items["med_type"].(float64)))
480
 				//med_type := strconv.Itoa(int(items["med_type"].(float64)))

+ 9 - 6
models/his_models.go View File

129
 	PType                  int64   `gorm:"column:p_type" json:"p_type" form:"p_type"`
129
 	PType                  int64   `gorm:"column:p_type" json:"p_type" form:"p_type"`
130
 	Diagnosis              int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
130
 	Diagnosis              int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
131
 	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
131
 	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
132
+	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
132
 }
133
 }
133
 
134
 
134
 func (HisPatient) TableName() string {
135
 func (HisPatient) TableName() string {
504
 	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
505
 	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
505
 	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
506
 	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
506
 
507
 
507
-	HisAdditionalCharge   []*HisAdditionalCharge `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`
508
-	VMHisPrescriptionInfo HisPrescriptionInfo    `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"info"`
509
-	Total                 string                 `gorm:"-" json:"total" form:"total"`
510
-	PType                 int64                  `gorm:"column:p_type" json:"p_type" form:"p_type"`
511
-	MedType               string                 `gorm:"column:med_type" json:"med_type" form:"med_type"`
512
-	TempHisOrder          TempHisOrder           `gorm:"ForeignKey:Number,MedType;AssociationForeignKey:BatchNumber,MedType" json:"order"`
508
+	HisAdditionalCharge []*HisAdditionalCharge `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`
509
+	HisPrescriptionInfo HisPrescriptionInfo    `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"info"`
510
+	Total               string                 `gorm:"-" json:"total" form:"total"`
511
+	PType               int64                  `gorm:"column:p_type" json:"p_type" form:"p_type"`
512
+	MedType             string                 `gorm:"column:med_type" json:"med_type" form:"med_type"`
513
+	TempHisOrder        TempHisOrder           `gorm:"ForeignKey:Number,MedType;AssociationForeignKey:BatchNumber,MedType" json:"order"`
513
 }
514
 }
514
 
515
 
515
 func (HisPrescription) TableName() string {
516
 func (HisPrescription) TableName() string {
1043
 	PType                  string  `gorm:"column:p_type" json:"p_type" form:"p_type"`
1044
 	PType                  string  `gorm:"column:p_type" json:"p_type" form:"p_type"`
1044
 	Diagnosis              int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
1045
 	Diagnosis              int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
1045
 	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
1046
 	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
1047
+	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
1046
 }
1048
 }
1047
 
1049
 
1048
 func (VMHisPatient) TableName() string {
1050
 func (VMHisPatient) TableName() string {
1404
 	PTemplateId                    int64                             `gorm:"column:p_template_id" json:"p_template_id" form:"p_template_id"`
1406
 	PTemplateId                    int64                             `gorm:"column:p_template_id" json:"p_template_id" form:"p_template_id"`
1405
 	HisPrescriptionAdviceTemplate  []*HisPrescriptionAdviceTemplate  `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
1407
 	HisPrescriptionAdviceTemplate  []*HisPrescriptionAdviceTemplate  `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
1406
 	HisPrescriptionProjectTemplate []*HisPrescriptionProjectTemplate `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
1408
 	HisPrescriptionProjectTemplate []*HisPrescriptionProjectTemplate `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
1409
+	MedType                        string                            `gorm:"column:med_type" json:"med_type" form:"med_type"`
1407
 }
1410
 }
1408
 
1411
 
1409
 func (HisPrescriptionInfoTemplate) TableName() string {
1412
 func (HisPrescriptionInfoTemplate) TableName() string {

+ 6 - 1
service/his_project_service.go View File

402
 		return db.Where("status = 1 and user_org_id = ?", orgid).Preload("Drug", "status = 1")
402
 		return db.Where("status = 1 and user_org_id = ?", orgid).Preload("Drug", "status = 1")
403
 	}).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
403
 	}).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
404
 		return db.Where("status = 1 AND user_org_id = ?", orgid).Preload("HisProject").Preload("GoodInfo", "status=1")
404
 		return db.Where("status = 1 AND user_org_id = ?", orgid).Preload("HisProject").Preload("GoodInfo", "status=1")
405
-	}).Preload("VMHisPrescriptionInfo", "status =1 and user_org_id = ?", orgid).Preload("XtHisAdditionalCharge", "status = 1 and user_org_id = ?", orgid).Find(&prescription).Error
405
+	}).Preload("HisPrescriptionInfo", "status =1 and user_org_id = ?", orgid).Preload("HisAdditionalCharge", "status = 1 and user_org_id = ?", orgid).Find(&prescription).Error
406
 
406
 
407
 	return prescription, err
407
 	return prescription, err
408
 }
408
 }
719
 	err := XTReadDB().Model(&patient).Where("id = ? and status = 1", id).First(&patient).Error
719
 	err := XTReadDB().Model(&patient).Where("id = ? and status = 1", id).First(&patient).Error
720
 	return patient, err
720
 	return patient, err
721
 }
721
 }
722
+
723
+func GetLastHisPatient(patient_id int64, org_id int64) (his models.HisPatient, err error) {
724
+	err = XTReadDB().Model(&models.HisPatient{}).Where("user_org_id = ? AND patient_id = ? and status = 1 AND patient_info <> ''", org_id, patient_id).First(&his).Error
725
+	return
726
+}

+ 13 - 2
service/his_service.go View File

856
 		Preload("HisHospitalCheckRecord", "status = 1 AND user_org_id = ?", user_org_id)
856
 		Preload("HisHospitalCheckRecord", "status = 1 AND user_org_id = ?", user_org_id)
857
 	db = db.Preload("HisFundSettleListResult", "status = 1")
857
 	db = db.Preload("HisFundSettleListResult", "status = 1")
858
 	db = db.Count(&total)
858
 	db = db.Count(&total)
859
-	err = db.Limit(limit).Offset(offset).Order("setl_time desc,ctime").Find(&order).Error
859
+	err = db.Limit(limit).Offset(offset).Order("settle_accounts_date desc,ctime").Find(&order).Error
860
 	return
860
 	return
861
 }
861
 }
862
 
862
 
1018
 
1018
 
1019
 }
1019
 }
1020
 
1020
 
1021
+func SaveHisPatient(his models.HisPatient) (err error) {
1022
+	err = writeDb.Save(&his).Error
1023
+	return
1024
+}
1025
+
1021
 func UpdataRegStatus(patient_id int64, record_time int64, org_id int64) {
1026
 func UpdataRegStatus(patient_id int64, record_time int64, org_id int64) {
1022
 	writeDb.Model(&models.HisPatient{}).Where("patient_id = ? AND status = 1 AND record_date =? AND user_org_id = ?", patient_id, record_time, org_id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()})
1027
 	writeDb.Model(&models.HisPatient{}).Where("patient_id = ? AND status = 1 AND record_date =? AND user_org_id = ?", patient_id, record_time, org_id).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()})
1023
 
1028
 
1663
 	DiagnosisId        int64   `gorm:"column:diagnosis_id" json:"diagnosis_id" form:"diagnosis_id"`
1668
 	DiagnosisId        int64   `gorm:"column:diagnosis_id" json:"diagnosis_id" form:"diagnosis_id"`
1664
 	DialysisCount      int64   `gorm:"-"`
1669
 	DialysisCount      int64   `gorm:"-"`
1665
 	PatientId          int64   `gorm:"column:patient_id" json:"dialysis_count" form:"dialysis_count"`
1670
 	PatientId          int64   `gorm:"column:patient_id" json:"dialysis_count" form:"dialysis_count"`
1671
+	HifmiPay           float64 `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
1672
+	HifobPay           float64 `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
1673
+	CvlservPay         float64 `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
1674
+	HifesPay           float64 `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
1675
+	MayPay             float64 `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
1676
+	SetlDetail         string  `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
1666
 }
1677
 }
1667
 
1678
 
1668
 func GetCheckAccountFormData(start_time int64, end_time int64, org_id int64, insutype string) (cus []*CustomAccountFormData, err error) {
1679
 func GetCheckAccountFormData(start_time int64, end_time int64, org_id int64, insutype string) (cus []*CustomAccountFormData, err error) {
1669
-	err = readDb.Raw("select o.patient_id as patient_id, p.diagnosis as diagnosis_id, p.iinfo as iinfo, o.medfee_sumamt as medfee_sumamt ,o.psn_name as psn_name ,p.id_card_no as id_card_no ,o.psn_no as psn_no, o.mdtrt_id as mdtrt_id, o.settle_accounts_date as settle_accounts_date,o.act_pay_dedc as act_pay_dedc,O.fund_pay_sumamt as fund_pay_sumamt,o.psn_cash_pay as psn_cash_pay ,o.acct_pay as acct_pay,o.psn_cash_pay as cash_pay,o.medfee_sumamt as sumamt  from his_order o  Join his_patient p On o.patient_id = p.patient_id AND o.settle_accounts_date = p.record_date where o.user_org_id = ? AND o.status = 1 AND o.order_status = 2  AND o.settle_accounts_date >= ? AND o.settle_accounts_date <= ? AND insutype = ? Group by o.id", org_id, start_time, end_time, insutype).Scan(&cus).Error
1680
+	err = readDb.Raw("select o.setl_detail as setl_detail, o.maf_pay as maf_pay,  o.hifmi_pay  as hifmi_pay, o.hifob_pay as hifob_pay, o.cvlserv_pay as cvlserv_pay, o.hifes_pay as hifes_pay, o.patient_id as patient_id, p.diagnosis as diagnosis_id, p.iinfo as iinfo, o.medfee_sumamt as medfee_sumamt ,o.psn_name as psn_name ,p.id_card_no as id_card_no ,o.psn_no as psn_no, o.mdtrt_id as mdtrt_id, o.settle_accounts_date as settle_accounts_date,o.act_pay_dedc as act_pay_dedc,O.fund_pay_sumamt as fund_pay_sumamt,o.psn_cash_pay as psn_cash_pay ,o.acct_pay as acct_pay,o.psn_cash_pay as cash_pay,o.medfee_sumamt as sumamt  from his_order o  Join his_patient p On o.patient_id = p.patient_id AND o.settle_accounts_date = p.record_date where o.user_org_id = ? AND o.status = 1 AND o.order_status = 2  AND o.settle_accounts_date >= ? AND o.settle_accounts_date <= ? AND insutype = ? Group by o.id", org_id, start_time, end_time, insutype).Scan(&cus).Error
1670
 
1681
 
1671
 	for _, item := range cus {
1682
 	for _, item := range cus {
1672
 		var total int64
1683
 		var total int64

+ 66 - 20
service/stock_service.go View File

646
 }
646
 }
647
 
647
 
648
 type Drug struct {
648
 type Drug struct {
649
-	ID              int64   `gorm:"column:id" json:"id" form:"id"`
650
-	DrugName        string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
651
-	DrugSpec        string  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
652
-	DrugType        int64   `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
653
-	DrugStockLimit  string  `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
654
-	DrugOriginPlace string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
655
-	DrugDosageForm  int64   `gorm:"column:drug_dosage_form" json:"drug_dosage_form" form:"drug_dosage_form"`
656
-	Manufacturer    int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
657
-	Status          int64   `gorm:"column:status" json:"status" form:"status"`
658
-	Ctime           int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
659
-	Mtime           int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
660
-	OrgId           int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
661
-	DrugCode        string  `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
662
-	Dose            float64 `gorm:"column:dose" json:"dose" form:"dose"`
663
-	MinNumber       int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
664
-	DoseUnit        string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
665
-	DrugDay         string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
666
-	MaxUnit         string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
667
-	MinUnit         string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
668
-	LastPrice       float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
649
+	ID                          int64   `gorm:"column:id" json:"id" form:"id"`
650
+	DrugName                    string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
651
+	Pinyin                      string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
652
+	Wubi                        string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
653
+	DrugAlias                   string  `gorm:"column:drug_alias" json:"drug_alias" form:"drug_alias"`
654
+	DrugAliasPinyin             string  `gorm:"column:drug_alias_pinyin" json:"drug_alias_pinyin" form:"drug_alias_pinyin"`
655
+	DrugAliasWubi               string  `gorm:"column:drug_alias_wubi" json:"drug_alias_wubi" form:"drug_alias_wubi"`
656
+	DrugCategory                int64   `gorm:"column:drug_category" json:"drug_category" form:"drug_category"`
657
+	DrugSpec                    string  `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
658
+	DrugType                    int64   `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
659
+	DrugStockLimit              string  `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
660
+	DrugOriginPlace             string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
661
+	DrugDosageForm              int64   `gorm:"column:drug_dosage_form" json:"drug_dosage_form" form:"drug_dosage_form"`
662
+	MedicalInsuranceLevel       int64   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
663
+	MaxUnit                     string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
664
+	MinUnit                     string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
665
+	UnitMatrixing               string  `gorm:"column:unit_matrixing" json:"unit_matrixing" form:"unit_matrixing"`
666
+	RetailPrice                 float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
667
+	LastPrice                   float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
668
+	DrugControl                 int64   `gorm:"column:drug_control" json:"drug_control" form:"drug_control"`
669
+	Number                      string  `gorm:"column:number" json:"number" form:"number"`
670
+	DrugClassify                string  `gorm:"column:drug_classify" json:"drug_classify" form:"drug_classify"`
671
+	DrugDose                    float64 `gorm:"column:drug_dose" json:"drug_dose" form:"drug_dose"`
672
+	DrugDoseUnit                int64   `gorm:"column:drug_dose_unit" json:"drug_dose_unit" form:"drug_dose_unit"`
673
+	MedicalInsuranceNumber      string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
674
+	Manufacturer                int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
675
+	PharmacologyCategory        int64   `gorm:"column:pharmacology_category" json:"pharmacology_category" form:"pharmacology_category"`
676
+	StatisticsCategory          int64   `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
677
+	Code                        string  `gorm:"column:code" json:"code" form:"code"`
678
+	IsSpecialDiseases           int64   `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
679
+	IsRecord                    int64   `gorm:"column:is_record" json:"is_record" form:"is_record"`
680
+	Agent                       string  `gorm:"column:agent" json:"agent" form:"agent"`
681
+	DrugStatus                  string  `gorm:"column:drug_status" json:"drug_status" form:"drug_status"`
682
+	LimitRemark                 string  `gorm:"column:limit_remark" json:"limit_remark" form:"limit_remark"`
683
+	DeliveryWay                 string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
684
+	ExecutionFrequency          string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
685
+	SingleDose                  float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
686
+	PrescribingNumber           float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
687
+	Label                       int64   `gorm:"column:label" json:"label" form:"label"`
688
+	Sort                        int64   `gorm:"column:sort" json:"sort" form:"sort"`
689
+	IsUseDoctorAdvice           int64   `gorm:"column:is_use_doctor_advice" json:"is_use_doctor_advice" form:"is_use_doctor_advice"`
690
+	IsDefault                   int64   `gorm:"column:is_default" json:"is_default" form:"is_default"`
691
+	IsChargePredict             int64   `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
692
+	IsStatisticsWork            int64   `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
693
+	IsChargeUse                 int64   `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
694
+	Status                      int64   `gorm:"column:status" json:"status" form:"status"`
695
+	Ctime                       int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
696
+	Mtime                       int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
697
+	OrgId                       int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
698
+	DrugCode                    string  `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
699
+	Dealer                      int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
700
+	DoseCode                    string  `gorm:"column:dose_code" json:"dose_code" form:"dose_code"`
701
+	RecordDate                  int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
702
+	DrugRemark                  string  `gorm:"column:drug_remark" json:"drug_remark" form:"drug_remark"`
703
+	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
704
+	IsMark                      int64   `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
705
+	PrescriptionMark            int64   `gorm:"column:prescription_mark" json:"prescription_mark" form:"prescription_mark"`
706
+	HospApprFlag                int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
707
+	LmtUsedFlag                 int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
708
+	Total                       float64 `gorm:"column:total" json:"total" form:"total"`
709
+	PrescribingNumberUnit       string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
710
+	MinNumber                   int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
711
+	Dose                        float64 `gorm:"column:dose" json:"dose" form:"dose"`
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"`
714
+	MinPrice                    float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
669
 }
715
 }
670
 
716
 
671
 func (Drug) TableName() string {
717
 func (Drug) TableName() string {